fix bug with oldtext
parent
0ec8e8c23d
commit
4d1fe434b3
|
@ -51,12 +51,13 @@ function getSelectionTextHtml() {
|
|||
return html;
|
||||
}
|
||||
|
||||
let oldtext
|
||||
let oldtext = {};
|
||||
function toggleReplyBox(t, id) {
|
||||
const element = document.getElementById(id);
|
||||
const ta = element.getElementsByTagName('textarea')[0]
|
||||
element.classList.remove('d-none')
|
||||
oldtext = ta.value;
|
||||
const cid = id.replace('reply-to-c_','')
|
||||
oldtext[cid] = ta.value;
|
||||
|
||||
let text = getSelection().toString().trim()
|
||||
if (text)
|
||||
|
@ -95,13 +96,13 @@ function toggleEdit(id) {
|
|||
actions.classList.toggle("d-none");
|
||||
|
||||
if (comment.classList.contains('d-none')) {
|
||||
oldtext = box.value;
|
||||
oldtext[id] = box.value;
|
||||
autoExpand(box);
|
||||
markdown(box);
|
||||
charLimit(box.id, 'charcount-edit-' + id)
|
||||
}
|
||||
else {
|
||||
box.value = oldtext;
|
||||
box.value = oldtext[id];
|
||||
}
|
||||
|
||||
close_inline_emoji_modal();
|
||||
|
@ -369,7 +370,8 @@ function cancel(fullname) {
|
|||
const element = document.getElementById(`reply-to-${fullname}`);
|
||||
const ta = element.getElementsByTagName('textarea')[0]
|
||||
element.classList.add('d-none')
|
||||
ta.value = oldtext;
|
||||
const cid = fullname.replace('c_','')
|
||||
ta.value = oldtext[cid];
|
||||
|
||||
remove_dialog();
|
||||
restore_reply_buttons(fullname)
|
||||
|
|
Loading…
Reference in New Issue