From be27f11ebb3f22a63f9d45c4b3484e7d62ac85b9 Mon Sep 17 00:00:00 2001 From: JFH <20402845+jfhenon@users.noreply.github.com> Date: Fri, 1 Jan 2021 23:03:05 +0100 Subject: [PATCH] fix initial content load --- src/editor/extensions/ext-storage/storageDialog.js | 8 +------- src/editor/svgedit.js | 8 +++++++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/editor/extensions/ext-storage/storageDialog.js b/src/editor/extensions/ext-storage/storageDialog.js index f060c4c3..ec0fc187 100644 --- a/src/editor/extensions/ext-storage/storageDialog.js +++ b/src/editor/extensions/ext-storage/storageDialog.js @@ -56,7 +56,7 @@ template.innerHTML = ` By default and where supported, SVG-Edit can store your editor preferences and SVG content locally on your machine so you do not need to add these back each time you load SVG-Edit. If, for privacy reasons, you do not wish to store this information on your machine, you can change away from the default option below.

@@ -181,9 +181,3 @@ export class SeStorageDialog extends HTMLElement { // Register customElements.define('se-storage-dialog', SeStorageDialog); - -/* -if ('localStorage' in window) { // && onWeb removed so Webkit works locally - this.storage = this.localStorage; - } -*/ diff --git a/src/editor/svgedit.js b/src/editor/svgedit.js index c34a5463..c7aabab3 100644 --- a/src/editor/svgedit.js +++ b/src/editor/svgedit.js @@ -478,7 +478,7 @@ class Editor { * @function module:SVGthis.init * @returns {void} */ - init () { + async init () { try { // Image props dialog added to DOM const newSeImgPropDialog = document.createElement('se-img-prop-dialog'); @@ -505,6 +505,10 @@ class Editor { console.error(err); } + if ('localStorage' in window) { // && onWeb removed so Webkit works locally + this.storage = window.localStorage; + } + this.configObj.load(); /** @@ -1147,6 +1151,8 @@ class Editor { this.ready(() => { injectExtendedContextMenuItemsIntoDom(); }); + // run callbacks stored by this.ready + await this.runCallbacks(); } /**