Skip to content

Commit

Permalink
accept button
Browse files Browse the repository at this point in the history
  • Loading branch information
zwalinpeng committed Dec 6, 2023
1 parent 02f71b5 commit b45306f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,20 @@ async function showPopup(output) {
devilOutputContainer.toggleClass("visible", !!formattedOutput);
devilsAdvocateOutput.html(`<p>${formattedOutput}</p>`);

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
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ <h1>Demo: Daemons</h1>
<!-- Devil's Advocate output container -->
<div id="devilOutputContainer">
<div id="devilOutput"></div>
<button id="acceptButton">Accept</button>
<button id="dismissButton">Close/Dismiss</button>
</div>

Expand Down

0 comments on commit b45306f

Please sign in to comment.