forked from rDrama/rDrama
1
0
Fork 0
rDrama/files/assets/js/edit_post.js

26 lines
717 B
JavaScript
Raw Normal View History

2023-10-01 14:23:29 +00:00
function togglePostEdit(id) {
const body = document.getElementById("post-body");
const title = document.getElementById("post-title");
const form = document.getElementById("edit-post-body-"+id);
2022-07-16 21:00:02 +00:00
body.classList.toggle("d-none");
title.classList.toggle("d-none");
form.classList.toggle("d-none");
2022-11-11 14:47:51 +00:00
if (body.classList.contains('d-none')) {
let box = document.getElementById("post-edit-box-"+id);
autoExpand(box);
markdown(box);
charLimit(box.id, 'charcount-post-edit')
box = document.getElementById("post-edit-title");
autoExpand(box);
}
2024-01-12 05:18:24 +00:00
close_inline_emoji_modal();
2022-11-11 14:47:51 +00:00
};
2023-08-06 03:26:16 +00:00
document.getElementById('post-edit-title').addEventListener('keydown', (e) => {
2023-08-06 03:33:34 +00:00
if (e.key === "Enter") e.preventDefault();
2023-08-06 03:26:16 +00:00
})