Skip to content

Commit

Permalink
feat: show confirmation modal before discarding changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pratikb64 committed Jan 22, 2025
1 parent f4356ad commit e15c61b
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions wiki/public/js/render_wiki.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,21 @@ window.RenderWiki = class RenderWiki extends Wiki {
});

$(".discard-edit-btn").on("click", () => {
// switch to view mode
toggleEditor();
$("html").css({ overflow: "auto" });
$('.sidebar-item[data-name="new-wiki-page"]').remove();
set_search_params();
this.activate_sidebars();
const discardDialog = frappe.msgprint({
title: __("Discard edits"),
indicator: "red",
message: __(`Are you sure you want to <b>discard</b> the changes?`),
primary_action: {
label: "Yes",
action() {
toggleEditor();
$("html").css({ overflow: "auto" });
$('.sidebar-item[data-name="new-wiki-page"]').remove();
set_search_params();
discardDialog.hide();
},
},
});
});

$(".add-wiki-btn").on("click", () => {
Expand Down

0 comments on commit e15c61b

Please sign in to comment.