Skip to content

Commit f0f12dd

Browse files
committed
fix(image-editor): prevent double discard changes confirmation
Signed-off-by: Hamza Mahjoubi <hamzamahjoubi221@gmail.com>
1 parent 32cd59b commit f0f12dd

File tree

5 files changed

+32
-60
lines changed

5 files changed

+32
-60
lines changed

css/init-TFf5sbzK.chunk.css renamed to css/init-DmJjQrDR.chunk.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/viewer-init.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* extracted by css-entry-points-plugin */
2-
@import './init-TFf5sbzK.chunk.css';
2+
@import './init-DmJjQrDR.chunk.css';
33
@import './logger-DG0nQhh6.chunk.css';
44
@import './NcActionButton-Cz95WiMV.chunk.css';
55
@import './NcActionLink-lgtGSyky.chunk.css';

js/viewer-init.mjs

Lines changed: 28 additions & 30 deletions
Large diffs are not rendered by default.

js/viewer-init.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/ImageEditor.vue

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,7 @@ export default {
145145
},
146146
147147
methods: {
148-
onClose(closingReason, haveNotSavedChanges) {
149-
if (haveNotSavedChanges) {
150-
this.onExitWithoutSaving()
151-
return
152-
}
148+
onClose() {
153149
window.removeEventListener('keydown', this.handleKeydown, true)
154150
this.$emit('close')
155151
},
@@ -206,28 +202,6 @@ export default {
206202
}
207203
},
208204
209-
/**
210-
* Show warning if unsaved changes
211-
*/
212-
onExitWithoutSaving() {
213-
OC.dialogs.confirmDestructive(
214-
translations.changesLoseWarningHint + '\n\n' + translations.discardChangesWarningHint,
215-
t('viewer', 'Unsaved changes'),
216-
{
217-
type: OC.dialogs.YES_NO_BUTTONS,
218-
confirm: t('viewer', 'Drop changes'),
219-
confirmClasses: 'error',
220-
cancel: translations.cancel,
221-
},
222-
(decision) => {
223-
if (!decision) {
224-
return
225-
}
226-
this.onClose('warning-ignored', false)
227-
},
228-
)
229-
},
230-
231205
// Key Handlers, override default Viewer arrow and escape key
232206
handleKeydown(event) {
233207
// Enter needs to be reached through as otherwise saving text does not work

0 commit comments

Comments
 (0)