From 896d43ade72a7af606534e2e0d960b481ef4dc4e Mon Sep 17 00:00:00 2001 From: LenAnderson Date: Thu, 18 Jul 2024 18:39:32 -0400 Subject: [PATCH] add QR delete confirm --- .../extensions/quick-reply/src/QuickReply.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/public/scripts/extensions/quick-reply/src/QuickReply.js b/public/scripts/extensions/quick-reply/src/QuickReply.js index 47933d6a9..f65c49c45 100644 --- a/public/scripts/extensions/quick-reply/src/QuickReply.js +++ b/public/scripts/extensions/quick-reply/src/QuickReply.js @@ -1,4 +1,4 @@ -import { POPUP_TYPE, Popup } from '../../../popup.js'; +import { POPUP_RESULT, POPUP_TYPE, Popup } from '../../../popup.js'; import { setSlashCommandAutoComplete } from '../../../slash-commands.js'; import { SlashCommandAbortController } from '../../../slash-commands/SlashCommandAbortController.js'; import { SlashCommandBreakPoint } from '../../../slash-commands/SlashCommandBreakPoint.js'; @@ -358,8 +358,19 @@ export class QuickReply { del.classList.add('fa-solid'); del.classList.add('fa-trash-can'); del.classList.add('redWarningBG'); - del.title = 'Remove quick reply'; - del.addEventListener('click', ()=>this.delete()); + del.title = 'Remove Quick Reply\n---\nShit+Click to skip confirmation'; + del.addEventListener('click', async(evt)=>{ + if (!evt.shiftKey) { + const result = await Popup.show.confirm( + 'Remove Quick Reply', + 'Are you sure you want to remove this Quick Reply?', + ); + if (result != POPUP_RESULT.AFFIRMATIVE) { + return; + } + } + this.delete(); + }); actions.append(del); } itemContent.append(actions);