@ckeditor/ckeditor5-export-word 0.0.0-nightly-20231102.0 → 0.0.0-nightly-20231104.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.
package/LICENSE.md CHANGED
@@ -2,7 +2,7 @@ Software License Agreement
2
2
  ==========================
3
3
 
4
4
  **CKEditor&nbsp;5 export to Docs feature** (https://ckeditor.com/ckeditor-5/)<br>
5
- Copyright (c) 2003-2023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
5
+ Copyright (c) 20032023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
6
6
 
7
7
  CKEditor&nbsp;5 export to Word feature is licensed under a commercial license and is protected by copyright law.
8
8
  For more details about available licensing options please contact us at sales@cksource.com.
@@ -15,4 +15,4 @@ Where not otherwise indicated, all CKEditor&nbsp;5 export to Word feature conten
15
15
  Trademarks
16
16
  ----------
17
17
 
18
- **CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
18
+ **CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks, or service marks of their respective holders.
@@ -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=["CommentsRepository","text","resolvedOptions","join","data-cke","get","ownerNode","timeZone","keys","content","TrackChanges","trim","hasAttribute","then","suggestions","comments","indexOf","isResolved","all","from","length","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.","warn","has","Users","authorId","plugins","cssRules","fetch","push","timezone","EDITOR_STYLES","getSuggestions","name","createdAt","cssText",".ck-content"];var i,s;i=r,s=376,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("0xd")](document.styleSheets))if(o[c("0x0")][c("0x6")](c("0x23")))for(const n of Array.from(o[c("0x15")]))-1!==n[c("0x1d")].indexOf(c("0x1e"))?t[c("0x17")](n[c("0x1d")]):-1!==n[c("0x1d")][c("0xa")](":root")&&e[c("0x17")](n[c("0x1d")]);return t[c("0xe")]||console[c("0x10")](c("0xf")),[...e,...t][c("0x22")](" ")[c("0x5")]()}function d(t){const e=t[c("0x14")][c("0x11")](c("0x12")),o=t.plugins.has(c("0x1f")),n=t[c("0x14")][c("0x11")](c("0x4")),r={};if(e&&o){const e=function(t){const e={};if(!t.length)return e;for(const o of t)o[c("0x9")].map((t=>{void 0===e[o.id]&&(e[o.id]=[]),e[o.id][c("0x17")]({author:t.author[c("0x1b")],content:t[c("0x3")],created:t.createdAt,is_resolved:o[c("0xb")]})}));return e}(t[c("0x14")][c("0x24")](c("0x1f")).getCommentThreads({skipNotAttached:!0,skipEmpty:!0}));Object.keys(e)[c("0xe")]&&(r[c("0x9")]=e)}if(e&&n){const e=t[c("0x14")][c("0x24")](c("0x4")),o=t[c("0x14")].get(c("0x12")),n=function(t,e){const o={};if(!t[c("0xe")]||!e[c("0xe")])return o;for(const n of t)o[n.id]={author:e[c("0x24")](n[c("0x13")])[c("0x1b")],created:n[c("0x1c")]};return o}(e[c("0x1a")]({toJSON:!0}),o.users);Object[c("0x2")](n).length&&(r.suggestions=n)}return(r[c("0x8")]||r[c("0x9")])&&(r[c("0x18")]=(new Intl.DateTimeFormat)[c("0x21")]()[c("0x1")]),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("0x19")!==o?e[c("0x17")](window[c("0x16")](o).then((t=>t[c("0x20")]()))):e.push(a());return Promise[c("0xc")](e)[c("0x7")]((t=>t[c("0x22")](" ")[c("0x5")]()))}(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 s=e[n]={exports:{}};return t[n](s,s.exports,o),s.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=["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.","text","styleSheets","cssText","name",".ck-content","indexOf","then","content","resolvedOptions","hasAttribute","from","isResolved","fetch","TrackChanges","createdAt","author","Users","join","users","plugins","EDITOR_STYLES","length","CommentsRepository","ownerNode","trim","keys","comments","suggestions","push","has","cssRules","timezone","getSuggestions","DateTimeFormat","map","get"];var s,i;s=r,i=190,function(t){for(;--t;)s.push(s.shift())}(++i);const c=function(t,e){return r[t-=0]};function a(){const t=[],e=[];for(const o of Array[c("0x6")](document[c("0x22")]))if(o[c("0x13")][c("0x5")]("data-cke"))for(const n of Array[c("0x6")](o[c("0x1a")]))-1!==n[c("0x23")][c("0x1")](c("0x0"))?t.push(n[c("0x23")]):-1!==n[c("0x23")][c("0x1")](":root")&&e[c("0x18")](n.cssText);return t[c("0x11")]||console.warn(c("0x20")),[...e,...t][c("0xd")](" ").trim()}function d(t){const e=t.plugins.has(c("0xc")),o=t[c("0xf")].has(c("0x12")),n=t[c("0xf")][c("0x19")](c("0x9")),r={};if(e&&o){const e=function(t){const e={};if(!t[c("0x11")])return e;for(const o of t)o.comments[c("0x1e")]((t=>{void 0===e[o.id]&&(e[o.id]=[]),e[o.id][c("0x18")]({author:t[c("0xb")].name,content:t[c("0x3")],created:t[c("0xa")],is_resolved:o[c("0x7")]})}));return e}(t.plugins[c("0x1f")]("CommentsRepository").getCommentThreads({skipNotAttached:!0,skipEmpty:!0}));Object[c("0x15")](e)[c("0x11")]&&(r.comments=e)}if(e&&n){const e=t[c("0xf")][c("0x1f")](c("0x9")),o=t[c("0xf")][c("0x1f")]("Users"),n=function(t,e){const o={};if(!t[c("0x11")]||!e[c("0x11")])return o;for(const n of t)o[n.id]={author:e.get(n.authorId)[c("0x24")],created:n[c("0xa")]};return o}(e[c("0x1c")]({toJSON:!0}),o[c("0xe")]);Object.keys(n)[c("0x11")]&&(r[c("0x17")]=n)}return(r[c("0x17")]||r[c("0x16")])&&(r[c("0x1b")]=(new(Intl[c("0x1d")]))[c("0x4")]().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||{},s=e.plugins.get("ExportWord"),i=t.token||s._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("0x10")!==o?e[c("0x18")](window[c("0x8")](o)[c("0x2")]((t=>t[c("0x21")]()))):e[c("0x18")](a());return Promise.all(e)[c("0x2")]((t=>t[c("0xd")](" ")[c("0x14")]()))}(t.stylesheets||["EDITOR_STYLES"]).then((async o=>{const s=await u(e),c={html:'<div class="ck-content" dir="'+e.locale.contentLanguageDirection+'">'+s+"</div>",css:o,options:{...r,...d(e)}},a={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/docx",...i?{Authorization:i.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 s=t.commands.get("exportWord"),i=new e.ButtonView(r),c=new e.SpinnerView;return i.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}),i.children.add(c),i.bind("isOn","isEnabled").to(s,"isBusy","isEnabled"),c.bind("isVisible").to(s,"isBusy"),i.iconView.bind("isVisible").to(s,"isBusy",(t=>!t)),this.listenTo(i,"execute",(()=>{t.execute("exportWord",n),t.editing.view.focus()})),i}));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-20231102.0",
3
+ "version": "0.0.0-nightly-20231104.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-20231102.0"
32
+ "ckeditor5": "0.0.0-nightly-20231104.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 _0x11760b}from'ckeditor5/src/core';import{ButtonView as _0x3973cc,Notification as _0x3ebdb5,SpinnerView as _0x267640}from'ckeditor5/src/ui';import _0x152054 from'./exportwordcommand';import _0x3e340a from'../theme/icons/exportword.svg';export default class d extends _0x11760b{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x3ebdb5];}['init'](){const _0x1848a2=this['editor'],t=_0x1848a2['t'],_0x4262d7=_0x1848a2['config']['get']('exportWord')||{};_0x1848a2['commands']['add']('exportWord',new _0x152054(_0x1848a2)),_0x1848a2['ui']['componentFactory']['add']('exportWord',_0x5945e5=>{const _0x242f4c=_0x1848a2['commands']['get']('exportWord'),_0x572c4a=new _0x3973cc(_0x5945e5),_0x2778d3=new _0x267640();return _0x572c4a['set']({'label':t('Export\x20to\x20Word'),'icon':_0x3e340a,'tooltip':!0x0}),_0x572c4a['children']['add'](_0x2778d3),_0x572c4a['bind']('isOn','isEnabled')['to'](_0x242f4c,'isBusy','isEnabled'),_0x2778d3['bind']('isVisible')['to'](_0x242f4c,'isBusy'),_0x572c4a['iconView']['bind']('isVisible')['to'](_0x242f4c,'isBusy',_0x4f7e33=>!_0x4f7e33),this['listenTo'](_0x572c4a,'execute',()=>{_0x1848a2['execute']('exportWord',_0x4262d7),_0x1848a2['editing']['view']['focus']();}),_0x572c4a;});const _0x67bd6e=_0x1848a2['plugins']['get']('CloudServices');!0x1===_0x4262d7['tokenUrl']?this['_token']=null:_0x4262d7['tokenUrl']?_0x67bd6e['registerTokenUrl'](_0x4262d7['tokenUrl'])['then'](_0x47860e=>{this['_token']=_0x47860e;}):this['_token']=_0x67bd6e['token'];}}
23
+ import{Plugin as _0x3ad905}from'ckeditor5/src/core';import{ButtonView as _0x419cdf,Notification as _0x2d9c2d,SpinnerView as _0x3ca8f0}from'ckeditor5/src/ui';import _0x177ef3 from'./exportwordcommand';import _0x290f32 from'../theme/icons/exportword.svg';export default class d extends _0x3ad905{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x2d9c2d];}['init'](){const _0x42af42=this['editor'],t=_0x42af42['t'],_0x596623=_0x42af42['config']['get']('exportWord')||{};_0x42af42['commands']['add']('exportWord',new _0x177ef3(_0x42af42)),_0x42af42['ui']['componentFactory']['add']('exportWord',_0x346af=>{const _0x971454=_0x42af42['commands']['get']('exportWord'),_0x5158de=new _0x419cdf(_0x346af),_0x14bd41=new _0x3ca8f0();return _0x5158de['set']({'label':t('Export\x20to\x20Word'),'icon':_0x290f32,'tooltip':!0x0}),_0x5158de['children']['add'](_0x14bd41),_0x5158de['bind']('isOn','isEnabled')['to'](_0x971454,'isBusy','isEnabled'),_0x14bd41['bind']('isVisible')['to'](_0x971454,'isBusy'),_0x5158de['iconView']['bind']('isVisible')['to'](_0x971454,'isBusy',_0x346d9b=>!_0x346d9b),this['listenTo'](_0x5158de,'execute',()=>{_0x42af42['execute']('exportWord',_0x596623),_0x42af42['editing']['view']['focus']();}),_0x5158de;});const _0x2935e6=_0x42af42['plugins']['get']('CloudServices');!0x1===_0x596623['tokenUrl']?this['_token']=null:_0x596623['tokenUrl']?_0x2935e6['registerTokenUrl'](_0x596623['tokenUrl'])['then'](_0x4a15e2=>{this['_token']=_0x4a15e2;}):this['_token']=_0x2935e6['token'];}}
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Command as _0x56cb9e}from'ckeditor5/src/core';import{getStyles as _0x53a5f0,getConverterOptions as _0x20fc85}from'./utils';export default class s extends _0x56cb9e{constructor(_0x34011c){super(_0x34011c),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x528b24={}){const _0x30c495=this['editor'],t=_0x30c495['t'],_0x25e268=_0x528b24['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x4fdee0=_0x528b24['converterOptions']||{},_0x51606a=_0x30c495['plugins']['get']('ExportWord'),_0xde8a6b=_0x528b24['token']||_0x51606a['_token'],_0x8f9516=!0x1!==_0x4fdee0['auto_pagination'],_0x314a57=_0x528b24['dataCallback']||(_0x4bdb10=>_0x4bdb10['data']['get']({'pagination':_0x8f9516}));return this['isBusy']=!0x0,this['refresh'](),_0x53a5f0(_0x528b24['stylesheets']||['EDITOR_STYLES'])['then'](async _0x86c4ea=>{const _0x1cbf3a=await _0x314a57(_0x30c495),_0x444104={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x30c495['locale']['contentLanguageDirection']+'\x22>'+_0x1cbf3a+'</div>','css':_0x86c4ea,'options':{..._0x4fdee0,..._0x20fc85(_0x30c495)}},_0x4f1850={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0xde8a6b?{'Authorization':_0xde8a6b['value']}:null},'body':JSON['stringify'](_0x444104)};return window['fetch'](_0x25e268,_0x4f1850)['then'](_0x21d210=>{if(0xc8!==_0x21d210['status'])throw _0x21d210;return _0x21d210['blob']();})['then'](_0x4d2c29=>{const _0x43b8ea='function'==typeof _0x528b24['fileName']?_0x528b24['fileName']():_0x528b24['fileName'];this['_downloadFile'](_0x4d2c29,_0x43b8ea||'document.docx');});})['catch'](_0x125109=>{throw _0x30c495['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x125109;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0x133937,_0x3b2a9b){const _0x15d3ed=document['createElement']('a');_0x15d3ed['href']=window['URL']['createObjectURL'](_0x133937),_0x15d3ed['download']=_0x3b2a9b,_0x15d3ed['click'](),_0x15d3ed['remove']();}}
23
+ import{Command as _0x1c3e7b}from'ckeditor5/src/core';import{getStyles as _0x5d0661,getConverterOptions as _0x28dc7a}from'./utils';export default class s extends _0x1c3e7b{constructor(_0x11a7c3){super(_0x11a7c3),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x32001e={}){const _0x28175b=this['editor'],t=_0x28175b['t'],_0x1eaf5b=_0x32001e['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x3b30ff=_0x32001e['converterOptions']||{},_0x124a24=_0x28175b['plugins']['get']('ExportWord'),_0x4f8b97=_0x32001e['token']||_0x124a24['_token'],_0xfe5d40=!0x1!==_0x3b30ff['auto_pagination'],_0x146b33=_0x32001e['dataCallback']||(_0x2766f6=>_0x2766f6['data']['get']({'pagination':_0xfe5d40}));return this['isBusy']=!0x0,this['refresh'](),_0x5d0661(_0x32001e['stylesheets']||['EDITOR_STYLES'])['then'](async _0x1acfc2=>{const _0x27ed9a=await _0x146b33(_0x28175b),_0x3025cd={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x28175b['locale']['contentLanguageDirection']+'\x22>'+_0x27ed9a+'</div>','css':_0x1acfc2,'options':{..._0x3b30ff,..._0x28dc7a(_0x28175b)}},_0x2a6cb1={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x4f8b97?{'Authorization':_0x4f8b97['value']}:null},'body':JSON['stringify'](_0x3025cd)};return window['fetch'](_0x1eaf5b,_0x2a6cb1)['then'](_0xfc4951=>{if(0xc8!==_0xfc4951['status'])throw _0xfc4951;return _0xfc4951['blob']();})['then'](_0x2178fe=>{const _0x4b6190='function'==typeof _0x32001e['fileName']?_0x32001e['fileName']():_0x32001e['fileName'];this['_downloadFile'](_0x2178fe,_0x4b6190||'document.docx');});})['catch'](_0x2fbef3=>{throw _0x28175b['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x2fbef3;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0x1b7707,_0x3110ec){const _0x5c77d5=document['createElement']('a');_0x5c77d5['href']=window['URL']['createObjectURL'](_0x1b7707),_0x5c77d5['download']=_0x3110ec,_0x5c77d5['click'](),_0x5c77d5['remove']();}}
package/src/utils.js CHANGED
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x3fe3=['CommentsRepository','text','resolvedOptions','join','data-cke','get','ownerNode','timeZone','keys','content','TrackChanges','trim','hasAttribute','then','suggestions','comments','indexOf','isResolved','all','from','length','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.','warn','has','Users','authorId','plugins','cssRules','fetch','push','timezone','EDITOR_STYLES','getSuggestions','name','createdAt','cssText','.ck-content'];(function(_0x41aa0e,_0x3fe356){const _0x1ed5e2=function(_0x6a33cd){while(--_0x6a33cd){_0x41aa0e['push'](_0x41aa0e['shift']());}};_0x1ed5e2(++_0x3fe356);}(_0x3fe3,0x178));const _0x1ed5=function(_0x41aa0e,_0x3fe356){_0x41aa0e=_0x41aa0e-0x0;let _0x1ed5e2=_0x3fe3[_0x41aa0e];return _0x1ed5e2;};export function getStyles(_0x321c68){if(!_0x321c68)return new Promise(_0x32cd70=>_0x32cd70(''));const _0x509d08=[];for(const _0xc1f05a of _0x321c68)_0x1ed5('0x19')!==_0xc1f05a?_0x509d08[_0x1ed5('0x17')](window[_0x1ed5('0x16')](_0xc1f05a)['then'](_0x3a65f5=>_0x3a65f5[_0x1ed5('0x20')]())):_0x509d08['push'](u());return Promise[_0x1ed5('0xc')](_0x509d08)[_0x1ed5('0x7')](_0x563073=>_0x563073[_0x1ed5('0x22')]('\x20')[_0x1ed5('0x5')]());}function u(){const _0x35622a=[],_0x1f5eae=[];for(const _0x45f1ce of Array[_0x1ed5('0xd')](document['styleSheets'])){if(_0x45f1ce[_0x1ed5('0x0')][_0x1ed5('0x6')](_0x1ed5('0x23')))for(const _0x4e5323 of Array['from'](_0x45f1ce[_0x1ed5('0x15')]))-0x1!==_0x4e5323[_0x1ed5('0x1d')]['indexOf'](_0x1ed5('0x1e'))?_0x35622a[_0x1ed5('0x17')](_0x4e5323[_0x1ed5('0x1d')]):-0x1!==_0x4e5323[_0x1ed5('0x1d')][_0x1ed5('0xa')](':root')&&_0x1f5eae[_0x1ed5('0x17')](_0x4e5323[_0x1ed5('0x1d')]);}return _0x35622a[_0x1ed5('0xe')]||console[_0x1ed5('0x10')](_0x1ed5('0xf')),[..._0x1f5eae,..._0x35622a][_0x1ed5('0x22')]('\x20')[_0x1ed5('0x5')]();}export function getConverterOptions(_0x505530){const _0x25011c=_0x505530[_0x1ed5('0x14')][_0x1ed5('0x11')](_0x1ed5('0x12')),_0x33a841=_0x505530['plugins']['has'](_0x1ed5('0x1f')),_0x25d780=_0x505530[_0x1ed5('0x14')][_0x1ed5('0x11')](_0x1ed5('0x4')),_0x5e710d={};if(_0x25011c&&_0x33a841){const _0x5a7db1=getComments(_0x505530[_0x1ed5('0x14')][_0x1ed5('0x24')](_0x1ed5('0x1f'))['getCommentThreads']({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object['keys'](_0x5a7db1)[_0x1ed5('0xe')]&&(_0x5e710d[_0x1ed5('0x9')]=_0x5a7db1);}if(_0x25011c&&_0x25d780){const _0xe1f03f=_0x505530[_0x1ed5('0x14')][_0x1ed5('0x24')](_0x1ed5('0x4')),_0x27abb5=_0x505530[_0x1ed5('0x14')]['get'](_0x1ed5('0x12')),_0x149f84=getSuggestions(_0xe1f03f[_0x1ed5('0x1a')]({'toJSON':!0x0}),_0x27abb5['users']);Object[_0x1ed5('0x2')](_0x149f84)['length']&&(_0x5e710d['suggestions']=_0x149f84);}return(_0x5e710d[_0x1ed5('0x8')]||_0x5e710d[_0x1ed5('0x9')])&&(_0x5e710d[_0x1ed5('0x18')]=new Intl['DateTimeFormat']()[_0x1ed5('0x21')]()[_0x1ed5('0x1')]),_0x5e710d;}export function getComments(_0x872865){const _0x58fb79={};if(!_0x872865['length'])return _0x58fb79;for(const _0xb7ace8 of _0x872865)_0xb7ace8[_0x1ed5('0x9')]['map'](_0x1ebe78=>{void 0x0===_0x58fb79[_0xb7ace8['id']]&&(_0x58fb79[_0xb7ace8['id']]=[]),_0x58fb79[_0xb7ace8['id']][_0x1ed5('0x17')]({'author':_0x1ebe78['author'][_0x1ed5('0x1b')],'content':_0x1ebe78[_0x1ed5('0x3')],'created':_0x1ebe78['createdAt'],'is_resolved':_0xb7ace8[_0x1ed5('0xb')]});});return _0x58fb79;}export function getSuggestions(_0x28630a,_0x1d6e4e){const _0x14d1e9={};if(!_0x28630a[_0x1ed5('0xe')]||!_0x1d6e4e[_0x1ed5('0xe')])return _0x14d1e9;for(const _0x4f368b of _0x28630a)_0x14d1e9[_0x4f368b['id']]={'author':_0x1d6e4e[_0x1ed5('0x24')](_0x4f368b[_0x1ed5('0x13')])[_0x1ed5('0x1b')],'created':_0x4f368b[_0x1ed5('0x1c')]};return _0x14d1e9;}
23
+ const _0x4643=['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.','text','styleSheets','cssText','name','.ck-content','indexOf','then','content','resolvedOptions','hasAttribute','from','isResolved','fetch','TrackChanges','createdAt','author','Users','join','users','plugins','EDITOR_STYLES','length','CommentsRepository','ownerNode','trim','keys','comments','suggestions','push','has','cssRules','timezone','getSuggestions','DateTimeFormat','map','get'];(function(_0x157d7e,_0x464329){const _0x4cc1e7=function(_0x3b9350){while(--_0x3b9350){_0x157d7e['push'](_0x157d7e['shift']());}};_0x4cc1e7(++_0x464329);}(_0x4643,0xbe));const _0x4cc1=function(_0x157d7e,_0x464329){_0x157d7e=_0x157d7e-0x0;let _0x4cc1e7=_0x4643[_0x157d7e];return _0x4cc1e7;};export function getStyles(_0x360322){if(!_0x360322)return new Promise(_0x3bd586=>_0x3bd586(''));const _0x315d0a=[];for(const _0x13db65 of _0x360322)_0x4cc1('0x10')!==_0x13db65?_0x315d0a[_0x4cc1('0x18')](window[_0x4cc1('0x8')](_0x13db65)[_0x4cc1('0x2')](_0xf87e73=>_0xf87e73[_0x4cc1('0x21')]())):_0x315d0a[_0x4cc1('0x18')](u());return Promise['all'](_0x315d0a)[_0x4cc1('0x2')](_0x2e940e=>_0x2e940e[_0x4cc1('0xd')]('\x20')[_0x4cc1('0x14')]());}function u(){const _0x10a13c=[],_0x5b262f=[];for(const _0x20c7f7 of Array[_0x4cc1('0x6')](document[_0x4cc1('0x22')])){if(_0x20c7f7[_0x4cc1('0x13')][_0x4cc1('0x5')]('data-cke'))for(const _0x2def3a of Array[_0x4cc1('0x6')](_0x20c7f7[_0x4cc1('0x1a')]))-0x1!==_0x2def3a[_0x4cc1('0x23')][_0x4cc1('0x1')](_0x4cc1('0x0'))?_0x10a13c['push'](_0x2def3a[_0x4cc1('0x23')]):-0x1!==_0x2def3a[_0x4cc1('0x23')][_0x4cc1('0x1')](':root')&&_0x5b262f[_0x4cc1('0x18')](_0x2def3a['cssText']);}return _0x10a13c[_0x4cc1('0x11')]||console['warn'](_0x4cc1('0x20')),[..._0x5b262f,..._0x10a13c][_0x4cc1('0xd')]('\x20')['trim']();}export function getConverterOptions(_0x54034a){const _0x5ecc4b=_0x54034a['plugins']['has'](_0x4cc1('0xc')),_0x159778=_0x54034a[_0x4cc1('0xf')]['has'](_0x4cc1('0x12')),_0x70dc8c=_0x54034a[_0x4cc1('0xf')][_0x4cc1('0x19')](_0x4cc1('0x9')),_0x5c6889={};if(_0x5ecc4b&&_0x159778){const _0x5ad848=getComments(_0x54034a['plugins'][_0x4cc1('0x1f')]('CommentsRepository')['getCommentThreads']({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object[_0x4cc1('0x15')](_0x5ad848)[_0x4cc1('0x11')]&&(_0x5c6889['comments']=_0x5ad848);}if(_0x5ecc4b&&_0x70dc8c){const _0x48e6a2=_0x54034a[_0x4cc1('0xf')][_0x4cc1('0x1f')](_0x4cc1('0x9')),_0x354d32=_0x54034a[_0x4cc1('0xf')][_0x4cc1('0x1f')]('Users'),_0x4a73cc=getSuggestions(_0x48e6a2[_0x4cc1('0x1c')]({'toJSON':!0x0}),_0x354d32[_0x4cc1('0xe')]);Object['keys'](_0x4a73cc)[_0x4cc1('0x11')]&&(_0x5c6889[_0x4cc1('0x17')]=_0x4a73cc);}return(_0x5c6889[_0x4cc1('0x17')]||_0x5c6889[_0x4cc1('0x16')])&&(_0x5c6889[_0x4cc1('0x1b')]=new Intl[(_0x4cc1('0x1d'))]()[_0x4cc1('0x4')]()['timeZone']),_0x5c6889;}export function getComments(_0x57bcef){const _0x18b1ae={};if(!_0x57bcef[_0x4cc1('0x11')])return _0x18b1ae;for(const _0x5c112d of _0x57bcef)_0x5c112d['comments'][_0x4cc1('0x1e')](_0x357660=>{void 0x0===_0x18b1ae[_0x5c112d['id']]&&(_0x18b1ae[_0x5c112d['id']]=[]),_0x18b1ae[_0x5c112d['id']][_0x4cc1('0x18')]({'author':_0x357660[_0x4cc1('0xb')]['name'],'content':_0x357660[_0x4cc1('0x3')],'created':_0x357660[_0x4cc1('0xa')],'is_resolved':_0x5c112d[_0x4cc1('0x7')]});});return _0x18b1ae;}export function getSuggestions(_0x27d2f5,_0xfcf6e7){const _0x34c267={};if(!_0x27d2f5[_0x4cc1('0x11')]||!_0xfcf6e7[_0x4cc1('0x11')])return _0x34c267;for(const _0x1284e9 of _0x27d2f5)_0x34c267[_0x1284e9['id']]={'author':_0xfcf6e7['get'](_0x1284e9['authorId'])[_0x4cc1('0x24')],'created':_0x1284e9[_0x4cc1('0xa')]};return _0x34c267;}