From fd8551b73bb6325db98535a5ecbff687a31ca2ae Mon Sep 17 00:00:00 2001 From: LenAnderson Date: Mon, 27 Nov 2023 22:02:20 +0000 Subject: [PATCH] fix context menu for Qr popout --- .../scripts/extensions/quick-reply/index.js | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/public/scripts/extensions/quick-reply/index.js b/public/scripts/extensions/quick-reply/index.js index 479e18510..821d3e193 100644 --- a/public/scripts/extensions/quick-reply/index.js +++ b/public/scripts/extensions/quick-reply/index.js @@ -354,6 +354,27 @@ async function doQuickReplyBarPopout() { let index = $(this).data('index'); sendQuickReply(index); }); + $('.quickReplyButton > .ctx-expander').on('click', function (evt) { + evt.stopPropagation(); + let index = $(this.closest('.quickReplyButton')).data('index'); + const qr = extension_settings.quickReply.quickReplySlots[index]; + if (qr.contextMenu?.length) { + evt.preventDefault(); + const tree = buildContextMenu(qr); + const menu = new ContextMenu(tree.children); + menu.show(evt); + } + }) + $('.quickReplyButton').on('contextmenu', function (evt) { + let index = $(this).data('index'); + const qr = extension_settings.quickReply.quickReplySlots[index]; + if (qr.contextMenu?.length) { + evt.preventDefault(); + const tree = buildContextMenu(qr); + const menu = new ContextMenu(tree.children); + menu.show(evt); + } + }); loadMovingUIState(); $("#quickReplyBarPopout").fadeIn(250) @@ -370,6 +391,27 @@ async function doQuickReplyBarPopout() { let index = $(this).data('index'); sendQuickReply(index); }); + $('.quickReplyButton > .ctx-expander').on('click', function (evt) { + evt.stopPropagation(); + let index = $(this.closest('.quickReplyButton')).data('index'); + const qr = extension_settings.quickReply.quickReplySlots[index]; + if (qr.contextMenu?.length) { + evt.preventDefault(); + const tree = buildContextMenu(qr); + const menu = new ContextMenu(tree.children); + menu.show(evt); + } + }) + $('.quickReplyButton').on('contextmenu', function (evt) { + let index = $(this).data('index'); + const qr = extension_settings.quickReply.quickReplySlots[index]; + if (qr.contextMenu?.length) { + evt.preventDefault(); + const tree = buildContextMenu(qr); + const menu = new ContextMenu(tree.children); + menu.show(evt); + } + }); $("#quickReplyPopoutButton").off('click').on('click', doQuickReplyBarPopout) })