From 0436916ee45e781114840cc45239384d1bfc0cda Mon Sep 17 00:00:00 2001 From: Ryan Hewitt Date: Tue, 5 Sep 2023 13:12:49 +0100 Subject: [PATCH] Add check prompt when changes have been made to a content block and the cancel button is used --- assets/ckeditor/js/concrete/inline.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/assets/ckeditor/js/concrete/inline.js b/assets/ckeditor/js/concrete/inline.js index b53b634f..79626ddf 100644 --- a/assets/ckeditor/js/concrete/inline.js +++ b/assets/ckeditor/js/concrete/inline.js @@ -15,8 +15,16 @@ CKEDITOR.plugins.add('concreteinline', { editor.addCommand('c5cancel', { exec: function (editor) { - ConcreteEvent.fire('EditModeExitInline') - editor.destroy() + if (editor.checkDirty()) { + ConcreteAlert.confirm(ccmi18n_editor.cancelPrompt, function () { + $.fn.dialog.closeTop(); + ConcreteEvent.fire('EditModeExitInline') + editor.destroy() + }, 'btn-danger', ccmi18n_editor.cancelPromptButton); + } else { + ConcreteEvent.fire('EditModeExitInline') + editor.destroy() + } } })