@ckeditor/ckeditor5-autosave
Advanced tools
Comparing version 35.4.0 to 36.0.0
!function(t){const e=t.en=t.en||{};e.dictionary=Object.assign(e.dictionary||{},{"Saving changes":"Saving changes"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})), | ||
/*! | ||
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. | ||
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/(()=>{var t={704:(t,e,i)=>{t.exports=i(79)("./src/core.js")},209:(t,e,i)=>{t.exports=i(79)("./src/utils.js")},79:t=>{"use strict";t.exports=CKEditor5.dll}},e={};function i(n){var s=e[n];if(void 0!==s)return s.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,i),o.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";i.r(n),i.d(n,{Autosave:()=>D});var t=i(704),e=i(209);const s=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)};const o="object"==typeof global&&global&&global.Object===Object&&global;var r="object"==typeof self&&self&&self.Object===Object&&self;const a=o||r||Function("return this")();const c=function(){return a.Date.now()};var u=/\s/;const d=function(t){for(var e=t.length;e--&&u.test(t.charAt(e)););return e};var l=/^\s+/;const h=function(t){return t?t.slice(0,d(t)+1).replace(l,""):t};const v=a.Symbol;var f=Object.prototype,m=f.hasOwnProperty,g=f.toString,p=v?v.toStringTag:void 0;const _=function(t){var e=m.call(t,p),i=t[p];try{t[p]=void 0;var n=!0}catch(t){}var s=g.call(t);return n&&(e?t[p]=i:delete t[p]),s};var b=Object.prototype.toString;const y=function(t){return b.call(t)};var S=v?v.toStringTag:void 0;const j=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":S&&S in Object(t)?_(t):y(t)};const O=function(t){return null!=t&&"object"==typeof t};const T=function(t){return"symbol"==typeof t||O(t)&&"[object Symbol]"==j(t)};var w=/^[-+]0x[0-9a-f]+$/i,P=/^0b[01]+$/i,A=/^0o[0-7]+$/i,x=parseInt;const E=function(t){if("number"==typeof t)return t;if(T(t))return NaN;if(s(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=s(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=h(t);var i=P.test(t);return i||A.test(t)?x(t.slice(2),i?2:8):w.test(t)?NaN:+t};var N=Math.max,I=Math.min;const C=function(t,e,i){var n,o,r,a,u,d,l=0,h=!1,v=!1,f=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){var i=n,s=o;return n=o=void 0,l=e,a=t.apply(s,i)}function g(t){return l=t,u=setTimeout(_,e),h?m(t):a}function p(t){var i=t-d;return void 0===d||i>=e||i<0||v&&t-l>=r}function _(){var t=c();if(p(t))return b(t);u=setTimeout(_,function(t){var i=e-(t-d);return v?I(i,r-(t-l)):i}(t))}function b(t){return u=void 0,f&&n?m(t):(n=o=void 0,a)}function y(){var t=c(),i=p(t);if(n=arguments,o=this,d=t,i){if(void 0===u)return g(d);if(v)return clearTimeout(u),u=setTimeout(_,e),m(d)}return void 0===u&&(u=setTimeout(_,e)),a}return e=E(e)||0,s(i)&&(h=!!i.leading,r=(v="maxWait"in i)?N(E(i.maxWait)||0,e):r,f="trailing"in i?!!i.trailing:f),y.cancel=function(){void 0!==u&&clearTimeout(u),l=0,n=d=o=u=void 0},y.flush=function(){return void 0===u?a:b(c())},y};class D extends t.Plugin{static get pluginName(){return"Autosave"}static get requires(){return[t.PendingActions]}constructor(i){super(i);const n=i.config.get("autosave")||{},s=n.waitingTime||1e3;this.set("state","synchronized"),this._debouncedSave=C(this._save.bind(this),s),this._lastDocumentVersion=i.model.document.version,this._savePromise=null,this._domEmitter=Object.create(e.DomEmitterMixin),this._config=n,this._pendingActions=i.plugins.get(t.PendingActions),this._makeImmediateSave=!1}init(){const t=this.editor,e=t.model.document;this.listenTo(t,"ready",(()=>{this.listenTo(e,"change:data",((t,e)=>{this._saveCallbacks.length&&e.isLocal&&("synchronized"===this.state&&(this.state="waiting",this._setPendingAction()),"waiting"===this.state&&this._debouncedSave())}))})),this.listenTo(t,"destroy",(()=>this._flush()),{priority:"highest"}),this._domEmitter.listenTo(window,"beforeunload",((t,e)=>{this._pendingActions.hasAny&&(e.returnValue=this._pendingActions.first.message)}))}destroy(){this._domEmitter.stopListening(),super.destroy()}save(){return this._debouncedSave.cancel(),this._save()}_flush(){this._debouncedSave.flush()}_save(){return this._savePromise?(this._makeImmediateSave=this.editor.model.document.version>this._lastDocumentVersion,this._savePromise):(this._setPendingAction(),this.state="saving",this._lastDocumentVersion=this.editor.model.document.version,this._savePromise=Promise.resolve().then((()=>Promise.all(this._saveCallbacks.map((t=>t(this.editor)))))).finally((()=>{this._savePromise=null})).then((()=>{if(this._makeImmediateSave)return this._makeImmediateSave=!1,this._save();this.editor.model.document.version>this._lastDocumentVersion?(this.state="waiting",this._debouncedSave()):(this.state="synchronized",this._pendingActions.remove(this._action),this._action=null)})).catch((t=>{throw this.state="error",this.state="saving",this._debouncedSave(),t})),this._savePromise)}_setPendingAction(){const t=this.editor.t;this._action||(this._action=this._pendingActions.add(t("Saving changes")))}get _saveCallbacks(){const t=[];return this.adapter&&this.adapter.save&&t.push(this.adapter.save),this._config.save&&t.push(this._config.save),t}}(0,e.mix)(D,e.ObservableMixin)})(),(window.CKEditor5=window.CKEditor5||{}).autosave=n})(); |
@@ -107,2 +107,2 @@ Changelog | ||
* The first implementation of the autosave plugin. Check out the [demo](https://ckeditor.com/docs/ckeditor5/latest/installation/advanced/saving-data.html#autosave-feature). | ||
* The first implementation of the autosave plugin. Check out the [demo](https://ckeditor.com/docs/ckeditor5/latest/installation/getting-started/getting-and-setting-data.html#autosave-feature). |
@@ -7,3 +7,3 @@ { | ||
"description": "Allows you to automatically save the data (e.g. send it to the server) when needed, for example, when the user changed the content.", | ||
"docs": "installation/advanced/saving-data.html#autosave-feature", | ||
"docs": "installation/getting-started/getting-and-setting-data.html#autosave-feature", | ||
"path": "src/autosave.js" | ||
@@ -10,0 +10,0 @@ } |
@@ -5,3 +5,3 @@ Software License Agreement | ||
**CKEditor 5 autosave feature** – https://github.com/ckeditor/ckeditor5-autosave <br> | ||
Copyright (c) 2003-2022, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved. | ||
Copyright (c) 2003-2023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved. | ||
@@ -8,0 +8,0 @@ Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html). |
{ | ||
"name": "@ckeditor/ckeditor5-autosave", | ||
"version": "35.4.0", | ||
"version": "36.0.0", | ||
"description": "Autosave feature for CKEditor 5.", | ||
@@ -15,12 +15,12 @@ "keywords": [ | ||
"dependencies": { | ||
"ckeditor5": "^35.4.0", | ||
"ckeditor5": "^36.0.0", | ||
"lodash-es": "^4.17.15" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-core": "^35.4.0", | ||
"@ckeditor/ckeditor5-dev-utils": "^31.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^35.4.0", | ||
"@ckeditor/ckeditor5-paragraph": "^35.4.0", | ||
"@ckeditor/ckeditor5-source-editing": "^35.4.0", | ||
"@ckeditor/ckeditor5-theme-lark": "^35.4.0", | ||
"@ckeditor/ckeditor5-core": "^36.0.0", | ||
"@ckeditor/ckeditor5-dev-utils": "^32.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^36.0.0", | ||
"@ckeditor/ckeditor5-paragraph": "^36.0.0", | ||
"@ckeditor/ckeditor5-source-editing": "^36.0.0", | ||
"@ckeditor/ckeditor5-theme-lark": "^36.0.0", | ||
"webpack": "^5.58.1", | ||
@@ -27,0 +27,0 @@ "webpack-cli": "^4.9.0" |
/** | ||
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. | ||
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -40,4 +40,4 @@ */ | ||
* | ||
* Read more about this feature in the {@glink installation/advanced/saving-data#autosave-feature Autosave feature} | ||
* section of the {@glink installation/advanced/saving-data Saving and getting data}. | ||
* Read more about this feature in the {@glink installation/getting-started/getting-and-setting-data#autosave-feature Autosave feature} | ||
* section of the {@glink installation/getting-started/getting-and-setting-data Saving and getting data}. | ||
* | ||
@@ -403,3 +403,3 @@ * @extends module:core/plugin~Plugin | ||
* | ||
* See also the demo of the {@glink installation/advanced/saving-data#autosave-feature autosave feature}. | ||
* See also the demo of the {@glink installation/getting-started/getting-and-setting-data#autosave-feature autosave feature}. | ||
* | ||
@@ -406,0 +406,0 @@ * @interface AutosaveConfig |
/** | ||
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. | ||
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
92040
+ Added@ckeditor/ckeditor5-clipboard@36.0.1(transitive)
+ Added@ckeditor/ckeditor5-core@36.0.1(transitive)
+ Added@ckeditor/ckeditor5-engine@36.0.1(transitive)
+ Added@ckeditor/ckeditor5-enter@36.0.1(transitive)
+ Added@ckeditor/ckeditor5-paragraph@36.0.1(transitive)
+ Added@ckeditor/ckeditor5-select-all@36.0.1(transitive)
+ Added@ckeditor/ckeditor5-typing@36.0.1(transitive)
+ Added@ckeditor/ckeditor5-ui@36.0.1(transitive)
+ Added@ckeditor/ckeditor5-undo@36.0.1(transitive)
+ Added@ckeditor/ckeditor5-upload@36.0.1(transitive)
+ Added@ckeditor/ckeditor5-utils@36.0.1(transitive)
+ Added@ckeditor/ckeditor5-widget@36.0.1(transitive)
+ Addedckeditor5@36.0.1(transitive)
- Removed@ckeditor/ckeditor5-clipboard@35.4.0(transitive)
- Removed@ckeditor/ckeditor5-core@35.4.0(transitive)
- Removed@ckeditor/ckeditor5-engine@35.4.0(transitive)
- Removed@ckeditor/ckeditor5-enter@35.4.0(transitive)
- Removed@ckeditor/ckeditor5-paragraph@35.4.0(transitive)
- Removed@ckeditor/ckeditor5-select-all@35.4.0(transitive)
- Removed@ckeditor/ckeditor5-typing@35.4.0(transitive)
- Removed@ckeditor/ckeditor5-ui@35.4.0(transitive)
- Removed@ckeditor/ckeditor5-undo@35.4.0(transitive)
- Removed@ckeditor/ckeditor5-upload@35.4.0(transitive)
- Removed@ckeditor/ckeditor5-utils@35.4.0(transitive)
- Removed@ckeditor/ckeditor5-widget@35.4.0(transitive)
- Removedckeditor5@35.4.0(transitive)
Updatedckeditor5@^36.0.0