jodit-pro 1.3.6 → 1.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/build/jodit.css +1 -1
  2. package/build/jodit.es5.css +2 -2
  3. package/build/jodit.es5.js +1 -1
  4. package/build/jodit.fat.css +1 -1
  5. package/build/jodit.fat.es5.css +1 -1
  6. package/build/jodit.fat.es5.js +1 -1
  7. package/build/jodit.fat.js +1 -1
  8. package/build/jodit.js +1 -1
  9. package/build/plugins/autocomplete/autocomplete.es5.js +1 -1
  10. package/build/plugins/autocomplete/autocomplete.js +1 -1
  11. package/build/plugins/backup/backup.es5.js +1 -1
  12. package/build/plugins/backup/backup.js +1 -1
  13. package/build/plugins/button-generator/button-generator.es5.js +1 -1
  14. package/build/plugins/button-generator/button-generator.js +1 -1
  15. package/build/plugins/change-case/change-case.es5.js +1 -1
  16. package/build/plugins/change-case/change-case.js +1 -1
  17. package/build/plugins/color-picker/color-picker.es5.js +1 -1
  18. package/build/plugins/color-picker/color-picker.js +1 -1
  19. package/build/plugins/emoji/emoji.es5.js +1 -1
  20. package/build/plugins/emoji/emoji.js +1 -1
  21. package/build/plugins/export-docs/export-docs.es5.js +1 -1
  22. package/build/plugins/export-docs/export-docs.js +1 -1
  23. package/build/plugins/finder/finder.es5.js +1 -1
  24. package/build/plugins/finder/finder.js +1 -1
  25. package/build/plugins/google-maps/google-maps.es5.js +1 -1
  26. package/build/plugins/google-maps/google-maps.js +1 -1
  27. package/build/plugins/google-search/google-search.es5.js +1 -1
  28. package/build/plugins/google-search/google-search.js +1 -1
  29. package/build/plugins/highlight-signature/highlight-signature.es5.js +1 -1
  30. package/build/plugins/highlight-signature/highlight-signature.js +1 -1
  31. package/build/plugins/iframe-editor/iframe-editor.es5.js +1 -1
  32. package/build/plugins/iframe-editor/iframe-editor.js +1 -1
  33. package/build/plugins/keyboard/keyboard.es5.js +1 -1
  34. package/build/plugins/keyboard/keyboard.js +1 -1
  35. package/build/plugins/page-break/page-break.es5.js +1 -1
  36. package/build/plugins/page-break/page-break.js +1 -1
  37. package/build/plugins/paste-code/paste-code.es5.js +1 -1
  38. package/build/plugins/paste-code/paste-code.js +1 -1
  39. package/build/plugins/paste-from-word/paste-from-word.es5.js +1 -1
  40. package/build/plugins/paste-from-word/paste-from-word.js +1 -1
  41. package/build/plugins/show-blocks/show-blocks.es5.js +1 -1
  42. package/build/plugins/show-blocks/show-blocks.js +1 -1
  43. package/build/plugins/tune-block/tune-block.es5.js +1 -1
  44. package/build/plugins/tune-block/tune-block.js +1 -1
  45. package/index.html +24 -24
  46. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(self,(function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[633],{779:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.autocomplete=void 0;var n=o(1),r=o(371),i=o(152),s=o(237),u=o(191),l=o(154),c=o(780),a=o(153),p=o(2),d=o(783);i.Config.prototype.autocomplete={sources:[],maxItems:50,isMatchedQuery:function(e,t){return 0===t.toLowerCase().indexOf(e.toLowerCase())},itemRenderer:function(e){var t;return null!==(t=e.title)&&void 0!==t?t:e.value},insertValueRenderer:function(e){return e.value+" "}};var f=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.requires=["enter","license"],t.hasStyle=!p.Jodit.fatMode,t.sources=[],t}return n.__extends(t,e),t.prototype.afterInit=function(e){var t=this;this.popup=new l.Popup(e),this.popup.setMod("padding",!1),this.list=new c.Autocomplete(e),this.popup.setContent(this.list.container),e.e.on("select.autocomplete",(function(o){var n=o.value;(0,u.isFunction)(o.insertValueRenderer)&&(n=o.insertValueRenderer(o)),l.Dom.isNode(n)||(n=e.createInside.fromHTML(n)),(0,d.replaceTextLeftOfCursorAfterSpace)(e.s.range,n),t.j.s.setCursorAfter(n),t.popup.close()})).on("keydown.autocomplete",this.onKeyDown).on("keydown.autocomplete",this.onKeyControlDown,{top:!0}).on("beforeEnter.autocomplete",this.onEnter,{top:!0}).on("autocomplete.autocomplete",this.onAutoComplete).on("registerAutocompleteSource.autocomplete",this.registerAutocompleteSource)},t.prototype.registerAutocompleteSource=function(e){this.sources.push(e)},t.isControlKey=function(e){return e===a.KEY_DOWN||e===a.KEY_UP||e===a.KEY_ENTER||e===a.KEY_TAB},t.prototype.onKeyDown=function(e){var o,r;return n.__awaiter(this,void 0,Promise,(function(){var i,s,l,c;return n.__generator(this,(function(n){switch(n.label){case 0:return e.key===a.KEY_ESC?(this.popup.isOpened&&this.popup.close(),[2]):(i=this.j.s,!t.isControlKey(e.key)&&i.isInsideArea&&i.isCollapsed?(s=(null===(o=this.j.s.sel)||void 0===o?void 0:o.rangeCount)?null===(r=this.j.s.sel)||void 0===r?void 0:r.getRangeAt(0):null,(l=s&&(0,d.getTextLeftOfCursor)(s).split(" ").pop())&&(0,u.trim)(l).length?[4,this.onAutoComplete(l)]:[3,2]):[2]);case 1:if((c=n.sent()).length)return[2,this.openPopup(c)];n.label=2;case 2:return this.popup.isOpened&&this.popup.close(),[2]}}))}))},t.prototype.onKeyControlDown=function(e){if(this.popup.isOpened&&t.isControlKey(e.key)){switch(e.key){case a.KEY_DOWN:this.list.selectNext();break;case a.KEY_UP:this.list.selectPrevious();break;case a.KEY_TAB:this.list.select()}return this.j.e.stopPropagation(e.type),!1}},t.prototype.onEnter=function(){if(this.popup.isOpened)return this.list.select(),!1},t.prototype.onAutoComplete=function(e){return n.__awaiter(this,void 0,Promise,(function(){var t,o=this;return n.__generator(this,(function(r){switch(r.label){case 0:return t=[],[4,Promise.all(this.sources.concat(this.j.o.autocomplete.sources).map((function(r){return n.__awaiter(o,void 0,void 0,(function(){var o,i,s,u;return n.__generator(this,(function(l){switch(l.label){case 0:return i=(o=t.push).apply,s=[t],u=[[]],[4,this.resolveFeed(e,r)];case 1:return i.apply(o,s.concat([n.__spreadArray.apply(void 0,u.concat([n.__read.apply(void 0,[l.sent()]),!1]))])),[2]}}))}))})))];case 1:return r.sent(),[2,t]}}))}))},t.prototype.resolveFeed=function(e,t,o){return n.__awaiter(this,void 0,Promise,(function(){var r,i,s,l,c,a;return n.__generator(this,(function(p){switch(p.label){case 0:return(0,u.isPromise)(t)?[4,t]:[3,2];case 1:t=p.sent(),p.label=2;case 2:return(0,u.isFunction)(t)?[4,t(e)]:[3,4];case 3:return r=p.sent(),[3,7];case 4:return(0,u.isArray)(t)?(i=this.j.o.autocomplete.isMatchedQuery,r=t.filter((function(t){return(0,u.isString)(t)?i(e,t):i(e,t.value)})).map((function(e){return(0,u.isString)(e)?{title:e,value:e}:e})),[3,7]):[3,5];case 5:return[4,this.resolveFeed(e,t.feed,t)];case 6:r=p.sent(),p.label=7;case 7:return r&&(0,u.isArray)(r)?(l=(s=this.j.o.autocomplete).itemRenderer,c=s.insertValueRenderer,a=s.maxItems,r=r.map((function(e){var t,r;return n.__assign({itemRenderer:null!==(t=null==o?void 0:o.itemRenderer)&&void 0!==t?t:l,insertValueRenderer:null!==(r=null==o?void 0:o.insertValueRenderer)&&void 0!==r?r:c},e)})),[2,r.slice(0,a)]):[2,[]]}}))}))},t.prototype.openPopup=function(e){var t=this;this.list.build(e),this.popup.open((function(){return t.j.s.range.getBoundingClientRect()}))},t.prototype.beforeDestruct=function(e){e.e.off(this.list).off("keydown.autocomplete",this.onKeyDown).off("autocomplete.autocomplete",this.onAutoComplete).off(".autocomplete"),this.list.destruct(),this.popup.destruct()},n.__decorate([s.autobind],t.prototype,"registerAutocompleteSource",null),n.__decorate([(0,s.debounce)()],t.prototype,"onKeyDown",null),n.__decorate([s.autobind],t.prototype,"onKeyControlDown",null),n.__decorate([s.autobind],t.prototype,"onEnter",null),n.__decorate([s.autobind],t.prototype,"onAutoComplete",null),n.__decorate([s.autobind],t.prototype,"resolveFeed",null),t}(r.Plugin);t.autocomplete=f,p.Jodit.plugins.add("autocomplete",f)},783:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.replaceTextLeftOfCursorAfterSpace=t.getTextLeftOfCursor=void 0;var n=o(235),r=o(449);t.getTextLeftOfCursor=function(e){var t,o,i,s,u=e.startContainer,l=e.startOffset;if(n.Dom.isText(u))return null!==(o=null===(t=u.nodeValue)||void 0===t?void 0:t.substr(0,l))&&void 0!==o?o:"";var c=u.childNodes[l];if(!c)return"";if(n.Dom.isText(c))return null!==(i=c.nodeValue)&&void 0!==i?i:"";var a=(0,r.findNotEmptyNeighbor)(c,!0,u);return n.Dom.isText(a)&&null!==(s=c.nodeValue)&&void 0!==s?s:""},t.replaceTextLeftOfCursorAfterSpace=function(e,t){var o,r=e.startContainer,i=e.startOffset;if(n.Dom.isText(r)){var s=null!==(o=r.nodeValue)&&void 0!==o?o:"",u=s.substr(0,i),l=s.substr(i),c=u.split(" ");c[c.length-1]="";var a=c.join(" ");return r.nodeValue=a+l,e.setStart(r,a.length),void e.insertNode(t)}}},780:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.Autocomplete=void 0;var n=o(1);o(781);var r=o(237),i=o(341),s=o(782),u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.elements=[],t.currentSelection=-1,t}return n.__extends(t,e),t.prototype.className=function(){return"Autocomplete"},t.prototype.onChangeSelection=function(e,t){var o;null!=t&&(null===(o=this.elements[t])||void 0===o||o.setMod("active",!1)),this.elements[this.currentSelection].setMod("active",!0),this.elements[this.currentSelection].container.scrollIntoView(!1)},t.prototype.build=function(e){var t=this;this.clear(),e.forEach((function(e,o){var n=new s.AutocompleteItem(t.jodit,e);t.j.e.on(n.container,"mousedown touchstart",(function(e){e.preventDefault()})).on(n.container,"click",(function(){t.currentSelection=o,t.select()})),t.append(n)})),this.currentSelection=0,this.onChangeSelection()},t.prototype.selectNext=function(){this.currentSelection+1>this.elements.length-1?this.currentSelection=0:this.currentSelection+=1},t.prototype.selectPrevious=function(){0>this.currentSelection-1?this.currentSelection=this.elements.length-1:this.currentSelection-=1},t.prototype.select=function(){this.j.e.fire("select.autocomplete",this.elements[this.currentSelection].item)},n.__decorate([(0,r.watch)("currentSelection")],t.prototype,"onChangeSelection",null),n.__decorate([r.component],t)}(i.UIGroup);t.Autocomplete=u},782:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.AutocompleteItem=void 0;var n=o(1);o(781);var r=o(341),i=o(191),s=function(e){function t(t,o){var n,r=this;(r=e.call(this,t)||this).item=o;var s=r.container;if((0,i.isFunction)(o.itemRenderer)){var u=o.itemRenderer(o);(0,i.isString)(u)?s.innerHTML=u:s.appendChild(u)}else s.innerText=null!==(n=o.title)&&void 0!==n?n:o.value;return r}return n.__extends(t,e),t.prototype.className=function(){return"AutocompleteItem"},t}(r.UIElement);t.AutocompleteItem=s},781:function(e,t,o){o.r(t)}},function(e){return e(e.s=779)}])}));
1
+ "use strict";!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(self,(function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[633],{6293:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.autocomplete=void 0;var n=o(70655),r=o(16490),i=o(85119),s=o(23112),u=o(75204),l=o(95185),c=o(50679),a=o(11606),p=o(97029),d=o(49852);i.Config.prototype.autocomplete={sources:[],maxItems:50,isMatchedQuery:function(e,t){return 0===t.toLowerCase().indexOf(e.toLowerCase())},itemRenderer:function(e){var t;return null!==(t=e.title)&&void 0!==t?t:e.value},insertValueRenderer:function(e){return e.value+" "}};var f=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.requires=["enter","license"],t.hasStyle=!p.Jodit.fatMode,t.sources=[],t}return n.__extends(t,e),t.prototype.afterInit=function(e){var t=this;this.popup=new l.Popup(e),this.popup.setMod("padding",!1),this.list=new c.Autocomplete(e),this.popup.setContent(this.list.container),e.e.on("select.autocomplete",(function(o){var n=o.value;(0,u.isFunction)(o.insertValueRenderer)&&(n=o.insertValueRenderer(o)),l.Dom.isNode(n)||(n=e.createInside.fromHTML(n)),(0,d.replaceTextLeftOfCursorAfterSpace)(e.s.range,n),t.j.s.setCursorAfter(n),t.popup.close()})).on("keydown.autocomplete",this.onKeyDown).on("keydown.autocomplete",this.onKeyControlDown,{top:!0}).on("beforeEnter.autocomplete",this.onEnter,{top:!0}).on("autocomplete.autocomplete",this.onAutoComplete).on("registerAutocompleteSource.autocomplete",this.registerAutocompleteSource)},t.prototype.registerAutocompleteSource=function(e){this.sources.push(e)},t.isControlKey=function(e){return e===a.KEY_DOWN||e===a.KEY_UP||e===a.KEY_ENTER||e===a.KEY_TAB},t.prototype.onKeyDown=function(e){var o,r;return n.__awaiter(this,void 0,Promise,(function(){var i,s,l,c;return n.__generator(this,(function(n){switch(n.label){case 0:return e.key===a.KEY_ESC?(this.popup.isOpened&&this.popup.close(),[2]):(i=this.j.s,!t.isControlKey(e.key)&&i.isInsideArea&&i.isCollapsed?(s=(null===(o=this.j.s.sel)||void 0===o?void 0:o.rangeCount)?null===(r=this.j.s.sel)||void 0===r?void 0:r.getRangeAt(0):null,(l=s&&(0,d.getTextLeftOfCursor)(s).split(" ").pop())&&(0,u.trim)(l).length?[4,this.onAutoComplete(l)]:[3,2]):[2]);case 1:if((c=n.sent()).length)return[2,this.openPopup(c)];n.label=2;case 2:return this.popup.isOpened&&this.popup.close(),[2]}}))}))},t.prototype.onKeyControlDown=function(e){if(this.popup.isOpened&&t.isControlKey(e.key)){switch(e.key){case a.KEY_DOWN:this.list.selectNext();break;case a.KEY_UP:this.list.selectPrevious();break;case a.KEY_TAB:this.list.select()}return this.j.e.stopPropagation(e.type),!1}},t.prototype.onEnter=function(){if(this.popup.isOpened)return this.list.select(),!1},t.prototype.onAutoComplete=function(e){return n.__awaiter(this,void 0,Promise,(function(){var t,o=this;return n.__generator(this,(function(r){switch(r.label){case 0:return t=[],[4,Promise.all(this.sources.concat(this.j.o.autocomplete.sources).map((function(r){return n.__awaiter(o,void 0,void 0,(function(){var o,i,s,u;return n.__generator(this,(function(l){switch(l.label){case 0:return i=(o=t.push).apply,s=[t],u=[[]],[4,this.resolveFeed(e,r)];case 1:return i.apply(o,s.concat([n.__spreadArray.apply(void 0,u.concat([n.__read.apply(void 0,[l.sent()]),!1]))])),[2]}}))}))})))];case 1:return r.sent(),[2,t]}}))}))},t.prototype.resolveFeed=function(e,t,o){return n.__awaiter(this,void 0,Promise,(function(){var r,i,s,l,c,a;return n.__generator(this,(function(p){switch(p.label){case 0:return(0,u.isPromise)(t)?[4,t]:[3,2];case 1:t=p.sent(),p.label=2;case 2:return(0,u.isFunction)(t)?[4,t(e)]:[3,4];case 3:return r=p.sent(),[3,7];case 4:return(0,u.isArray)(t)?(i=this.j.o.autocomplete.isMatchedQuery,r=t.filter((function(t){return(0,u.isString)(t)?i(e,t):i(e,t.value)})).map((function(e){return(0,u.isString)(e)?{title:e,value:e}:e})),[3,7]):[3,5];case 5:return[4,this.resolveFeed(e,t.feed,t)];case 6:r=p.sent(),p.label=7;case 7:return r&&(0,u.isArray)(r)?(l=(s=this.j.o.autocomplete).itemRenderer,c=s.insertValueRenderer,a=s.maxItems,r=r.map((function(e){var t,r;return n.__assign({itemRenderer:null!==(t=null==o?void 0:o.itemRenderer)&&void 0!==t?t:l,insertValueRenderer:null!==(r=null==o?void 0:o.insertValueRenderer)&&void 0!==r?r:c},e)})),[2,r.slice(0,a)]):[2,[]]}}))}))},t.prototype.openPopup=function(e){var t=this;this.list.build(e),this.popup.open((function(){return t.j.s.range.getBoundingClientRect()}))},t.prototype.beforeDestruct=function(e){e.e.off(this.list).off("keydown.autocomplete",this.onKeyDown).off("autocomplete.autocomplete",this.onAutoComplete).off(".autocomplete"),this.list.destruct(),this.popup.destruct()},n.__decorate([s.autobind],t.prototype,"registerAutocompleteSource",null),n.__decorate([(0,s.debounce)()],t.prototype,"onKeyDown",null),n.__decorate([s.autobind],t.prototype,"onKeyControlDown",null),n.__decorate([s.autobind],t.prototype,"onEnter",null),n.__decorate([s.autobind],t.prototype,"onAutoComplete",null),n.__decorate([s.autobind],t.prototype,"resolveFeed",null),t}(r.Plugin);t.autocomplete=f,p.Jodit.plugins.add("autocomplete",f)},49852:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.replaceTextLeftOfCursorAfterSpace=t.getTextLeftOfCursor=void 0;var n=o(44370);t.getTextLeftOfCursor=function(e){var t,o,r,i,s=e.startContainer,u=e.startOffset;if(n.Dom.isText(s))return null!==(o=null===(t=s.nodeValue)||void 0===t?void 0:t.substr(0,u))&&void 0!==o?o:"";var l=s.childNodes[u];if(!l)return"";if(n.Dom.isText(l))return null!==(r=l.nodeValue)&&void 0!==r?r:"";var c=n.Dom.findNotEmptyNeighbor(l,!0,s);return n.Dom.isText(c)&&null!==(i=l.nodeValue)&&void 0!==i?i:""},t.replaceTextLeftOfCursorAfterSpace=function(e,t){var o,r=e.startContainer,i=e.startOffset;if(n.Dom.isText(r)){var s=null!==(o=r.nodeValue)&&void 0!==o?o:"",u=s.substr(0,i),l=s.substr(i),c=u.split(" ");c[c.length-1]="";var a=c.join(" ");return r.nodeValue=a+l,e.setStart(r,a.length),void e.insertNode(t)}}},50679:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.Autocomplete=void 0;var n=o(70655);o(27063);var r=o(23112),i=o(78827),s=o(55496),u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.elements=[],t.currentSelection=-1,t}return n.__extends(t,e),t.prototype.className=function(){return"Autocomplete"},t.prototype.onChangeSelection=function(e,t){var o;null!=t&&(null===(o=this.elements[t])||void 0===o||o.setMod("active",!1)),this.elements[this.currentSelection].setMod("active",!0),this.elements[this.currentSelection].container.scrollIntoView(!1)},t.prototype.build=function(e){var t=this;this.clear(),e.forEach((function(e,o){var n=new s.AutocompleteItem(t.jodit,e);t.j.e.on(n.container,"mousedown touchstart",(function(e){e.preventDefault()})).on(n.container,"click",(function(){t.currentSelection=o,t.select()})),t.append(n)})),this.currentSelection=0,this.onChangeSelection()},t.prototype.selectNext=function(){this.currentSelection+1>this.elements.length-1?this.currentSelection=0:this.currentSelection+=1},t.prototype.selectPrevious=function(){0>this.currentSelection-1?this.currentSelection=this.elements.length-1:this.currentSelection-=1},t.prototype.select=function(){this.j.e.fire("select.autocomplete",this.elements[this.currentSelection].item)},n.__decorate([(0,r.watch)("currentSelection")],t.prototype,"onChangeSelection",null),n.__decorate([r.component],t)}(i.UIGroup);t.Autocomplete=u},55496:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.AutocompleteItem=void 0;var n=o(70655);o(27063);var r=o(78827),i=o(75204),s=function(e){function t(t,o){var n,r=this;(r=e.call(this,t)||this).item=o;var s=r.container;if((0,i.isFunction)(o.itemRenderer)){var u=o.itemRenderer(o);(0,i.isString)(u)?s.innerHTML=u:s.appendChild(u)}else s.innerText=null!==(n=o.title)&&void 0!==n?n:o.value;return r}return n.__extends(t,e),t.prototype.className=function(){return"AutocompleteItem"},t}(r.UIElement);t.AutocompleteItem=s},27063:function(e,t,o){o.r(t)}},function(e){return e(e.s=6293)}])}));
@@ -1 +1 @@
1
- "use strict";((e,t)=>{if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}})(self,(function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[633],{250(e,t,o){o.r(t),o.d(t,{autocomplete:()=>v});var n=o(225),s=o(95),i=o(2),r=o(53),l=o(32),u=o(4),c=o(89);class p extends c.u1{constructor(e,t){var o;super(e),this.item=t;const{container:n}=this;if((0,l.isFunction)(t.itemRenderer)){const e=t.itemRenderer(t);(0,l.isString)(e)?n.innerHTML=e:n.appendChild(e)}else n.innerText=null!==(o=t.title)&&void 0!==o?o:t.value}className(){return"AutocompleteItem"}}let a=class extends c.qe{constructor(){super(...arguments),this.elements=[],this.currentSelection=-1}className(){return"Autocomplete"}onChangeSelection(e,t){var o;null!=t&&(null===(o=this.elements[t])||void 0===o||o.setMod("active",!1)),this.elements[this.currentSelection].setMod("active",!0),this.elements[this.currentSelection].container.scrollIntoView(!1)}build(e){this.clear(),e.forEach(((e,t)=>{const o=new p(this.jodit,e);this.j.e.on(o.container,"mousedown touchstart",(e=>{e.preventDefault()})).on(o.container,"click",(()=>{this.currentSelection=t,this.select()})),this.append(o)})),this.currentSelection=0,this.onChangeSelection()}selectNext(){this.currentSelection+1>this.elements.length-1?this.currentSelection=0:this.currentSelection+=1}selectPrevious(){0>this.currentSelection-1?this.currentSelection=this.elements.length-1:this.currentSelection-=1}select(){this.j.e.fire("select.autocomplete",this.elements[this.currentSelection].item)}};(0,n.gn)([(0,r.watch)("currentSelection")],a.prototype,"onChangeSelection",null),a=(0,n.gn)([r.component],a);var d=o(3),h=o(1),m=o(51),f=o(122);i.D.prototype.autocomplete={sources:[],maxItems:50,isMatchedQuery:(e,t)=>0===t.toLowerCase().indexOf(e.toLowerCase()),itemRenderer(e){var t;return null!==(t=e.title)&&void 0!==t?t:e.value},insertValueRenderer:e=>e.value+" "};class v extends s.S{constructor(){super(...arguments),this.requires=["enter","license"],this.hasStyle=!h.Jodit.fatMode,this.sources=[]}afterInit(e){this.popup=new u.Popup(e),this.popup.setMod("padding",!1),this.list=new a(e),this.popup.setContent(this.list.container),e.e.on("select.autocomplete",(t=>{let o=t.value;(0,l.isFunction)(t.insertValueRenderer)&&(o=t.insertValueRenderer(t)),u.Dom.isNode(o)||(o=e.createInside.fromHTML(o)),((e,t)=>{var o;const{startContainer:n,startOffset:s}=e;if(m.i.isText(n)){const i=null!==(o=n.nodeValue)&&void 0!==o?o:"",r=i.substr(0,s),l=i.substr(s),u=r.split(" ");u[u.length-1]="";const c=u.join(" ");n.nodeValue=c+l,e.setStart(n,c.length),e.insertNode(t)}})(e.s.range,o),this.j.s.setCursorAfter(o),this.popup.close()})).on("keydown.autocomplete",this.onKeyDown).on("keydown.autocomplete",this.onKeyControlDown,{top:!0}).on("beforeEnter.autocomplete",this.onEnter,{top:!0}).on("autocomplete.autocomplete",this.onAutoComplete).on("registerAutocompleteSource.autocomplete",this.registerAutocompleteSource)}registerAutocompleteSource(e){this.sources.push(e)}static isControlKey(e){return e===d.KEY_DOWN||e===d.KEY_UP||e===d.KEY_ENTER||e===d.KEY_TAB}async onKeyDown(e){var t,o;if(e.key===d.KEY_ESC)return void(this.popup.isOpened&&this.popup.close());const{s:n}=this.j;if(v.isControlKey(e.key)||!n.isInsideArea||!n.isCollapsed)return;const s=(null===(t=this.j.s.sel)||void 0===t?void 0:t.rangeCount)?null===(o=this.j.s.sel)||void 0===o?void 0:o.getRangeAt(0):null,i=s&&(e=>{var t,o,n,s;const{startContainer:i,startOffset:r}=e;if(m.i.isText(i))return null!==(o=null===(t=i.nodeValue)||void 0===t?void 0:t.substr(0,r))&&void 0!==o?o:"";const l=i.childNodes[r];if(!l)return"";if(m.i.isText(l))return null!==(n=l.nodeValue)&&void 0!==n?n:"";const u=(0,f.tT)(l,!0,i);return m.i.isText(u)&&null!==(s=l.nodeValue)&&void 0!==s?s:""})(s).split(" ").pop();if(i&&(0,l.trim)(i).length){const e=await this.onAutoComplete(i);if(e.length)return this.openPopup(e)}this.popup.isOpened&&this.popup.close()}onKeyControlDown(e){if(this.popup.isOpened&&v.isControlKey(e.key)){switch(e.key){case d.KEY_DOWN:this.list.selectNext();break;case d.KEY_UP:this.list.selectPrevious();break;case d.KEY_TAB:this.list.select()}return this.j.e.stopPropagation(e.type),!1}}onEnter(){if(this.popup.isOpened)return this.list.select(),!1}async onAutoComplete(e){const t=[];return await Promise.all(this.sources.concat(this.j.o.autocomplete.sources).map((async o=>{t.push(...await this.resolveFeed(e,o))}))),t}async resolveFeed(e,t,o){let n;if((0,l.isPromise)(t)&&(t=await t),(0,l.isFunction)(t))n=await t(e);else if((0,l.isArray)(t)){const o=t,{isMatchedQuery:s}=this.j.o.autocomplete;n=o.filter((t=>(0,l.isString)(t)?s(e,t):s(e,t.value))).map((e=>(0,l.isString)(e)?{title:e,value:e}:e))}else n=await this.resolveFeed(e,t.feed,t);if(n&&(0,l.isArray)(n)){const{itemRenderer:e,insertValueRenderer:t,maxItems:s}=this.j.o.autocomplete;return n=n.map((n=>{var s,i;return{itemRenderer:null!==(s=null==o?void 0:o.itemRenderer)&&void 0!==s?s:e,insertValueRenderer:null!==(i=null==o?void 0:o.insertValueRenderer)&&void 0!==i?i:t,...n}})),n.slice(0,s)}return[]}openPopup(e){this.list.build(e),this.popup.open((()=>this.j.s.range.getBoundingClientRect()))}beforeDestruct(e){e.e.off(this.list).off("keydown.autocomplete",this.onKeyDown).off("autocomplete.autocomplete",this.onAutoComplete).off(".autocomplete"),this.list.destruct(),this.popup.destruct()}}(0,n.gn)([r.autobind],v.prototype,"registerAutocompleteSource",null),(0,n.gn)([(0,r.debounce)()],v.prototype,"onKeyDown",null),(0,n.gn)([r.autobind],v.prototype,"onKeyControlDown",null),(0,n.gn)([r.autobind],v.prototype,"onEnter",null),(0,n.gn)([r.autobind],v.prototype,"onAutoComplete",null),(0,n.gn)([r.autobind],v.prototype,"resolveFeed",null),h.Jodit.plugins.add("autocomplete",v)},225(e,t,o){function n(e,t,o,n){var s,i=arguments.length,r=3>i?t:null===n?n=Object.getOwnPropertyDescriptor(t,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,o,n);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(r=(3>i?s(r):i>3?s(t,o,r):s(t,o))||r);return i>3&&r&&Object.defineProperty(t,o,r),r}o.d(t,{gn:()=>n})}},e=>e(e.s=250)])}));
1
+ "use strict";((e,t)=>{if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var r in o)("object"==typeof exports?exports:e)[r]=o[r]}})(self,(function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[633],{6293(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.autocomplete=void 0;var r=o(70655),n=o(16490),i=o(85119),s=o(23112),l=o(75204),u=o(95185),a=o(50679),c=o(11606),p=o(97029),d=o(49852);i.Config.prototype.autocomplete={sources:[],maxItems:50,isMatchedQuery:(e,t)=>0===t.toLowerCase().indexOf(e.toLowerCase()),itemRenderer(e){var t;return null!==(t=e.title)&&void 0!==t?t:e.value},insertValueRenderer:e=>e.value+" "};var h=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.requires=["enter","license"],t.hasStyle=!p.Jodit.fatMode,t.sources=[],t}return r.__extends(t,e),t.prototype.afterInit=function(e){var t=this;this.popup=new u.Popup(e),this.popup.setMod("padding",!1),this.list=new a.Autocomplete(e),this.popup.setContent(this.list.container),e.e.on("select.autocomplete",(o=>{var r=o.value;(0,l.isFunction)(o.insertValueRenderer)&&(r=o.insertValueRenderer(o)),u.Dom.isNode(r)||(r=e.createInside.fromHTML(r)),(0,d.replaceTextLeftOfCursorAfterSpace)(e.s.range,r),t.j.s.setCursorAfter(r),t.popup.close()})).on("keydown.autocomplete",this.onKeyDown).on("keydown.autocomplete",this.onKeyControlDown,{top:!0}).on("beforeEnter.autocomplete",this.onEnter,{top:!0}).on("autocomplete.autocomplete",this.onAutoComplete).on("registerAutocompleteSource.autocomplete",this.registerAutocompleteSource)},t.prototype.registerAutocompleteSource=function(e){this.sources.push(e)},t.isControlKey=e=>e===c.KEY_DOWN||e===c.KEY_UP||e===c.KEY_ENTER||e===c.KEY_TAB,t.prototype.onKeyDown=function(e){var o,n;return r.__awaiter(this,void 0,Promise,(function(){var i,s,u,a;return r.__generator(this,(function(r){switch(r.label){case 0:return e.key===c.KEY_ESC?(this.popup.isOpened&&this.popup.close(),[2]):(i=this.j.s,!t.isControlKey(e.key)&&i.isInsideArea&&i.isCollapsed?(s=(null===(o=this.j.s.sel)||void 0===o?void 0:o.rangeCount)?null===(n=this.j.s.sel)||void 0===n?void 0:n.getRangeAt(0):null,(u=s&&(0,d.getTextLeftOfCursor)(s).split(" ").pop())&&(0,l.trim)(u).length?[4,this.onAutoComplete(u)]:[3,2]):[2]);case 1:if((a=r.sent()).length)return[2,this.openPopup(a)];r.label=2;case 2:return this.popup.isOpened&&this.popup.close(),[2]}}))}))},t.prototype.onKeyControlDown=function(e){if(this.popup.isOpened&&t.isControlKey(e.key)){switch(e.key){case c.KEY_DOWN:this.list.selectNext();break;case c.KEY_UP:this.list.selectPrevious();break;case c.KEY_TAB:this.list.select()}return this.j.e.stopPropagation(e.type),!1}},t.prototype.onEnter=function(){if(this.popup.isOpened)return this.list.select(),!1},t.prototype.onAutoComplete=function(e){return r.__awaiter(this,void 0,Promise,(function(){var t,o=this;return r.__generator(this,(function(n){switch(n.label){case 0:return t=[],[4,Promise.all(this.sources.concat(this.j.o.autocomplete.sources).map((function(n){return r.__awaiter(o,void 0,void 0,(function(){var o,i,s,l;return r.__generator(this,(function(u){switch(u.label){case 0:return i=(o=t.push).apply,s=[t],l=[[]],[4,this.resolveFeed(e,n)];case 1:return i.apply(o,s.concat([r.__spreadArray.apply(void 0,l.concat([r.__read.call(void 0,u.sent()),!1]))])),[2]}}))}))})))];case 1:return n.sent(),[2,t]}}))}))},t.prototype.resolveFeed=function(e,t,o){return r.__awaiter(this,void 0,Promise,(function(){var n,i,s,u,a,c;return r.__generator(this,(function(p){switch(p.label){case 0:return(0,l.isPromise)(t)?[4,t]:[3,2];case 1:t=p.sent(),p.label=2;case 2:return(0,l.isFunction)(t)?[4,t(e)]:[3,4];case 3:return n=p.sent(),[3,7];case 4:return(0,l.isArray)(t)?(i=this.j.o.autocomplete.isMatchedQuery,n=t.filter((t=>(0,l.isString)(t)?i(e,t):i(e,t.value))).map((e=>(0,l.isString)(e)?{title:e,value:e}:e)),[3,7]):[3,5];case 5:return[4,this.resolveFeed(e,t.feed,t)];case 6:n=p.sent(),p.label=7;case 7:return n&&(0,l.isArray)(n)?(u=(s=this.j.o.autocomplete).itemRenderer,a=s.insertValueRenderer,c=s.maxItems,n=n.map((e=>{var t,n;return r.__assign({itemRenderer:null!==(t=null==o?void 0:o.itemRenderer)&&void 0!==t?t:u,insertValueRenderer:null!==(n=null==o?void 0:o.insertValueRenderer)&&void 0!==n?n:a},e)})),[2,n.slice(0,c)]):[2,[]]}}))}))},t.prototype.openPopup=function(e){var t=this;this.list.build(e),this.popup.open((()=>t.j.s.range.getBoundingClientRect()))},t.prototype.beforeDestruct=function(e){e.e.off(this.list).off("keydown.autocomplete",this.onKeyDown).off("autocomplete.autocomplete",this.onAutoComplete).off(".autocomplete"),this.list.destruct(),this.popup.destruct()},r.__decorate([s.autobind],t.prototype,"registerAutocompleteSource",null),r.__decorate([(0,s.debounce)()],t.prototype,"onKeyDown",null),r.__decorate([s.autobind],t.prototype,"onKeyControlDown",null),r.__decorate([s.autobind],t.prototype,"onEnter",null),r.__decorate([s.autobind],t.prototype,"onAutoComplete",null),r.__decorate([s.autobind],t.prototype,"resolveFeed",null),t}(n.Plugin);t.autocomplete=h,p.Jodit.plugins.add("autocomplete",h)},49852(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.replaceTextLeftOfCursorAfterSpace=t.getTextLeftOfCursor=void 0;var r=o(44370);t.getTextLeftOfCursor=e=>{var t,o,n,i,s=e.startContainer,l=e.startOffset;if(r.Dom.isText(s))return null!==(o=null===(t=s.nodeValue)||void 0===t?void 0:t.substr(0,l))&&void 0!==o?o:"";var u=s.childNodes[l];if(!u)return"";if(r.Dom.isText(u))return null!==(n=u.nodeValue)&&void 0!==n?n:"";var a=r.Dom.findNotEmptyNeighbor(u,!0,s);return r.Dom.isText(a)&&null!==(i=u.nodeValue)&&void 0!==i?i:""},t.replaceTextLeftOfCursorAfterSpace=(e,t)=>{var o,n=e.startContainer,i=e.startOffset;if(r.Dom.isText(n)){var s=null!==(o=n.nodeValue)&&void 0!==o?o:"",l=s.substr(0,i),u=s.substr(i),a=l.split(" ");a[a.length-1]="";var c=a.join(" ");return n.nodeValue=c+u,e.setStart(n,c.length),void e.insertNode(t)}}},50679(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.Autocomplete=void 0;var r=o(70655);o(27063);var n=o(23112),i=o(78827),s=o(55496),l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.elements=[],t.currentSelection=-1,t}return r.__extends(t,e),t.prototype.className=()=>"Autocomplete",t.prototype.onChangeSelection=function(e,t){var o;null!=t&&(null===(o=this.elements[t])||void 0===o||o.setMod("active",!1)),this.elements[this.currentSelection].setMod("active",!0),this.elements[this.currentSelection].container.scrollIntoView(!1)},t.prototype.build=function(e){var t=this;this.clear(),e.forEach(((e,o)=>{var r=new s.AutocompleteItem(t.jodit,e);t.j.e.on(r.container,"mousedown touchstart",(e=>{e.preventDefault()})).on(r.container,"click",(()=>{t.currentSelection=o,t.select()})),t.append(r)})),this.currentSelection=0,this.onChangeSelection()},t.prototype.selectNext=function(){this.currentSelection+1>this.elements.length-1?this.currentSelection=0:this.currentSelection+=1},t.prototype.selectPrevious=function(){0>this.currentSelection-1?this.currentSelection=this.elements.length-1:this.currentSelection-=1},t.prototype.select=function(){this.j.e.fire("select.autocomplete",this.elements[this.currentSelection].item)},r.__decorate([(0,n.watch)("currentSelection")],t.prototype,"onChangeSelection",null),r.__decorate([n.component],t)}(i.UIGroup);t.Autocomplete=l},55496(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.AutocompleteItem=void 0;var r=o(70655);o(27063);var n=o(78827),i=o(75204),s=function(e){function t(t,o){var r,n=this;(n=e.call(this,t)||this).item=o;var s=n.container;if((0,i.isFunction)(o.itemRenderer)){var l=o.itemRenderer(o);(0,i.isString)(l)?s.innerHTML=l:s.appendChild(l)}else s.innerText=null!==(r=o.title)&&void 0!==r?r:o.value;return n}return r.__extends(t,e),t.prototype.className=()=>"AutocompleteItem",t}(n.UIElement);t.AutocompleteItem=s},27063(e,t,o){o.r(t)}},e=>e(e.s=6293)])}));
@@ -1 +1 @@
1
- !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o=e();for(var n in o)("object"==typeof exports?exports:t)[n]=o[n]}}(self,(function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[391],{784:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.backup=void 0;var n=o(1);o(785);var i=o(371),r=o(788),a=o(328),s=o(789),c=o(341),u=o(237),l=o(2),p=function(t){function e(){var e,o=this;return(o=t.apply(this,n.__spreadArray([],n.__read(arguments),!1))||this).requires=["license"],o.hasStyle=!l.Jodit.fatMode,o.buttons=[{name:"backup.restore",group:"history"}],o.box=new s.UIBackupBox(o.j),o.dialog=null,o.storage=null!==(e=o.jodit.o.backup.remoteStore)&&void 0!==e?e:new r.DefaultStorage(o.jodit),o.timeout=0,o}return n.__extends(e,t),e.prototype.afterInit=function(t){var e=this;t.registerCommand("saveBackup",this.onSaveBackup).registerCommand("openBackupDialog",{exec:this.onOpenBackupDialog,hotkeys:t.o.backup.hotkeys});var o=function(){e.timeout=t.async.setTimeout((function(){e.onSaveBackup(),o()}),1e3*t.o.backup.interval)};o(),t.e.on(this.box,"choose",this.onSelectItem).on(t.ow,"beforeunload.backup",(function(){e.onSaveBackup()}))},e.prototype.prepareDialog=function(){this.dialog||(this.dialog=new a.Dialog({minWidth:this.j.o.backup.dialogWidth,buttons:["fullsize","dialog.close"]}).setContent(this.box.container)),this.dialog.setHeader(this.jodit.i18n("Restore")),this.addButtonsToDialog()},e.prototype.onSaveBackup=function(){this.storage.add({created:new Date,html:this.j.value})},e.prototype.onOpenBackupDialog=function(){return n.__awaiter(this,void 0,Promise,(function(){var t,e;return n.__generator(this,(function(o){switch(o.label){case 0:return this.prepareDialog(),(t=this.dialog)?(t.open().setModal(!0),[4,this.storage.items()]):[2];case 1:return e=o.sent(),this.box.build(n.__spreadArray([{created:new Date,html:this.j.value}],n.__read(e),!1)),t.calcAutoSize(),t.setPosition(),[2]}}))}))},e.prototype.onSelectItem=function(t){var e;null===(e=this.dialog)||void 0===e||e.close(),this.j.value=t.html,this.j.s.focus()},e.prototype.addButtonsToDialog=function(){var t,e=this,o=this.jodit,n=(0,c.Button)(o,{name:"ok",tabIndex:0,variant:"primary",text:"Ok"}),i=(0,c.Button)(o,{variant:"secondary",tabIndex:0,text:"Cancel"}),r=(0,c.Button)(o,{name:"clear",tabIndex:0,variant:"secondary",text:"Remove all"});n.onAction((function(){e.box.chooseSelected()})),i.onAction((function(){var t;null===(t=e.dialog)||void 0===t||t.close()})),r.onAction((function(){(0,a.Confirm)("Are you sure?",void 0,(function(t){var o;t&&(e.storage.clear(),null===(o=e.dialog)||void 0===o||o.close())}))}));var s=new c.UIBlock(o,[r,i,n]);s.container.style.margin="0",s.container.style.justifyContent="flex-end",s.container.style.width="100%",null===(t=this.dialog)||void 0===t||t.setFooter(s)},e.prototype.beforeDestruct=function(){var t,e=this.j;e.async.clearTimeout(this.timeout),e.e.off(this.box,"choose",this.onSelectItem).off(e.ow,"beforeunload.backup"),this.box.destruct(),null===(t=this.dialog)||void 0===t||t.destruct()},n.__decorate([u.autobind],e.prototype,"onSaveBackup",null),n.__decorate([u.autobind],e.prototype,"onOpenBackupDialog",null),n.__decorate([u.autobind],e.prototype,"onSelectItem",null),e}(i.Plugin);e.backup=p,l.Jodit.plugins.add("backup",p)},785:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=o(152),i=o(275),r=o(243);n.Config.prototype.backup={interval:30,limit:50,dialogWidth:700,hotkeys:["ctrl+shift+b","cmd+shift+b"]},n.Config.prototype.controls.backup={store:{command:"saveBackup",text:"Save backup now"},restore:{tooltip:"Restore",list:["backup.store"],exec:function(t){t.execCommand("openBackupDialog")}}},i.Icon.set("restore",o(786)),(0,r.extendLang)(o(787))},787:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},788:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultStorage=void 0;var n=o(1),i=function(){function t(t){this.jodit=t,this.key="backup.default.storage"}return t.prototype.add=function(t){return n.__awaiter(this,void 0,Promise,(function(){var e;return n.__generator(this,(function(o){return t.html.trim().length?((e=this.jodit.storage.get(this.key)||[]).find((function(e){return e.html===t.html}))||(e.unshift(t),e.length>this.jodit.o.backup.limit&&(e.length=this.jodit.o.backup.limit),this.jodit.storage.set(this.key,e)),[2,!1]):[2,!1]}))}))},t.prototype.items=function(){return Promise.resolve(this.jodit.storage.get(this.key)||[])},t.prototype.clear=function(){return this.jodit.storage.delete(this.key),Promise.resolve(!1)},t}();e.DefaultStorage=i},789:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UIBackupBox=void 0;var n=o(1);o(790);var i=o(237),r=o(341),a=o(791),s=function(t){function e(e){var o=t.call(this,e)||this;return o.list=new a.UIBackupList(o.j),o.preview=o.j.c.div(o.getFullElName("preview")),o.container.appendChild(o.list.container),o.container.appendChild(o.preview),o.list.container.classList.add(o.getFullElName("list")),e.e.on(o.list,"select",o.onSelectItem).on(o.list,"choose",o.onChooseItem),o}return n.__extends(e,t),e.prototype.className=function(){return"UIBackupBox"},e.prototype.build=function(t){this.preview.innerHTML="",this.list.build(t)},e.prototype.destruct=function(){return this.j.e.off(this.list,"select",this.onSelectItem),this.list.destruct(),t.prototype.destruct.call(this)},e.prototype.onSelectItem=function(t){this.latestSelected=t,this.preview.innerHTML=t.html||'<div class="'.concat(this.getFullElName("empty"),'">').concat(this.j.i18n("Empty"),"</div>")},e.prototype.onChooseItem=function(t){this.j.e.fire(this,"choose",t)},e.prototype.chooseSelected=function(){this.onChooseItem(this.latestSelected)},n.__decorate([i.autobind],e.prototype,"onSelectItem",null),n.__decorate([i.autobind],e.prototype,"onChooseItem",null),n.__decorate([i.component],e)}(r.UIElement);e.UIBackupBox=s},792:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UIBackupItem=void 0;var n=o(1);o(793);var i=o(341),r=o(191),a=function(t){function e(e,o){var n=t.call(this,e)||this;return n.data=o,n.container.innerHTML=n.formatDate(o.created),(0,r.attr)(n.container,"tabIndex",0),n}return n.__extends(e,t),e.prototype.className=function(){return"UIBackupItem"},e.prototype.formatDate=function(t){var e=new Date,o=(0,r.isString)(t)?new Date(t):t,n=(e.getTime()-o.getTime())/1e3;return(0,r.isFunction)(this.j.o.backup.formatDate)?this.j.o.backup.formatDate(o):.2>n?this.j.i18n("Current"):60>n?this.j.i18n("Less minute"):n>3600?n>86400?"".concat(o.toDateString()," ").concat(o.toLocaleTimeString()):this.j.i18n("%s hours ago",Math.floor(n/3600)):this.j.i18n("%s minutes ago",Math.floor(n/60))},e.prototype.focus=function(){this.container.focus()},e}(i.UIElement);e.UIBackupItem=a},791:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UIBackupList=void 0;var n=o(1),i=o(341),r=o(237),a=o(792),s=o(153),c=o(191),u=function(t){function e(e){var o=t.call(this,e)||this;return o.elements=[],o.currentSelection=-1,e.e.on(o.container,"keydown",(function(t){switch(t.key){case s.KEY_ENTER:t.preventDefault(),t.stopPropagation(),o.onChoose(o.currentSelection);break;case s.KEY_DOWN:o.selectNext();break;case s.KEY_UP:o.selectPrevious()}})),o}return n.__extends(e,t),e.prototype.className=function(){return"UIBackupList"},e.prototype.createContainer=function(e){var o=t.prototype.createContainer.call(this,e);return(0,c.attr)(o,"tabIndex","-1"),o},e.prototype.build=function(t){var e=this;this.clear(),t.forEach((function(t,o){var n=new a.UIBackupItem(e.jodit,t);e.append(n),e.j.e.on(n.container,"focus",(function(){return e.onSelect(o)})).on(n.container,"click",(function(){return e.onSelect(o)})).on(n.container,"dblclick",(function(){return e.onChoose(o)}))})),this.currentSelection=0,this.onChangeCurrentSelection(void 0,-1,0)},e.prototype.onChangeCurrentSelection=function(t,e,o){var n,i,r;null===(n=this.elements[e])||void 0===n||n.setMod("active",!1),null===(i=this.elements[o])||void 0===i||i.setMod("active",!0),null===(r=this.elements[o])||void 0===r||r.focus(),this.j.e.fire(this,"select",this.elements[o].data)},e.prototype.onSelect=function(t){this.currentSelection=t},e.prototype.onChoose=function(t){this.j.e.fire(this,"choose",this.elements[null!=t?t:this.currentSelection].data)},e.prototype.selectNext=function(){this.currentSelection+1>this.elements.length-1?this.currentSelection=0:this.currentSelection+=1},e.prototype.selectPrevious=function(){0>this.currentSelection-1?this.currentSelection=this.elements.length-1:this.currentSelection-=1},n.__decorate([(0,r.watch)("currentSelection")],e.prototype,"onChangeCurrentSelection",null),n.__decorate([r.autobind],e.prototype,"onSelect",null),n.__decorate([r.autobind],e.prototype,"onChoose",null),n.__decorate([r.component],e)}(i.UIGroup);e.UIBackupList=u},786:function(t){t.exports='<?xml version="1.0" ?><svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><title/><g id="Upload"><path d="M16,26h8V50a2,2,0,0,0,2,2H38a2,2,0,0,0,2-2V26h8a2,2,0,0,0,1.4946-3.3291l-16-18a2,2,0,0,0-2.9892,0l-16,18A2,2,0,0,0,16,26ZM32,9.0107,43.5464,22H38a2,2,0,0,0-2,2V48H28V24a2,2,0,0,0-2-2H20.4536Z"/><path d="M53,42a2,2,0,0,0-2,2V54a2.0023,2.0023,0,0,1-2,2H15a2.0023,2.0023,0,0,1-2-2V44a2,2,0,0,0-4,0V54a6.0066,6.0066,0,0,0,6,6H49a6.0066,6.0066,0,0,0,6-6V44A2,2,0,0,0,53,42Z"/></g></svg>'},790:function(t,e,o){"use strict";o.r(e)},793:function(t,e,o){"use strict";o.r(e)}},function(t){return t(t.s=784)}])}));
1
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o=e();for(var n in o)("object"==typeof exports?exports:t)[n]=o[n]}}(self,(function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[391],{48436:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.backup=void 0;var n=o(70655);o(98673);var i=o(16490),r=o(51078),a=o(92681),s=o(97770),c=o(78827),u=o(23112),l=o(97029),p=function(t){function e(){var e,o=this;return(o=t.apply(this,n.__spreadArray([],n.__read(arguments),!1))||this).requires=["license"],o.hasStyle=!l.Jodit.fatMode,o.buttons=[{name:"backup.restore",group:"history"}],o.box=new s.UIBackupBox(o.j),o.dialog=null,o.storage=null!==(e=o.jodit.o.backup.remoteStore)&&void 0!==e?e:new r.DefaultStorage(o.jodit),o.timeout=0,o}return n.__extends(e,t),e.prototype.afterInit=function(t){var e=this;t.registerCommand("saveBackup",this.onSaveBackup).registerCommand("openBackupDialog",{exec:this.onOpenBackupDialog,hotkeys:t.o.backup.hotkeys});var o=function(){e.timeout=t.async.setTimeout((function(){e.onSaveBackup(),o()}),1e3*t.o.backup.interval)};o(),t.e.on(this.box,"choose",this.onSelectItem).on(t.ow,"beforeunload.backup",(function(){e.onSaveBackup()}))},e.prototype.prepareDialog=function(){this.dialog||(this.dialog=new a.Dialog({minWidth:this.j.o.backup.dialogWidth,buttons:["fullsize","dialog.close"]}).setContent(this.box.container)),this.dialog.setHeader(this.jodit.i18n("Restore")),this.addButtonsToDialog()},e.prototype.onSaveBackup=function(){this.storage.add({created:new Date,html:this.j.value})},e.prototype.onOpenBackupDialog=function(){return n.__awaiter(this,void 0,Promise,(function(){var t,e;return n.__generator(this,(function(o){switch(o.label){case 0:return this.prepareDialog(),(t=this.dialog)?(t.open().setModal(!0),[4,this.storage.items()]):[2];case 1:return e=o.sent(),this.box.build(n.__spreadArray([{created:new Date,html:this.j.value}],n.__read(e),!1)),t.calcAutoSize(),t.setPosition(),[2]}}))}))},e.prototype.onSelectItem=function(t){var e;null===(e=this.dialog)||void 0===e||e.close(),this.j.value=t.html,this.j.s.focus()},e.prototype.addButtonsToDialog=function(){var t,e=this,o=this.jodit,n=(0,c.Button)(o,{name:"ok",tabIndex:0,variant:"primary",text:"Ok"}),i=(0,c.Button)(o,{variant:"secondary",tabIndex:0,text:"Cancel"}),r=(0,c.Button)(o,{name:"clear",tabIndex:0,variant:"secondary",text:"Remove all"});n.onAction((function(){e.box.chooseSelected()})),i.onAction((function(){var t;null===(t=e.dialog)||void 0===t||t.close()})),r.onAction((function(){(0,a.Confirm)("Are you sure?",void 0,(function(t){var o;t&&(e.storage.clear(),null===(o=e.dialog)||void 0===o||o.close())}))}));var s=new c.UIBlock(o,[r,i,n]);s.container.style.margin="0",s.container.style.justifyContent="flex-end",s.container.style.width="100%",null===(t=this.dialog)||void 0===t||t.setFooter(s)},e.prototype.beforeDestruct=function(){var t,e=this.j;e.async.clearTimeout(this.timeout),e.e.off(this.box,"choose",this.onSelectItem).off(e.ow,"beforeunload.backup"),this.box.destruct(),null===(t=this.dialog)||void 0===t||t.destruct()},n.__decorate([u.autobind],e.prototype,"onSaveBackup",null),n.__decorate([u.autobind],e.prototype,"onOpenBackupDialog",null),n.__decorate([u.autobind],e.prototype,"onSelectItem",null),e}(i.Plugin);e.backup=p,l.Jodit.plugins.add("backup",p)},98673:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=o(85119),i=o(59050),r=o(98740);n.Config.prototype.backup={interval:30,limit:50,dialogWidth:700,hotkeys:["ctrl+shift+b","cmd+shift+b"]},n.Config.prototype.controls.backup={store:{command:"saveBackup",text:"Save backup now"},restore:{tooltip:"Restore",list:["backup.store"],exec:function(t){t.execCommand("openBackupDialog")}}},i.Icon.set("restore",o(12240)),(0,r.extendLang)(o(27892))},27892:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},51078:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultStorage=void 0;var n=o(70655),i=function(){function t(t){this.jodit=t,this.key="backup.default.storage"}return t.prototype.add=function(t){return n.__awaiter(this,void 0,Promise,(function(){var e;return n.__generator(this,(function(o){return t.html.trim().length?((e=this.jodit.storage.get(this.key)||[]).find((function(e){return e.html===t.html}))||(e.unshift(t),e.length>this.jodit.o.backup.limit&&(e.length=this.jodit.o.backup.limit),this.jodit.storage.set(this.key,e)),[2,!1]):[2,!1]}))}))},t.prototype.items=function(){return Promise.resolve(this.jodit.storage.get(this.key)||[])},t.prototype.clear=function(){return this.jodit.storage.delete(this.key),Promise.resolve(!1)},t}();e.DefaultStorage=i},97770:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UIBackupBox=void 0;var n=o(70655);o(5269);var i=o(23112),r=o(78827),a=o(16307),s=function(t){function e(e){var o=t.call(this,e)||this;return o.list=new a.UIBackupList(o.j),o.preview=o.j.c.div(o.getFullElName("preview")),o.container.appendChild(o.list.container),o.container.appendChild(o.preview),o.list.container.classList.add(o.getFullElName("list")),e.e.on(o.list,"select",o.onSelectItem).on(o.list,"choose",o.onChooseItem),o}return n.__extends(e,t),e.prototype.className=function(){return"UIBackupBox"},e.prototype.build=function(t){this.preview.innerHTML="",this.list.build(t)},e.prototype.destruct=function(){return this.j.e.off(this.list,"select",this.onSelectItem),this.list.destruct(),t.prototype.destruct.call(this)},e.prototype.onSelectItem=function(t){this.latestSelected=t,this.preview.innerHTML=t.html||'<div class="'.concat(this.getFullElName("empty"),'">').concat(this.j.i18n("Empty"),"</div>")},e.prototype.onChooseItem=function(t){this.j.e.fire(this,"choose",t)},e.prototype.chooseSelected=function(){this.onChooseItem(this.latestSelected)},n.__decorate([i.autobind],e.prototype,"onSelectItem",null),n.__decorate([i.autobind],e.prototype,"onChooseItem",null),n.__decorate([i.component],e)}(r.UIElement);e.UIBackupBox=s},86788:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UIBackupItem=void 0;var n=o(70655);o(25241);var i=o(78827),r=o(75204),a=function(t){function e(e,o){var n=t.call(this,e)||this;return n.data=o,n.container.innerHTML=n.formatDate(o.created),(0,r.attr)(n.container,"tabIndex",0),n}return n.__extends(e,t),e.prototype.className=function(){return"UIBackupItem"},e.prototype.formatDate=function(t){var e=new Date,o=(0,r.isString)(t)?new Date(t):t,n=(e.getTime()-o.getTime())/1e3;return(0,r.isFunction)(this.j.o.backup.formatDate)?this.j.o.backup.formatDate(o):.2>n?this.j.i18n("Current"):60>n?this.j.i18n("Less minute"):n>3600?n>86400?"".concat(o.toDateString()," ").concat(o.toLocaleTimeString()):this.j.i18n("%s hours ago",Math.floor(n/3600)):this.j.i18n("%s minutes ago",Math.floor(n/60))},e.prototype.focus=function(){this.container.focus()},e}(i.UIElement);e.UIBackupItem=a},16307:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UIBackupList=void 0;var n=o(70655),i=o(78827),r=o(23112),a=o(86788),s=o(11606),c=o(75204),u=function(t){function e(e){var o=t.call(this,e)||this;return o.elements=[],o.currentSelection=-1,e.e.on(o.container,"keydown",(function(t){switch(t.key){case s.KEY_ENTER:t.preventDefault(),t.stopPropagation(),o.onChoose(o.currentSelection);break;case s.KEY_DOWN:o.selectNext();break;case s.KEY_UP:o.selectPrevious()}})),o}return n.__extends(e,t),e.prototype.className=function(){return"UIBackupList"},e.prototype.createContainer=function(e){var o=t.prototype.createContainer.call(this,e);return(0,c.attr)(o,"tabIndex","-1"),o},e.prototype.build=function(t){var e=this;this.clear(),t.forEach((function(t,o){var n=new a.UIBackupItem(e.jodit,t);e.append(n),e.j.e.on(n.container,"focus",(function(){return e.onSelect(o)})).on(n.container,"click",(function(){return e.onSelect(o)})).on(n.container,"dblclick",(function(){return e.onChoose(o)}))})),this.currentSelection=0,this.onChangeCurrentSelection(void 0,-1,0)},e.prototype.onChangeCurrentSelection=function(t,e,o){var n,i,r;null===(n=this.elements[e])||void 0===n||n.setMod("active",!1),null===(i=this.elements[o])||void 0===i||i.setMod("active",!0),null===(r=this.elements[o])||void 0===r||r.focus(),this.j.e.fire(this,"select",this.elements[o].data)},e.prototype.onSelect=function(t){this.currentSelection=t},e.prototype.onChoose=function(t){this.j.e.fire(this,"choose",this.elements[null!=t?t:this.currentSelection].data)},e.prototype.selectNext=function(){this.currentSelection+1>this.elements.length-1?this.currentSelection=0:this.currentSelection+=1},e.prototype.selectPrevious=function(){0>this.currentSelection-1?this.currentSelection=this.elements.length-1:this.currentSelection-=1},n.__decorate([(0,r.watch)("currentSelection")],e.prototype,"onChangeCurrentSelection",null),n.__decorate([r.autobind],e.prototype,"onSelect",null),n.__decorate([r.autobind],e.prototype,"onChoose",null),n.__decorate([r.component],e)}(i.UIGroup);e.UIBackupList=u},12240:function(t){t.exports='<?xml version="1.0" ?><svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><title/><g id="Upload"><path d="M16,26h8V50a2,2,0,0,0,2,2H38a2,2,0,0,0,2-2V26h8a2,2,0,0,0,1.4946-3.3291l-16-18a2,2,0,0,0-2.9892,0l-16,18A2,2,0,0,0,16,26ZM32,9.0107,43.5464,22H38a2,2,0,0,0-2,2V48H28V24a2,2,0,0,0-2-2H20.4536Z"/><path d="M53,42a2,2,0,0,0-2,2V54a2.0023,2.0023,0,0,1-2,2H15a2.0023,2.0023,0,0,1-2-2V44a2,2,0,0,0-4,0V54a6.0066,6.0066,0,0,0,6,6H49a6.0066,6.0066,0,0,0,6-6V44A2,2,0,0,0,53,42Z"/></g></svg>'},5269:function(t,e,o){"use strict";o.r(e)},25241:function(t,e,o){"use strict";o.r(e)}},function(t){return t(t.s=48436)}])}));
@@ -1 +1 @@
1
- ((t,e)=>{if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o=e();for(var i in o)("object"==typeof exports?exports:t)[i]=o[i]}})(self,(function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[391],{251(t,e,o){"use strict";o.r(e),o.d(e,{backup:()=>b});var i=o(225),s=o(2),n=o(64),a=o(57);s.D.prototype.backup={interval:30,limit:50,dialogWidth:700,hotkeys:["ctrl+shift+b","cmd+shift+b"]},s.D.prototype.controls.backup={store:{command:"saveBackup",text:"Save backup now"},restore:{tooltip:"Restore",list:["backup.store"],exec(t){t.execCommand("openBackupDialog")}}},n.J.set("restore",o(252)),(0,a.xl)(o(253));var r=o(95);class l{constructor(t){this.jodit=t,this.key="backup.default.storage"}async add(t){if(!t.html.trim().length)return!1;const e=this.jodit.storage.get(this.key)||[];return e.find((e=>e.html===t.html))||(e.unshift(t),e.length>this.jodit.o.backup.limit&&(e.length=this.jodit.o.backup.limit),this.jodit.storage.set(this.key,e)),!1}items(){return Promise.resolve(this.jodit.storage.get(this.key)||[])}clear(){return this.jodit.storage.delete(this.key),Promise.resolve(!1)}}var c=o(82),h=o(53),u=o(89),d=o(32);class p extends u.u1{constructor(t,e){super(t),this.data=e,this.container.innerHTML=this.formatDate(e.created),(0,d.attr)(this.container,"tabIndex",0)}className(){return"UIBackupItem"}formatDate(t){const e=new Date,o=(0,d.isString)(t)?new Date(t):t,i=(e.getTime()-o.getTime())/1e3;return(0,d.isFunction)(this.j.o.backup.formatDate)?this.j.o.backup.formatDate(o):.2>i?this.j.i18n("Current"):60>i?this.j.i18n("Less minute"):i>3600?i>86400?`${o.toDateString()} ${o.toLocaleTimeString()}`:this.j.i18n("%s hours ago",Math.floor(i/3600)):this.j.i18n("%s minutes ago",Math.floor(i/60))}focus(){this.container.focus()}}var m=o(3);let g=class extends u.qe{constructor(t){super(t),this.elements=[],this.currentSelection=-1,t.e.on(this.container,"keydown",(t=>{switch(t.key){case m.KEY_ENTER:t.preventDefault(),t.stopPropagation(),this.onChoose(this.currentSelection);break;case m.KEY_DOWN:this.selectNext();break;case m.KEY_UP:this.selectPrevious()}}))}className(){return"UIBackupList"}createContainer(t){const e=super.createContainer(t);return(0,d.attr)(e,"tabIndex","-1"),e}build(t){this.clear(),t.forEach(((t,e)=>{const o=new p(this.jodit,t);this.append(o),this.j.e.on(o.container,"focus",(()=>this.onSelect(e))).on(o.container,"click",(()=>this.onSelect(e))).on(o.container,"dblclick",(()=>this.onChoose(e)))})),this.currentSelection=0,this.onChangeCurrentSelection(void 0,-1,0)}onChangeCurrentSelection(t,e,o){var i,s,n;null===(i=this.elements[e])||void 0===i||i.setMod("active",!1),null===(s=this.elements[o])||void 0===s||s.setMod("active",!0),null===(n=this.elements[o])||void 0===n||n.focus(),this.j.e.fire(this,"select",this.elements[o].data)}onSelect(t){this.currentSelection=t}onChoose(t){this.j.e.fire(this,"choose",this.elements[null!=t?t:this.currentSelection].data)}selectNext(){this.currentSelection+1>this.elements.length-1?this.currentSelection=0:this.currentSelection+=1}selectPrevious(){0>this.currentSelection-1?this.currentSelection=this.elements.length-1:this.currentSelection-=1}};(0,i.gn)([(0,h.watch)("currentSelection")],g.prototype,"onChangeCurrentSelection",null),(0,i.gn)([h.autobind],g.prototype,"onSelect",null),(0,i.gn)([h.autobind],g.prototype,"onChoose",null),g=(0,i.gn)([h.component],g);let v=class extends u.u1{constructor(t){super(t),this.list=new g(this.j),this.preview=this.j.c.div(this.getFullElName("preview")),this.container.appendChild(this.list.container),this.container.appendChild(this.preview),this.list.container.classList.add(this.getFullElName("list")),t.e.on(this.list,"select",this.onSelectItem).on(this.list,"choose",this.onChooseItem)}className(){return"UIBackupBox"}build(t){this.preview.innerHTML="",this.list.build(t)}destruct(){return this.j.e.off(this.list,"select",this.onSelectItem),this.list.destruct(),super.destruct()}onSelectItem(t){this.latestSelected=t,this.preview.innerHTML=t.html||`<div class="${this.getFullElName("empty")}">${this.j.i18n("Empty")}</div>`}onChooseItem(t){this.j.e.fire(this,"choose",t)}chooseSelected(){this.onChooseItem(this.latestSelected)}};(0,i.gn)([h.autobind],v.prototype,"onSelectItem",null),(0,i.gn)([h.autobind],v.prototype,"onChooseItem",null),v=(0,i.gn)([h.component],v);var f=o(1);class b extends r.S{constructor(){var t;super(...arguments),this.requires=["license"],this.hasStyle=!f.Jodit.fatMode,this.buttons=[{name:"backup.restore",group:"history"}],this.box=new v(this.j),this.dialog=null,this.storage=null!==(t=this.jodit.o.backup.remoteStore)&&void 0!==t?t:new l(this.jodit),this.timeout=0}afterInit(t){t.registerCommand("saveBackup",this.onSaveBackup).registerCommand("openBackupDialog",{exec:this.onOpenBackupDialog,hotkeys:t.o.backup.hotkeys});const e=()=>{this.timeout=t.async.setTimeout((()=>{this.onSaveBackup(),e()}),1e3*t.o.backup.interval)};e(),t.e.on(this.box,"choose",this.onSelectItem).on(t.ow,"beforeunload.backup",(()=>{this.onSaveBackup()}))}prepareDialog(){this.dialog||(this.dialog=new c.Vq({minWidth:this.j.o.backup.dialogWidth,buttons:["fullsize","dialog.close"]}).setContent(this.box.container)),this.dialog.setHeader(this.jodit.i18n("Restore")),this.addButtonsToDialog()}onSaveBackup(){this.storage.add({created:new Date,html:this.j.value})}async onOpenBackupDialog(){this.prepareDialog();const{dialog:t}=this;if(!t)return;t.open().setModal(!0);const e=await this.storage.items();this.box.build([{created:new Date,html:this.j.value},...e]),t.calcAutoSize(),t.setPosition()}onSelectItem(t){var e;null===(e=this.dialog)||void 0===e||e.close(),this.j.value=t.html,this.j.s.focus()}addButtonsToDialog(){var t;const{jodit:e}=this,o=(0,u.zx)(e,{name:"ok",tabIndex:0,variant:"primary",text:"Ok"}),i=(0,u.zx)(e,{variant:"secondary",tabIndex:0,text:"Cancel"}),s=(0,u.zx)(e,{name:"clear",tabIndex:0,variant:"secondary",text:"Remove all"});o.onAction((()=>{this.box.chooseSelected()})),i.onAction((()=>{var t;null===(t=this.dialog)||void 0===t||t.close()})),s.onAction((()=>{(0,c.I4)("Are you sure?",void 0,(t=>{var e;t&&(this.storage.clear(),null===(e=this.dialog)||void 0===e||e.close())}))}));const n=new u.eC(e,[s,i,o]);n.container.style.margin="0",n.container.style.justifyContent="flex-end",n.container.style.width="100%",null===(t=this.dialog)||void 0===t||t.setFooter(n)}beforeDestruct(){var t;const{j:e}=this;e.async.clearTimeout(this.timeout),e.e.off(this.box,"choose",this.onSelectItem).off(e.ow,"beforeunload.backup"),this.box.destruct(),null===(t=this.dialog)||void 0===t||t.destruct()}}(0,i.gn)([h.autobind],b.prototype,"onSaveBackup",null),(0,i.gn)([h.autobind],b.prototype,"onOpenBackupDialog",null),(0,i.gn)([h.autobind],b.prototype,"onSelectItem",null),f.Jodit.plugins.add("backup",b)},253(t,e,o){"use strict";o.r(e)},225(t,e,o){"use strict";function i(t,e,o,i){var s,n=arguments.length,a=3>n?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,i);else for(var r=t.length-1;r>=0;r--)(s=t[r])&&(a=(3>n?s(a):n>3?s(e,o,a):s(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a}o.d(e,{gn:()=>i})},252(t){t.exports='<?xml version="1.0" ?><svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><title/><g id="Upload"><path d="M16,26h8V50a2,2,0,0,0,2,2H38a2,2,0,0,0,2-2V26h8a2,2,0,0,0,1.4946-3.3291l-16-18a2,2,0,0,0-2.9892,0l-16,18A2,2,0,0,0,16,26ZM32,9.0107,43.5464,22H38a2,2,0,0,0-2,2V48H28V24a2,2,0,0,0-2-2H20.4536Z"/><path d="M53,42a2,2,0,0,0-2,2V54a2.0023,2.0023,0,0,1-2,2H15a2.0023,2.0023,0,0,1-2-2V44a2,2,0,0,0-4,0V54a6.0066,6.0066,0,0,0,6,6H49a6.0066,6.0066,0,0,0,6-6V44A2,2,0,0,0,53,42Z"/></g></svg>'}},t=>t(t.s=251)])}));
1
+ ((t,e)=>{if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o=e();for(var i in o)("object"==typeof exports?exports:t)[i]=o[i]}})(self,(function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[391],{48436(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.backup=void 0;var i=o(70655);o(98673);var n=o(16490),r=o(51078),a=o(92681),s=o(97770),c=o(78827),l=o(23112),u=o(97029),p=function(t){function e(){var e,o=this;return(o=t.apply(this,i.__spreadArray([],i.__read(arguments),!1))||this).requires=["license"],o.hasStyle=!u.Jodit.fatMode,o.buttons=[{name:"backup.restore",group:"history"}],o.box=new s.UIBackupBox(o.j),o.dialog=null,o.storage=null!==(e=o.jodit.o.backup.remoteStore)&&void 0!==e?e:new r.DefaultStorage(o.jodit),o.timeout=0,o}return i.__extends(e,t),e.prototype.afterInit=function(t){var e=this;t.registerCommand("saveBackup",this.onSaveBackup).registerCommand("openBackupDialog",{exec:this.onOpenBackupDialog,hotkeys:t.o.backup.hotkeys});var o=()=>{e.timeout=t.async.setTimeout((()=>{e.onSaveBackup(),o()}),1e3*t.o.backup.interval)};o(),t.e.on(this.box,"choose",this.onSelectItem).on(t.ow,"beforeunload.backup",(()=>{e.onSaveBackup()}))},e.prototype.prepareDialog=function(){this.dialog||(this.dialog=new a.Dialog({minWidth:this.j.o.backup.dialogWidth,buttons:["fullsize","dialog.close"]}).setContent(this.box.container)),this.dialog.setHeader(this.jodit.i18n("Restore")),this.addButtonsToDialog()},e.prototype.onSaveBackup=function(){this.storage.add({created:new Date,html:this.j.value})},e.prototype.onOpenBackupDialog=function(){return i.__awaiter(this,void 0,Promise,(function(){var t,e;return i.__generator(this,(function(o){switch(o.label){case 0:return this.prepareDialog(),(t=this.dialog)?(t.open().setModal(!0),[4,this.storage.items()]):[2];case 1:return e=o.sent(),this.box.build(i.__spreadArray([{created:new Date,html:this.j.value}],i.__read(e),!1)),t.calcAutoSize(),t.setPosition(),[2]}}))}))},e.prototype.onSelectItem=function(t){var e;null===(e=this.dialog)||void 0===e||e.close(),this.j.value=t.html,this.j.s.focus()},e.prototype.addButtonsToDialog=function(){var t,e=this,o=this.jodit,i=(0,c.Button)(o,{name:"ok",tabIndex:0,variant:"primary",text:"Ok"}),n=(0,c.Button)(o,{variant:"secondary",tabIndex:0,text:"Cancel"}),r=(0,c.Button)(o,{name:"clear",tabIndex:0,variant:"secondary",text:"Remove all"});i.onAction((()=>{e.box.chooseSelected()})),n.onAction((()=>{var t;null===(t=e.dialog)||void 0===t||t.close()})),r.onAction((()=>{(0,a.Confirm)("Are you sure?",void 0,(t=>{var o;t&&(e.storage.clear(),null===(o=e.dialog)||void 0===o||o.close())}))}));var s=new c.UIBlock(o,[r,n,i]);s.container.style.margin="0",s.container.style.justifyContent="flex-end",s.container.style.width="100%",null===(t=this.dialog)||void 0===t||t.setFooter(s)},e.prototype.beforeDestruct=function(){var t,e=this.j;e.async.clearTimeout(this.timeout),e.e.off(this.box,"choose",this.onSelectItem).off(e.ow,"beforeunload.backup"),this.box.destruct(),null===(t=this.dialog)||void 0===t||t.destruct()},i.__decorate([l.autobind],e.prototype,"onSaveBackup",null),i.__decorate([l.autobind],e.prototype,"onOpenBackupDialog",null),i.__decorate([l.autobind],e.prototype,"onSelectItem",null),e}(n.Plugin);e.backup=p,u.Jodit.plugins.add("backup",p)},98673(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=o(85119),n=o(59050),r=o(98740);i.Config.prototype.backup={interval:30,limit:50,dialogWidth:700,hotkeys:["ctrl+shift+b","cmd+shift+b"]},i.Config.prototype.controls.backup={store:{command:"saveBackup",text:"Save backup now"},restore:{tooltip:"Restore",list:["backup.store"],exec(t){t.execCommand("openBackupDialog")}}},n.Icon.set("restore",o(12240)),(0,r.extendLang)(o(27892))},27892(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},51078(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultStorage=void 0;var i=o(70655),n=function(){function t(t){this.jodit=t,this.key="backup.default.storage"}return t.prototype.add=function(t){return i.__awaiter(this,void 0,Promise,(function(){var e;return i.__generator(this,(function(o){return t.html.trim().length?((e=this.jodit.storage.get(this.key)||[]).find((e=>e.html===t.html))||(e.unshift(t),e.length>this.jodit.o.backup.limit&&(e.length=this.jodit.o.backup.limit),this.jodit.storage.set(this.key,e)),[2,!1]):[2,!1]}))}))},t.prototype.items=function(){return Promise.resolve(this.jodit.storage.get(this.key)||[])},t.prototype.clear=function(){return this.jodit.storage.delete(this.key),Promise.resolve(!1)},t}();e.DefaultStorage=n},97770(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UIBackupBox=void 0;var i=o(70655);o(5269);var n=o(23112),r=o(78827),a=o(16307),s=function(t){function e(e){var o=t.call(this,e)||this;return o.list=new a.UIBackupList(o.j),o.preview=o.j.c.div(o.getFullElName("preview")),o.container.appendChild(o.list.container),o.container.appendChild(o.preview),o.list.container.classList.add(o.getFullElName("list")),e.e.on(o.list,"select",o.onSelectItem).on(o.list,"choose",o.onChooseItem),o}return i.__extends(e,t),e.prototype.className=()=>"UIBackupBox",e.prototype.build=function(t){this.preview.innerHTML="",this.list.build(t)},e.prototype.destruct=function(){return this.j.e.off(this.list,"select",this.onSelectItem),this.list.destruct(),t.prototype.destruct.call(this)},e.prototype.onSelectItem=function(t){this.latestSelected=t,this.preview.innerHTML=t.html||'<div class="'.concat(this.getFullElName("empty"),'">').concat(this.j.i18n("Empty"),"</div>")},e.prototype.onChooseItem=function(t){this.j.e.fire(this,"choose",t)},e.prototype.chooseSelected=function(){this.onChooseItem(this.latestSelected)},i.__decorate([n.autobind],e.prototype,"onSelectItem",null),i.__decorate([n.autobind],e.prototype,"onChooseItem",null),i.__decorate([n.component],e)}(r.UIElement);e.UIBackupBox=s},86788(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UIBackupItem=void 0;var i=o(70655);o(25241);var n=o(78827),r=o(75204),a=function(t){function e(e,o){var i=t.call(this,e)||this;return i.data=o,i.container.innerHTML=i.formatDate(o.created),(0,r.attr)(i.container,"tabIndex",0),i}return i.__extends(e,t),e.prototype.className=()=>"UIBackupItem",e.prototype.formatDate=function(t){var e=new Date,o=(0,r.isString)(t)?new Date(t):t,i=(e.getTime()-o.getTime())/1e3;return(0,r.isFunction)(this.j.o.backup.formatDate)?this.j.o.backup.formatDate(o):.2>i?this.j.i18n("Current"):60>i?this.j.i18n("Less minute"):i>3600?i>86400?"".concat(o.toDateString()," ").concat(o.toLocaleTimeString()):this.j.i18n("%s hours ago",Math.floor(i/3600)):this.j.i18n("%s minutes ago",Math.floor(i/60))},e.prototype.focus=function(){this.container.focus()},e}(n.UIElement);e.UIBackupItem=a},16307(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UIBackupList=void 0;var i=o(70655),n=o(78827),r=o(23112),a=o(86788),s=o(11606),c=o(75204),l=function(t){function e(e){var o=t.call(this,e)||this;return o.elements=[],o.currentSelection=-1,e.e.on(o.container,"keydown",(t=>{switch(t.key){case s.KEY_ENTER:t.preventDefault(),t.stopPropagation(),o.onChoose(o.currentSelection);break;case s.KEY_DOWN:o.selectNext();break;case s.KEY_UP:o.selectPrevious()}})),o}return i.__extends(e,t),e.prototype.className=()=>"UIBackupList",e.prototype.createContainer=function(e){var o=t.prototype.createContainer.call(this,e);return(0,c.attr)(o,"tabIndex","-1"),o},e.prototype.build=function(t){var e=this;this.clear(),t.forEach(((t,o)=>{var i=new a.UIBackupItem(e.jodit,t);e.append(i),e.j.e.on(i.container,"focus",(()=>e.onSelect(o))).on(i.container,"click",(()=>e.onSelect(o))).on(i.container,"dblclick",(()=>e.onChoose(o)))})),this.currentSelection=0,this.onChangeCurrentSelection(void 0,-1,0)},e.prototype.onChangeCurrentSelection=function(t,e,o){var i,n,r;null===(i=this.elements[e])||void 0===i||i.setMod("active",!1),null===(n=this.elements[o])||void 0===n||n.setMod("active",!0),null===(r=this.elements[o])||void 0===r||r.focus(),this.j.e.fire(this,"select",this.elements[o].data)},e.prototype.onSelect=function(t){this.currentSelection=t},e.prototype.onChoose=function(t){this.j.e.fire(this,"choose",this.elements[null!=t?t:this.currentSelection].data)},e.prototype.selectNext=function(){this.currentSelection+1>this.elements.length-1?this.currentSelection=0:this.currentSelection+=1},e.prototype.selectPrevious=function(){0>this.currentSelection-1?this.currentSelection=this.elements.length-1:this.currentSelection-=1},i.__decorate([(0,r.watch)("currentSelection")],e.prototype,"onChangeCurrentSelection",null),i.__decorate([r.autobind],e.prototype,"onSelect",null),i.__decorate([r.autobind],e.prototype,"onChoose",null),i.__decorate([r.component],e)}(n.UIGroup);e.UIBackupList=l},12240(t){t.exports='<?xml version="1.0" ?><svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><title/><g id="Upload"><path d="M16,26h8V50a2,2,0,0,0,2,2H38a2,2,0,0,0,2-2V26h8a2,2,0,0,0,1.4946-3.3291l-16-18a2,2,0,0,0-2.9892,0l-16,18A2,2,0,0,0,16,26ZM32,9.0107,43.5464,22H38a2,2,0,0,0-2,2V48H28V24a2,2,0,0,0-2-2H20.4536Z"/><path d="M53,42a2,2,0,0,0-2,2V54a2.0023,2.0023,0,0,1-2,2H15a2.0023,2.0023,0,0,1-2-2V44a2,2,0,0,0-4,0V54a6.0066,6.0066,0,0,0,6,6H49a6.0066,6.0066,0,0,0,6-6V44A2,2,0,0,0,53,42Z"/></g></svg>'},5269(t,e,o){"use strict";o.r(e)},25241(t,e,o){"use strict";o.r(e)}},t=>t(t.s=48436)])}));