@ckeditor/ckeditor5-export-word 0.0.0-nightly-20240124.0 → 0.0.0-nightly-20240125.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:()=>l});var t=o(704),e=o(273);const r=["plugins","CommentsRepository","suggestions","TrackChanges","comments","length","from","has","ownerNode","resolvedOptions","name","push","EDITOR_STYLES","join","hasAttribute","createdAt","data-cke","author","timeZone","getSuggestions","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.","isResolved","fetch","authorId","cssRules","users","cssText","keys","all","text","getCommentThreads","DateTimeFormat","indexOf","Users","styleSheets","map","trim","get","then"];var i,s;i=r,s=402,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("0x21")](document[c("0x16")]))if(o[c("0x23")][c("0x2")](c("0x4")))for(const n of Array[c("0x21")](o[c("0xc")]))-1!==n[c("0xe")][c("0x14")](".ck-content")?t[c("0x26")](n.cssText):-1!==n[c("0xe")][c("0x14")](":root")&&e[c("0x26")](n[c("0xe")]);return t[c("0x20")]||console.warn(c("0x8")),[...e,...t].join(" ")[c("0x18")]()}function d(t){const e=t[c("0x1b")][c("0x22")](c("0x15")),o=t[c("0x1b")].has(c("0x1c")),n=t[c("0x1b")].has(c("0x1e")),r={};if(e&&o){const e=function(t){const e={};if(!t[c("0x20")])return e;for(const o of t)o[c("0x1f")][c("0x17")]((t=>{void 0===e[o.id]&&(e[o.id]=[]),e[o.id][c("0x26")]({author:t[c("0x5")][c("0x25")],content:t.content,created:t[c("0x3")],is_resolved:o[c("0x9")]})}));return e}(t[c("0x1b")][c("0x19")](c("0x1c"))[c("0x12")]({skipNotAttached:!0,skipEmpty:!0}));Object[c("0xf")](e)[c("0x20")]&&(r[c("0x1f")]=e)}if(e&&n){const e=t[c("0x1b")][c("0x19")](c("0x1e")),o=t[c("0x1b")][c("0x19")](c("0x15")),n=function(t,e){const o={};if(!t[c("0x20")]||!e[c("0x20")])return o;for(const n of t)o[n.id]={author:e[c("0x19")](n[c("0xb")])[c("0x25")],created:n[c("0x3")]};return o}(e[c("0x7")]({toJSON:!0}),o[c("0xd")]);Object.keys(n)[c("0x20")]&&(r.suggestions=n)}return(r[c("0x1d")]||r[c("0x1f")])&&(r.timezone=(new(Intl[c("0x13")]))[c("0x24")]()[c("0x6")]),r}class x 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,x=!1!==r.auto_pagination,l=t.dataCallback||(t=>t.data.get({pagination:x}));return this.isBusy=!0,this.refresh(),function(t){if(!t)return new Promise((t=>t("")));const e=[];for(const o of t)c("0x0")!==o?e.push(window[c("0xa")](o).then((t=>t[c("0x11")]()))):e.push(a());return Promise[c("0x10")](e)[c("0x1a")]((t=>t[c("0x1")](" ").trim()))}(t.stylesheets||["EDITOR_STYLES"]).then((async o=>{const i=await l(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 l 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 x(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:()=>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.","indexOf","from","content","text","author","trim","name","TrackChanges","createdAt","join","cssRules","keys","cssText","timeZone","has",":root","all","timezone","resolvedOptions","getCommentThreads","push","get","length",".ck-content","isResolved","data-cke","EDITOR_STYLES","comments","users","CommentsRepository","suggestions","plugins","authorId","ownerNode"];var i,s;i=r,s=335,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("0x11")](document.styleSheets))if(o[c("0xe")].hasAttribute(c("0x6")))for(const n of Array[c("0x11")](o[c("0x1a")]))-1!==n[c("0x1c")][c("0x10")](c("0x4"))?t.push(n.cssText):-1!==n[c("0x1c")].indexOf(c("0x1f"))&&e[c("0x1")](n[c("0x1c")]);return t.length||console.warn(c("0xf")),[...e,...t][c("0x19")](" ")[c("0x15")]()}function d(t){const e=t[c("0xc")][c("0x1e")]("Users"),o=t[c("0xc")][c("0x1e")](c("0xa")),n=t.plugins[c("0x1e")](c("0x17")),r={};if(e&&o){const e=function(t){const e={};if(!t[c("0x3")])return e;for(const o of t)o[c("0x8")].map((t=>{void 0===e[o.id]&&(e[o.id]=[]),e[o.id].push({author:t[c("0x14")][c("0x16")],content:t[c("0x12")],created:t.createdAt,is_resolved:o[c("0x5")]})}));return e}(t.plugins[c("0x2")](c("0xa"))[c("0x0")]({skipNotAttached:!0,skipEmpty:!0}));Object[c("0x1b")](e)[c("0x3")]&&(r[c("0x8")]=e)}if(e&&n){const e=t[c("0xc")].get(c("0x17")),o=t[c("0xc")].get("Users"),n=function(t,e){const o={};if(!t[c("0x3")]||!e.length)return o;for(const n of t)o[n.id]={author:e[c("0x2")](n[c("0xd")]).name,created:n[c("0x18")]};return o}(e.getSuggestions({toJSON:!0}),o[c("0x9")]);Object[c("0x1b")](n).length&&(r[c("0xb")]=n)}return(r[c("0xb")]||r.comments)&&(r[c("0x21")]=(new Intl.DateTimeFormat)[c("0x22")]()[c("0x1d")]),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("0x7")!==o?e[c("0x1")](window.fetch(o).then((t=>t[c("0x13")]()))):e[c("0x1")](a());return Promise[c("0x20")](e).then((t=>t[c("0x19")](" ").trim()))}(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-20240124.0",
3
+ "version": "0.0.0-nightly-20240125.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-20240124.0"
33
+ "ckeditor5": "0.0.0-nightly-20240125.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 _0xaa6393}from'ckeditor5/src/core.js';import{ButtonView as _0x11137b,Notification as _0x5dacf1,SpinnerView as _0x5f2c24}from'ckeditor5/src/ui.js';import _0x4636f8 from'./exportwordcommand.js';import _0x3c639a from'../theme/icons/exportword.svg';export default class d extends _0xaa6393{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x5dacf1];}['init'](){const _0x5240f5=this['editor'],t=_0x5240f5['t'],_0x20fd29=_0x5240f5['config']['get']('exportWord')||{};_0x5240f5['commands']['add']('exportWord',new _0x4636f8(_0x5240f5)),_0x5240f5['ui']['componentFactory']['add']('exportWord',_0x1714f7=>{const _0x3e1ebc=_0x5240f5['commands']['get']('exportWord'),_0xa9423d=new _0x11137b(_0x1714f7),_0x33612b=new _0x5f2c24();return _0xa9423d['set']({'label':t('Export\x20to\x20Word'),'icon':_0x3c639a,'tooltip':!0x0}),_0xa9423d['children']['add'](_0x33612b),_0xa9423d['bind']('isOn','isEnabled')['to'](_0x3e1ebc,'isBusy','isEnabled'),_0x33612b['bind']('isVisible')['to'](_0x3e1ebc,'isBusy'),_0xa9423d['iconView']['bind']('isVisible')['to'](_0x3e1ebc,'isBusy',_0x29a8a2=>!_0x29a8a2),this['listenTo'](_0xa9423d,'execute',()=>{_0x5240f5['execute']('exportWord',_0x20fd29),_0x5240f5['editing']['view']['focus']();}),_0xa9423d;});const _0x4b3dcc=_0x5240f5['plugins']['get']('CloudServices');!0x1===_0x20fd29['tokenUrl']?this['_token']=null:_0x20fd29['tokenUrl']?_0x4b3dcc['registerTokenUrl'](_0x20fd29['tokenUrl'])['then'](_0x5ab39d=>{this['_token']=_0x5ab39d;}):this['_token']=_0x4b3dcc['token'];}}
23
+ import{Plugin as _0x87048f}from'ckeditor5/src/core.js';import{ButtonView as _0x3362ca,Notification as _0x177b04,SpinnerView as _0x185687}from'ckeditor5/src/ui.js';import _0x88c160 from'./exportwordcommand.js';import _0x1dbbca from'../theme/icons/exportword.svg';export default class d extends _0x87048f{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x177b04];}['init'](){const _0x2f66ed=this['editor'],t=_0x2f66ed['t'],_0x4aebf7=_0x2f66ed['config']['get']('exportWord')||{};_0x2f66ed['commands']['add']('exportWord',new _0x88c160(_0x2f66ed)),_0x2f66ed['ui']['componentFactory']['add']('exportWord',_0x2eb1d0=>{const _0x14a4d8=_0x2f66ed['commands']['get']('exportWord'),_0x5f0bac=new _0x3362ca(_0x2eb1d0),_0x3b17fc=new _0x185687();return _0x5f0bac['set']({'label':t('Export\x20to\x20Word'),'icon':_0x1dbbca,'tooltip':!0x0}),_0x5f0bac['children']['add'](_0x3b17fc),_0x5f0bac['bind']('isOn','isEnabled')['to'](_0x14a4d8,'isBusy','isEnabled'),_0x3b17fc['bind']('isVisible')['to'](_0x14a4d8,'isBusy'),_0x5f0bac['iconView']['bind']('isVisible')['to'](_0x14a4d8,'isBusy',_0x21b4fc=>!_0x21b4fc),this['listenTo'](_0x5f0bac,'execute',()=>{_0x2f66ed['execute']('exportWord',_0x4aebf7),_0x2f66ed['editing']['view']['focus']();}),_0x5f0bac;});const _0x354b7f=_0x2f66ed['plugins']['get']('CloudServices');!0x1===_0x4aebf7['tokenUrl']?this['_token']=null:_0x4aebf7['tokenUrl']?_0x354b7f['registerTokenUrl'](_0x4aebf7['tokenUrl'])['then'](_0x198e84=>{this['_token']=_0x198e84;}):this['_token']=_0x354b7f['token'];}}
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Command as _0x537e97}from'ckeditor5/src/core.js';import{getStyles as _0xf38fa3,getConverterOptions as _0x38cd87}from'./utils.js';export default class i extends _0x537e97{constructor(_0x4088ac){super(_0x4088ac),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x32feb7={}){const _0xbac239=this['editor'],t=_0xbac239['t'],_0x1afda7=_0x32feb7['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x24fd60=_0x32feb7['converterOptions']||{},_0x1a37ba=_0xbac239['plugins']['get']('ExportWord'),_0x4ee87c=_0x32feb7['token']||_0x1a37ba['_token'],_0x3cb10c=!0x1!==_0x24fd60['auto_pagination'],_0x3fe663=_0x32feb7['dataCallback']||(_0x5c855d=>_0x5c855d['data']['get']({'pagination':_0x3cb10c}));return this['isBusy']=!0x0,this['refresh'](),_0xf38fa3(_0x32feb7['stylesheets']||['EDITOR_STYLES'])['then'](async _0x4d020d=>{const _0x1bcc98=await _0x3fe663(_0xbac239),_0x50e9f8={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0xbac239['locale']['contentLanguageDirection']+'\x22>'+_0x1bcc98+'</div>','css':_0x4d020d,'options':{..._0x24fd60,..._0x38cd87(_0xbac239)}},_0x5e4e84={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x4ee87c?{'Authorization':_0x4ee87c['value']}:null},'body':JSON['stringify'](_0x50e9f8)};return window['fetch'](_0x1afda7,_0x5e4e84)['then'](_0x1151b1=>{if(0xc8!==_0x1151b1['status'])throw _0x1151b1;return _0x1151b1['blob']();})['then'](_0x4c7b5e=>{const _0x1ae392='function'==typeof _0x32feb7['fileName']?_0x32feb7['fileName']():_0x32feb7['fileName'];this['_downloadFile'](_0x4c7b5e,_0x1ae392||'document.docx');});})['catch'](_0x7e993d=>{throw _0xbac239['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x7e993d;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0x15b43f,_0x51d5b0){const _0x12755e=document['createElement']('a');_0x12755e['href']=window['URL']['createObjectURL'](_0x15b43f),_0x12755e['download']=_0x51d5b0,_0x12755e['click'](),_0x12755e['remove']();}}
23
+ import{Command as _0x2cdf30}from'ckeditor5/src/core.js';import{getStyles as _0x1fe724,getConverterOptions as _0x3f548e}from'./utils.js';export default class i extends _0x2cdf30{constructor(_0x3e146a){super(_0x3e146a),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x35532d={}){const _0x52401f=this['editor'],t=_0x52401f['t'],_0x4aa71c=_0x35532d['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x3db6e2=_0x35532d['converterOptions']||{},_0x541744=_0x52401f['plugins']['get']('ExportWord'),_0x3b7dd2=_0x35532d['token']||_0x541744['_token'],_0x27c24b=!0x1!==_0x3db6e2['auto_pagination'],_0x1ddc77=_0x35532d['dataCallback']||(_0x581a3f=>_0x581a3f['data']['get']({'pagination':_0x27c24b}));return this['isBusy']=!0x0,this['refresh'](),_0x1fe724(_0x35532d['stylesheets']||['EDITOR_STYLES'])['then'](async _0x17fe5f=>{const _0x50b8ef=await _0x1ddc77(_0x52401f),_0x21dfca={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x52401f['locale']['contentLanguageDirection']+'\x22>'+_0x50b8ef+'</div>','css':_0x17fe5f,'options':{..._0x3db6e2,..._0x3f548e(_0x52401f)}},_0xf67277={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x3b7dd2?{'Authorization':_0x3b7dd2['value']}:null},'body':JSON['stringify'](_0x21dfca)};return window['fetch'](_0x4aa71c,_0xf67277)['then'](_0x36caf1=>{if(0xc8!==_0x36caf1['status'])throw _0x36caf1;return _0x36caf1['blob']();})['then'](_0x1034c2=>{const _0x1c8cdd='function'==typeof _0x35532d['fileName']?_0x35532d['fileName']():_0x35532d['fileName'];this['_downloadFile'](_0x1034c2,_0x1c8cdd||'document.docx');});})['catch'](_0x486cd9=>{throw _0x52401f['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x486cd9;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0x4746ed,_0x32c186){const _0x22a51b=document['createElement']('a');_0x22a51b['href']=window['URL']['createObjectURL'](_0x4746ed),_0x22a51b['download']=_0x32c186,_0x22a51b['click'](),_0x22a51b['remove']();}}
package/src/utils.js CHANGED
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x5de4=['plugins','CommentsRepository','suggestions','TrackChanges','comments','length','from','has','ownerNode','resolvedOptions','name','push','EDITOR_STYLES','join','hasAttribute','createdAt','data-cke','author','timeZone','getSuggestions','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.','isResolved','fetch','authorId','cssRules','users','cssText','keys','all','text','getCommentThreads','DateTimeFormat','indexOf','Users','styleSheets','map','trim','get','then'];(function(_0x47ef95,_0x5de4bb){const _0x60c6ad=function(_0x593ad8){while(--_0x593ad8){_0x47ef95['push'](_0x47ef95['shift']());}};_0x60c6ad(++_0x5de4bb);}(_0x5de4,0x192));const _0x60c6=function(_0x47ef95,_0x5de4bb){_0x47ef95=_0x47ef95-0x0;let _0x60c6ad=_0x5de4[_0x47ef95];return _0x60c6ad;};export function getStyles(_0x1f11ad){if(!_0x1f11ad)return new Promise(_0x282e2a=>_0x282e2a(''));const _0x2541be=[];for(const _0x215499 of _0x1f11ad)_0x60c6('0x0')!==_0x215499?_0x2541be['push'](window[_0x60c6('0xa')](_0x215499)['then'](_0x328d55=>_0x328d55[_0x60c6('0x11')]())):_0x2541be['push'](u());return Promise[_0x60c6('0x10')](_0x2541be)[_0x60c6('0x1a')](_0x332fce=>_0x332fce[_0x60c6('0x1')]('\x20')['trim']());}function u(){const _0x112795=[],_0xc87f2c=[];for(const _0x2e0c36 of Array[_0x60c6('0x21')](document[_0x60c6('0x16')])){if(_0x2e0c36[_0x60c6('0x23')][_0x60c6('0x2')](_0x60c6('0x4')))for(const _0x3c0d8e of Array[_0x60c6('0x21')](_0x2e0c36[_0x60c6('0xc')]))-0x1!==_0x3c0d8e[_0x60c6('0xe')][_0x60c6('0x14')]('.ck-content')?_0x112795[_0x60c6('0x26')](_0x3c0d8e['cssText']):-0x1!==_0x3c0d8e[_0x60c6('0xe')][_0x60c6('0x14')](':root')&&_0xc87f2c[_0x60c6('0x26')](_0x3c0d8e[_0x60c6('0xe')]);}return _0x112795[_0x60c6('0x20')]||console['warn'](_0x60c6('0x8')),[..._0xc87f2c,..._0x112795]['join']('\x20')[_0x60c6('0x18')]();}export function getConverterOptions(_0x2b31f1){const _0x369509=_0x2b31f1[_0x60c6('0x1b')][_0x60c6('0x22')](_0x60c6('0x15')),_0x45ab3d=_0x2b31f1[_0x60c6('0x1b')]['has'](_0x60c6('0x1c')),_0x476768=_0x2b31f1[_0x60c6('0x1b')]['has'](_0x60c6('0x1e')),_0x80228c={};if(_0x369509&&_0x45ab3d){const _0x8154c3=getComments(_0x2b31f1[_0x60c6('0x1b')][_0x60c6('0x19')](_0x60c6('0x1c'))[_0x60c6('0x12')]({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object[_0x60c6('0xf')](_0x8154c3)[_0x60c6('0x20')]&&(_0x80228c[_0x60c6('0x1f')]=_0x8154c3);}if(_0x369509&&_0x476768){const _0x5becde=_0x2b31f1[_0x60c6('0x1b')][_0x60c6('0x19')](_0x60c6('0x1e')),_0x7659bf=_0x2b31f1[_0x60c6('0x1b')][_0x60c6('0x19')](_0x60c6('0x15')),_0xca1240=getSuggestions(_0x5becde[_0x60c6('0x7')]({'toJSON':!0x0}),_0x7659bf[_0x60c6('0xd')]);Object['keys'](_0xca1240)[_0x60c6('0x20')]&&(_0x80228c['suggestions']=_0xca1240);}return(_0x80228c[_0x60c6('0x1d')]||_0x80228c[_0x60c6('0x1f')])&&(_0x80228c['timezone']=new Intl[(_0x60c6('0x13'))]()[_0x60c6('0x24')]()[_0x60c6('0x6')]),_0x80228c;}export function getComments(_0x37ee1c){const _0x3bd571={};if(!_0x37ee1c[_0x60c6('0x20')])return _0x3bd571;for(const _0x288c3b of _0x37ee1c)_0x288c3b[_0x60c6('0x1f')][_0x60c6('0x17')](_0xad3f95=>{void 0x0===_0x3bd571[_0x288c3b['id']]&&(_0x3bd571[_0x288c3b['id']]=[]),_0x3bd571[_0x288c3b['id']][_0x60c6('0x26')]({'author':_0xad3f95[_0x60c6('0x5')][_0x60c6('0x25')],'content':_0xad3f95['content'],'created':_0xad3f95[_0x60c6('0x3')],'is_resolved':_0x288c3b[_0x60c6('0x9')]});});return _0x3bd571;}export function getSuggestions(_0x436d5f,_0x145471){const _0x182421={};if(!_0x436d5f[_0x60c6('0x20')]||!_0x145471[_0x60c6('0x20')])return _0x182421;for(const _0x5b1c65 of _0x436d5f)_0x182421[_0x5b1c65['id']]={'author':_0x145471[_0x60c6('0x19')](_0x5b1c65[_0x60c6('0xb')])[_0x60c6('0x25')],'created':_0x5b1c65[_0x60c6('0x3')]};return _0x182421;}
23
+ const _0x394f=['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.','indexOf','from','content','text','author','trim','name','TrackChanges','createdAt','join','cssRules','keys','cssText','timeZone','has',':root','all','timezone','resolvedOptions','getCommentThreads','push','get','length','.ck-content','isResolved','data-cke','EDITOR_STYLES','comments','users','CommentsRepository','suggestions','plugins','authorId','ownerNode'];(function(_0x37e52a,_0x394ff9){const _0x2b53d2=function(_0x599ebe){while(--_0x599ebe){_0x37e52a['push'](_0x37e52a['shift']());}};_0x2b53d2(++_0x394ff9);}(_0x394f,0x14f));const _0x2b53=function(_0x37e52a,_0x394ff9){_0x37e52a=_0x37e52a-0x0;let _0x2b53d2=_0x394f[_0x37e52a];return _0x2b53d2;};export function getStyles(_0x175578){if(!_0x175578)return new Promise(_0x56b0aa=>_0x56b0aa(''));const _0x448316=[];for(const _0x21a8cd of _0x175578)_0x2b53('0x7')!==_0x21a8cd?_0x448316[_0x2b53('0x1')](window['fetch'](_0x21a8cd)['then'](_0xa0d347=>_0xa0d347[_0x2b53('0x13')]())):_0x448316[_0x2b53('0x1')](u());return Promise[_0x2b53('0x20')](_0x448316)['then'](_0x45774b=>_0x45774b[_0x2b53('0x19')]('\x20')['trim']());}function u(){const _0x2763a5=[],_0xe9f29a=[];for(const _0x58c07c of Array[_0x2b53('0x11')](document['styleSheets'])){if(_0x58c07c[_0x2b53('0xe')]['hasAttribute'](_0x2b53('0x6')))for(const _0x12d60a of Array[_0x2b53('0x11')](_0x58c07c[_0x2b53('0x1a')]))-0x1!==_0x12d60a[_0x2b53('0x1c')][_0x2b53('0x10')](_0x2b53('0x4'))?_0x2763a5['push'](_0x12d60a['cssText']):-0x1!==_0x12d60a[_0x2b53('0x1c')]['indexOf'](_0x2b53('0x1f'))&&_0xe9f29a[_0x2b53('0x1')](_0x12d60a[_0x2b53('0x1c')]);}return _0x2763a5['length']||console['warn'](_0x2b53('0xf')),[..._0xe9f29a,..._0x2763a5][_0x2b53('0x19')]('\x20')[_0x2b53('0x15')]();}export function getConverterOptions(_0x59a5c2){const _0x8fac4f=_0x59a5c2[_0x2b53('0xc')][_0x2b53('0x1e')]('Users'),_0x10be91=_0x59a5c2[_0x2b53('0xc')][_0x2b53('0x1e')](_0x2b53('0xa')),_0x110a08=_0x59a5c2['plugins'][_0x2b53('0x1e')](_0x2b53('0x17')),_0xa190b2={};if(_0x8fac4f&&_0x10be91){const _0x58a87c=getComments(_0x59a5c2['plugins'][_0x2b53('0x2')](_0x2b53('0xa'))[_0x2b53('0x0')]({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object[_0x2b53('0x1b')](_0x58a87c)[_0x2b53('0x3')]&&(_0xa190b2[_0x2b53('0x8')]=_0x58a87c);}if(_0x8fac4f&&_0x110a08){const _0x897220=_0x59a5c2[_0x2b53('0xc')]['get'](_0x2b53('0x17')),_0x267ae9=_0x59a5c2[_0x2b53('0xc')]['get']('Users'),_0x33d9d7=getSuggestions(_0x897220['getSuggestions']({'toJSON':!0x0}),_0x267ae9[_0x2b53('0x9')]);Object[_0x2b53('0x1b')](_0x33d9d7)['length']&&(_0xa190b2[_0x2b53('0xb')]=_0x33d9d7);}return(_0xa190b2[_0x2b53('0xb')]||_0xa190b2['comments'])&&(_0xa190b2[_0x2b53('0x21')]=new Intl['DateTimeFormat']()[_0x2b53('0x22')]()[_0x2b53('0x1d')]),_0xa190b2;}export function getComments(_0x811382){const _0x119549={};if(!_0x811382[_0x2b53('0x3')])return _0x119549;for(const _0x4d6841 of _0x811382)_0x4d6841[_0x2b53('0x8')]['map'](_0x548cc9=>{void 0x0===_0x119549[_0x4d6841['id']]&&(_0x119549[_0x4d6841['id']]=[]),_0x119549[_0x4d6841['id']]['push']({'author':_0x548cc9[_0x2b53('0x14')][_0x2b53('0x16')],'content':_0x548cc9[_0x2b53('0x12')],'created':_0x548cc9['createdAt'],'is_resolved':_0x4d6841[_0x2b53('0x5')]});});return _0x119549;}export function getSuggestions(_0x3923e0,_0x5611f7){const _0x4f6bc3={};if(!_0x3923e0[_0x2b53('0x3')]||!_0x5611f7['length'])return _0x4f6bc3;for(const _0x29aa38 of _0x3923e0)_0x4f6bc3[_0x29aa38['id']]={'author':_0x5611f7[_0x2b53('0x2')](_0x29aa38[_0x2b53('0xd')])['name'],'created':_0x29aa38[_0x2b53('0x18')]};return _0x4f6bc3;}