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 @@