diff --git a/assets/script.js b/assets/script.js index c334866..3544b9b 100644 --- a/assets/script.js +++ b/assets/script.js @@ -52,10 +52,8 @@ function alertAsync(message) { return popup(dialog); } -function confirmAsync(message) { - const dialog = instantiate("confirm"); - dialog.querySelector(".message").textContent = message; - return popup(dialog); +function confirmDiscard() { + return popup(instantiate("confirm-discard")); } let hasBeenOpen = false; @@ -161,7 +159,7 @@ function openEditor() { ev.preventDefault(); ev.stopPropagation(); - Promise.resolve(!isEdited(form) || confirmAsync("Discard changes?")) + Promise.resolve(!isEdited(form) || confirmDiscard()) .then(doReset => { if (doReset) { container.classList.remove('edit'); diff --git a/templates/dialog_prototypes.html b/templates/dialog_prototypes.html index 31e5c61..c0a8a5d 100644 --- a/templates/dialog_prototypes.html +++ b/templates/dialog_prototypes.html @@ -22,10 +22,10 @@ -