From b173b6c2f73ba403588b870a1a9b7ee7f2badaf8 Mon Sep 17 00:00:00 2001 From: Agriya Dev5 Date: Mon, 4 Jan 2021 19:56:12 +0530 Subject: [PATCH] #issue_fix double click and opensvg issue fixed --- src/editor/components/seMenu.js | 4 ++-- src/editor/dialogs/seConfirmDialog.js | 2 +- src/editor/extensions/ext-opensave/ext-opensave.js | 2 +- src/editor/svgedit.js | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/editor/components/seMenu.js b/src/editor/components/seMenu.js index e1277963..03ce7b58 100644 --- a/src/editor/components/seMenu.js +++ b/src/editor/components/seMenu.js @@ -111,7 +111,7 @@ export class SeMenu extends HTMLElement { * @function connectedCallback * @returns {void} */ - connectedCallback () { + /* connectedCallback () { this.$menu.addEventListener('openedchange', (e) => { e.preventDefault(); const selectedItem = e?.detail?.closeResult; @@ -119,7 +119,7 @@ export class SeMenu extends HTMLElement { document.getElementById(selectedItem.id).click(); } }); - } + } */ } // Register diff --git a/src/editor/dialogs/seConfirmDialog.js b/src/editor/dialogs/seConfirmDialog.js index b2502ff1..66aa5cd0 100644 --- a/src/editor/dialogs/seConfirmDialog.js +++ b/src/editor/dialogs/seConfirmDialog.js @@ -1,8 +1,8 @@ // eslint-disable-next-line node/no-unpublished-import import AlertDialog from 'elix/define/AlertDialog.js'; -const dialog = new AlertDialog(); const seConfirm = async (text, choices) => { + const dialog = new AlertDialog(); dialog.textContent = text; dialog.choices = (choices === undefined) ? ['Ok', 'Cancel'] : choices; dialog.open(); diff --git a/src/editor/extensions/ext-opensave/ext-opensave.js b/src/editor/extensions/ext-opensave/ext-opensave.js index ad736155..d6bb550e 100644 --- a/src/editor/extensions/ext-opensave/ext-opensave.js +++ b/src/editor/extensions/ext-opensave/ext-opensave.js @@ -54,7 +54,7 @@ export default { }, async open () { const ok = await this.openPrep(); - if (!ok) { return; } + if (ok === 'Cancel') { return; } this.svgCanvas.clear(); const input = document.createElement('input'); input.type = 'file'; diff --git a/src/editor/svgedit.js b/src/editor/svgedit.js index f9bd9033..f63ef3bc 100644 --- a/src/editor/svgedit.js +++ b/src/editor/svgedit.js @@ -1398,12 +1398,12 @@ class Editor extends EditorStartup { * @returns {boolean|Promise} Resolves to boolean indicating `true` if there were no changes * and `false` after the user confirms. */ - openPrep () { + async openPrep () { $('#main_menu').hide(); if (this.svgCanvas.undoMgr.getUndoStackSize() === 0) { return true; } - return seConfirm(this.uiStrings.notification.QwantToOpen); + return await seConfirm(this.uiStrings.notification.QwantToOpen); } /**