From 8304b4a1ae50668156b127e17bda2948a70057aa Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 2 Jun 2020 16:31:52 +0200 Subject: [PATCH] Adapted GUI: display user fields in tinymce-editor on doubleclick Signed-off-by: Cris --- public/js/messaging/messageWrite.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/public/js/messaging/messageWrite.js b/public/js/messaging/messageWrite.js index 1978fc08c..8b1d73bdf 100644 --- a/public/js/messaging/messageWrite.js +++ b/public/js/messaging/messageWrite.js @@ -78,6 +78,21 @@ $(document).ready(function () }); } + if ($("#user_fields")) + { + $("#user_fields").dblclick(function () + { + if ($("#bodyTextArea")) + { + //if editor active add at cursor position, otherwise at end + if (tinymce.activeEditor.id === "bodyTextArea") + tinymce.activeEditor.execCommand('mceInsertContent', false, $(this).children(":selected").val()); + else + tinyMCE.get("bodyTextArea").setContent(tinyMCE.get("bodyTextArea").getContent() + $(this).children(":selected").val()); + } + }); + } + if ($("#recipients")) { $("#recipients").change(tinymcePreviewSetContent);