diff options
Diffstat (limited to 'view/js/main.js')
-rw-r--r-- | view/js/main.js | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/view/js/main.js b/view/js/main.js index e1a97dde0..cfdd82315 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -447,16 +447,18 @@ function inserteditortag(BBcode, id) { } function insertCommentAttach(comment,id) { - activeCommentID = id; activeCommentText = comment; - $('body').css('cursor', 'wait'); - $('#invisible-comment-upload').trigger('click'); - return false; +} +function insertCommentEmbed(comment,id) { + activeCommentID = id; + activeCommentText = comment; + initializeEmbedPhotoDialog(); + return false; } function insertCommentURL(comment, id) { @@ -1734,6 +1736,35 @@ function addeditortext(data) { } } +// Add text to active comment region if set, otherwise add to main editor +function addActiveEditorText(data) { + if (activeCommentID) { + const textarea = document.getElementById('comment-edit-text-' + activeCommentID); + + if (textarea) { + let currentText = textarea.value; + + // Clear the textarea if it matches the active comment text + if (currentText === activeCommentText) { + currentText = ''; + } + + textarea.classList.add('expanded'); + openMenu('comment-tools-' + activeCommentID); + textarea.value = currentText + data; + textarea.focus(); + textarea.click(); + preview_comment(activeCommentID); + } + + // Reset activeCommentID after processing + activeCommentID = 0; + } else { + addeditortext(data); + preview_post(); + } +} + function makeid(length) { var result = ''; var characters = 'abcdef0123456789'; |