diff --git a/package.json b/package.json index abdf860..17aa51d 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,9 @@ "html5-framework", "javascript-framework" ], - "publishConfig": { "access": "public" }, + "publishConfig": { + "access": "public" + }, "scripts": { "start": "npx webpack --config webpack.config.js", "build": "NODE_ENV=production npx webpack --config webpack.config.js", @@ -34,7 +36,9 @@ }, "author": "CoCreate LLC", "license": "MIT", - "bugs": { "url": "https://github.com/CoCreate-app/CoCreate-modal/issues" }, + "bugs": { + "url": "https://github.com/CoCreate-app/CoCreate-modal/issues" + }, "homepage": "https://cocreate.app/docs/modal", "funding": { "type": "GitHub Sponsors ❤", @@ -60,6 +64,7 @@ "@cocreate/crud-client": "^1.18.0", "@cocreate/docs": "^1.5.9", "@cocreate/element-prototype": "^1.4.6", + "@cocreate/local-storage": "^1.3.49", "@cocreate/message-client": "^1.1.128", "@cocreate/observer": "^1.5.59", "@cocreate/position": "^1.1.41", diff --git a/src/index.js b/src/index.js index 8457c09..426bd7f 100644 --- a/src/index.js +++ b/src/index.js @@ -3,6 +3,7 @@ import uuid from '@cocreate/uuid' import action from '@cocreate/actions'; import observer from '@cocreate/observer'; import message from '@cocreate/message-client'; +import localStorge from '@cocreate/local-storage'; import './index.css'; function CoCreateModal(id) { @@ -18,15 +19,15 @@ function CoCreateModal(id) { this.modals = new Map(); this.rootId = this.pageId; this.parentId = this.pageId; - window.localStorage.setItem('rootId', this.pageId) + localStorage.setItem('rootId', this.pageId) } else { - this.pageId = window.localStorage.getItem('pageId') + this.pageId = localStorage.getItem('pageId') let viewPort = window.top.CoCreate.modal.viewPorts if (viewPort) viewPort.set(this.pageId, this) // ToDo: can be depreciated if we find a better way to pass rootid and parentid - this.parentId = window.localStorage.getItem('parentId') + this.parentId = localStorage.getItem('parentId') this.rootId = window.top.CoCreate.modal.rootId } @@ -140,7 +141,7 @@ CoCreateModal.prototype = { break; } - window.localStorage.setItem('parentId', openId) + localStorage.setItem('parentId', openId) data.type = 'open'; data.parentId = openId; diff --git a/src/modal.js b/src/modal.js index 7f9cd70..f541e13 100644 --- a/src/modal.js +++ b/src/modal.js @@ -31,7 +31,7 @@ function Modal(el, options, viewPort) { this.el.setAttribute("id", this.id); this.el.setAttribute("moveable", ''); - window.localStorage.setItem('pageId', this.id) + localStorage.setItem('pageId', this.id) this._init(); this._setModalSize();