forked from MarseyWorld/MarseyWorld
reset edit box to old value when cancelling
parent
2ad2a545f5
commit
801c9bea3e
|
@ -82,6 +82,7 @@ function toggleReplyBox(t, id) {
|
|||
t.innerHTML = newHTML
|
||||
}
|
||||
|
||||
let old_text
|
||||
function toggleEdit(id){
|
||||
const comment = document.getElementById("comment-text-"+id);
|
||||
const form = document.getElementById("comment-edit-"+id);
|
||||
|
@ -93,10 +94,14 @@ function toggleEdit(id){
|
|||
actions.classList.toggle("d-none");
|
||||
|
||||
if (comment.classList.contains('d-none')) {
|
||||
old_text = box.value;
|
||||
autoExpand(box);
|
||||
markdown(box);
|
||||
charLimit(box.id, 'charcount-edit-' + id)
|
||||
}
|
||||
else {
|
||||
box.value = old_text;
|
||||
}
|
||||
|
||||
close_inline_emoji_modal();
|
||||
};
|
||||
|
|
|
@ -1,22 +1,28 @@
|
|||
let old_body_text, old_title_box
|
||||
function togglePostEdit(id) {
|
||||
const body = document.getElementById("post-body");
|
||||
const title = document.getElementById("post-title");
|
||||
const form = document.getElementById("edit-post-body-"+id);
|
||||
const body_box = document.getElementById("post-edit-box-"+id);
|
||||
const title_box = document.getElementById("post-edit-title");
|
||||
|
||||
body.classList.toggle("d-none");
|
||||
title.classList.toggle("d-none");
|
||||
form.classList.toggle("d-none");
|
||||
|
||||
if (body.classList.contains('d-none')) {
|
||||
let box = document.getElementById("post-edit-box-"+id);
|
||||
autoExpand(box);
|
||||
markdown(box);
|
||||
charLimit(box.id, 'charcount-post-edit')
|
||||
old_body_text = body_box.value;
|
||||
autoExpand(body_box);
|
||||
markdown(body_box);
|
||||
charLimit(body_box.id, 'charcount-post-edit')
|
||||
|
||||
box = document.getElementById("post-edit-title");
|
||||
autoExpand(box);
|
||||
old_title_box = title_box.value;
|
||||
autoExpand(title_box);
|
||||
}
|
||||
else {
|
||||
body_box.value = old_body_text;
|
||||
title_box.value = old_title_box;
|
||||
}
|
||||
|
||||
close_inline_emoji_modal();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue