mirror of
https://github.com/itflow-org/itflow
synced 2026-11-29 15:48:59 +00:00
Leaving a page: a ticket's reply no longer asks Leave page first, as it is kept as a draft, and invoice, quote and recurring invoice notes save on the way out instead of asking; the document editor, signature and settings pages still ask
This commit is contained in:
@@ -1166,7 +1166,9 @@ itflowBindOnce('itflowCategoryAdd', 'click', '[data-category-add]', function ()
|
||||
*
|
||||
* Editors inside an open modal are skipped, as before: the modal is where that
|
||||
* work gets submitted or discarded. Editors from a closed ajax modal are removed
|
||||
* by js/ajax_modal.js, so tinymce.get() no longer returns them.
|
||||
* by js/ajax_modal.js, so tinymce.get() no longer returns them. So is one whose
|
||||
* text is kept as a draft (data-draft-kept - the ticket reply, agent/js/ticket_reply_extras.js),
|
||||
* where leaving loses nothing.
|
||||
*
|
||||
* Flagged on window because modal_footer.php re-loads this file on every ajax
|
||||
* modal open.
|
||||
@@ -1179,7 +1181,8 @@ if (!window.itflowEditorUnloadGuard) {
|
||||
}
|
||||
const unsaved = tinymce.get().some(function (editor) {
|
||||
const inVisibleModal = editor.getContainer()?.closest('.modal.show');
|
||||
return !inVisibleModal && editor.isDirty();
|
||||
const keptAsDraft = editor.getElement()?.dataset.draftKept === '1';
|
||||
return !inVisibleModal && !keptAsDraft && editor.isDirty();
|
||||
});
|
||||
if (unsaved) {
|
||||
e.preventDefault();
|
||||
|
||||
Reference in New Issue
Block a user