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