@ckeditor/ckeditor5-autosave 31.1.0 → 34.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE.md +2 -2
- package/README.md +2 -1
- package/build/autosave.js +3 -3
- package/build/autosave.js.map +1 -0
- package/build/translations/bs.js +1 -0
- package/build/translations/el.js +1 -0
- package/build/translations/jv.js +1 -0
- package/ckeditor5-metadata.json +1 -1
- package/lang/translations/af.po +1 -1
- package/lang/translations/ar.po +1 -1
- package/lang/translations/az.po +1 -1
- package/lang/translations/bs.po +21 -0
- package/lang/translations/cs.po +1 -1
- package/lang/translations/da.po +1 -1
- package/lang/translations/de-ch.po +1 -1
- package/lang/translations/de.po +1 -1
- package/lang/translations/el.po +21 -0
- package/lang/translations/en-au.po +1 -1
- package/lang/translations/en-gb.po +1 -1
- package/lang/translations/en.po +1 -1
- package/lang/translations/es.po +1 -1
- package/lang/translations/et.po +1 -1
- package/lang/translations/fa.po +1 -1
- package/lang/translations/fi.po +1 -1
- package/lang/translations/fr.po +1 -1
- package/lang/translations/gl.po +1 -1
- package/lang/translations/he.po +1 -1
- package/lang/translations/hi.po +1 -1
- package/lang/translations/hr.po +1 -1
- package/lang/translations/hu.po +1 -1
- package/lang/translations/id.po +1 -1
- package/lang/translations/it.po +1 -1
- package/lang/translations/ja.po +1 -1
- package/lang/translations/jv.po +21 -0
- package/lang/translations/km.po +1 -1
- package/lang/translations/ko.po +1 -1
- package/lang/translations/ku.po +1 -1
- package/lang/translations/lt.po +1 -1
- package/lang/translations/lv.po +1 -1
- package/lang/translations/ne.po +1 -1
- package/lang/translations/nl.po +1 -1
- package/lang/translations/no.po +1 -1
- package/lang/translations/pl.po +1 -1
- package/lang/translations/pt-br.po +1 -1
- package/lang/translations/ro.po +1 -1
- package/lang/translations/ru.po +1 -1
- package/lang/translations/sk.po +1 -1
- package/lang/translations/sl.po +1 -1
- package/lang/translations/sq.po +1 -1
- package/lang/translations/sr-latn.po +1 -1
- package/lang/translations/sr.po +1 -1
- package/lang/translations/sv.po +1 -1
- package/lang/translations/th.po +1 -1
- package/lang/translations/tk.po +1 -1
- package/lang/translations/tr.po +1 -1
- package/lang/translations/ug.po +1 -1
- package/lang/translations/uk.po +1 -1
- package/lang/translations/vi.po +1 -1
- package/lang/translations/zh-cn.po +1 -1
- package/lang/translations/zh.po +1 -1
- package/package.json +11 -11
- package/src/autosave.js +112 -36
- package/src/index.js +1 -1
package/LICENSE.md
CHANGED
@@ -2,7 +2,7 @@ Software License Agreement
|
|
2
2
|
==========================
|
3
3
|
|
4
4
|
**CKEditor 5 autosave feature** – https://github.com/ckeditor/ckeditor5-autosave <br>
|
5
|
-
Copyright (c) 2003-
|
5
|
+
Copyright (c) 2003-2022, [CKSource](http://cksource.com) Holding sp. z o.o. All rights reserved.
|
6
6
|
|
7
7
|
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
|
8
8
|
|
@@ -14,4 +14,4 @@ Where not otherwise indicated, all CKEditor content is authored by CKSource engi
|
|
14
14
|
Trademarks
|
15
15
|
----------
|
16
16
|
|
17
|
-
**CKEditor** is a trademark of [CKSource](http://cksource.com)
|
17
|
+
**CKEditor** is a trademark of [CKSource](http://cksource.com) Holding sp. z o.o. All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
|
package/README.md
CHANGED
@@ -3,7 +3,8 @@ CKEditor 5 autosave feature
|
|
3
3
|
|
4
4
|
[![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-autosave.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-autosave)
|
5
5
|
[![Coverage Status](https://coveralls.io/repos/github/ckeditor/ckeditor5/badge.svg?branch=master)](https://coveralls.io/github/ckeditor/ckeditor5?branch=master)
|
6
|
-
[![Build Status](https://travis-ci.com/ckeditor/ckeditor5.svg?branch=master)](https://travis-ci.com/ckeditor/ckeditor5)
|
6
|
+
[![Build Status](https://travis-ci.com/ckeditor/ckeditor5.svg?branch=master)](https://app.travis-ci.com/github/ckeditor/ckeditor5)
|
7
|
+
![Dependency Status](https://img.shields.io/librariesio/release/npm/@ckeditor/ckeditor5-autosave)
|
7
8
|
|
8
9
|
This package implements the autosave feature for CKEditor 5.
|
9
10
|
|
package/build/autosave.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
+
!function(t){const e=t.en=t.en||{};e.dictionary=Object.assign(e.dictionary||{},{"Saving changes":"Saving changes"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),
|
1
2
|
/*!
|
2
|
-
* @license Copyright (c) 2003-
|
3
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
3
4
|
* For licensing, see LICENSE.md.
|
4
|
-
*/
|
5
|
-
!function(t){const e=t.en=t.en||{};e.dictionary=Object.assign(e.dictionary||{},{"Saving changes":"Saving changes"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),window.CKEditor5=window.CKEditor5||{},window.CKEditor5.autosave=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=5)}([function(t,e,n){t.exports=n(2)("./src/core.js")},function(t,e,n){t.exports=n(2)("./src/utils.js")},function(t,e){t.exports=CKEditor5.dll},function(t,e,n){"use strict";(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.a=n}).call(this,n(4))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";n.r(e),n.d(e,"Autosave",(function(){return K}));var i=n(0),r=n(1);var o=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},s=n(3),a="object"==typeof self&&self&&self.Object===Object&&self,u=s.a||a||Function("return this")(),c=function(){return u.Date.now()},d=/\s/;var l=function(t){for(var e=t.length;e--&&d.test(t.charAt(e)););return e},f=/^\s+/;var h=function(t){return t?t.slice(0,l(t)+1).replace(f,""):t},v=u.Symbol,p=Object.prototype,g=p.hasOwnProperty,b=p.toString,m=v?v.toStringTag:void 0;var y=function(t){var e=g.call(t,m),n=t[m];try{t[m]=void 0;var i=!0}catch(t){}var r=b.call(t);return i&&(e?t[m]=n:delete t[m]),r},_=Object.prototype.toString;var j=function(t){return _.call(t)},w=v?v.toStringTag:void 0;var O=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":w&&w in Object(t)?y(t):j(t)};var S=function(t){return null!=t&&"object"==typeof t};var T=function(t){return"symbol"==typeof t||S(t)&&"[object Symbol]"==O(t)},x=/^[-+]0x[0-9a-f]+$/i,A=/^0b[01]+$/i,E=/^0o[0-7]+$/i,P=parseInt;var N=function(t){if("number"==typeof t)return t;if(T(t))return NaN;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=h(t);var n=A.test(t);return n||E.test(t)?P(t.slice(2),n?2:8):x.test(t)?NaN:+t},C=Math.max,M=Math.min;var D=function(t,e,n){var i,r,s,a,u,d,l=0,f=!1,h=!1,v=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function p(e){var n=i,o=r;return i=r=void 0,l=e,a=t.apply(o,n)}function g(t){return l=t,u=setTimeout(m,e),f?p(t):a}function b(t){var n=t-d;return void 0===d||n>=e||n<0||h&&t-l>=s}function m(){var t=c();if(b(t))return y(t);u=setTimeout(m,function(t){var n=e-(t-d);return h?M(n,s-(t-l)):n}(t))}function y(t){return u=void 0,v&&i?p(t):(i=r=void 0,a)}function _(){var t=c(),n=b(t);if(i=arguments,r=this,d=t,n){if(void 0===u)return g(d);if(h)return clearTimeout(u),u=setTimeout(m,e),p(d)}return void 0===u&&(u=setTimeout(m,e)),a}return e=N(e)||0,o(n)&&(f=!!n.leading,s=(h="maxWait"in n)?C(N(n.maxWait)||0,e):s,v="trailing"in n?!!n.trailing:v),_.cancel=function(){void 0!==u&&clearTimeout(u),l=0,i=d=r=u=void 0},_.flush=function(){return void 0===u?a:y(c())},_};class K extends i.Plugin{static get pluginName(){return"Autosave"}static get requires(){return[i.PendingActions]}constructor(t){super(t);const e=t.config.get("autosave")||{},n=e.waitingTime||1e3;this.set("state","synchronized"),this._debouncedSave=D(this._save.bind(this),n),this._lastDocumentVersion=t.model.document.version,this._domEmitter=Object.create(r.DomEmitterMixin),this._config=e}init(){const t=this.editor,e=t.model.document,n=t.t;this._pendingActions=t.plugins.get(i.PendingActions),this.listenTo(t,"ready",()=>{this.listenTo(e,"change:data",()=>{this._saveCallbacks.length&&("synchronized"==this.state?(this._action=this._pendingActions.add(n("Saving changes")),this.state="waiting",this._debouncedSave()):"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(){this._debouncedSave.cancel(),this._save()}_flush(){this._debouncedSave.flush()}_save(){this.state="saving",this._lastDocumentVersion=this.editor.model.document.version,Promise.resolve().then(()=>Promise.all(this._saveCallbacks.map(t=>t(this.editor)))).catch(t=>{throw this.state="error",this.state="saving",this._debouncedSave(),t}).then(()=>{this.editor.model.document.version>this._lastDocumentVersion?(this.state="waiting",this._debouncedSave()):(this.state="synchronized",this._pendingActions.remove(this._action),this._action=null)})}get _saveCallbacks(){const t=[];return this.adapter&&this.adapter.save&&t.push(this.adapter.save),this._config.save&&t.push(this._config.save),t}}Object(r.mix)(K,r.ObservableMixin)}]);
|
5
|
+
*/(()=>{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})();
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["webpack://CKEditor5.autosave/./src/autosave.js","webpack://CKEditor5.autosave/delegated \"./src/core.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.autosave/delegated \"./src/utils.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.autosave/external var \"CKEditor5.dll\"","webpack://CKEditor5.autosave/javascript/node_modules/lodash-es/_Symbol.js","webpack://CKEditor5.autosave/javascript/node_modules/lodash-es/_baseGetTag.js","webpack://CKEditor5.autosave/javascript/node_modules/lodash-es/_baseTrim.js","webpack://CKEditor5.autosave/javascript/node_modules/lodash-es/_freeGlobal.js","webpack://CKEditor5.autosave/javascript/node_modules/lodash-es/_getRawTag.js","webpack://CKEditor5.autosave/javascript/node_modules/lodash-es/_objectToString.js","webpack://CKEditor5.autosave/javascript/node_modules/lodash-es/_root.js","webpack://CKEditor5.autosave/javascript/node_modules/lodash-es/_trimmedEndIndex.js","webpack://CKEditor5.autosave/javascript/node_modules/lodash-es/debounce.js","webpack://CKEditor5.autosave/javascript/node_modules/lodash-es/isObject.js","webpack://CKEditor5.autosave/javascript/node_modules/lodash-es/isObjectLike.js","webpack://CKEditor5.autosave/javascript/node_modules/lodash-es/isSymbol.js","webpack://CKEditor5.autosave/javascript/node_modules/lodash-es/now.js","webpack://CKEditor5.autosave/javascript/node_modules/lodash-es/toNumber.js","webpack://CKEditor5.autosave/webpack/bootstrap","webpack://CKEditor5.autosave/webpack/runtime/define property getters","webpack://CKEditor5.autosave/webpack/runtime/hasOwnProperty shorthand","webpack://CKEditor5.autosave/webpack/runtime/make namespace object","webpack://CKEditor5.autosave/./src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE4D;AACgB;AACvC;;AAErC;;AAEA;AACA,QAAQ,yCAAyC;AACjD;AACA;AACA,sBAAsB;AACtB;AACA,IAAI,8EAA8E;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,wCAAwC;AACxC,mBAAmB,iEAAiE;AACpF;AACA;AACA;AACe,uBAAuB,sDAAM;AAC5C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,8DAAc;AACzB;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,0CAA0C;AACxD;;AAEA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B,uBAAuB;AACvB,sBAAsB;AACtB;AACA;AACA;AACA;AACA,cAAc,mCAAmC;AACjD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,wBAAwB,qDAAQ;;AAEhC;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,oCAAoC,gEAAe;;AAEnD;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,2CAA2C;AACzD;AACA,6CAA6C,8DAAc;;AAE3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,QAAQ;AACtB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL,IAAI;;AAEJ;AACA;AACA,2DAA2D,sBAAsB;;AAEjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,wDAAG,YAAY,gEAAe;;AAE9B;AACA;AACA;AACA,YAAY,gDAAgD;AAC5D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,kCAAkC;AAC7C,aAAa;AACb;;AAEA;AACA,6BAA6B,yDAAyD;AACtF;AACA,iBAAiB,8CAA8C;AAC/D;AACA,YAAY,yCAAyC;AACrD;;AAEA;AACA,6BAA6B,yDAAyD;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,QAAQ,oFAAoF;AAC5F;AACA,6BAA6B,2EAA2E;AACxG;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,WAAW,kCAAkC;AAC7C,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,YAAY,QAAQ;AACpB;;;;;;;;;;;AC5bA;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;ACA8B;;AAE9B;AACA,aAAa,uDAAW;;AAExB,iEAAe,MAAM,EAAC;;;;;;;;;;;;;;;;;;;ACLY;AACM;AACU;;AAElD;AACA;AACA;;AAEA;AACA,qBAAqB,kDAAM,GAAG,8DAAkB;;AAEhD;AACA;AACA;AACA;AACA,WAAW,GAAG;AACd,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,yDAAS;AACf,MAAM,8DAAc;AACpB;;AAEA,iEAAe,UAAU,EAAC;;;;;;;;;;;;;;;;;AC3B0B;;AAEpD;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,aAAa,QAAQ;AACrB;AACA;AACA;AACA,sBAAsB,+DAAe;AACrC;AACA;;AAEA,iEAAe,QAAQ,EAAC;;;;;;;;;;;;;;;;AClBxB;AACA;;AAEA,iEAAe,UAAU,EAAC;;;;;;;;;;;;;;;;;ACHQ;;AAElC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,kDAAM,GAAG,8DAAkB;;AAEhD;AACA;AACA;AACA;AACA,WAAW,GAAG;AACd,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA,iEAAe,SAAS,EAAC;;;;;;;;;;;;;;;;AC7CzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,GAAG;AACd,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA,iEAAe,cAAc,EAAC;;;;;;;;;;;;;;;;;ACrBY;;AAE1C;AACA;;AAEA;AACA,WAAW,sDAAU;;AAErB,iEAAe,IAAI,EAAC;;;;;;;;;;;;;;;;ACRpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,aAAa,QAAQ;AACrB;AACA;AACA;;AAEA;AACA;AACA;;AAEA,iEAAe,eAAe,EAAC;;;;;;;;;;;;;;;;;;;AClBM;AACV;AACU;;AAErC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,UAAU;AACrB,WAAW,QAAQ;AACnB,WAAW,QAAQ,WAAW;AAC9B,WAAW,SAAS;AACpB;AACA,WAAW,QAAQ;AACnB;AACA,WAAW,SAAS;AACpB;AACA,aAAa,UAAU;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,+CAA+C,iBAAiB;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS,wDAAQ;AACjB,MAAM,wDAAQ;AACd;AACA;AACA,iCAAiC,wDAAQ;AACzC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAe,mDAAG;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,yDAAyD,mDAAG;AAC5D;;AAEA;AACA,eAAe,mDAAG;AAClB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iEAAe,QAAQ,EAAC;;;;;;;;;;;;;;;;AC9LxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,GAAG;AACd,aAAa,SAAS;AACtB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iEAAe,QAAQ,EAAC;;;;;;;;;;;;;;;;AC9BxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,GAAG;AACd,aAAa,SAAS;AACtB;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iEAAe,YAAY,EAAC;;;;;;;;;;;;;;;;;;AC5Bc;AACG;;AAE7C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,GAAG;AACd,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,4DAAY,WAAW,0DAAU;AACtC;;AAEA,iEAAe,QAAQ,EAAC;;;;;;;;;;;;;;;;;AC5BM;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,SAAS,yDAAa;AACtB;;AAEA,iEAAe,GAAG,EAAC;;;;;;;;;;;;;;;;;;;ACtBmB;AACD;AACA;;AAErC;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,GAAG;AACd,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,wDAAQ;AACd;AACA;AACA,MAAM,wDAAQ;AACd;AACA,YAAY,wDAAQ;AACpB;AACA;AACA;AACA;AACA,UAAU,wDAAQ;AAClB;AACA;AACA;AACA;AACA;;AAEA,iEAAe,QAAQ,EAAC;;;;;;;UC/DxB;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;ACNA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEiD","file":"autosave.js","sourcesContent":["/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module autosave/autosave\n */\n\nimport { Plugin, PendingActions } from 'ckeditor5/src/core';\nimport { DomEmitterMixin, ObservableMixin, mix } from 'ckeditor5/src/utils';\nimport { debounce } from 'lodash-es';\n\n/* globals window */\n\n/**\n * The {@link module:autosave/autosave~Autosave} plugin allows you to automatically save the data (e.g. send it to the server)\n * when needed (when the user changed the content).\n *\n * It listens to the {@link module:engine/model/document~Document#event:change:data `editor.model.document#change:data`}\n * and `window#beforeunload` events and calls the\n * {@link module:autosave/autosave~AutosaveAdapter#save `config.autosave.save()`} function.\n *\n *\t\tClassicEditor\n *\t\t\t.create( document.querySelector( '#editor' ), {\n *\t\t\t\tplugins: [ ArticlePluginSet, Autosave ],\n *\t\t\t\ttoolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ],\n *\t\t\t\timage: {\n *\t\t\t\t\ttoolbar: [ 'imageStyle:block', 'imageStyle:side', '|', 'toggleImageCaption', 'imageTextAlternative' ],\n *\t\t\t\t},\n *\t\t\t\tautosave: {\n *\t\t\t\t\tsave( editor ) {\n *\t\t\t\t\t\t// The saveData() function must return a promise\n *\t\t\t\t\t\t// which should be resolved when the data is successfully saved.\n *\t\t\t\t\t\treturn saveData( editor.getData() );\n *\t\t\t\t\t}\n *\t\t\t\t}\n *\t\t\t} );\n *\n * Read more about this feature in the {@glink installation/advanced/saving-data#autosave-feature Autosave feature}\n * section of the {@glink installation/advanced/saving-data Saving and getting data}.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class Autosave extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'Autosave';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ PendingActions ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tconstructor( editor ) {\n\t\tsuper( editor );\n\n\t\tconst config = editor.config.get( 'autosave' ) || {};\n\n\t\t// A minimum amount of time that needs to pass after the last action.\n\t\t// After that time the provided save callbacks are being called.\n\t\tconst waitingTime = config.waitingTime || 1000;\n\n\t\t/**\n\t\t * The adapter is an object with a `save()` method. That method will be called whenever\n\t\t * the data changes. It might be called some time after the change,\n\t\t * since the event is throttled for performance reasons.\n\t\t *\n\t\t * @member {module:autosave/autosave~AutosaveAdapter} #adapter\n\t\t */\n\n\t\t/**\n\t\t * The state of this plugin.\n\t\t *\n\t\t * The plugin can be in the following states:\n\t\t *\n\t\t * * synchronized – When all changes are saved.\n\t\t * * waiting – When the plugin is waiting for other changes before calling `adapter#save()` and `config.autosave.save()`.\n\t\t * * saving – When the provided save method is called and the plugin waits for the response.\n\t\t * * error &ndash When the provided save method will throw an error. This state immediately changes to the `saving` state and\n\t\t * the save method will be called again in the short period of time.\n\t\t *\n\t\t * @readonly\n\t\t * @member {'synchronized'|'waiting'|'saving'} #state\n\t\t */\n\t\tthis.set( 'state', 'synchronized' );\n\n\t\t/**\n\t\t * Debounced save method. The `save()` method is called the specified `waitingTime` after `debouncedSave()` is called,\n\t\t * unless a new action happens in the meantime.\n\t\t *\n\t\t * @private\n\t\t * @type {Function}\n\t\t */\n\t\tthis._debouncedSave = debounce( this._save.bind( this ), waitingTime );\n\n\t\t/**\n\t\t * The last saved document version.\n\t\t *\n\t\t * @private\n\t\t * @type {Number}\n\t\t */\n\t\tthis._lastDocumentVersion = editor.model.document.version;\n\n\t\t/**\n\t\t * Promise used for asynchronous save calls.\n\t\t *\n\t\t * Created to handle the autosave call to an external data source. It resolves when that call is finished. It is re-used if\n\t\t * save is called before the promise has been resolved. It is set to `null` if there is no call in progress.\n\t\t *\n\t\t * @type {Promise|null}\n\t\t * @private\n\t\t */\n\t\tthis._savePromise = null;\n\n\t\t/**\n\t\t * DOM emitter.\n\t\t *\n\t\t * @private\n\t\t * @type {DomEmitterMixin}\n\t\t */\n\t\tthis._domEmitter = Object.create( DomEmitterMixin );\n\n\t\t/**\n\t\t * The configuration of this plugins.\n\t\t *\n\t\t * @private\n\t\t * @type {Object}\n\t\t */\n\t\tthis._config = config;\n\n\t\t/**\n\t\t * Editor's pending actions manager.\n\t\t *\n\t\t * @private\n\t\t * @member {module:core/pendingactions~PendingActions} #_pendingActions\n\t\t */\n\t\tthis._pendingActions = editor.plugins.get( PendingActions );\n\n\t\t/**\n\t\t * Informs whether there should be another autosave callback performed, immediately after current autosave callback finishes.\n\t\t *\n\t\t * This is set to `true` when there is a save request while autosave callback is already being processed\n\t\t * and the model has changed since the last save.\n\t\t *\n\t\t * @private\n\t\t * @type {Boolean}\n\t\t */\n\t\tthis._makeImmediateSave = false;\n\n\t\t/**\n\t\t * An action that will be added to the pending action manager for actions happening in that plugin.\n\t\t *\n\t\t * @private\n\t\t * @member {Object} #_action\n\t\t */\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\tconst editor = this.editor;\n\t\tconst doc = editor.model.document;\n\n\t\t// Add the listener only after the editor is initialized to prevent firing save callback on data init.\n\t\tthis.listenTo( editor, 'ready', () => {\n\t\t\tthis.listenTo( doc, 'change:data', ( evt, batch ) => {\n\t\t\t\tif ( !this._saveCallbacks.length ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( !batch.isLocal ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( this.state === 'synchronized' ) {\n\t\t\t\t\tthis.state = 'waiting';\n\t\t\t\t\t// Set pending action already when we are waiting for the autosave callback.\n\t\t\t\t\tthis._setPendingAction();\n\t\t\t\t}\n\n\t\t\t\tif ( this.state === 'waiting' ) {\n\t\t\t\t\tthis._debouncedSave();\n\t\t\t\t}\n\n\t\t\t\t// If the plugin is in `saving` state, it will change its state later basing on the `document.version`.\n\t\t\t\t// If the `document.version` will be higher than stored `#_lastDocumentVersion`, then it means, that some `change:data`\n\t\t\t\t// event has fired in the meantime.\n\t\t\t} );\n\t\t} );\n\n\t\t// Flush on the editor's destroy listener with the highest priority to ensure that\n\t\t// `editor.getData()` will be called before plugins are destroyed.\n\t\tthis.listenTo( editor, 'destroy', () => this._flush(), { priority: 'highest' } );\n\n\t\t// It's not possible to easy test it because karma uses `beforeunload` event\n\t\t// to warn before full page reload and this event cannot be dispatched manually.\n\t\t/* istanbul ignore next */\n\t\tthis._domEmitter.listenTo( window, 'beforeunload', ( evtInfo, domEvt ) => {\n\t\t\tif ( this._pendingActions.hasAny ) {\n\t\t\t\tdomEvt.returnValue = this._pendingActions.first.message;\n\t\t\t}\n\t\t} );\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tdestroy() {\n\t\t// There's no need for canceling or flushing the throttled save, as\n\t\t// it's done on the editor's destroy event with the highest priority.\n\n\t\tthis._domEmitter.stopListening();\n\t\tsuper.destroy();\n\t}\n\n\t/**\n\t * Immediately calls autosave callback. All previously queued (debounced) callbacks are cleared. If there is already an autosave\n\t * callback in progress, then the requested save will be performed immediately after the current callback finishes.\n\t *\n\t * @returns {Promise} A promise that will be resolved when the autosave callback is finished.\n\t */\n\tsave() {\n\t\tthis._debouncedSave.cancel();\n\n\t\treturn this._save();\n\t}\n\n\t/**\n\t * Invokes the remaining `_save()` method call.\n\t *\n\t * @protected\n\t */\n\t_flush() {\n\t\tthis._debouncedSave.flush();\n\t}\n\n\t/**\n\t * If the adapter is set and a new document version exists,\n\t * the `_save()` method creates a pending action and calls the `adapter.save()` method.\n\t * It waits for the result and then removes the created pending action.\n\t *\n\t * @private\n\t * @returns {Promise} A promise that will be resolved when the autosave callback is finished.\n\t */\n\t_save() {\n\t\tif ( this._savePromise ) {\n\t\t\tthis._makeImmediateSave = this.editor.model.document.version > this._lastDocumentVersion;\n\n\t\t\treturn this._savePromise;\n\t\t}\n\n\t\t// Make sure there is a pending action (in case if `_save()` was called through manual `save()` call).\n\t\tthis._setPendingAction();\n\n\t\tthis.state = 'saving';\n\t\tthis._lastDocumentVersion = this.editor.model.document.version;\n\n\t\t// Wait one promise cycle to be sure that save callbacks are not called inside a conversion or when the editor's state changes.\n\t\tthis._savePromise = Promise.resolve()\n\t\t\t// Make autosave callback.\n\t\t\t.then( () => Promise.all(\n\t\t\t\tthis._saveCallbacks.map( cb => cb( this.editor ) )\n\t\t\t) )\n\t\t\t// When the autosave callback is finished, always clear `this._savePromise`, no matter if it was successful or not.\n\t\t\t.finally( () => {\n\t\t\t\tthis._savePromise = null;\n\t\t\t} )\n\t\t\t// If the save was successful, we have three scenarios:\n\t\t\t//\n\t\t\t// 1. If a save was requested when an autosave callback was already processed, we need to immediately call\n\t\t\t// another autosave callback. In this case, `this._savePromise` will not be resolved until the next callback is done.\n\t\t\t// 2. Otherwise, if changes happened to the model, make a delayed autosave callback (like the change just happened).\n\t\t\t// 3. If no changes happened to the model, return to the `synchronized` state.\n\t\t\t.then( () => {\n\t\t\t\tif ( this._makeImmediateSave ) {\n\t\t\t\t\tthis._makeImmediateSave = false;\n\n\t\t\t\t\t// Start another autosave callback. Return a promise that will be resolved after the new autosave callback.\n\t\t\t\t\t// This way promises returned by `_save()` will not be resolved until all changes are saved.\n\t\t\t\t\t//\n\t\t\t\t\t// If `save()` was called when another (most often automatic) autosave callback was already processed,\n\t\t\t\t\t// the promise returned by `save()` call will be resolved only after new changes have been saved.\n\t\t\t\t\t//\n\t\t\t\t\t// Note that it would not work correctly if `this._savePromise` is not cleared.\n\t\t\t\t\treturn this._save();\n\t\t\t\t} else {\n\t\t\t\t\tif ( this.editor.model.document.version > this._lastDocumentVersion ) {\n\t\t\t\t\t\tthis.state = 'waiting';\n\t\t\t\t\t\tthis._debouncedSave();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.state = 'synchronized';\n\t\t\t\t\t\tthis._pendingActions.remove( this._action );\n\t\t\t\t\t\tthis._action = null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} )\n\t\t\t// In case of an error, retry the autosave callback after a delay (and also throw the original error).\n\t\t\t.catch( err => {\n\t\t\t\t// Change state to `error` so that listeners handling autosave error can be called.\n\t\t\t\tthis.state = 'error';\n\t\t\t\t// Then, immediately change to the `saving` state as described above.\n\t\t\t\t// Being in the `saving` state ensures that the autosave callback won't be delayed further by the `change:data` listener.\n\t\t\t\tthis.state = 'saving';\n\n\t\t\t\tthis._debouncedSave();\n\n\t\t\t\tthrow err;\n\t\t\t} );\n\n\t\treturn this._savePromise;\n\t}\n\n\t/**\n\t * Creates a pending action if it is not set already.\n\t *\n\t * @private\n\t */\n\t_setPendingAction() {\n\t\tconst t = this.editor.t;\n\n\t\tif ( !this._action ) {\n\t\t\tthis._action = this._pendingActions.add( t( 'Saving changes' ) );\n\t\t}\n\t}\n\n\t/**\n\t * Saves callbacks.\n\t *\n\t * @private\n\t * @type {Array.<Function>}\n\t */\n\tget _saveCallbacks() {\n\t\tconst saveCallbacks = [];\n\n\t\tif ( this.adapter && this.adapter.save ) {\n\t\t\tsaveCallbacks.push( this.adapter.save );\n\t\t}\n\n\t\tif ( this._config.save ) {\n\t\t\tsaveCallbacks.push( this._config.save );\n\t\t}\n\n\t\treturn saveCallbacks;\n\t}\n}\n\nmix( Autosave, ObservableMixin );\n\n/**\n * An interface that requires the `save()` method.\n *\n * Used by {@link module:autosave/autosave~Autosave#adapter}.\n *\n * @interface module:autosave/autosave~AutosaveAdapter\n */\n\n/**\n * The method that will be called when the data changes. It should return a promise (e.g. in case of saving content to the database),\n * so the autosave plugin will wait for that action before removing it from pending actions.\n *\n * @method #save\n * @param {module:core/editor/editor~Editor} editor The editor instance.\n * @returns {Promise.<*>}\n */\n\n/**\n * The configuration of the {@link module:autosave/autosave~Autosave autosave feature}.\n *\n * Read more in {@link module:autosave/autosave~AutosaveConfig}.\n *\n * @member {module:autosave/autosave~AutosaveConfig} module:core/editor/editorconfig~EditorConfig#autosave\n */\n\n/**\n * The configuration of the {@link module:autosave/autosave~Autosave autosave feature}.\n *\n *\t\tClassicEditor\n *\t\t\t.create( editorElement, {\n *\t\t\t\tautosave: {\n *\t\t\t\t\tsave( editor ) {\n *\t\t\t\t\t\t// The saveData() function must return a promise\n *\t\t\t\t\t\t// which should be resolved when the data is successfully saved.\n *\t\t\t\t\t\treturn saveData( editor.getData() );\n *\t\t\t\t\t}\n *\t\t\t\t}\n *\t\t\t} );\n *\t\t\t.then( ... )\n *\t\t\t.catch( ... );\n *\n * See {@link module:core/editor/editorconfig~EditorConfig all editor configuration options}.\n *\n * See also the demo of the {@glink installation/advanced/saving-data#autosave-feature autosave feature}.\n *\n * @interface AutosaveConfig\n */\n\n/**\n * The callback to be executed when the data needs to be saved.\n *\n * This function must return a promise which should be resolved when the data is successfully saved.\n *\n *\t\tClassicEditor\n *\t\t\t.create( editorElement, {\n *\t\t\t\tautosave: {\n *\t\t\t\t\tsave( editor ) {\n *\t\t\t\t\t\treturn saveData( editor.getData() );\n *\t\t\t\t\t}\n *\t\t\t\t}\n *\t\t\t} );\n *\t\t\t.then( ... )\n *\t\t\t.catch( ... );\n *\n * @method module:autosave/autosave~AutosaveConfig#save\n * @param {module:core/editor/editor~Editor} editor The editor instance.\n * @returns {Promise.<*>}\n */\n\n/**\n * The minimum amount of time that needs to pass after the last action to call the provided callback.\n * By default it is 1000 ms.\n *\n *\t\tClassicEditor\n *\t\t\t.create( editorElement, {\n *\t\t\t\tautosave: {\n *\t\t\t\t\tsave( editor ) {\n *\t\t\t\t\t\treturn saveData( editor.getData() );\n *\t\t\t\t\t},\n *\t\t\t\t\twaitingTime: 2000\n *\t\t\t\t}\n *\t\t\t} );\n *\t\t\t.then( ... )\n *\t\t\t.catch( ... );\n *\n * @member {Number} module:autosave/autosave~AutosaveConfig#waitingTime\n */\n","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/core.js\");","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/utils.js\");","module.exports = CKEditor5.dll;","import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n","import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n","import trimmedEndIndex from './_trimmedEndIndex.js';\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nexport default baseTrim;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n","import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nexport default trimmedEndIndex;\n","import isObject from './isObject.js';\nimport now from './now.js';\nimport toNumber from './toNumber.js';\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nexport default debounce;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nexport default isSymbol;\n","import root from './_root.js';\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nexport default now;\n","import baseTrim from './_baseTrim.js';\nimport isObject from './isObject.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nexport default toNumber;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module autosave\n */\n\nexport { default as Autosave } from './autosave';\n"],"sourceRoot":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(n){const i=n.bs=n.bs||{};i.dictionary=Object.assign(i.dictionary||{},{"Saving changes":"Spremanje izmjena"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(n){const i=n.el=n.el||{};i.dictionary=Object.assign(i.dictionary||{},{"Saving changes":"Αποθήκευση αλλαγών"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(n){const i=n.jv=n.jv||{};i.dictionary=Object.assign(i.dictionary||{},{"Saving changes":"Nyimpen perubahan"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
|
package/ckeditor5-metadata.json
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
"name": "Autosave",
|
5
5
|
"className": "Autosave",
|
6
6
|
"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.",
|
7
|
-
"docs": "
|
7
|
+
"docs": "installation/advanced/saving-data.html#autosave-feature",
|
8
8
|
"path": "src/autosave.js"
|
9
9
|
}
|
10
10
|
]
|
package/lang/translations/af.po
CHANGED
package/lang/translations/ar.po
CHANGED
package/lang/translations/az.po
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
2
|
+
#
|
3
|
+
# !!! IMPORTANT !!!
|
4
|
+
#
|
5
|
+
# Before you edit this file, please keep in mind that contributing to the project
|
6
|
+
# translations is possible ONLY via the Transifex online service.
|
7
|
+
#
|
8
|
+
# To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
|
9
|
+
#
|
10
|
+
# To learn more, check out the official contributor's guide:
|
11
|
+
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
|
12
|
+
#
|
13
|
+
msgid ""
|
14
|
+
msgstr ""
|
15
|
+
"Language-Team: Bosnian (https://www.transifex.com/ckeditor/teams/11143/bs/)\n"
|
16
|
+
"Language: bs\n"
|
17
|
+
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
18
|
+
|
19
|
+
msgctxt "A message that the data is being saved."
|
20
|
+
msgid "Saving changes"
|
21
|
+
msgstr "Spremanje izmjena"
|
package/lang/translations/cs.po
CHANGED
package/lang/translations/da.po
CHANGED
package/lang/translations/de.po
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
2
|
+
#
|
3
|
+
# !!! IMPORTANT !!!
|
4
|
+
#
|
5
|
+
# Before you edit this file, please keep in mind that contributing to the project
|
6
|
+
# translations is possible ONLY via the Transifex online service.
|
7
|
+
#
|
8
|
+
# To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
|
9
|
+
#
|
10
|
+
# To learn more, check out the official contributor's guide:
|
11
|
+
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
|
12
|
+
#
|
13
|
+
msgid ""
|
14
|
+
msgstr ""
|
15
|
+
"Language-Team: Greek (https://www.transifex.com/ckeditor/teams/11143/el/)\n"
|
16
|
+
"Language: el\n"
|
17
|
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
18
|
+
|
19
|
+
msgctxt "A message that the data is being saved."
|
20
|
+
msgid "Saving changes"
|
21
|
+
msgstr "Αποθήκευση αλλαγών"
|
package/lang/translations/en.po
CHANGED
package/lang/translations/es.po
CHANGED
package/lang/translations/et.po
CHANGED
package/lang/translations/fa.po
CHANGED
package/lang/translations/fi.po
CHANGED
package/lang/translations/fr.po
CHANGED
package/lang/translations/gl.po
CHANGED
package/lang/translations/he.po
CHANGED
package/lang/translations/hi.po
CHANGED
package/lang/translations/hr.po
CHANGED
package/lang/translations/hu.po
CHANGED
package/lang/translations/id.po
CHANGED
package/lang/translations/it.po
CHANGED
package/lang/translations/ja.po
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
2
|
+
#
|
3
|
+
# !!! IMPORTANT !!!
|
4
|
+
#
|
5
|
+
# Before you edit this file, please keep in mind that contributing to the project
|
6
|
+
# translations is possible ONLY via the Transifex online service.
|
7
|
+
#
|
8
|
+
# To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
|
9
|
+
#
|
10
|
+
# To learn more, check out the official contributor's guide:
|
11
|
+
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
|
12
|
+
#
|
13
|
+
msgid ""
|
14
|
+
msgstr ""
|
15
|
+
"Language-Team: Javanese (https://www.transifex.com/ckeditor/teams/11143/jv/)\n"
|
16
|
+
"Language: jv\n"
|
17
|
+
"Plural-Forms: nplurals=1; plural=0;\n"
|
18
|
+
|
19
|
+
msgctxt "A message that the data is being saved."
|
20
|
+
msgid "Saving changes"
|
21
|
+
msgstr "Nyimpen perubahan"
|
package/lang/translations/km.po
CHANGED
package/lang/translations/ko.po
CHANGED
package/lang/translations/ku.po
CHANGED
package/lang/translations/lt.po
CHANGED
package/lang/translations/lv.po
CHANGED
package/lang/translations/ne.po
CHANGED
package/lang/translations/nl.po
CHANGED
package/lang/translations/no.po
CHANGED
package/lang/translations/pl.po
CHANGED
package/lang/translations/ro.po
CHANGED
package/lang/translations/ru.po
CHANGED
package/lang/translations/sk.po
CHANGED
package/lang/translations/sl.po
CHANGED
package/lang/translations/sq.po
CHANGED
package/lang/translations/sr.po
CHANGED
package/lang/translations/sv.po
CHANGED
package/lang/translations/th.po
CHANGED
package/lang/translations/tk.po
CHANGED
package/lang/translations/tr.po
CHANGED
package/lang/translations/ug.po
CHANGED
package/lang/translations/uk.po
CHANGED
package/lang/translations/vi.po
CHANGED
package/lang/translations/zh.po
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-autosave",
|
3
|
-
"version": "
|
3
|
+
"version": "34.0.0",
|
4
4
|
"description": "Autosave feature for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -12,21 +12,21 @@
|
|
12
12
|
],
|
13
13
|
"main": "src/index.js",
|
14
14
|
"dependencies": {
|
15
|
-
"ckeditor5": "^
|
15
|
+
"ckeditor5": "^34.0.0",
|
16
16
|
"lodash-es": "^4.17.15"
|
17
17
|
},
|
18
18
|
"devDependencies": {
|
19
|
-
"@ckeditor/ckeditor5-core": "^
|
20
|
-
"@ckeditor/ckeditor5-dev-utils": "^
|
21
|
-
"@ckeditor/ckeditor5-editor-classic": "^
|
22
|
-
"@ckeditor/ckeditor5-paragraph": "^
|
23
|
-
"@ckeditor/ckeditor5-source-editing": "^
|
24
|
-
"@ckeditor/ckeditor5-theme-lark": "^
|
25
|
-
"webpack": "^
|
26
|
-
"webpack-cli": "^
|
19
|
+
"@ckeditor/ckeditor5-core": "^34.0.0",
|
20
|
+
"@ckeditor/ckeditor5-dev-utils": "^30.0.0",
|
21
|
+
"@ckeditor/ckeditor5-editor-classic": "^34.0.0",
|
22
|
+
"@ckeditor/ckeditor5-paragraph": "^34.0.0",
|
23
|
+
"@ckeditor/ckeditor5-source-editing": "^34.0.0",
|
24
|
+
"@ckeditor/ckeditor5-theme-lark": "^34.0.0",
|
25
|
+
"webpack": "^5.58.1",
|
26
|
+
"webpack-cli": "^4.9.0"
|
27
27
|
},
|
28
28
|
"engines": {
|
29
|
-
"node": ">=
|
29
|
+
"node": ">=14.0.0",
|
30
30
|
"npm": ">=5.7.1"
|
31
31
|
},
|
32
32
|
"author": "CKSource (http://cksource.com/)",
|
package/src/autosave.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
5
5
|
|
@@ -37,8 +37,8 @@ import { debounce } from 'lodash-es';
|
|
37
37
|
* }
|
38
38
|
* } );
|
39
39
|
*
|
40
|
-
* Read more about this feature in the {@glink
|
41
|
-
* section of the {@glink
|
40
|
+
* Read more about this feature in the {@glink installation/advanced/saving-data#autosave-feature Autosave feature}
|
41
|
+
* section of the {@glink installation/advanced/saving-data Saving and getting data}.
|
42
42
|
*
|
43
43
|
* @extends module:core/plugin~Plugin
|
44
44
|
*/
|
@@ -88,6 +88,7 @@ export default class Autosave extends Plugin {
|
|
88
88
|
* * error &ndash When the provided save method will throw an error. This state immediately changes to the `saving` state and
|
89
89
|
* the save method will be called again in the short period of time.
|
90
90
|
*
|
91
|
+
* @readonly
|
91
92
|
* @member {'synchronized'|'waiting'|'saving'} #state
|
92
93
|
*/
|
93
94
|
this.set( 'state', 'synchronized' );
|
@@ -109,6 +110,17 @@ export default class Autosave extends Plugin {
|
|
109
110
|
*/
|
110
111
|
this._lastDocumentVersion = editor.model.document.version;
|
111
112
|
|
113
|
+
/**
|
114
|
+
* Promise used for asynchronous save calls.
|
115
|
+
*
|
116
|
+
* Created to handle the autosave call to an external data source. It resolves when that call is finished. It is re-used if
|
117
|
+
* save is called before the promise has been resolved. It is set to `null` if there is no call in progress.
|
118
|
+
*
|
119
|
+
* @type {Promise|null}
|
120
|
+
* @private
|
121
|
+
*/
|
122
|
+
this._savePromise = null;
|
123
|
+
|
112
124
|
/**
|
113
125
|
* DOM emitter.
|
114
126
|
*
|
@@ -126,17 +138,29 @@ export default class Autosave extends Plugin {
|
|
126
138
|
this._config = config;
|
127
139
|
|
128
140
|
/**
|
129
|
-
*
|
141
|
+
* Editor's pending actions manager.
|
130
142
|
*
|
131
143
|
* @private
|
132
|
-
* @member {
|
144
|
+
* @member {module:core/pendingactions~PendingActions} #_pendingActions
|
133
145
|
*/
|
146
|
+
this._pendingActions = editor.plugins.get( PendingActions );
|
134
147
|
|
135
148
|
/**
|
136
|
-
*
|
149
|
+
* Informs whether there should be another autosave callback performed, immediately after current autosave callback finishes.
|
150
|
+
*
|
151
|
+
* This is set to `true` when there is a save request while autosave callback is already being processed
|
152
|
+
* and the model has changed since the last save.
|
137
153
|
*
|
138
154
|
* @private
|
139
|
-
* @
|
155
|
+
* @type {Boolean}
|
156
|
+
*/
|
157
|
+
this._makeImmediateSave = false;
|
158
|
+
|
159
|
+
/**
|
160
|
+
* An action that will be added to the pending action manager for actions happening in that plugin.
|
161
|
+
*
|
162
|
+
* @private
|
163
|
+
* @member {Object} #_action
|
140
164
|
*/
|
141
165
|
}
|
142
166
|
|
@@ -146,25 +170,25 @@ export default class Autosave extends Plugin {
|
|
146
170
|
init() {
|
147
171
|
const editor = this.editor;
|
148
172
|
const doc = editor.model.document;
|
149
|
-
const t = editor.t;
|
150
|
-
|
151
|
-
this._pendingActions = editor.plugins.get( PendingActions );
|
152
173
|
|
153
174
|
// Add the listener only after the editor is initialized to prevent firing save callback on data init.
|
154
175
|
this.listenTo( editor, 'ready', () => {
|
155
|
-
this.listenTo( doc, 'change:data', () => {
|
176
|
+
this.listenTo( doc, 'change:data', ( evt, batch ) => {
|
156
177
|
if ( !this._saveCallbacks.length ) {
|
157
178
|
return;
|
158
179
|
}
|
159
180
|
|
160
|
-
if (
|
161
|
-
|
162
|
-
|
181
|
+
if ( !batch.isLocal ) {
|
182
|
+
return;
|
183
|
+
}
|
163
184
|
|
164
|
-
|
185
|
+
if ( this.state === 'synchronized' ) {
|
186
|
+
this.state = 'waiting';
|
187
|
+
// Set pending action already when we are waiting for the autosave callback.
|
188
|
+
this._setPendingAction();
|
165
189
|
}
|
166
190
|
|
167
|
-
|
191
|
+
if ( this.state === 'waiting' ) {
|
168
192
|
this._debouncedSave();
|
169
193
|
}
|
170
194
|
|
@@ -200,11 +224,15 @@ export default class Autosave extends Plugin {
|
|
200
224
|
}
|
201
225
|
|
202
226
|
/**
|
203
|
-
*
|
227
|
+
* Immediately calls autosave callback. All previously queued (debounced) callbacks are cleared. If there is already an autosave
|
228
|
+
* callback in progress, then the requested save will be performed immediately after the current callback finishes.
|
229
|
+
*
|
230
|
+
* @returns {Promise} A promise that will be resolved when the autosave callback is finished.
|
204
231
|
*/
|
205
232
|
save() {
|
206
233
|
this._debouncedSave.cancel();
|
207
|
-
|
234
|
+
|
235
|
+
return this._save();
|
208
236
|
}
|
209
237
|
|
210
238
|
/**
|
@@ -222,39 +250,87 @@ export default class Autosave extends Plugin {
|
|
222
250
|
* It waits for the result and then removes the created pending action.
|
223
251
|
*
|
224
252
|
* @private
|
253
|
+
* @returns {Promise} A promise that will be resolved when the autosave callback is finished.
|
225
254
|
*/
|
226
255
|
_save() {
|
256
|
+
if ( this._savePromise ) {
|
257
|
+
this._makeImmediateSave = this.editor.model.document.version > this._lastDocumentVersion;
|
258
|
+
|
259
|
+
return this._savePromise;
|
260
|
+
}
|
261
|
+
|
262
|
+
// Make sure there is a pending action (in case if `_save()` was called through manual `save()` call).
|
263
|
+
this._setPendingAction();
|
264
|
+
|
227
265
|
this.state = 'saving';
|
228
266
|
this._lastDocumentVersion = this.editor.model.document.version;
|
229
267
|
|
230
|
-
// Wait one promise cycle to be sure that save callbacks are not called
|
231
|
-
|
232
|
-
|
268
|
+
// Wait one promise cycle to be sure that save callbacks are not called inside a conversion or when the editor's state changes.
|
269
|
+
this._savePromise = Promise.resolve()
|
270
|
+
// Make autosave callback.
|
233
271
|
.then( () => Promise.all(
|
234
272
|
this._saveCallbacks.map( cb => cb( this.editor ) )
|
235
273
|
) )
|
236
|
-
//
|
237
|
-
|
238
|
-
|
274
|
+
// When the autosave callback is finished, always clear `this._savePromise`, no matter if it was successful or not.
|
275
|
+
.finally( () => {
|
276
|
+
this._savePromise = null;
|
277
|
+
} )
|
278
|
+
// If the save was successful, we have three scenarios:
|
279
|
+
//
|
280
|
+
// 1. If a save was requested when an autosave callback was already processed, we need to immediately call
|
281
|
+
// another autosave callback. In this case, `this._savePromise` will not be resolved until the next callback is done.
|
282
|
+
// 2. Otherwise, if changes happened to the model, make a delayed autosave callback (like the change just happened).
|
283
|
+
// 3. If no changes happened to the model, return to the `synchronized` state.
|
284
|
+
.then( () => {
|
285
|
+
if ( this._makeImmediateSave ) {
|
286
|
+
this._makeImmediateSave = false;
|
287
|
+
|
288
|
+
// Start another autosave callback. Return a promise that will be resolved after the new autosave callback.
|
289
|
+
// This way promises returned by `_save()` will not be resolved until all changes are saved.
|
290
|
+
//
|
291
|
+
// If `save()` was called when another (most often automatic) autosave callback was already processed,
|
292
|
+
// the promise returned by `save()` call will be resolved only after new changes have been saved.
|
293
|
+
//
|
294
|
+
// Note that it would not work correctly if `this._savePromise` is not cleared.
|
295
|
+
return this._save();
|
296
|
+
} else {
|
297
|
+
if ( this.editor.model.document.version > this._lastDocumentVersion ) {
|
298
|
+
this.state = 'waiting';
|
299
|
+
this._debouncedSave();
|
300
|
+
} else {
|
301
|
+
this.state = 'synchronized';
|
302
|
+
this._pendingActions.remove( this._action );
|
303
|
+
this._action = null;
|
304
|
+
}
|
305
|
+
}
|
306
|
+
} )
|
307
|
+
// In case of an error, retry the autosave callback after a delay (and also throw the original error).
|
239
308
|
.catch( err => {
|
309
|
+
// Change state to `error` so that listeners handling autosave error can be called.
|
240
310
|
this.state = 'error';
|
241
|
-
//
|
311
|
+
// Then, immediately change to the `saving` state as described above.
|
312
|
+
// Being in the `saving` state ensures that the autosave callback won't be delayed further by the `change:data` listener.
|
242
313
|
this.state = 'saving';
|
243
314
|
|
244
315
|
this._debouncedSave();
|
245
316
|
|
246
317
|
throw err;
|
247
|
-
} )
|
248
|
-
.then( () => {
|
249
|
-
if ( this.editor.model.document.version > this._lastDocumentVersion ) {
|
250
|
-
this.state = 'waiting';
|
251
|
-
this._debouncedSave();
|
252
|
-
} else {
|
253
|
-
this.state = 'synchronized';
|
254
|
-
this._pendingActions.remove( this._action );
|
255
|
-
this._action = null;
|
256
|
-
}
|
257
318
|
} );
|
319
|
+
|
320
|
+
return this._savePromise;
|
321
|
+
}
|
322
|
+
|
323
|
+
/**
|
324
|
+
* Creates a pending action if it is not set already.
|
325
|
+
*
|
326
|
+
* @private
|
327
|
+
*/
|
328
|
+
_setPendingAction() {
|
329
|
+
const t = this.editor.t;
|
330
|
+
|
331
|
+
if ( !this._action ) {
|
332
|
+
this._action = this._pendingActions.add( t( 'Saving changes' ) );
|
333
|
+
}
|
258
334
|
}
|
259
335
|
|
260
336
|
/**
|
@@ -323,7 +399,7 @@ mix( Autosave, ObservableMixin );
|
|
323
399
|
*
|
324
400
|
* See {@link module:core/editor/editorconfig~EditorConfig all editor configuration options}.
|
325
401
|
*
|
326
|
-
* See also the demo of the {@glink
|
402
|
+
* See also the demo of the {@glink installation/advanced/saving-data#autosave-feature autosave feature}.
|
327
403
|
*
|
328
404
|
* @interface AutosaveConfig
|
329
405
|
*/
|
package/src/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
5
5
|
|