@ckeditor/ckeditor5-export-word 0.0.0-nightly-20240130.0 → 0.0.0-nightly-20240131.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={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=["then","plugins","authorId","author","CommentsRepository","indexOf","getSuggestions","styleSheets","cssRules","DateTimeFormat","data-cke","get","comments","TrackChanges","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.",":root","isResolved","push","all","keys","trim","getCommentThreads","createdAt","content","has","hasAttribute","join","timezone","suggestions","EDITOR_STYLES","text","from","name","resolvedOptions","length","cssText","Users","users"];var i,s;i=r,s=419,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("0x1e")](document[c("0x6")]))if(o.ownerNode[c("0x18")](c("0x9")))for(const n of Array[c("0x1e")](o[c("0x7")]))-1!==n[c("0x22")][c("0x4")](".ck-content")?t[c("0x10")](n[c("0x22")]):-1!==n[c("0x22")].indexOf(c("0xe"))&&e.push(n[c("0x22")]);return t[c("0x21")]||console.warn(c("0xd")),[...e,...t][c("0x19")](" ").trim()}function d(t){const e=t[c("0x0")][c("0x17")]("Users"),o=t[c("0x0")].has(c("0x3")),n=t[c("0x0")].has(c("0xc")),r={};if(e&&o){const e=function(t){const e={};if(!t[c("0x21")])return e;for(const o of t)o[c("0xb")].map((t=>{void 0===e[o.id]&&(e[o.id]=[]),e[o.id][c("0x10")]({author:t[c("0x2")][c("0x1f")],content:t[c("0x16")],created:t[c("0x15")],is_resolved:o[c("0xf")]})}));return e}(t.plugins.get("CommentsRepository")[c("0x14")]({skipNotAttached:!0,skipEmpty:!0}));Object[c("0x12")](e)[c("0x21")]&&(r[c("0xb")]=e)}if(e&&n){const e=t[c("0x0")][c("0xa")]("TrackChanges"),o=t[c("0x0")][c("0xa")](c("0x23")),n=function(t,e){const o={};if(!t.length||!e[c("0x21")])return o;for(const n of t)o[n.id]={author:e[c("0xa")](n[c("0x1")])[c("0x1f")],created:n[c("0x15")]};return o}(e[c("0x5")]({toJSON:!0}),o[c("0x24")]);Object[c("0x12")](n)[c("0x21")]&&(r.suggestions=n)}return(r[c("0x1b")]||r.comments)&&(r[c("0x1a")]=(new(Intl[c("0x8")]))[c("0x20")]().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("0x1c")!==o?e[c("0x10")](window.fetch(o)[c("0x25")]((t=>t[c("0x1d")]()))):e[c("0x10")](a());return Promise[c("0x11")](e)[c("0x25")]((t=>t[c("0x19")](" ")[c("0x13")]()))}(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=["all","getSuggestions","hasAttribute","createdAt","plugins","styleSheets","cssRules","text","then","users","name","fetch","resolvedOptions","TrackChanges","warn","isResolved","cssText","Users","content","timeZone","authorId","push","from","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.","ownerNode","data-cke","author","comments","trim","timezone","DateTimeFormat","length","indexOf","map","has","getCommentThreads","get","keys","join",":root","CommentsRepository"];var s,i;s=r,i=125,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("0x14")](document[c("0x3")]))if(o[c("0x16")][c("0x0")](c("0x17")))for(const n of Array[c("0x14")](o[c("0x4")]))-1!==n[c("0xe")].indexOf(".ck-content")?t.push(n.cssText):-1!==n.cssText[c("0x1e")](c("0x25"))&&e[c("0x13")](n[c("0xe")]);return t[c("0x1d")]||console[c("0xc")](c("0x15")),[...e,...t][c("0x24")](" ")[c("0x1a")]()}function d(t){const e=t[c("0x2")].has(c("0xf")),o=t[c("0x2")][c("0x20")](c("0x26")),n=t[c("0x2")][c("0x20")](c("0xb")),r={};if(e&&o){const e=function(t){const e={};if(!t[c("0x1d")])return e;for(const o of t)o.comments[c("0x1f")]((t=>{void 0===e[o.id]&&(e[o.id]=[]),e[o.id][c("0x13")]({author:t[c("0x18")][c("0x8")],content:t[c("0x10")],created:t[c("0x1")],is_resolved:o[c("0xd")]})}));return e}(t.plugins.get("CommentsRepository")[c("0x21")]({skipNotAttached:!0,skipEmpty:!0}));Object[c("0x23")](e).length&&(r.comments=e)}if(e&&n){const e=t[c("0x2")][c("0x22")](c("0xb")),o=t[c("0x2")][c("0x22")](c("0xf")),n=function(t,e){const o={};if(!t[c("0x1d")]||!e[c("0x1d")])return o;for(const n of t)o[n.id]={author:e.get(n[c("0x12")]).name,created:n[c("0x1")]};return o}(e[c("0x28")]({toJSON:!0}),o[c("0x7")]);Object[c("0x23")](n)[c("0x1d")]&&(r.suggestions=n)}return(r.suggestions||r[c("0x19")])&&(r[c("0x1b")]=(new(Intl[c("0x1c")]))[c("0xa")]()[c("0x11")]),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)"EDITOR_STYLES"!==o?e[c("0x13")](window[c("0x9")](o)[c("0x6")]((t=>t[c("0x5")]()))):e[c("0x13")](a());return Promise[c("0x27")](e).then((t=>t[c("0x24")](" ")[c("0x1a")]()))}(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-20240130.0",
3
+ "version": "0.0.0-nightly-20240131.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-20240130.0"
33
+ "ckeditor5": "0.0.0-nightly-20240131.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 _0x35e320}from'ckeditor5/src/core.js';import{ButtonView as _0xb41ca4,Notification as _0x4c3ab5,SpinnerView as _0x435a45}from'ckeditor5/src/ui.js';import _0x3915b5 from'./exportwordcommand.js';import _0x51010c from'../theme/icons/exportword.svg';export default class d extends _0x35e320{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x4c3ab5];}['init'](){const _0x279455=this['editor'],t=_0x279455['t'],_0x18e934=_0x279455['config']['get']('exportWord')||{};_0x279455['commands']['add']('exportWord',new _0x3915b5(_0x279455)),_0x279455['ui']['componentFactory']['add']('exportWord',_0x4ba6cd=>{const _0x5127a8=_0x279455['commands']['get']('exportWord'),_0x4dc1f1=new _0xb41ca4(_0x4ba6cd),_0x3662e2=new _0x435a45();return _0x4dc1f1['set']({'label':t('Export\x20to\x20Word'),'icon':_0x51010c,'tooltip':!0x0}),_0x4dc1f1['children']['add'](_0x3662e2),_0x4dc1f1['bind']('isOn','isEnabled')['to'](_0x5127a8,'isBusy','isEnabled'),_0x3662e2['bind']('isVisible')['to'](_0x5127a8,'isBusy'),_0x4dc1f1['iconView']['bind']('isVisible')['to'](_0x5127a8,'isBusy',_0x5e6675=>!_0x5e6675),this['listenTo'](_0x4dc1f1,'execute',()=>{_0x279455['execute']('exportWord',_0x18e934),_0x279455['editing']['view']['focus']();}),_0x4dc1f1;});const _0x72b6d4=_0x279455['plugins']['get']('CloudServices');!0x1===_0x18e934['tokenUrl']?this['_token']=null:_0x18e934['tokenUrl']?_0x72b6d4['registerTokenUrl'](_0x18e934['tokenUrl'])['then'](_0x444ab0=>{this['_token']=_0x444ab0;}):this['_token']=_0x72b6d4['token'];}}
23
+ import{Plugin as _0x4dc277}from'ckeditor5/src/core.js';import{ButtonView as _0x547835,Notification as _0x369bf3,SpinnerView as _0x215703}from'ckeditor5/src/ui.js';import _0x296696 from'./exportwordcommand.js';import _0x3aad94 from'../theme/icons/exportword.svg';export default class d extends _0x4dc277{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x369bf3];}['init'](){const _0x305a34=this['editor'],t=_0x305a34['t'],_0x20c80a=_0x305a34['config']['get']('exportWord')||{};_0x305a34['commands']['add']('exportWord',new _0x296696(_0x305a34)),_0x305a34['ui']['componentFactory']['add']('exportWord',_0x15e410=>{const _0x110a40=_0x305a34['commands']['get']('exportWord'),_0x330343=new _0x547835(_0x15e410),_0x199f53=new _0x215703();return _0x330343['set']({'label':t('Export\x20to\x20Word'),'icon':_0x3aad94,'tooltip':!0x0}),_0x330343['children']['add'](_0x199f53),_0x330343['bind']('isOn','isEnabled')['to'](_0x110a40,'isBusy','isEnabled'),_0x199f53['bind']('isVisible')['to'](_0x110a40,'isBusy'),_0x330343['iconView']['bind']('isVisible')['to'](_0x110a40,'isBusy',_0x5f3d71=>!_0x5f3d71),this['listenTo'](_0x330343,'execute',()=>{_0x305a34['execute']('exportWord',_0x20c80a),_0x305a34['editing']['view']['focus']();}),_0x330343;});const _0x253ba8=_0x305a34['plugins']['get']('CloudServices');!0x1===_0x20c80a['tokenUrl']?this['_token']=null:_0x20c80a['tokenUrl']?_0x253ba8['registerTokenUrl'](_0x20c80a['tokenUrl'])['then'](_0x4ed0ab=>{this['_token']=_0x4ed0ab;}):this['_token']=_0x253ba8['token'];}}
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Command as _0x32eaa0}from'ckeditor5/src/core.js';import{getStyles as _0x24b03e,getConverterOptions as _0x59e93e}from'./utils.js';export default class i extends _0x32eaa0{constructor(_0x375c5b){super(_0x375c5b),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x46ac78={}){const _0x14a325=this['editor'],t=_0x14a325['t'],_0x1b97f6=_0x46ac78['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0xc65180=_0x46ac78['converterOptions']||{},_0xbce3d1=_0x14a325['plugins']['get']('ExportWord'),_0x214891=_0x46ac78['token']||_0xbce3d1['_token'],_0x503246=!0x1!==_0xc65180['auto_pagination'],_0x24569e=_0x46ac78['dataCallback']||(_0x1cb587=>_0x1cb587['data']['get']({'pagination':_0x503246}));return this['isBusy']=!0x0,this['refresh'](),_0x24b03e(_0x46ac78['stylesheets']||['EDITOR_STYLES'])['then'](async _0x2a13f0=>{const _0x1e5d54=await _0x24569e(_0x14a325),_0x4ff23c={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x14a325['locale']['contentLanguageDirection']+'\x22>'+_0x1e5d54+'</div>','css':_0x2a13f0,'options':{..._0xc65180,..._0x59e93e(_0x14a325)}},_0x5e995b={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x214891?{'Authorization':_0x214891['value']}:null},'body':JSON['stringify'](_0x4ff23c)};return window['fetch'](_0x1b97f6,_0x5e995b)['then'](_0x345a06=>{if(0xc8!==_0x345a06['status'])throw _0x345a06;return _0x345a06['blob']();})['then'](_0x3de3c8=>{const _0x4a5677='function'==typeof _0x46ac78['fileName']?_0x46ac78['fileName']():_0x46ac78['fileName'];this['_downloadFile'](_0x3de3c8,_0x4a5677||'document.docx');});})['catch'](_0x94bb16=>{throw _0x14a325['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x94bb16;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0x19312f,_0x8ce37d){const _0x509698=document['createElement']('a');_0x509698['href']=window['URL']['createObjectURL'](_0x19312f),_0x509698['download']=_0x8ce37d,_0x509698['click'](),_0x509698['remove']();}}
23
+ import{Command as _0x18c116}from'ckeditor5/src/core.js';import{getStyles as _0x5e7fa8,getConverterOptions as _0x53cec6}from'./utils.js';export default class i extends _0x18c116{constructor(_0x5c75f4){super(_0x5c75f4),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x3bfd7d={}){const _0x5552c3=this['editor'],t=_0x5552c3['t'],_0x155685=_0x3bfd7d['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x4e8d29=_0x3bfd7d['converterOptions']||{},_0x308517=_0x5552c3['plugins']['get']('ExportWord'),_0x3098cb=_0x3bfd7d['token']||_0x308517['_token'],_0x21b474=!0x1!==_0x4e8d29['auto_pagination'],_0x433978=_0x3bfd7d['dataCallback']||(_0x896b76=>_0x896b76['data']['get']({'pagination':_0x21b474}));return this['isBusy']=!0x0,this['refresh'](),_0x5e7fa8(_0x3bfd7d['stylesheets']||['EDITOR_STYLES'])['then'](async _0x4ceccb=>{const _0xc232ef=await _0x433978(_0x5552c3),_0x5b24b5={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x5552c3['locale']['contentLanguageDirection']+'\x22>'+_0xc232ef+'</div>','css':_0x4ceccb,'options':{..._0x4e8d29,..._0x53cec6(_0x5552c3)}},_0x5c1f2e={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x3098cb?{'Authorization':_0x3098cb['value']}:null},'body':JSON['stringify'](_0x5b24b5)};return window['fetch'](_0x155685,_0x5c1f2e)['then'](_0x2bf2d7=>{if(0xc8!==_0x2bf2d7['status'])throw _0x2bf2d7;return _0x2bf2d7['blob']();})['then'](_0x344f10=>{const _0x6dd575='function'==typeof _0x3bfd7d['fileName']?_0x3bfd7d['fileName']():_0x3bfd7d['fileName'];this['_downloadFile'](_0x344f10,_0x6dd575||'document.docx');});})['catch'](_0x150764=>{throw _0x5552c3['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x150764;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0x3c367a,_0x5e3a1b){const _0x1bbedd=document['createElement']('a');_0x1bbedd['href']=window['URL']['createObjectURL'](_0x3c367a),_0x1bbedd['download']=_0x5e3a1b,_0x1bbedd['click'](),_0x1bbedd['remove']();}}
package/src/utils.js CHANGED
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x5839=['then','plugins','authorId','author','CommentsRepository','indexOf','getSuggestions','styleSheets','cssRules','DateTimeFormat','data-cke','get','comments','TrackChanges','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.',':root','isResolved','push','all','keys','trim','getCommentThreads','createdAt','content','has','hasAttribute','join','timezone','suggestions','EDITOR_STYLES','text','from','name','resolvedOptions','length','cssText','Users','users'];(function(_0x4be04d,_0x583978){const _0x4f598b=function(_0x4de949){while(--_0x4de949){_0x4be04d['push'](_0x4be04d['shift']());}};_0x4f598b(++_0x583978);}(_0x5839,0x1a3));const _0x4f59=function(_0x4be04d,_0x583978){_0x4be04d=_0x4be04d-0x0;let _0x4f598b=_0x5839[_0x4be04d];return _0x4f598b;};export function getStyles(_0x5da94a){if(!_0x5da94a)return new Promise(_0x2f2099=>_0x2f2099(''));const _0x36daba=[];for(const _0x5d8d1d of _0x5da94a)_0x4f59('0x1c')!==_0x5d8d1d?_0x36daba[_0x4f59('0x10')](window['fetch'](_0x5d8d1d)[_0x4f59('0x25')](_0x537fe1=>_0x537fe1[_0x4f59('0x1d')]())):_0x36daba[_0x4f59('0x10')](u());return Promise[_0x4f59('0x11')](_0x36daba)[_0x4f59('0x25')](_0x4c121f=>_0x4c121f[_0x4f59('0x19')]('\x20')[_0x4f59('0x13')]());}function u(){const _0x30f7ea=[],_0x100bcc=[];for(const _0x183ec8 of Array[_0x4f59('0x1e')](document[_0x4f59('0x6')])){if(_0x183ec8['ownerNode'][_0x4f59('0x18')](_0x4f59('0x9')))for(const _0x55310d of Array[_0x4f59('0x1e')](_0x183ec8[_0x4f59('0x7')]))-0x1!==_0x55310d[_0x4f59('0x22')][_0x4f59('0x4')]('.ck-content')?_0x30f7ea[_0x4f59('0x10')](_0x55310d[_0x4f59('0x22')]):-0x1!==_0x55310d[_0x4f59('0x22')]['indexOf'](_0x4f59('0xe'))&&_0x100bcc['push'](_0x55310d[_0x4f59('0x22')]);}return _0x30f7ea[_0x4f59('0x21')]||console['warn'](_0x4f59('0xd')),[..._0x100bcc,..._0x30f7ea][_0x4f59('0x19')]('\x20')['trim']();}export function getConverterOptions(_0x5eb9ca){const _0x41ea1c=_0x5eb9ca[_0x4f59('0x0')][_0x4f59('0x17')]('Users'),_0x1b0169=_0x5eb9ca[_0x4f59('0x0')]['has'](_0x4f59('0x3')),_0x16d3cb=_0x5eb9ca[_0x4f59('0x0')]['has'](_0x4f59('0xc')),_0x6f8180={};if(_0x41ea1c&&_0x1b0169){const _0x441705=getComments(_0x5eb9ca['plugins']['get']('CommentsRepository')[_0x4f59('0x14')]({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object[_0x4f59('0x12')](_0x441705)[_0x4f59('0x21')]&&(_0x6f8180[_0x4f59('0xb')]=_0x441705);}if(_0x41ea1c&&_0x16d3cb){const _0x3e6be9=_0x5eb9ca[_0x4f59('0x0')][_0x4f59('0xa')]('TrackChanges'),_0x44ec4d=_0x5eb9ca[_0x4f59('0x0')][_0x4f59('0xa')](_0x4f59('0x23')),_0x5e795d=getSuggestions(_0x3e6be9[_0x4f59('0x5')]({'toJSON':!0x0}),_0x44ec4d[_0x4f59('0x24')]);Object[_0x4f59('0x12')](_0x5e795d)[_0x4f59('0x21')]&&(_0x6f8180['suggestions']=_0x5e795d);}return(_0x6f8180[_0x4f59('0x1b')]||_0x6f8180['comments'])&&(_0x6f8180[_0x4f59('0x1a')]=new Intl[(_0x4f59('0x8'))]()[_0x4f59('0x20')]()['timeZone']),_0x6f8180;}export function getComments(_0x1b0200){const _0x384b59={};if(!_0x1b0200[_0x4f59('0x21')])return _0x384b59;for(const _0x5e864d of _0x1b0200)_0x5e864d[_0x4f59('0xb')]['map'](_0x866e6d=>{void 0x0===_0x384b59[_0x5e864d['id']]&&(_0x384b59[_0x5e864d['id']]=[]),_0x384b59[_0x5e864d['id']][_0x4f59('0x10')]({'author':_0x866e6d[_0x4f59('0x2')][_0x4f59('0x1f')],'content':_0x866e6d[_0x4f59('0x16')],'created':_0x866e6d[_0x4f59('0x15')],'is_resolved':_0x5e864d[_0x4f59('0xf')]});});return _0x384b59;}export function getSuggestions(_0x4fdb48,_0x593867){const _0x551cfc={};if(!_0x4fdb48['length']||!_0x593867[_0x4f59('0x21')])return _0x551cfc;for(const _0x4260b0 of _0x4fdb48)_0x551cfc[_0x4260b0['id']]={'author':_0x593867[_0x4f59('0xa')](_0x4260b0[_0x4f59('0x1')])[_0x4f59('0x1f')],'created':_0x4260b0[_0x4f59('0x15')]};return _0x551cfc;}
23
+ const _0x3400=['all','getSuggestions','hasAttribute','createdAt','plugins','styleSheets','cssRules','text','then','users','name','fetch','resolvedOptions','TrackChanges','warn','isResolved','cssText','Users','content','timeZone','authorId','push','from','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.','ownerNode','data-cke','author','comments','trim','timezone','DateTimeFormat','length','indexOf','map','has','getCommentThreads','get','keys','join',':root','CommentsRepository'];(function(_0x60a2ad,_0x34000f){const _0x4f8e1a=function(_0xecdc48){while(--_0xecdc48){_0x60a2ad['push'](_0x60a2ad['shift']());}};_0x4f8e1a(++_0x34000f);}(_0x3400,0x7d));const _0x4f8e=function(_0x60a2ad,_0x34000f){_0x60a2ad=_0x60a2ad-0x0;let _0x4f8e1a=_0x3400[_0x60a2ad];return _0x4f8e1a;};export function getStyles(_0x30d70b){if(!_0x30d70b)return new Promise(_0x33c7c0=>_0x33c7c0(''));const _0x3ebf6c=[];for(const _0x558abe of _0x30d70b)'EDITOR_STYLES'!==_0x558abe?_0x3ebf6c[_0x4f8e('0x13')](window[_0x4f8e('0x9')](_0x558abe)[_0x4f8e('0x6')](_0x44a023=>_0x44a023[_0x4f8e('0x5')]())):_0x3ebf6c[_0x4f8e('0x13')](u());return Promise[_0x4f8e('0x27')](_0x3ebf6c)['then'](_0x28578e=>_0x28578e[_0x4f8e('0x24')]('\x20')[_0x4f8e('0x1a')]());}function u(){const _0x4c2a01=[],_0x5b6217=[];for(const _0x28782d of Array[_0x4f8e('0x14')](document[_0x4f8e('0x3')])){if(_0x28782d[_0x4f8e('0x16')][_0x4f8e('0x0')](_0x4f8e('0x17')))for(const _0x22f297 of Array[_0x4f8e('0x14')](_0x28782d[_0x4f8e('0x4')]))-0x1!==_0x22f297[_0x4f8e('0xe')]['indexOf']('.ck-content')?_0x4c2a01['push'](_0x22f297['cssText']):-0x1!==_0x22f297['cssText'][_0x4f8e('0x1e')](_0x4f8e('0x25'))&&_0x5b6217[_0x4f8e('0x13')](_0x22f297[_0x4f8e('0xe')]);}return _0x4c2a01[_0x4f8e('0x1d')]||console[_0x4f8e('0xc')](_0x4f8e('0x15')),[..._0x5b6217,..._0x4c2a01][_0x4f8e('0x24')]('\x20')[_0x4f8e('0x1a')]();}export function getConverterOptions(_0x5bc3c4){const _0x4b7c3b=_0x5bc3c4[_0x4f8e('0x2')]['has'](_0x4f8e('0xf')),_0x5affe5=_0x5bc3c4[_0x4f8e('0x2')][_0x4f8e('0x20')](_0x4f8e('0x26')),_0x43a39b=_0x5bc3c4[_0x4f8e('0x2')][_0x4f8e('0x20')](_0x4f8e('0xb')),_0xf79206={};if(_0x4b7c3b&&_0x5affe5){const _0x4b1d88=getComments(_0x5bc3c4['plugins']['get']('CommentsRepository')[_0x4f8e('0x21')]({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object[_0x4f8e('0x23')](_0x4b1d88)['length']&&(_0xf79206['comments']=_0x4b1d88);}if(_0x4b7c3b&&_0x43a39b){const _0x38715a=_0x5bc3c4[_0x4f8e('0x2')][_0x4f8e('0x22')](_0x4f8e('0xb')),_0x4e9dce=_0x5bc3c4[_0x4f8e('0x2')][_0x4f8e('0x22')](_0x4f8e('0xf')),_0x5a2963=getSuggestions(_0x38715a[_0x4f8e('0x28')]({'toJSON':!0x0}),_0x4e9dce[_0x4f8e('0x7')]);Object[_0x4f8e('0x23')](_0x5a2963)[_0x4f8e('0x1d')]&&(_0xf79206['suggestions']=_0x5a2963);}return(_0xf79206['suggestions']||_0xf79206[_0x4f8e('0x19')])&&(_0xf79206[_0x4f8e('0x1b')]=new Intl[(_0x4f8e('0x1c'))]()[_0x4f8e('0xa')]()[_0x4f8e('0x11')]),_0xf79206;}export function getComments(_0x54303d){const _0x405470={};if(!_0x54303d[_0x4f8e('0x1d')])return _0x405470;for(const _0x548f4d of _0x54303d)_0x548f4d['comments'][_0x4f8e('0x1f')](_0x3eaa47=>{void 0x0===_0x405470[_0x548f4d['id']]&&(_0x405470[_0x548f4d['id']]=[]),_0x405470[_0x548f4d['id']][_0x4f8e('0x13')]({'author':_0x3eaa47[_0x4f8e('0x18')][_0x4f8e('0x8')],'content':_0x3eaa47[_0x4f8e('0x10')],'created':_0x3eaa47[_0x4f8e('0x1')],'is_resolved':_0x548f4d[_0x4f8e('0xd')]});});return _0x405470;}export function getSuggestions(_0x4cbec4,_0x4cb676){const _0x41d452={};if(!_0x4cbec4[_0x4f8e('0x1d')]||!_0x4cb676[_0x4f8e('0x1d')])return _0x41d452;for(const _0x3e5408 of _0x4cbec4)_0x41d452[_0x3e5408['id']]={'author':_0x4cb676['get'](_0x3e5408[_0x4f8e('0x12')])['name'],'created':_0x3e5408[_0x4f8e('0x1')]};return _0x41d452;}