@ckeditor/ckeditor5-export-word 0.0.0-nightly-20231029.0 → 0.0.0-nightly-20231031.0

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.
@@ -2,4 +2,4 @@
2
2
  /*!
3
3
  * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
4
4
  * For licensing, see LICENSE.md.
5
- */(()=>{var t={704:(t,e,o)=>{t.exports=o(79)("./src/core.js")},273:(t,e,o)=>{t.exports=o(79)("./src/ui.js")},79:t=>{"use strict";t.exports=CKEditor5.dll}},e={};function o(n){var r=e[n];if(void 0!==r)return r.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,o),i.exports}o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";o.r(n),o.d(n,{ExportWord:()=>u});var t=o(704),e=o(273);const r=["fetch","CommentsRepository","trim","join","data-cke","cssRules","length","warn","author","suggestions","users","name","plugins","getCommentThreads","push","TrackChanges","cssText","EDITOR_STYLES",".ck-content","from","indexOf","get","comments","timeZone","has","The editor stylesheet could not be found in the document. Check your webpack config – style-loader should use data-cke=true attribute for the editor stylesheet.","keys","then",":root","all","createdAt","text","Users","ownerNode"];var i,s;i=r,s=426,function(t){for(;--t;)i.push(i.shift())}(++s);const c=function(t,e){return r[t-=0]};function a(){const t=[],e=[];for(const o of Array.from(document.styleSheets))if(o[c("0xf")].hasAttribute(c("0x14")))for(const n of Array[c("0x1")](o[c("0x15")]))-1!==n.cssText[c("0x2")](c("0x0"))?t[c("0x1e")](n[c("0x20")]):-1!==n[c("0x20")][c("0x2")](c("0xa"))&&e[c("0x1e")](n.cssText);return t[c("0x16")]||console[c("0x17")](c("0x7")),[...e,...t][c("0x13")](" ")[c("0x12")]()}function d(t){const e=t[c("0x1c")][c("0x6")](c("0xe")),o=t[c("0x1c")][c("0x6")](c("0x11")),n=t.plugins[c("0x6")](c("0x1f")),r={};if(e&&o){const e=function(t){const e={};if(!t[c("0x16")])return e;for(const o of t)o.comments.map((t=>{void 0===e[o.id]&&(e[o.id]=[]),e[o.id][c("0x1e")]({author:t[c("0x18")][c("0x1b")],content:t.content,created:t[c("0xc")],is_resolved:o.isResolved})}));return e}(t[c("0x1c")].get("CommentsRepository")[c("0x1d")]({skipNotAttached:!0,skipEmpty:!0}));Object[c("0x8")](e)[c("0x16")]&&(r[c("0x4")]=e)}if(e&&n){const e=t[c("0x1c")][c("0x3")](c("0x1f")),o=t.plugins[c("0x3")](c("0xe")),n=function(t,e){const o={};if(!t[c("0x16")]||!e[c("0x16")])return o;for(const n of t)o[n.id]={author:e[c("0x3")](n.authorId)[c("0x1b")],created:n[c("0xc")]};return o}(e.getSuggestions({toJSON:!0}),o[c("0x1a")]);Object[c("0x8")](n)[c("0x16")]&&(r[c("0x19")]=n)}return(r[c("0x19")]||r[c("0x4")])&&(r.timezone=(new Intl.DateTimeFormat).resolvedOptions()[c("0x5")]),r}class l extends t.Command{constructor(t){super(t),this.set("isBusy",!1),this.affectsData=!1}refresh(){this.isEnabled=!this.isBusy,this.value=this.isBusy?"pending":void 0}execute(t={}){const e=this.editor,o=e.t,n=t.converterUrl||"https://docx-converter.cke-cs.com/v1/convert",r=t.converterOptions||{},i=e.plugins.get("ExportWord"),s=t.token||i._token,l=!1!==r.auto_pagination,u=t.dataCallback||(t=>t.data.get({pagination:l}));return this.isBusy=!0,this.refresh(),function(t){if(!t)return new Promise((t=>t("")));const e=[];for(const o of t)c("0x21")!==o?e[c("0x1e")](window[c("0x10")](o)[c("0x9")]((t=>t[c("0xd")]()))):e[c("0x1e")](a());return Promise[c("0xb")](e)[c("0x9")]((t=>t.join(" ")[c("0x12")]()))}(t.stylesheets||["EDITOR_STYLES"]).then((async o=>{const i=await u(e),c={html:'<div class="ck-content" dir="'+e.locale.contentLanguageDirection+'">'+i+"</div>",css:o,options:{...r,...d(e)}},a={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/docx",...s?{Authorization:s.value}:null},body:JSON.stringify(c)};return window.fetch(n,a).then((t=>{if(200!==t.status)throw t;return t.blob()})).then((e=>{const o="function"==typeof t.fileName?t.fileName():t.fileName;this._downloadFile(e,o||"document.docx")}))})).catch((t=>{throw e.plugins.get("Notification").showWarning(o("An error occurred while generating the Word file.")),t})).finally((()=>{this.isBusy=!1,this.refresh()}))}_downloadFile(t,e){const o=document.createElement("a");o.href=window.URL.createObjectURL(t),o.download=e,o.click(),o.remove()}}class u extends t.Plugin{static get pluginName(){return"ExportWord"}static get requires(){return["CloudServices",e.Notification]}init(){const t=this.editor,o=t.t,n=t.config.get("exportWord")||{};t.commands.add("exportWord",new l(t)),t.ui.componentFactory.add("exportWord",(r=>{const i=t.commands.get("exportWord"),s=new e.ButtonView(r),c=new e.SpinnerView;return s.set({label:o("Export to Word"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M17.826 16.843a.75.75 0 0 0-1.152-.96L15.5 17.29V12H14v5.29l-1.174-1.408a.75.75 0 0 0-1.152.96l2.346 2.816a.95.95 0 0 0 1.46 0l2.346-2.815Z"/><path d="m14 0 5 4.5v9.741a2.737 2.737 0 0 0-1.5-.617V6.5h-5v-5h-8v3H3V0h11Zm0 2v3h3.3L14 2Z"/><path d="M3 17.5h6.746c.1.22.23.429.391.623l.731.877H3v-1.5Z"/><path d="M8.5 6a1.5 1.5 0 0 1 1.493 1.356L10 7.5v7a1.5 1.5 0 0 1-1.356 1.493L8.5 16h-7a1.5 1.5 0 0 1-1.493-1.356L0 14.5v-7a1.5 1.5 0 0 1 1.356-1.493L1.5 6h7ZM7.483 8.795l-.042.088-.986 2.534-.947-2.528-.043-.092a.601.601 0 0 0-1.042.008l-.042.093-.883 2.465-.937-2.475-.042-.089a.6.6 0 0 0-1.107.42l.027.093 1.514 4 .044.092a.6.6 0 0 0 1.041-.01l.041-.092.88-2.458.925 2.467.046.096a.6.6 0 0 0 1.032 0l.043-.09 1.554-4 .028-.093a.6.6 0 0 0-1.104-.43v.001Z"/></svg>\n',tooltip:!0}),s.children.add(c),s.bind("isOn","isEnabled").to(i,"isBusy","isEnabled"),c.bind("isVisible").to(i,"isBusy"),s.iconView.bind("isVisible").to(i,"isBusy",(t=>!t)),this.listenTo(s,"execute",(()=>{t.execute("exportWord",n),t.editing.view.focus()})),s}));const r=t.plugins.get("CloudServices");!1===n.tokenUrl?this._token=null:n.tokenUrl?r.registerTokenUrl(n.tokenUrl).then((t=>{this._token=t})):this._token=r.token}}})(),(window.CKEditor5=window.CKEditor5||{}).exportWord=n})();
5
+ */(()=>{var t={704:(t,e,o)=>{t.exports=o(79)("./src/core.js")},273:(t,e,o)=>{t.exports=o(79)("./src/ui.js")},79:t=>{"use strict";t.exports=CKEditor5.dll}},e={};function o(n){var r=e[n];if(void 0!==r)return r.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,o),i.exports}o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";o.r(n),o.d(n,{ExportWord:()=>x});var t=o(704),e=o(273);const r=["name","keys","timezone","timeZone",".ck-content","getCommentThreads","text","TrackChanges","join","isResolved","all","content","EDITOR_STYLES","ownerNode","resolvedOptions","indexOf","get","author","comments","Users","push","CommentsRepository","suggestions","trim","DateTimeFormat",":root","map","cssRules","warn","length","cssText","from","hasAttribute","styleSheets","has","plugins","authorId","fetch","createdAt","then"];var i,s;i=r,s=183,function(t){for(;--t;)i.push(i.shift())}(++s);const c=function(t,e){return r[t-=0]};function a(){const t=[],e=[];for(const o of Array.from(document[c("0xa")]))if(o[c("0x1e")][c("0x9")]("data-cke"))for(const n of Array[c("0x8")](o[c("0x4")]))-1!==n[c("0x7")][c("0x20")](c("0x15"))?t[c("0x25")](n[c("0x7")]):-1!==n[c("0x7")][c("0x20")](c("0x2"))&&e[c("0x25")](n.cssText);return t.length||console[c("0x5")]("The editor stylesheet could not be found in the document. Check your webpack config – style-loader should use data-cke=true attribute for the editor stylesheet."),[...e,...t][c("0x19")](" ")[c("0x0")]()}function d(t){const e=t.plugins.has(c("0x24")),o=t[c("0xc")][c("0xb")](c("0x26")),n=t[c("0xc")][c("0xb")](c("0x18")),r={};if(e&&o){const e=function(t){const e={};if(!t.length)return e;for(const o of t)o[c("0x23")][c("0x3")]((t=>{void 0===e[o.id]&&(e[o.id]=[]),e[o.id].push({author:t[c("0x22")].name,content:t[c("0x1c")],created:t.createdAt,is_resolved:o[c("0x1a")]})}));return e}(t[c("0xc")][c("0x21")]("CommentsRepository")[c("0x16")]({skipNotAttached:!0,skipEmpty:!0}));Object[c("0x12")](e).length&&(r[c("0x23")]=e)}if(e&&n){const e=t[c("0xc")][c("0x21")](c("0x18")),o=t[c("0xc")][c("0x21")](c("0x24")),n=function(t,e){const o={};if(!t[c("0x6")]||!e[c("0x6")])return o;for(const n of t)o[n.id]={author:e[c("0x21")](n[c("0xd")])[c("0x11")],created:n[c("0xf")]};return o}(e.getSuggestions({toJSON:!0}),o.users);Object[c("0x12")](n)[c("0x6")]&&(r[c("0x27")]=n)}return(r[c("0x27")]||r[c("0x23")])&&(r[c("0x13")]=(new(Intl[c("0x1")]))[c("0x1f")]()[c("0x14")]),r}class l extends t.Command{constructor(t){super(t),this.set("isBusy",!1),this.affectsData=!1}refresh(){this.isEnabled=!this.isBusy,this.value=this.isBusy?"pending":void 0}execute(t={}){const e=this.editor,o=e.t,n=t.converterUrl||"https://docx-converter.cke-cs.com/v1/convert",r=t.converterOptions||{},i=e.plugins.get("ExportWord"),s=t.token||i._token,l=!1!==r.auto_pagination,x=t.dataCallback||(t=>t.data.get({pagination:l}));return this.isBusy=!0,this.refresh(),function(t){if(!t)return new Promise((t=>t("")));const e=[];for(const o of t)c("0x1d")!==o?e[c("0x25")](window[c("0xe")](o)[c("0x10")]((t=>t[c("0x17")]()))):e[c("0x25")](a());return Promise[c("0x1b")](e)[c("0x10")]((t=>t[c("0x19")](" ")[c("0x0")]()))}(t.stylesheets||["EDITOR_STYLES"]).then((async o=>{const i=await x(e),c={html:'<div class="ck-content" dir="'+e.locale.contentLanguageDirection+'">'+i+"</div>",css:o,options:{...r,...d(e)}},a={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/docx",...s?{Authorization:s.value}:null},body:JSON.stringify(c)};return window.fetch(n,a).then((t=>{if(200!==t.status)throw t;return t.blob()})).then((e=>{const o="function"==typeof t.fileName?t.fileName():t.fileName;this._downloadFile(e,o||"document.docx")}))})).catch((t=>{throw e.plugins.get("Notification").showWarning(o("An error occurred while generating the Word file.")),t})).finally((()=>{this.isBusy=!1,this.refresh()}))}_downloadFile(t,e){const o=document.createElement("a");o.href=window.URL.createObjectURL(t),o.download=e,o.click(),o.remove()}}class x extends t.Plugin{static get pluginName(){return"ExportWord"}static get requires(){return["CloudServices",e.Notification]}init(){const t=this.editor,o=t.t,n=t.config.get("exportWord")||{};t.commands.add("exportWord",new l(t)),t.ui.componentFactory.add("exportWord",(r=>{const i=t.commands.get("exportWord"),s=new e.ButtonView(r),c=new e.SpinnerView;return s.set({label:o("Export to Word"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M17.826 16.843a.75.75 0 0 0-1.152-.96L15.5 17.29V12H14v5.29l-1.174-1.408a.75.75 0 0 0-1.152.96l2.346 2.816a.95.95 0 0 0 1.46 0l2.346-2.815Z"/><path d="m14 0 5 4.5v9.741a2.737 2.737 0 0 0-1.5-.617V6.5h-5v-5h-8v3H3V0h11Zm0 2v3h3.3L14 2Z"/><path d="M3 17.5h6.746c.1.22.23.429.391.623l.731.877H3v-1.5Z"/><path d="M8.5 6a1.5 1.5 0 0 1 1.493 1.356L10 7.5v7a1.5 1.5 0 0 1-1.356 1.493L8.5 16h-7a1.5 1.5 0 0 1-1.493-1.356L0 14.5v-7a1.5 1.5 0 0 1 1.356-1.493L1.5 6h7ZM7.483 8.795l-.042.088-.986 2.534-.947-2.528-.043-.092a.601.601 0 0 0-1.042.008l-.042.093-.883 2.465-.937-2.475-.042-.089a.6.6 0 0 0-1.107.42l.027.093 1.514 4 .044.092a.6.6 0 0 0 1.041-.01l.041-.092.88-2.458.925 2.467.046.096a.6.6 0 0 0 1.032 0l.043-.09 1.554-4 .028-.093a.6.6 0 0 0-1.104-.43v.001Z"/></svg>\n',tooltip:!0}),s.children.add(c),s.bind("isOn","isEnabled").to(i,"isBusy","isEnabled"),c.bind("isVisible").to(i,"isBusy"),s.iconView.bind("isVisible").to(i,"isBusy",(t=>!t)),this.listenTo(s,"execute",(()=>{t.execute("exportWord",n),t.editing.view.focus()})),s}));const r=t.plugins.get("CloudServices");!1===n.tokenUrl?this._token=null:n.tokenUrl?r.registerTokenUrl(n.tokenUrl).then((t=>{this._token=t})):this._token=r.token}}})(),(window.CKEditor5=window.CKEditor5||{}).exportWord=n})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-export-word",
3
- "version": "0.0.0-nightly-20231029.0",
3
+ "version": "0.0.0-nightly-20231031.0",
4
4
  "description": "Export to Word feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "main": "src/index.js",
31
31
  "dependencies": {
32
- "ckeditor5": "0.0.0-nightly-20231029.0"
32
+ "ckeditor5": "0.0.0-nightly-20231031.0"
33
33
  },
34
34
  "license": "SEE LICENSE IN LICENSE.md",
35
35
  "author": "CKSource (https://cksource.com/)",
package/src/exportword.js CHANGED
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Plugin as _0x3eb175}from'ckeditor5/src/core';import{ButtonView as _0x4cdcc1,Notification as _0x5d4c65,SpinnerView as _0x1aab7b}from'ckeditor5/src/ui';import _0x30f706 from'./exportwordcommand';import _0x233515 from'../theme/icons/exportword.svg';export default class d extends _0x3eb175{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x5d4c65];}['init'](){const _0x4d7ee7=this['editor'],t=_0x4d7ee7['t'],_0x47b6e3=_0x4d7ee7['config']['get']('exportWord')||{};_0x4d7ee7['commands']['add']('exportWord',new _0x30f706(_0x4d7ee7)),_0x4d7ee7['ui']['componentFactory']['add']('exportWord',_0xccb00=>{const _0xc59b2a=_0x4d7ee7['commands']['get']('exportWord'),_0xf02d64=new _0x4cdcc1(_0xccb00),_0x317037=new _0x1aab7b();return _0xf02d64['set']({'label':t('Export\x20to\x20Word'),'icon':_0x233515,'tooltip':!0x0}),_0xf02d64['children']['add'](_0x317037),_0xf02d64['bind']('isOn','isEnabled')['to'](_0xc59b2a,'isBusy','isEnabled'),_0x317037['bind']('isVisible')['to'](_0xc59b2a,'isBusy'),_0xf02d64['iconView']['bind']('isVisible')['to'](_0xc59b2a,'isBusy',_0x3a1256=>!_0x3a1256),this['listenTo'](_0xf02d64,'execute',()=>{_0x4d7ee7['execute']('exportWord',_0x47b6e3),_0x4d7ee7['editing']['view']['focus']();}),_0xf02d64;});const _0x5508d6=_0x4d7ee7['plugins']['get']('CloudServices');!0x1===_0x47b6e3['tokenUrl']?this['_token']=null:_0x47b6e3['tokenUrl']?_0x5508d6['registerTokenUrl'](_0x47b6e3['tokenUrl'])['then'](_0x5771ac=>{this['_token']=_0x5771ac;}):this['_token']=_0x5508d6['token'];}}
23
+ import{Plugin as _0x2a1db7}from'ckeditor5/src/core';import{ButtonView as _0x10f9dc,Notification as _0xf39f2d,SpinnerView as _0x52f00c}from'ckeditor5/src/ui';import _0xaef2cc from'./exportwordcommand';import _0x545941 from'../theme/icons/exportword.svg';export default class d extends _0x2a1db7{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0xf39f2d];}['init'](){const _0x21e842=this['editor'],t=_0x21e842['t'],_0x4beb28=_0x21e842['config']['get']('exportWord')||{};_0x21e842['commands']['add']('exportWord',new _0xaef2cc(_0x21e842)),_0x21e842['ui']['componentFactory']['add']('exportWord',_0x572c41=>{const _0x4a12dc=_0x21e842['commands']['get']('exportWord'),_0x162c37=new _0x10f9dc(_0x572c41),_0x3053e7=new _0x52f00c();return _0x162c37['set']({'label':t('Export\x20to\x20Word'),'icon':_0x545941,'tooltip':!0x0}),_0x162c37['children']['add'](_0x3053e7),_0x162c37['bind']('isOn','isEnabled')['to'](_0x4a12dc,'isBusy','isEnabled'),_0x3053e7['bind']('isVisible')['to'](_0x4a12dc,'isBusy'),_0x162c37['iconView']['bind']('isVisible')['to'](_0x4a12dc,'isBusy',_0x27d0b7=>!_0x27d0b7),this['listenTo'](_0x162c37,'execute',()=>{_0x21e842['execute']('exportWord',_0x4beb28),_0x21e842['editing']['view']['focus']();}),_0x162c37;});const _0x362c28=_0x21e842['plugins']['get']('CloudServices');!0x1===_0x4beb28['tokenUrl']?this['_token']=null:_0x4beb28['tokenUrl']?_0x362c28['registerTokenUrl'](_0x4beb28['tokenUrl'])['then'](_0x3b3409=>{this['_token']=_0x3b3409;}):this['_token']=_0x362c28['token'];}}
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Command as _0x1a3b0f}from'ckeditor5/src/core';import{getStyles as _0xa154cc,getConverterOptions as _0x1d9c2e}from'./utils';export default class s extends _0x1a3b0f{constructor(_0x3670db){super(_0x3670db),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x4536b5={}){const _0x5b423a=this['editor'],t=_0x5b423a['t'],_0x1c4d97=_0x4536b5['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x23c26b=_0x4536b5['converterOptions']||{},_0xda5be6=_0x5b423a['plugins']['get']('ExportWord'),_0x380f3b=_0x4536b5['token']||_0xda5be6['_token'],_0x4e4ede=!0x1!==_0x23c26b['auto_pagination'],_0x1f5845=_0x4536b5['dataCallback']||(_0x2e2f11=>_0x2e2f11['data']['get']({'pagination':_0x4e4ede}));return this['isBusy']=!0x0,this['refresh'](),_0xa154cc(_0x4536b5['stylesheets']||['EDITOR_STYLES'])['then'](async _0x57ec4b=>{const _0x1c9127=await _0x1f5845(_0x5b423a),_0x46d384={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x5b423a['locale']['contentLanguageDirection']+'\x22>'+_0x1c9127+'</div>','css':_0x57ec4b,'options':{..._0x23c26b,..._0x1d9c2e(_0x5b423a)}},_0x198289={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x380f3b?{'Authorization':_0x380f3b['value']}:null},'body':JSON['stringify'](_0x46d384)};return window['fetch'](_0x1c4d97,_0x198289)['then'](_0x43acc0=>{if(0xc8!==_0x43acc0['status'])throw _0x43acc0;return _0x43acc0['blob']();})['then'](_0x17a790=>{const _0x324345='function'==typeof _0x4536b5['fileName']?_0x4536b5['fileName']():_0x4536b5['fileName'];this['_downloadFile'](_0x17a790,_0x324345||'document.docx');});})['catch'](_0x2b8e2b=>{throw _0x5b423a['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x2b8e2b;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0xf1f365,_0x8dd1a){const _0x29d6cf=document['createElement']('a');_0x29d6cf['href']=window['URL']['createObjectURL'](_0xf1f365),_0x29d6cf['download']=_0x8dd1a,_0x29d6cf['click'](),_0x29d6cf['remove']();}}
23
+ import{Command as _0x28f1e6}from'ckeditor5/src/core';import{getStyles as _0xa4825a,getConverterOptions as _0xe22fa1}from'./utils';export default class s extends _0x28f1e6{constructor(_0x578b87){super(_0x578b87),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x836b3d={}){const _0x47ee27=this['editor'],t=_0x47ee27['t'],_0x579f7e=_0x836b3d['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x5b662e=_0x836b3d['converterOptions']||{},_0x48a023=_0x47ee27['plugins']['get']('ExportWord'),_0x41bc27=_0x836b3d['token']||_0x48a023['_token'],_0x580559=!0x1!==_0x5b662e['auto_pagination'],_0xbc599c=_0x836b3d['dataCallback']||(_0x339f58=>_0x339f58['data']['get']({'pagination':_0x580559}));return this['isBusy']=!0x0,this['refresh'](),_0xa4825a(_0x836b3d['stylesheets']||['EDITOR_STYLES'])['then'](async _0x3b0114=>{const _0x58e20d=await _0xbc599c(_0x47ee27),_0x1d0ba6={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x47ee27['locale']['contentLanguageDirection']+'\x22>'+_0x58e20d+'</div>','css':_0x3b0114,'options':{..._0x5b662e,..._0xe22fa1(_0x47ee27)}},_0x5b9e34={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x41bc27?{'Authorization':_0x41bc27['value']}:null},'body':JSON['stringify'](_0x1d0ba6)};return window['fetch'](_0x579f7e,_0x5b9e34)['then'](_0x1b9b09=>{if(0xc8!==_0x1b9b09['status'])throw _0x1b9b09;return _0x1b9b09['blob']();})['then'](_0x4be728=>{const _0x351168='function'==typeof _0x836b3d['fileName']?_0x836b3d['fileName']():_0x836b3d['fileName'];this['_downloadFile'](_0x4be728,_0x351168||'document.docx');});})['catch'](_0x399548=>{throw _0x47ee27['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x399548;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0x87320c,_0x44e453){const _0x93802b=document['createElement']('a');_0x93802b['href']=window['URL']['createObjectURL'](_0x87320c),_0x93802b['download']=_0x44e453,_0x93802b['click'](),_0x93802b['remove']();}}
package/src/utils.js CHANGED
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0xc373=['fetch','CommentsRepository','trim','join','data-cke','cssRules','length','warn','author','suggestions','users','name','plugins','getCommentThreads','push','TrackChanges','cssText','EDITOR_STYLES','.ck-content','from','indexOf','get','comments','timeZone','has','The\x20editor\x20stylesheet\x20could\x20not\x20be\x20found\x20in\x20the\x20document.\x20Check\x20your\x20webpack\x20config\x20–\x20style-loader\x20should\x20use\x20data-cke=true\x20attribute\x20for\x20the\x20editor\x20stylesheet.','keys','then',':root','all','createdAt','text','Users','ownerNode'];(function(_0x4dc34f,_0xc37338){const _0x55f022=function(_0x58e79f){while(--_0x58e79f){_0x4dc34f['push'](_0x4dc34f['shift']());}};_0x55f022(++_0xc37338);}(_0xc373,0x1aa));const _0x55f0=function(_0x4dc34f,_0xc37338){_0x4dc34f=_0x4dc34f-0x0;let _0x55f022=_0xc373[_0x4dc34f];return _0x55f022;};export function getStyles(_0x5d653c){if(!_0x5d653c)return new Promise(_0x3ae653=>_0x3ae653(''));const _0x2b2a2e=[];for(const _0x3b265c of _0x5d653c)_0x55f0('0x21')!==_0x3b265c?_0x2b2a2e[_0x55f0('0x1e')](window[_0x55f0('0x10')](_0x3b265c)[_0x55f0('0x9')](_0xa4f547=>_0xa4f547[_0x55f0('0xd')]())):_0x2b2a2e[_0x55f0('0x1e')](u());return Promise[_0x55f0('0xb')](_0x2b2a2e)[_0x55f0('0x9')](_0x1c4996=>_0x1c4996['join']('\x20')[_0x55f0('0x12')]());}function u(){const _0x48eeaa=[],_0x27e612=[];for(const _0x5ccba7 of Array['from'](document['styleSheets'])){if(_0x5ccba7[_0x55f0('0xf')]['hasAttribute'](_0x55f0('0x14')))for(const _0x5ed362 of Array[_0x55f0('0x1')](_0x5ccba7[_0x55f0('0x15')]))-0x1!==_0x5ed362['cssText'][_0x55f0('0x2')](_0x55f0('0x0'))?_0x48eeaa[_0x55f0('0x1e')](_0x5ed362[_0x55f0('0x20')]):-0x1!==_0x5ed362[_0x55f0('0x20')][_0x55f0('0x2')](_0x55f0('0xa'))&&_0x27e612[_0x55f0('0x1e')](_0x5ed362['cssText']);}return _0x48eeaa[_0x55f0('0x16')]||console[_0x55f0('0x17')](_0x55f0('0x7')),[..._0x27e612,..._0x48eeaa][_0x55f0('0x13')]('\x20')[_0x55f0('0x12')]();}export function getConverterOptions(_0xc21d29){const _0x25950e=_0xc21d29[_0x55f0('0x1c')][_0x55f0('0x6')](_0x55f0('0xe')),_0x3398d7=_0xc21d29[_0x55f0('0x1c')][_0x55f0('0x6')](_0x55f0('0x11')),_0x4168a6=_0xc21d29['plugins'][_0x55f0('0x6')](_0x55f0('0x1f')),_0x11d911={};if(_0x25950e&&_0x3398d7){const _0x120dce=getComments(_0xc21d29[_0x55f0('0x1c')]['get']('CommentsRepository')[_0x55f0('0x1d')]({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object[_0x55f0('0x8')](_0x120dce)[_0x55f0('0x16')]&&(_0x11d911[_0x55f0('0x4')]=_0x120dce);}if(_0x25950e&&_0x4168a6){const _0x2605a4=_0xc21d29[_0x55f0('0x1c')][_0x55f0('0x3')](_0x55f0('0x1f')),_0x499274=_0xc21d29['plugins'][_0x55f0('0x3')](_0x55f0('0xe')),_0x3be96d=getSuggestions(_0x2605a4['getSuggestions']({'toJSON':!0x0}),_0x499274[_0x55f0('0x1a')]);Object[_0x55f0('0x8')](_0x3be96d)[_0x55f0('0x16')]&&(_0x11d911[_0x55f0('0x19')]=_0x3be96d);}return(_0x11d911[_0x55f0('0x19')]||_0x11d911[_0x55f0('0x4')])&&(_0x11d911['timezone']=new Intl['DateTimeFormat']()['resolvedOptions']()[_0x55f0('0x5')]),_0x11d911;}export function getComments(_0x2f4f0f){const _0x5c627d={};if(!_0x2f4f0f[_0x55f0('0x16')])return _0x5c627d;for(const _0x1f6d91 of _0x2f4f0f)_0x1f6d91['comments']['map'](_0x58856b=>{void 0x0===_0x5c627d[_0x1f6d91['id']]&&(_0x5c627d[_0x1f6d91['id']]=[]),_0x5c627d[_0x1f6d91['id']][_0x55f0('0x1e')]({'author':_0x58856b[_0x55f0('0x18')][_0x55f0('0x1b')],'content':_0x58856b['content'],'created':_0x58856b[_0x55f0('0xc')],'is_resolved':_0x1f6d91['isResolved']});});return _0x5c627d;}export function getSuggestions(_0x316b68,_0x1737a9){const _0x49bdbf={};if(!_0x316b68[_0x55f0('0x16')]||!_0x1737a9[_0x55f0('0x16')])return _0x49bdbf;for(const _0x4f4368 of _0x316b68)_0x49bdbf[_0x4f4368['id']]={'author':_0x1737a9[_0x55f0('0x3')](_0x4f4368['authorId'])[_0x55f0('0x1b')],'created':_0x4f4368[_0x55f0('0xc')]};return _0x49bdbf;}
23
+ const _0x2a35=['name','keys','timezone','timeZone','.ck-content','getCommentThreads','text','TrackChanges','join','isResolved','all','content','EDITOR_STYLES','ownerNode','resolvedOptions','indexOf','get','author','comments','Users','push','CommentsRepository','suggestions','trim','DateTimeFormat',':root','map','cssRules','warn','length','cssText','from','hasAttribute','styleSheets','has','plugins','authorId','fetch','createdAt','then'];(function(_0x13dcab,_0x2a3555){const _0x3ebd11=function(_0xdca047){while(--_0xdca047){_0x13dcab['push'](_0x13dcab['shift']());}};_0x3ebd11(++_0x2a3555);}(_0x2a35,0xb7));const _0x3ebd=function(_0x13dcab,_0x2a3555){_0x13dcab=_0x13dcab-0x0;let _0x3ebd11=_0x2a35[_0x13dcab];return _0x3ebd11;};export function getStyles(_0x22f8b8){if(!_0x22f8b8)return new Promise(_0x43c328=>_0x43c328(''));const _0x5032c2=[];for(const _0x186602 of _0x22f8b8)_0x3ebd('0x1d')!==_0x186602?_0x5032c2[_0x3ebd('0x25')](window[_0x3ebd('0xe')](_0x186602)[_0x3ebd('0x10')](_0x50f01a=>_0x50f01a[_0x3ebd('0x17')]())):_0x5032c2[_0x3ebd('0x25')](u());return Promise[_0x3ebd('0x1b')](_0x5032c2)[_0x3ebd('0x10')](_0x5350bb=>_0x5350bb[_0x3ebd('0x19')]('\x20')[_0x3ebd('0x0')]());}function u(){const _0x374e86=[],_0x624d5a=[];for(const _0x1b31a0 of Array['from'](document[_0x3ebd('0xa')])){if(_0x1b31a0[_0x3ebd('0x1e')][_0x3ebd('0x9')]('data-cke'))for(const _0x22db98 of Array[_0x3ebd('0x8')](_0x1b31a0[_0x3ebd('0x4')]))-0x1!==_0x22db98[_0x3ebd('0x7')][_0x3ebd('0x20')](_0x3ebd('0x15'))?_0x374e86[_0x3ebd('0x25')](_0x22db98[_0x3ebd('0x7')]):-0x1!==_0x22db98[_0x3ebd('0x7')][_0x3ebd('0x20')](_0x3ebd('0x2'))&&_0x624d5a[_0x3ebd('0x25')](_0x22db98['cssText']);}return _0x374e86['length']||console[_0x3ebd('0x5')]('The\x20editor\x20stylesheet\x20could\x20not\x20be\x20found\x20in\x20the\x20document.\x20Check\x20your\x20webpack\x20config\x20–\x20style-loader\x20should\x20use\x20data-cke=true\x20attribute\x20for\x20the\x20editor\x20stylesheet.'),[..._0x624d5a,..._0x374e86][_0x3ebd('0x19')]('\x20')[_0x3ebd('0x0')]();}export function getConverterOptions(_0x5c307a){const _0x1b16d7=_0x5c307a['plugins']['has'](_0x3ebd('0x24')),_0x51772c=_0x5c307a[_0x3ebd('0xc')][_0x3ebd('0xb')](_0x3ebd('0x26')),_0xf6fcf9=_0x5c307a[_0x3ebd('0xc')][_0x3ebd('0xb')](_0x3ebd('0x18')),_0x3f3442={};if(_0x1b16d7&&_0x51772c){const _0x4ae996=getComments(_0x5c307a[_0x3ebd('0xc')][_0x3ebd('0x21')]('CommentsRepository')[_0x3ebd('0x16')]({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object[_0x3ebd('0x12')](_0x4ae996)['length']&&(_0x3f3442[_0x3ebd('0x23')]=_0x4ae996);}if(_0x1b16d7&&_0xf6fcf9){const _0xc2f09=_0x5c307a[_0x3ebd('0xc')][_0x3ebd('0x21')](_0x3ebd('0x18')),_0x4ae70b=_0x5c307a[_0x3ebd('0xc')][_0x3ebd('0x21')](_0x3ebd('0x24')),_0x72e167=getSuggestions(_0xc2f09['getSuggestions']({'toJSON':!0x0}),_0x4ae70b['users']);Object[_0x3ebd('0x12')](_0x72e167)[_0x3ebd('0x6')]&&(_0x3f3442[_0x3ebd('0x27')]=_0x72e167);}return(_0x3f3442[_0x3ebd('0x27')]||_0x3f3442[_0x3ebd('0x23')])&&(_0x3f3442[_0x3ebd('0x13')]=new Intl[(_0x3ebd('0x1'))]()[_0x3ebd('0x1f')]()[_0x3ebd('0x14')]),_0x3f3442;}export function getComments(_0x31d7f7){const _0x133cfa={};if(!_0x31d7f7['length'])return _0x133cfa;for(const _0x5a28be of _0x31d7f7)_0x5a28be[_0x3ebd('0x23')][_0x3ebd('0x3')](_0x2248c8=>{void 0x0===_0x133cfa[_0x5a28be['id']]&&(_0x133cfa[_0x5a28be['id']]=[]),_0x133cfa[_0x5a28be['id']]['push']({'author':_0x2248c8[_0x3ebd('0x22')]['name'],'content':_0x2248c8[_0x3ebd('0x1c')],'created':_0x2248c8['createdAt'],'is_resolved':_0x5a28be[_0x3ebd('0x1a')]});});return _0x133cfa;}export function getSuggestions(_0x1b7cb0,_0x1de3c7){const _0x37e3cb={};if(!_0x1b7cb0[_0x3ebd('0x6')]||!_0x1de3c7[_0x3ebd('0x6')])return _0x37e3cb;for(const _0x3b473c of _0x1b7cb0)_0x37e3cb[_0x3b473c['id']]={'author':_0x1de3c7[_0x3ebd('0x21')](_0x3b473c[_0x3ebd('0xd')])[_0x3ebd('0x11')],'created':_0x3b473c[_0x3ebd('0xf')]};return _0x37e3cb;}