diff --git a/.jsduck/categories.json b/.jsduck/categories.json index ffe4984644..702a78e901 100644 --- a/.jsduck/categories.json +++ b/.jsduck/categories.json @@ -98,6 +98,7 @@ "ve.init", "ve.init.Platform", "ve.init.Target", + "ve.init.*Storage", "global", "ve.init.sa*" ] diff --git a/.jsduck/eg-iframe.html b/.jsduck/eg-iframe.html index d46a671ff8..ccfe0e4aba 100644 --- a/.jsduck/eg-iframe.html +++ b/.jsduck/eg-iframe.html @@ -144,6 +144,8 @@ + + @@ -502,6 +504,7 @@ + diff --git a/extension.json b/extension.json index e8f873719d..63aa775a3c 100644 --- a/extension.json +++ b/extension.json @@ -599,6 +599,8 @@ "lib/ve/src/ve.utils.client.js", "lib/ve/src/ve.TriggerListener.js", "lib/ve/src/init/ve.init.js", + "lib/ve/src/init/ve.init.SafeStorage.js", + "lib/ve/src/init/ve.init.ListStorage.js", "lib/ve/src/init/ve.init.Platform.js", "lib/ve/src/init/ve.init.Target.js" ], diff --git a/jsduck.json b/jsduck.json index f3ef2f7d08..c3f118cc34 100644 --- a/jsduck.json +++ b/jsduck.json @@ -7,7 +7,7 @@ "--processes": "0", "--warnings-exit-nonzero": true, "--builtin-classes": true, - "--external": "HTMLDocument,Window,Node,Text,Set,Range,Selection,ClientRect,File,FileList,Blob,DataTransfer,DataTransferItem,KeyboardEvent,MouseEvent,Promise", + "--external": "HTMLDocument,Window,Node,Text,Set,Range,Selection,ClientRect,File,FileList,Blob,DataTransfer,DataTransferItem,KeyboardEvent,MouseEvent,Promise,Storage", "--warnings": ["-nodoc(class,public)", "-global"], "--": [ ".jsduck/external.js", diff --git a/lib/ve b/lib/ve index d9ece414a0..06f1ebb8ee 160000 --- a/lib/ve +++ b/lib/ve @@ -1 +1 @@ -Subproject commit d9ece414a06bd4e4515337a745ea278aecc13e92 +Subproject commit 06f1ebb8ee11a0505b4a4193c29478b01257caa1 diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js index 920c46eed0..4431550604 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js @@ -503,7 +503,7 @@ ve.init.mw.DesktopArticleTarget.prototype.setupNewSection = function ( surface ) } ); if ( this.recovered ) { this.sectionTitle.setValue( - ve.init.platform.getSession( 've-docsectiontitle' ) || '' + ve.init.platform.sessionStorage.get( 've-docsectiontitle' ) || '' ); } this.sectionTitle.connect( this, { change: 'onSectionTitleChange' } ); @@ -516,7 +516,7 @@ ve.init.mw.DesktopArticleTarget.prototype.setupNewSection = function ( surface ) } surface.once( 'destroy', this.teardownNewSection.bind( this, surface ) ); } else { - ve.init.platform.removeSession( 've-docsectiontitle' ); + ve.init.platform.sessionStorage.remove( 've-docsectiontitle' ); } }; @@ -524,7 +524,7 @@ ve.init.mw.DesktopArticleTarget.prototype.setupNewSection = function ( surface ) * Handle section title changes */ ve.init.mw.DesktopArticleTarget.prototype.onSectionTitleChange = function () { - ve.init.platform.setSession( 've-docsectiontitle', this.sectionTitle.getValue() ); + ve.init.platform.sessionStorage.set( 've-docsectiontitle', this.sectionTitle.getValue() ); this.updateToolbarSaveButtonState(); }; diff --git a/modules/ve-mw/init/ve.init.mw.Platform.js b/modules/ve-mw/init/ve.init.mw.Platform.js index 16d8089423..bf543d1cb2 100644 --- a/modules/ve-mw/init/ve.init.mw.Platform.js +++ b/modules/ve-mw/init/ve.init.mw.Platform.js @@ -151,25 +151,12 @@ ve.init.mw.Platform.prototype.setUserConfig = function ( keyOrValueMap, value ) } }; -/** - * @inheritdoc - */ -ve.init.mw.Platform.prototype.getSession = function ( key ) { - return mw.storage.session.get( key ); +ve.init.mw.Platform.prototype.createLocalStorage = function () { + return this.createListStorage( mw.storage ); }; -/** - * @inheritdoc - */ -ve.init.mw.Platform.prototype.setSession = function ( key, value ) { - return mw.storage.session.set( key, value ); -}; - -/** - * @inheritdoc - */ -ve.init.mw.Platform.prototype.removeSession = function ( key ) { - return mw.storage.session.remove( key ); +ve.init.mw.Platform.prototype.createSessionStorage = function () { + return this.createListStorage( mw.storage.session ); }; /**