@ckeditor/ckeditor5-export-word 0.0.0-nightly-20240204.0 → 0.0.0-nightly-20240206.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-2024, CKSource Holding sp. z o.o. All rights reserved.
4
4
  * For licensing, see LICENSE.md.
5
- */(()=>{var t={968:(t,e,o)=>{t.exports=o(672)("./src/core.js")},348:(t,e,o)=>{t.exports=o(672)("./src/ui.js")},672: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(968),e=o(348);const r=["CommentsRepository","has","trim","resolvedOptions","TrackChanges","name","users","push","then","styleSheets","Users","indexOf","suggestions","plugins","createdAt","from","all","join","timeZone","EDITOR_STYLES","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.","length","keys","author","get","getSuggestions","timezone","cssText",".ck-content","comments","cssRules"];var i,s;i=r,s=281,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("0x7")]))if(o.ownerNode.hasAttribute("data-cke"))for(const n of Array[c("0xd")](o[c("0x1c")]))-1!==n[c("0x19")][c("0x9")](c("0x1a"))?t[c("0x5")](n[c("0x19")]):-1!==n[c("0x19")][c("0x9")](":root")&&e[c("0x5")](n[c("0x19")]);return t[c("0x13")]||console.warn(c("0x12")),[...e,...t][c("0xf")](" ")[c("0x0")]()}function d(t){const e=t[c("0xb")][c("0x1e")](c("0x8")),o=t[c("0xb")].has(c("0x1d")),n=t.plugins[c("0x1e")](c("0x2")),r={};if(e&&o){const e=function(t){const e={};if(!t[c("0x13")])return e;for(const o of t)o.comments.map((t=>{void 0===e[o.id]&&(e[o.id]=[]),e[o.id].push({author:t[c("0x15")][c("0x3")],content:t.content,created:t[c("0xc")],is_resolved:o.isResolved})}));return e}(t.plugins.get("CommentsRepository").getCommentThreads({skipNotAttached:!0,skipEmpty:!0}));Object[c("0x14")](e)[c("0x13")]&&(r[c("0x1b")]=e)}if(e&&n){const e=t.plugins[c("0x16")](c("0x2")),o=t[c("0xb")][c("0x16")](c("0x8")),n=function(t,e){const o={};if(!t[c("0x13")]||!e[c("0x13")])return o;for(const n of t)o[n.id]={author:e[c("0x16")](n.authorId).name,created:n[c("0xc")]};return o}(e[c("0x17")]({toJSON:!0}),o[c("0x4")]);Object[c("0x14")](n).length&&(r[c("0xa")]=n)}return(r[c("0xa")]||r[c("0x1b")])&&(r[c("0x18")]=(new Intl.DateTimeFormat)[c("0x1")]()[c("0x10")]),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("0x11")!==o?e[c("0x5")](window.fetch(o).then((t=>t.text()))):e[c("0x5")](a());return Promise[c("0xe")](e)[c("0x6")]((t=>t[c("0xf")](" ")[c("0x0")]()))}(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={968:(t,e,o)=>{t.exports=o(672)("./src/core.js")},348:(t,e,o)=>{t.exports=o(672)("./src/ui.js")},672: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(968),e=o(348);const r=["getCommentThreads","timezone","DateTimeFormat","Users","push","createdAt","keys","CommentsRepository","cssText","has","getSuggestions","from","content","trim","authorId","EDITOR_STYLES","fetch",".ck-content","comments","all","indexOf","isResolved","plugins","warn","map","TrackChanges","suggestions","then","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.","length","author","styleSheets","hasAttribute","get","name","resolvedOptions"];var i,s;i=r,s=438,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[c("0x5")](document[c("0x19")]))if(o.ownerNode[c("0x1a")]("data-cke"))for(const n of Array[c("0x5")](o.cssRules))-1!==n[c("0x2")][c("0xe")](c("0xb"))?t[c("0x22")](n.cssText):-1!==n[c("0x2")][c("0xe")](":root")&&e[c("0x22")](n[c("0x2")]);return t.length||console[c("0x11")](c("0x16")),[...e,...t].join(" ")[c("0x7")]()}function d(t){const e=t[c("0x10")].has("Users"),o=t[c("0x10")][c("0x3")](c("0x1")),n=t[c("0x10")][c("0x3")](c("0x13")),r={};if(e&&o){const e=function(t){const e={};if(!t[c("0x17")])return e;for(const o of t)o[c("0xc")][c("0x12")]((t=>{void 0===e[o.id]&&(e[o.id]=[]),e[o.id].push({author:t[c("0x18")][c("0x1c")],content:t[c("0x6")],created:t[c("0x23")],is_resolved:o[c("0xf")]})}));return e}(t[c("0x10")][c("0x1b")]("CommentsRepository")[c("0x1e")]({skipNotAttached:!0,skipEmpty:!0}));Object[c("0x0")](e)[c("0x17")]&&(r[c("0xc")]=e)}if(e&&n){const e=t[c("0x10")].get(c("0x13")),o=t.plugins.get(c("0x21")),n=function(t,e){const o={};if(!t.length||!e[c("0x17")])return o;for(const n of t)o[n.id]={author:e.get(n[c("0x8")])[c("0x1c")],created:n[c("0x23")]};return o}(e[c("0x4")]({toJSON:!0}),o.users);Object[c("0x0")](n).length&&(r[c("0x14")]=n)}return(r.suggestions||r[c("0xc")])&&(r[c("0x1f")]=(new(Intl[c("0x20")]))[c("0x1d")]().timeZone),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("0x9")!==o?e.push(window[c("0xa")](o)[c("0x15")]((t=>t.text()))):e[c("0x22")](a());return Promise[c("0xd")](e)[c("0x15")]((t=>t.join(" ")[c("0x7")]()))}(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})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-export-word",
3
- "version": "0.0.0-nightly-20240204.0",
3
+ "version": "0.0.0-nightly-20240206.0",
4
4
  "description": "Export to Word feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -30,7 +30,7 @@
30
30
  "type": "module",
31
31
  "main": "src/index.js",
32
32
  "dependencies": {
33
- "ckeditor5": "0.0.0-nightly-20240204.0"
33
+ "ckeditor5": "0.0.0-nightly-20240206.0"
34
34
  },
35
35
  "license": "SEE LICENSE IN LICENSE.md",
36
36
  "author": "CKSource (https://cksource.com/)",
package/src/exportword.js CHANGED
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Plugin as _0x50d58c}from'ckeditor5/src/core.js';import{ButtonView as _0x454181,Notification as _0x1c9e5a,SpinnerView as _0x4df590}from'ckeditor5/src/ui.js';import _0x255427 from'./exportwordcommand.js';import _0x212e02 from'../theme/icons/exportword.svg';export default class d extends _0x50d58c{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x1c9e5a];}['init'](){const _0x3b3dc2=this['editor'],t=_0x3b3dc2['t'],_0x1ee51e=_0x3b3dc2['config']['get']('exportWord')||{};_0x3b3dc2['commands']['add']('exportWord',new _0x255427(_0x3b3dc2)),_0x3b3dc2['ui']['componentFactory']['add']('exportWord',_0x2178b5=>{const _0x11fe32=_0x3b3dc2['commands']['get']('exportWord'),_0x319ff1=new _0x454181(_0x2178b5),_0x41f06c=new _0x4df590();return _0x319ff1['set']({'label':t('Export\x20to\x20Word'),'icon':_0x212e02,'tooltip':!0x0}),_0x319ff1['children']['add'](_0x41f06c),_0x319ff1['bind']('isOn','isEnabled')['to'](_0x11fe32,'isBusy','isEnabled'),_0x41f06c['bind']('isVisible')['to'](_0x11fe32,'isBusy'),_0x319ff1['iconView']['bind']('isVisible')['to'](_0x11fe32,'isBusy',_0x31bee8=>!_0x31bee8),this['listenTo'](_0x319ff1,'execute',()=>{_0x3b3dc2['execute']('exportWord',_0x1ee51e),_0x3b3dc2['editing']['view']['focus']();}),_0x319ff1;});const _0x5db466=_0x3b3dc2['plugins']['get']('CloudServices');!0x1===_0x1ee51e['tokenUrl']?this['_token']=null:_0x1ee51e['tokenUrl']?_0x5db466['registerTokenUrl'](_0x1ee51e['tokenUrl'])['then'](_0x5f5063=>{this['_token']=_0x5f5063;}):this['_token']=_0x5db466['token'];}}
23
+ import{Plugin as _0x6cbfed}from'ckeditor5/src/core.js';import{ButtonView as _0x3e2f3e,Notification as _0x415fb1,SpinnerView as _0x1977b5}from'ckeditor5/src/ui.js';import _0x538ab8 from'./exportwordcommand.js';import _0xa8f8a7 from'../theme/icons/exportword.svg';export default class d extends _0x6cbfed{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x415fb1];}['init'](){const _0x3a697f=this['editor'],t=_0x3a697f['t'],_0x2ec66d=_0x3a697f['config']['get']('exportWord')||{};_0x3a697f['commands']['add']('exportWord',new _0x538ab8(_0x3a697f)),_0x3a697f['ui']['componentFactory']['add']('exportWord',_0x1a047d=>{const _0x47c35e=_0x3a697f['commands']['get']('exportWord'),_0x5617a2=new _0x3e2f3e(_0x1a047d),_0x4c3538=new _0x1977b5();return _0x5617a2['set']({'label':t('Export\x20to\x20Word'),'icon':_0xa8f8a7,'tooltip':!0x0}),_0x5617a2['children']['add'](_0x4c3538),_0x5617a2['bind']('isOn','isEnabled')['to'](_0x47c35e,'isBusy','isEnabled'),_0x4c3538['bind']('isVisible')['to'](_0x47c35e,'isBusy'),_0x5617a2['iconView']['bind']('isVisible')['to'](_0x47c35e,'isBusy',_0x283ff0=>!_0x283ff0),this['listenTo'](_0x5617a2,'execute',()=>{_0x3a697f['execute']('exportWord',_0x2ec66d),_0x3a697f['editing']['view']['focus']();}),_0x5617a2;});const _0x122c60=_0x3a697f['plugins']['get']('CloudServices');!0x1===_0x2ec66d['tokenUrl']?this['_token']=null:_0x2ec66d['tokenUrl']?_0x122c60['registerTokenUrl'](_0x2ec66d['tokenUrl'])['then'](_0x54b122=>{this['_token']=_0x54b122;}):this['_token']=_0x122c60['token'];}}
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Command as _0x1b8bcf}from'ckeditor5/src/core.js';import{getStyles as _0x58e649,getConverterOptions as _0x52e0f8}from'./utils.js';export default class i extends _0x1b8bcf{constructor(_0x507d3a){super(_0x507d3a),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x4012c9={}){const _0x8f941f=this['editor'],t=_0x8f941f['t'],_0x406483=_0x4012c9['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x3d84c1=_0x4012c9['converterOptions']||{},_0x2acc3b=_0x8f941f['plugins']['get']('ExportWord'),_0x14d1e5=_0x4012c9['token']||_0x2acc3b['_token'],_0x48ec35=!0x1!==_0x3d84c1['auto_pagination'],_0x10b84d=_0x4012c9['dataCallback']||(_0xfdba00=>_0xfdba00['data']['get']({'pagination':_0x48ec35}));return this['isBusy']=!0x0,this['refresh'](),_0x58e649(_0x4012c9['stylesheets']||['EDITOR_STYLES'])['then'](async _0x3c4f29=>{const _0x33ad87=await _0x10b84d(_0x8f941f),_0x401c47={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x8f941f['locale']['contentLanguageDirection']+'\x22>'+_0x33ad87+'</div>','css':_0x3c4f29,'options':{..._0x3d84c1,..._0x52e0f8(_0x8f941f)}},_0x49d219={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x14d1e5?{'Authorization':_0x14d1e5['value']}:null},'body':JSON['stringify'](_0x401c47)};return window['fetch'](_0x406483,_0x49d219)['then'](_0x5bec2a=>{if(0xc8!==_0x5bec2a['status'])throw _0x5bec2a;return _0x5bec2a['blob']();})['then'](_0x49b1a2=>{const _0x1c95c4='function'==typeof _0x4012c9['fileName']?_0x4012c9['fileName']():_0x4012c9['fileName'];this['_downloadFile'](_0x49b1a2,_0x1c95c4||'document.docx');});})['catch'](_0x353248=>{throw _0x8f941f['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x353248;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0x3c5115,_0x406a31){const _0x2a0357=document['createElement']('a');_0x2a0357['href']=window['URL']['createObjectURL'](_0x3c5115),_0x2a0357['download']=_0x406a31,_0x2a0357['click'](),_0x2a0357['remove']();}}
23
+ import{Command as _0x3d21ec}from'ckeditor5/src/core.js';import{getStyles as _0x460548,getConverterOptions as _0x565e73}from'./utils.js';export default class i extends _0x3d21ec{constructor(_0x2aa987){super(_0x2aa987),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x234c93={}){const _0x17e292=this['editor'],t=_0x17e292['t'],_0x169727=_0x234c93['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x4a8606=_0x234c93['converterOptions']||{},_0x1e98c2=_0x17e292['plugins']['get']('ExportWord'),_0x1d4612=_0x234c93['token']||_0x1e98c2['_token'],_0x3242c3=!0x1!==_0x4a8606['auto_pagination'],_0x4640e6=_0x234c93['dataCallback']||(_0x385806=>_0x385806['data']['get']({'pagination':_0x3242c3}));return this['isBusy']=!0x0,this['refresh'](),_0x460548(_0x234c93['stylesheets']||['EDITOR_STYLES'])['then'](async _0x47215f=>{const _0xe3086b=await _0x4640e6(_0x17e292),_0x2b5189={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x17e292['locale']['contentLanguageDirection']+'\x22>'+_0xe3086b+'</div>','css':_0x47215f,'options':{..._0x4a8606,..._0x565e73(_0x17e292)}},_0x311e3d={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x1d4612?{'Authorization':_0x1d4612['value']}:null},'body':JSON['stringify'](_0x2b5189)};return window['fetch'](_0x169727,_0x311e3d)['then'](_0x631aaa=>{if(0xc8!==_0x631aaa['status'])throw _0x631aaa;return _0x631aaa['blob']();})['then'](_0xeaa30=>{const _0x422259='function'==typeof _0x234c93['fileName']?_0x234c93['fileName']():_0x234c93['fileName'];this['_downloadFile'](_0xeaa30,_0x422259||'document.docx');});})['catch'](_0x2d5d51=>{throw _0x17e292['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x2d5d51;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0x1262d3,_0x3c3548){const _0x21556d=document['createElement']('a');_0x21556d['href']=window['URL']['createObjectURL'](_0x1262d3),_0x21556d['download']=_0x3c3548,_0x21556d['click'](),_0x21556d['remove']();}}
package/src/utils.js CHANGED
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x1e92=['CommentsRepository','has','trim','resolvedOptions','TrackChanges','name','users','push','then','styleSheets','Users','indexOf','suggestions','plugins','createdAt','from','all','join','timeZone','EDITOR_STYLES','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.','length','keys','author','get','getSuggestions','timezone','cssText','.ck-content','comments','cssRules'];(function(_0x2b0faa,_0x1e92c0){const _0x5f4aa8=function(_0x8f272a){while(--_0x8f272a){_0x2b0faa['push'](_0x2b0faa['shift']());}};_0x5f4aa8(++_0x1e92c0);}(_0x1e92,0x119));const _0x5f4a=function(_0x2b0faa,_0x1e92c0){_0x2b0faa=_0x2b0faa-0x0;let _0x5f4aa8=_0x1e92[_0x2b0faa];return _0x5f4aa8;};export function getStyles(_0x5cefc9){if(!_0x5cefc9)return new Promise(_0xd1c018=>_0xd1c018(''));const _0x4eba4=[];for(const _0x325b18 of _0x5cefc9)_0x5f4a('0x11')!==_0x325b18?_0x4eba4[_0x5f4a('0x5')](window['fetch'](_0x325b18)['then'](_0x3c0874=>_0x3c0874['text']())):_0x4eba4[_0x5f4a('0x5')](u());return Promise[_0x5f4a('0xe')](_0x4eba4)[_0x5f4a('0x6')](_0x1524da=>_0x1524da[_0x5f4a('0xf')]('\x20')[_0x5f4a('0x0')]());}function u(){const _0x365f31=[],_0x3a5194=[];for(const _0x3e06c1 of Array['from'](document[_0x5f4a('0x7')])){if(_0x3e06c1['ownerNode']['hasAttribute']('data-cke'))for(const _0x5bb23e of Array[_0x5f4a('0xd')](_0x3e06c1[_0x5f4a('0x1c')]))-0x1!==_0x5bb23e[_0x5f4a('0x19')][_0x5f4a('0x9')](_0x5f4a('0x1a'))?_0x365f31[_0x5f4a('0x5')](_0x5bb23e[_0x5f4a('0x19')]):-0x1!==_0x5bb23e[_0x5f4a('0x19')][_0x5f4a('0x9')](':root')&&_0x3a5194[_0x5f4a('0x5')](_0x5bb23e[_0x5f4a('0x19')]);}return _0x365f31[_0x5f4a('0x13')]||console['warn'](_0x5f4a('0x12')),[..._0x3a5194,..._0x365f31][_0x5f4a('0xf')]('\x20')[_0x5f4a('0x0')]();}export function getConverterOptions(_0x3eb956){const _0x40da01=_0x3eb956[_0x5f4a('0xb')][_0x5f4a('0x1e')](_0x5f4a('0x8')),_0x3c5561=_0x3eb956[_0x5f4a('0xb')]['has'](_0x5f4a('0x1d')),_0x2cdfeb=_0x3eb956['plugins'][_0x5f4a('0x1e')](_0x5f4a('0x2')),_0x325131={};if(_0x40da01&&_0x3c5561){const _0x15bd80=getComments(_0x3eb956['plugins']['get']('CommentsRepository')['getCommentThreads']({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object[_0x5f4a('0x14')](_0x15bd80)[_0x5f4a('0x13')]&&(_0x325131[_0x5f4a('0x1b')]=_0x15bd80);}if(_0x40da01&&_0x2cdfeb){const _0x5dde0c=_0x3eb956['plugins'][_0x5f4a('0x16')](_0x5f4a('0x2')),_0xd1fae9=_0x3eb956[_0x5f4a('0xb')][_0x5f4a('0x16')](_0x5f4a('0x8')),_0xd1e313=getSuggestions(_0x5dde0c[_0x5f4a('0x17')]({'toJSON':!0x0}),_0xd1fae9[_0x5f4a('0x4')]);Object[_0x5f4a('0x14')](_0xd1e313)['length']&&(_0x325131[_0x5f4a('0xa')]=_0xd1e313);}return(_0x325131[_0x5f4a('0xa')]||_0x325131[_0x5f4a('0x1b')])&&(_0x325131[_0x5f4a('0x18')]=new Intl['DateTimeFormat']()[_0x5f4a('0x1')]()[_0x5f4a('0x10')]),_0x325131;}export function getComments(_0x4437ea){const _0x8a7dca={};if(!_0x4437ea[_0x5f4a('0x13')])return _0x8a7dca;for(const _0x42c87c of _0x4437ea)_0x42c87c['comments']['map'](_0x2bb0b1=>{void 0x0===_0x8a7dca[_0x42c87c['id']]&&(_0x8a7dca[_0x42c87c['id']]=[]),_0x8a7dca[_0x42c87c['id']]['push']({'author':_0x2bb0b1[_0x5f4a('0x15')][_0x5f4a('0x3')],'content':_0x2bb0b1['content'],'created':_0x2bb0b1[_0x5f4a('0xc')],'is_resolved':_0x42c87c['isResolved']});});return _0x8a7dca;}export function getSuggestions(_0x313c9c,_0x44282c){const _0xfcd6c9={};if(!_0x313c9c[_0x5f4a('0x13')]||!_0x44282c[_0x5f4a('0x13')])return _0xfcd6c9;for(const _0x17d83c of _0x313c9c)_0xfcd6c9[_0x17d83c['id']]={'author':_0x44282c[_0x5f4a('0x16')](_0x17d83c['authorId'])['name'],'created':_0x17d83c[_0x5f4a('0xc')]};return _0xfcd6c9;}
23
+ const _0x1e8a=['getCommentThreads','timezone','DateTimeFormat','Users','push','createdAt','keys','CommentsRepository','cssText','has','getSuggestions','from','content','trim','authorId','EDITOR_STYLES','fetch','.ck-content','comments','all','indexOf','isResolved','plugins','warn','map','TrackChanges','suggestions','then','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.','length','author','styleSheets','hasAttribute','get','name','resolvedOptions'];(function(_0x5091dc,_0x1e8a70){const _0x76ac53=function(_0x1137d3){while(--_0x1137d3){_0x5091dc['push'](_0x5091dc['shift']());}};_0x76ac53(++_0x1e8a70);}(_0x1e8a,0x1b6));const _0x76ac=function(_0x5091dc,_0x1e8a70){_0x5091dc=_0x5091dc-0x0;let _0x76ac53=_0x1e8a[_0x5091dc];return _0x76ac53;};export function getStyles(_0x2feba1){if(!_0x2feba1)return new Promise(_0x15b849=>_0x15b849(''));const _0x53876d=[];for(const _0xd1bf0a of _0x2feba1)_0x76ac('0x9')!==_0xd1bf0a?_0x53876d['push'](window[_0x76ac('0xa')](_0xd1bf0a)[_0x76ac('0x15')](_0x25dd75=>_0x25dd75['text']())):_0x53876d[_0x76ac('0x22')](u());return Promise[_0x76ac('0xd')](_0x53876d)[_0x76ac('0x15')](_0x5bb367=>_0x5bb367['join']('\x20')[_0x76ac('0x7')]());}function u(){const _0x5999db=[],_0x2d723d=[];for(const _0x29d394 of Array[_0x76ac('0x5')](document[_0x76ac('0x19')])){if(_0x29d394['ownerNode'][_0x76ac('0x1a')]('data-cke'))for(const _0x12c456 of Array[_0x76ac('0x5')](_0x29d394['cssRules']))-0x1!==_0x12c456[_0x76ac('0x2')][_0x76ac('0xe')](_0x76ac('0xb'))?_0x5999db[_0x76ac('0x22')](_0x12c456['cssText']):-0x1!==_0x12c456[_0x76ac('0x2')][_0x76ac('0xe')](':root')&&_0x2d723d[_0x76ac('0x22')](_0x12c456[_0x76ac('0x2')]);}return _0x5999db['length']||console[_0x76ac('0x11')](_0x76ac('0x16')),[..._0x2d723d,..._0x5999db]['join']('\x20')[_0x76ac('0x7')]();}export function getConverterOptions(_0x25e05f){const _0x483dc0=_0x25e05f[_0x76ac('0x10')]['has']('Users'),_0x4812e5=_0x25e05f[_0x76ac('0x10')][_0x76ac('0x3')](_0x76ac('0x1')),_0x3af8b0=_0x25e05f[_0x76ac('0x10')][_0x76ac('0x3')](_0x76ac('0x13')),_0x46623c={};if(_0x483dc0&&_0x4812e5){const _0xfbebc2=getComments(_0x25e05f[_0x76ac('0x10')][_0x76ac('0x1b')]('CommentsRepository')[_0x76ac('0x1e')]({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object[_0x76ac('0x0')](_0xfbebc2)[_0x76ac('0x17')]&&(_0x46623c[_0x76ac('0xc')]=_0xfbebc2);}if(_0x483dc0&&_0x3af8b0){const _0x210843=_0x25e05f[_0x76ac('0x10')]['get'](_0x76ac('0x13')),_0x524d1b=_0x25e05f['plugins']['get'](_0x76ac('0x21')),_0x528c57=getSuggestions(_0x210843[_0x76ac('0x4')]({'toJSON':!0x0}),_0x524d1b['users']);Object[_0x76ac('0x0')](_0x528c57)['length']&&(_0x46623c[_0x76ac('0x14')]=_0x528c57);}return(_0x46623c['suggestions']||_0x46623c[_0x76ac('0xc')])&&(_0x46623c[_0x76ac('0x1f')]=new Intl[(_0x76ac('0x20'))]()[_0x76ac('0x1d')]()['timeZone']),_0x46623c;}export function getComments(_0x53f1d8){const _0x57804f={};if(!_0x53f1d8[_0x76ac('0x17')])return _0x57804f;for(const _0x2f7e64 of _0x53f1d8)_0x2f7e64[_0x76ac('0xc')][_0x76ac('0x12')](_0x5b90f8=>{void 0x0===_0x57804f[_0x2f7e64['id']]&&(_0x57804f[_0x2f7e64['id']]=[]),_0x57804f[_0x2f7e64['id']]['push']({'author':_0x5b90f8[_0x76ac('0x18')][_0x76ac('0x1c')],'content':_0x5b90f8[_0x76ac('0x6')],'created':_0x5b90f8[_0x76ac('0x23')],'is_resolved':_0x2f7e64[_0x76ac('0xf')]});});return _0x57804f;}export function getSuggestions(_0x178af4,_0x25af04){const _0x398a53={};if(!_0x178af4['length']||!_0x25af04[_0x76ac('0x17')])return _0x398a53;for(const _0x599b35 of _0x178af4)_0x398a53[_0x599b35['id']]={'author':_0x25af04['get'](_0x599b35[_0x76ac('0x8')])[_0x76ac('0x1c')],'created':_0x599b35[_0x76ac('0x23')]};return _0x398a53;}