aboutsummaryrefslogtreecommitdiffstats
path: root/view/js
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2025-04-04 10:51:51 +0000
committerMario <mario@mariovavti.com>2025-04-04 10:51:51 +0000
commita822e94f9b3020a42ce3f184c9942af6c2cd45f6 (patch)
treebacc580c16cb927f98d5b700dc16896b07af7ecb /view/js
parent484971c90a33c3ffcc46c119fc9eeba75a5821aa (diff)
downloadvolse-hubzilla-a822e94f9b3020a42ce3f184c9942af6c2cd45f6.tar.gz
volse-hubzilla-a822e94f9b3020a42ce3f184c9942af6c2cd45f6.tar.bz2
volse-hubzilla-a822e94f9b3020a42ce3f184c9942af6c2cd45f6.zip
move jot popup handling to template, port photo selector to vanilla javascript and enable it for comments if applicable
Diffstat (limited to 'view/js')
-rw-r--r--view/js/main.js39
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';