From b45306f2f4fed1cdc76abaa4402761b926d7200b Mon Sep 17 00:00:00 2001 From: zoie peng Date: Tue, 5 Dec 2023 23:42:43 -0500 Subject: [PATCH] accept button --- functions.js | 14 ++++++++++++++ index.html | 1 + 2 files changed, 15 insertions(+) diff --git a/functions.js b/functions.js index 56acc3c..cef6343 100644 --- a/functions.js +++ b/functions.js @@ -246,6 +246,20 @@ async function showPopup(output) { devilOutputContainer.toggleClass("visible", !!formattedOutput); devilsAdvocateOutput.html(`

${formattedOutput}

`); + acceptChangesBtn = $("#acceptButton"); + // Don't show "Accept" button for Devil's Advocate + if (!acceptButtonActive) { + acceptChangesBtn.css("display", "none"); + } else { + acceptChangesBtn.css("display", "inline"); + acceptChangesBtn.on("click", function () { + // Replace text editor contents with suggested text + devilOutputContainer.removeClass("visible"); + devilsAdvocateOutput.empty(); + replaceText(quill.getSelection(true), output); + }); + } + closeModalBtn = $("#dismissButton"); closeModalBtn.on("click", function () { // Hide devilOutputContainer and clear its content on closing the modal diff --git a/index.html b/index.html index c58ef16..14ca2bd 100644 --- a/index.html +++ b/index.html @@ -47,6 +47,7 @@

Demo: Daemons

+