jodit-pro 1.3.34 → 1.3.36

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 (53) hide show
  1. package/build/config.js +1 -0
  2. package/build/jodit.es5.css +1 -1
  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/mobile-view/mobile-view.es5.js +1 -1
  36. package/build/plugins/mobile-view/mobile-view.js +1 -1
  37. package/build/plugins/page-break/page-break.es5.js +1 -1
  38. package/build/plugins/page-break/page-break.js +1 -1
  39. package/build/plugins/paste-code/paste-code.es5.js +1 -1
  40. package/build/plugins/paste-code/paste-code.js +1 -1
  41. package/build/plugins/paste-from-word/paste-from-word.es5.js +1 -1
  42. package/build/plugins/paste-from-word/paste-from-word.js +1 -1
  43. package/build/plugins/show-blocks/show-blocks.es5.js +1 -1
  44. package/build/plugins/show-blocks/show-blocks.js +1 -1
  45. package/build/plugins/todo-list/todo-list.css +1 -0
  46. package/build/plugins/todo-list/todo-list.es5.css +1 -0
  47. package/build/plugins/todo-list/todo-list.es5.js +1 -0
  48. package/build/plugins/todo-list/todo-list.js +1 -0
  49. package/build/plugins/translate/translate.es5.js +1 -1
  50. package/build/plugins/translate/translate.js +1 -1
  51. package/build/plugins/tune-block/tune-block.es5.js +1 -1
  52. package/build/plugins/tune-block/tune-block.js +1 -1
  53. 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],{6293:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.autocomplete=void 0;var n=o(70655),r=o(43464),i=o(733),s=o(51923),u=o(16892),l=o(12815),c=o(17497),a=o(50679),p=o(49940),d=o(97029),f=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 h=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.requires=["enter","license"],t.hasStyle=!d.Jodit.fatMode,t.sources=[],t}return n.__extends(t,e),t.prototype.afterInit=function(e){var t=this;this.popup=new c.Popup(e),this.popup.setMod("padding",!1),this.list=new a.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,f.replaceTextLeftOfCursorAfterSpace)(e.s.range,n),t.j.s.setCursorAfter(n),t.j.synchronizeValues(),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===p.KEY_DOWN||e===p.KEY_UP||e===p.KEY_ENTER||e===p.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===p.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,f.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 p.KEY_DOWN:this.list.selectNext();break;case p.KEY_UP:this.list.selectPrevious();break;case p.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(){var e=t.j,o=e.s.range.getBoundingClientRect(),n={left:o.left,top:o.top,height:o.height,width:o.width};if(e.o.iframe&&e.iframe){var r=(0,u.position)(e.iframe,e);n.top+=r.top,n.left+=r.left}return n}))},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=h,d.Jodit.plugins.add("autocomplete",h)},49852:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.replaceTextLeftOfCursorAfterSpace=t.getTextLeftOfCursor=void 0;var n=o(12815);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,i,s=e.startContainer,u=e.startOffset;if(n.Dom.isText(s)||n.Dom.isText(s=s.childNodes[u-1])&&(u=null!==(r=null===(o=s.nodeValue)||void 0===o?void 0:o.length)&&void 0!==r?r:0),n.Dom.isText(s)){var l=null!==(i=s.nodeValue)&&void 0!==i?i:"",c=l.substring(0,u),a=l.substring(u),p=c.split(" ");p[p.length-1]="";var d=p.join(" ");return s.nodeValue=d+a,e.setStart(s,d.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(51923),i=o(98440),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(98440),i=o(16892),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
+ "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(10818),i=o(43854),s=o(11975),u=o(47643),l=o(38886),c=o(59316),a=o(50679),p=o(36257),d=o(97029),f=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 h=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.requires=["enter","license"],t.hasStyle=!d.Jodit.fatMode,t.sources=[],t}return n.__extends(t,e),t.prototype.afterInit=function(e){var t=this;this.popup=new c.Popup(e),this.popup.setMod("padding",!1),this.list=new a.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,f.replaceTextLeftOfCursorAfterSpace)(e.s.range,n),t.j.s.setCursorAfter(n),t.j.synchronizeValues(),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===p.KEY_DOWN||e===p.KEY_UP||e===p.KEY_ENTER||e===p.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===p.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,f.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 p.KEY_DOWN:this.list.selectNext();break;case p.KEY_UP:this.list.selectPrevious();break;case p.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(){var e=t.j,o=e.s.range.getBoundingClientRect(),n={left:o.left,top:o.top,height:o.height,width:o.width};if(e.o.iframe&&e.iframe){var r=(0,u.position)(e.iframe,e);n.top+=r.top,n.left+=r.left}return n}))},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=h,d.Jodit.plugins.add("autocomplete",h)},49852:function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.replaceTextLeftOfCursorAfterSpace=t.getTextLeftOfCursor=void 0;var n=o(38886);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,i,s=e.startContainer,u=e.startOffset;if(n.Dom.isText(s)||n.Dom.isText(s=s.childNodes[u-1])&&(u=null!==(r=null===(o=s.nodeValue)||void 0===o?void 0:o.length)&&void 0!==r?r:0),n.Dom.isText(s)){var l=null!==(i=s.nodeValue)&&void 0!==i?i:"",c=l.substring(0,u),a=l.substring(u),p=c.split(" ");p[p.length-1]="";var d=p.join(" ");return s.nodeValue=d+a,e.setStart(s,d.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(11975),i=o(98813),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(98813),i=o(47643),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],{38096(e,t,o){o.r(t),o.d(t,{autocomplete(){return m}});var n=o(70655),i=o(43464),s=o(733),r=o(98422),l=o(16892),u=o(12815),c=o(17497),a=o(33993);class p extends a.u1{className(){return"AutocompleteItem"}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}}let h=class e extends a.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")],h.prototype,"onChangeSelection",null),h=(0,n.gn)([r.component],h);var d=o(49940),f=o(62195);s.D.prototype.autocomplete={sources:[],maxItems:50,isMatchedQuery(e,t){return 0===t.toLowerCase().indexOf(e.toLowerCase())},itemRenderer(e){var t;return null!==(t=e.title)&&void 0!==t?t:e.value},insertValueRenderer(e){return e.value+" "}};class m extends i.S{constructor(){super(...arguments),this.requires=["enter","license"],this.hasStyle=!f.Jodit.fatMode,this.sources=[]}afterInit(e){this.popup=new c.G(e),this.popup.setMod("padding",!1),this.list=new h(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.i.isNode(o)||(o=e.createInside.fromHTML(o)),((e,t)=>{var o,n,i;let{startContainer:s,startOffset:r}=e;if(u.i.isText(s)||(s=s.childNodes[r-1],u.i.isText(s)&&(r=null!==(n=null===(o=s.nodeValue)||void 0===o?void 0:o.length)&&void 0!==n?n:0)),u.i.isText(s)){const o=null!==(i=s.nodeValue)&&void 0!==i?i:"",n=o.substring(0,r),l=o.substring(r),u=n.split(" ");u[u.length-1]="";const c=u.join(" ");s.nodeValue=c+l,e.setStart(s,c.length),e.insertNode(t)}})(e.s.range,o),this.j.s.setCursorAfter(o),this.j.synchronizeValues(),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(m.isControlKey(e.key)||!n.isInsideArea||!n.isCollapsed)return;const i=(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,s=i&&(e=>{var t,o,n,i;const{startContainer:s,startOffset:r}=e;if(u.i.isText(s))return null!==(o=null===(t=s.nodeValue)||void 0===t?void 0:t.substr(0,r))&&void 0!==o?o:"";const l=s.childNodes[r];if(!l)return"";if(u.i.isText(l))return null!==(n=l.nodeValue)&&void 0!==n?n:"";const c=u.i.findNotEmptyNeighbor(l,!0,s);return u.i.isText(c)&&null!==(i=l.nodeValue)&&void 0!==i?i:""})(i).split(" ").pop();if(s&&(0,l.trim)(s).length){const e=await this.onAutoComplete(s);if(e.length)return this.openPopup(e)}this.popup.isOpened&&this.popup.close()}onKeyControlDown(e){if(this.popup.isOpened&&m.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:i}=this.j.o.autocomplete;n=o.filter((t=>(0,l.isString)(t)?i(e,t):i(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:i}=this.j.o.autocomplete;return n=n.map((n=>{var i,s;return{itemRenderer:null!==(i=null==o?void 0:o.itemRenderer)&&void 0!==i?i:e,insertValueRenderer:null!==(s=null==o?void 0:o.insertValueRenderer)&&void 0!==s?s:t,...n}})),n.slice(0,i)}return[]}openPopup(e){this.list.build(e),this.popup.open((()=>{const{j:e}=this,t=e.s.range.getBoundingClientRect(),o={left:t.left,top:t.top,height:t.height,width:t.width};if(e.o.iframe&&e.iframe){const t=(0,l.position)(e.iframe,e);o.top+=t.top,o.left+=t.left}return o}))}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],m.prototype,"registerAutocompleteSource",null),(0,n.gn)([(0,r.debounce)()],m.prototype,"onKeyDown",null),(0,n.gn)([r.autobind],m.prototype,"onKeyControlDown",null),(0,n.gn)([r.autobind],m.prototype,"onEnter",null),(0,n.gn)([r.autobind],m.prototype,"onAutoComplete",null),(0,n.gn)([r.autobind],m.prototype,"resolveFeed",null),f.Jodit.plugins.add("autocomplete",m)},70655(e,t,o){function n(e,t,o,n){var i,s=arguments.length,r=3>s?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--)(i=e[l])&&(r=(3>s?i(r):s>3?i(t,o,r):i(t,o))||r);return s>3&&r&&Object.defineProperty(t,o,r),r}o.d(t,{gn(){return n}})}},e=>e(e.s=38096)])}));
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],{38096(e,t,o){o.r(t),o.d(t,{autocomplete(){return m}});var n=o(70655),i=o(10818),s=o(43854),r=o(51663),l=o(47643),u=o(38886),c=o(59316),a=o(86673);class p extends a.u1{className(){return"AutocompleteItem"}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}}let h=class e extends a.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")],h.prototype,"onChangeSelection",null),h=(0,n.gn)([r.component],h);var d=o(36257),f=o(1120);s.D.prototype.autocomplete={sources:[],maxItems:50,isMatchedQuery(e,t){return 0===t.toLowerCase().indexOf(e.toLowerCase())},itemRenderer(e){var t;return null!==(t=e.title)&&void 0!==t?t:e.value},insertValueRenderer(e){return e.value+" "}};class m extends i.S{constructor(){super(...arguments),this.requires=["enter","license"],this.hasStyle=!f.Jodit.fatMode,this.sources=[]}afterInit(e){this.popup=new c.G(e),this.popup.setMod("padding",!1),this.list=new h(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.i.isNode(o)||(o=e.createInside.fromHTML(o)),((e,t)=>{var o,n,i;let{startContainer:s,startOffset:r}=e;if(u.i.isText(s)||(s=s.childNodes[r-1],u.i.isText(s)&&(r=null!==(n=null===(o=s.nodeValue)||void 0===o?void 0:o.length)&&void 0!==n?n:0)),u.i.isText(s)){const o=null!==(i=s.nodeValue)&&void 0!==i?i:"",n=o.substring(0,r),l=o.substring(r),u=n.split(" ");u[u.length-1]="";const c=u.join(" ");s.nodeValue=c+l,e.setStart(s,c.length),e.insertNode(t)}})(e.s.range,o),this.j.s.setCursorAfter(o),this.j.synchronizeValues(),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(m.isControlKey(e.key)||!n.isInsideArea||!n.isCollapsed)return;const i=(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,s=i&&(e=>{var t,o,n,i;const{startContainer:s,startOffset:r}=e;if(u.i.isText(s))return null!==(o=null===(t=s.nodeValue)||void 0===t?void 0:t.substr(0,r))&&void 0!==o?o:"";const l=s.childNodes[r];if(!l)return"";if(u.i.isText(l))return null!==(n=l.nodeValue)&&void 0!==n?n:"";const c=u.i.findNotEmptyNeighbor(l,!0,s);return u.i.isText(c)&&null!==(i=l.nodeValue)&&void 0!==i?i:""})(i).split(" ").pop();if(s&&(0,l.trim)(s).length){const e=await this.onAutoComplete(s);if(e.length)return this.openPopup(e)}this.popup.isOpened&&this.popup.close()}onKeyControlDown(e){if(this.popup.isOpened&&m.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:i}=this.j.o.autocomplete;n=o.filter((t=>(0,l.isString)(t)?i(e,t):i(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:i}=this.j.o.autocomplete;return n=n.map((n=>{var i,s;return{itemRenderer:null!==(i=null==o?void 0:o.itemRenderer)&&void 0!==i?i:e,insertValueRenderer:null!==(s=null==o?void 0:o.insertValueRenderer)&&void 0!==s?s:t,...n}})),n.slice(0,i)}return[]}openPopup(e){this.list.build(e),this.popup.open((()=>{const{j:e}=this,t=e.s.range.getBoundingClientRect(),o={left:t.left,top:t.top,height:t.height,width:t.width};if(e.o.iframe&&e.iframe){const t=(0,l.position)(e.iframe,e);o.top+=t.top,o.left+=t.left}return o}))}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],m.prototype,"registerAutocompleteSource",null),(0,n.gn)([(0,r.debounce)()],m.prototype,"onKeyDown",null),(0,n.gn)([r.autobind],m.prototype,"onKeyControlDown",null),(0,n.gn)([r.autobind],m.prototype,"onEnter",null),(0,n.gn)([r.autobind],m.prototype,"onAutoComplete",null),(0,n.gn)([r.autobind],m.prototype,"resolveFeed",null),f.Jodit.plugins.add("autocomplete",m)},70655(e,t,o){function n(e,t,o,n){var i,s=arguments.length,r=3>s?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--)(i=e[l])&&(r=(3>s?i(r):s>3?i(t,o,r):i(t,o))||r);return s>3&&r&&Object.defineProperty(t,o,r),r}o.d(t,{gn(){return n}})}},e=>e(e.s=38096)])}));
@@ -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],{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(43464),r=o(51078),a=o(97770),s=o(98440),c=o(51923),u=o(97029),l=function(t){function e(){var e,o=this;return(o=t.apply(this,n.__spreadArray([],n.__read(arguments),!1))||this).requires=["license"],o.hasStyle=!u.Jodit.fatMode,o.buttons=[{name:"backup.restore",group:"history"}],o.__box=new a.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=this.j.dlg({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,s.Button)(o,{name:"ok",tabIndex:0,variant:"primary",text:"Ok"}),i=(0,s.Button)(o,{variant:"secondary",tabIndex:0,text:"Cancel"}),r=(0,s.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(){o.confirm("Are you sure?",void 0,(function(t){var o;t&&(e.__storage.clear(),null===(o=e.__dialog)||void 0===o||o.close())}))}));var a=new s.UIBlock(o,[r,i,n]);a.container.style.margin="0",a.container.style.justifyContent="flex-end",a.container.style.width="100%",null===(t=this.__dialog)||void 0===t||t.setFooter(a)},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([c.autobind],e.prototype,"onSaveBackup",null),n.__decorate([c.autobind],e.prototype,"onOpenBackupDialog",null),n.__decorate([c.autobind],e.prototype,"onSelectItem",null),e}(i.Plugin);e.backup=l,u.Jodit.plugins.add("backup",l)},98673:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=o(733),i=o(74259),r=o(58706);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(51923),r=o(98440),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(98440),r=o(16892),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(98440),r=o(51923),a=o(86788),s=o(49940),c=o(16892),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
+ !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(10818),r=o(51078),a=o(97770),s=o(98813),c=o(11975),u=o(97029),l=function(t){function e(){var e,o=this;return(o=t.apply(this,n.__spreadArray([],n.__read(arguments),!1))||this).requires=["license"],o.hasStyle=!u.Jodit.fatMode,o.buttons=[{name:"backup.restore",group:"history"}],o.__box=new a.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=this.j.dlg({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,s.Button)(o,{name:"ok",tabIndex:0,variant:"primary",text:"Ok"}),i=(0,s.Button)(o,{variant:"secondary",tabIndex:0,text:"Cancel"}),r=(0,s.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(){o.confirm("Are you sure?",void 0,(function(t){var o;t&&(e.__storage.clear(),null===(o=e.__dialog)||void 0===o||o.close())}))}));var a=new s.UIBlock(o,[r,i,n]);a.container.style.margin="0",a.container.style.justifyContent="flex-end",a.container.style.width="100%",null===(t=this.__dialog)||void 0===t||t.setFooter(a)},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([c.autobind],e.prototype,"onSaveBackup",null),n.__decorate([c.autobind],e.prototype,"onOpenBackupDialog",null),n.__decorate([c.autobind],e.prototype,"onSelectItem",null),e}(i.Plugin);e.backup=l,u.Jodit.plugins.add("backup",l)},98673:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=o(43854),i=o(34759),r=o(78855);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(11975),r=o(98813),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(98813),r=o(47643),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(98813),r=o(11975),a=o(86788),s=o(36257),c=o(47643),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],{62899(t,e,o){"use strict";o.r(e),o.d(e,{backup(){return f}});var i=o(70655),s=o(733),n=o(74259),a=o(58706);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(12240)),(0,a.xl)(o(27892));var r=o(43464);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(98422),h=o(33993),u=o(16892);class d extends h.u1{className(){return"UIBackupItem"}constructor(t,e){super(t),this.data=e,this.container.innerHTML=this.formatDate(e.created),(0,u.attr)(this.container,"tabIndex",0)}formatDate(t){const e=new Date,o=(0,u.isString)(t)?new Date(t):t,i=(e.getTime()-o.getTime())/1e3;return(0,u.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 p=o(49940);let m=class t extends h.qe{className(){return"UIBackupList"}createContainer(t){const e=super.createContainer(t);return(0,u.attr)(e,"tabIndex","-1"),e}constructor(t){super(t),this.elements=[],this.currentSelection=-1,t.e.on(this.container,"keydown",(t=>{switch(t.key){case p.KEY_ENTER:t.preventDefault(),t.stopPropagation(),this.onChoose(this.currentSelection);break;case p.KEY_DOWN:this.selectNext();break;case p.KEY_UP:this.selectPrevious()}}))}build(t){this.clear(),t.forEach(((t,e)=>{const o=new d(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,c.watch)("currentSelection")],m.prototype,"onChangeCurrentSelection",null),(0,i.gn)([c.autobind],m.prototype,"onSelect",null),(0,i.gn)([c.autobind],m.prototype,"onChoose",null),m=(0,i.gn)([c.component],m);let g=class t extends h.u1{className(){return"UIBackupBox"}constructor(t){super(t),this.list=new m(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)}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)([c.autobind],g.prototype,"onSelectItem",null),(0,i.gn)([c.autobind],g.prototype,"onChooseItem",null),g=(0,i.gn)([c.component],g);var v=o(62195);class f extends r.S{constructor(){var t;super(...arguments),this.requires=["license"],this.hasStyle=!v.Jodit.fatMode,this.buttons=[{name:"backup.restore",group:"history"}],this.__box=new g(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=this.j.dlg({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,h.zx)(e,{name:"ok",tabIndex:0,variant:"primary",text:"Ok"}),i=(0,h.zx)(e,{variant:"secondary",tabIndex:0,text:"Cancel"}),s=(0,h.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((()=>{e.confirm("Are you sure?",void 0,(t=>{var e;t&&(this.__storage.clear(),null===(e=this.__dialog)||void 0===e||e.close())}))}));const n=new h.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)([c.autobind],f.prototype,"onSaveBackup",null),(0,i.gn)([c.autobind],f.prototype,"onOpenBackupDialog",null),(0,i.gn)([c.autobind],f.prototype,"onSelectItem",null),v.Jodit.plugins.add("backup",f)},27892(t,e,o){"use strict";o.r(e)},70655(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(){return i}})},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>'}},t=>t(t.s=62899)])}));
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],{62899(t,e,o){"use strict";o.r(e),o.d(e,{backup(){return f}});var i=o(70655),s=o(43854),n=o(34759),a=o(78855);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(12240)),(0,a.xl)(o(27892));var r=o(10818);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(51663),h=o(86673),u=o(47643);class d extends h.u1{className(){return"UIBackupItem"}constructor(t,e){super(t),this.data=e,this.container.innerHTML=this.formatDate(e.created),(0,u.attr)(this.container,"tabIndex",0)}formatDate(t){const e=new Date,o=(0,u.isString)(t)?new Date(t):t,i=(e.getTime()-o.getTime())/1e3;return(0,u.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 p=o(36257);let m=class t extends h.qe{className(){return"UIBackupList"}createContainer(t){const e=super.createContainer(t);return(0,u.attr)(e,"tabIndex","-1"),e}constructor(t){super(t),this.elements=[],this.currentSelection=-1,t.e.on(this.container,"keydown",(t=>{switch(t.key){case p.KEY_ENTER:t.preventDefault(),t.stopPropagation(),this.onChoose(this.currentSelection);break;case p.KEY_DOWN:this.selectNext();break;case p.KEY_UP:this.selectPrevious()}}))}build(t){this.clear(),t.forEach(((t,e)=>{const o=new d(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,c.watch)("currentSelection")],m.prototype,"onChangeCurrentSelection",null),(0,i.gn)([c.autobind],m.prototype,"onSelect",null),(0,i.gn)([c.autobind],m.prototype,"onChoose",null),m=(0,i.gn)([c.component],m);let g=class t extends h.u1{className(){return"UIBackupBox"}constructor(t){super(t),this.list=new m(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)}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)([c.autobind],g.prototype,"onSelectItem",null),(0,i.gn)([c.autobind],g.prototype,"onChooseItem",null),g=(0,i.gn)([c.component],g);var v=o(1120);class f extends r.S{constructor(){var t;super(...arguments),this.requires=["license"],this.hasStyle=!v.Jodit.fatMode,this.buttons=[{name:"backup.restore",group:"history"}],this.__box=new g(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=this.j.dlg({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,h.zx)(e,{name:"ok",tabIndex:0,variant:"primary",text:"Ok"}),i=(0,h.zx)(e,{variant:"secondary",tabIndex:0,text:"Cancel"}),s=(0,h.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((()=>{e.confirm("Are you sure?",void 0,(t=>{var e;t&&(this.__storage.clear(),null===(e=this.__dialog)||void 0===e||e.close())}))}));const n=new h.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)([c.autobind],f.prototype,"onSaveBackup",null),(0,i.gn)([c.autobind],f.prototype,"onOpenBackupDialog",null),(0,i.gn)([c.autobind],f.prototype,"onSelectItem",null),v.Jodit.plugins.add("backup",f)},27892(t,e,o){"use strict";o.r(e)},70655(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(){return i}})},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>'}},t=>t(t.s=62899)])}));