Merge pull request #1407 from LenAnderson/fix-qr-popout-context

fix context menu for QR popout
This commit is contained in:
Cohee 2023-11-28 02:44:20 +02:00 committed by GitHub
commit 91e1281208
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 42 additions and 0 deletions

View File

@ -354,6 +354,27 @@ async function doQuickReplyBarPopout() {
let index = $(this).data('index'); let index = $(this).data('index');
sendQuickReply(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(); loadMovingUIState();
$("#quickReplyBarPopout").fadeIn(250) $("#quickReplyBarPopout").fadeIn(250)
@ -370,6 +391,27 @@ async function doQuickReplyBarPopout() {
let index = $(this).data('index'); let index = $(this).data('index');
sendQuickReply(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) $("#quickReplyPopoutButton").off('click').on('click', doQuickReplyBarPopout)
}) })