@ckeditor/ckeditor5-export-word 0.0.0-nightly-20231221.0 → 0.0.0-nightly-20231223.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,4 +2,4 @@
2
2
  /*!
3
3
  * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
4
4
  * For licensing, see LICENSE.md.
5
- */(()=>{var e={704:(e,t,o)=>{e.exports=o(79)("./src/core.js")},273:(e,t,o)=>{e.exports=o(79)("./src/ui.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,o),s.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";o.r(n),o.d(n,{ExportWord:()=>l});var e=o(704),t=o(273);const r=["data-cke","cssRules","name","suggestions","isResolved","comments","fetch","then","styleSheets","warn","keys","cssText","length","ownerNode","from","DateTimeFormat","has","CommentsRepository","get","createdAt","content","users","TrackChanges","getSuggestions","author","indexOf","trim","Users","all",":root","hasAttribute",".ck-content","plugins","map","push","timezone","join","resolvedOptions","timeZone","text"];var s,i;s=r,i=243,function(e){for(;--e;)s.push(s.shift())}(++i);const a=function(e,t){return r[e-=0]};function c(){const e=[],t=[];for(const o of Array[a("0xb")](document[a("0x5")]))if(o[a("0xa")][a("0x1b")](a("0x25")))for(const n of Array.from(o[a("0x26")]))-1!==n[a("0x8")][a("0x16")](a("0x1c"))?e[a("0x1f")](n[a("0x8")]):-1!==n[a("0x8")][a("0x16")](a("0x1a"))&&t[a("0x1f")](n[a("0x8")]);return e[a("0x9")]||console[a("0x6")]("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."),[...t,...e][a("0x21")](" ")[a("0x17")]()}function d(e){const t=e[a("0x1d")][a("0xd")](a("0x18")),o=e[a("0x1d")].has(a("0xe")),n=e[a("0x1d")].has(a("0x13")),r={};if(t&&o){const t=function(e){const t={};if(!e[a("0x9")])return t;for(const o of e)o[a("0x2")][a("0x1e")]((e=>{void 0===t[o.id]&&(t[o.id]=[]),t[o.id][a("0x1f")]({author:e[a("0x15")][a("0x27")],content:e[a("0x11")],created:e[a("0x10")],is_resolved:o[a("0x1")]})}));return t}(e[a("0x1d")][a("0xf")](a("0xe")).getCommentThreads({skipNotAttached:!0,skipEmpty:!0}));Object[a("0x7")](t)[a("0x9")]&&(r.comments=t)}if(t&&n){const t=e[a("0x1d")][a("0xf")](a("0x13")),o=e[a("0x1d")][a("0xf")](a("0x18")),n=function(e,t){const o={};if(!e[a("0x9")]||!t.length)return o;for(const n of e)o[n.id]={author:t[a("0xf")](n.authorId)[a("0x27")],created:n.createdAt};return o}(t[a("0x14")]({toJSON:!0}),o[a("0x12")]);Object[a("0x7")](n)[a("0x9")]&&(r.suggestions=n)}return(r[a("0x0")]||r[a("0x2")])&&(r[a("0x20")]=(new(Intl[a("0xc")]))[a("0x22")]()[a("0x23")]),r}class u extends e.Command{constructor(e){super(e),this.set("isBusy",!1),this.affectsData=!1}refresh(){this.isEnabled=!this.isBusy,this.value=this.isBusy?"pending":void 0}execute(e={}){const t=this.editor,o=t.t,n=e.converterUrl||"https://docx-converter.cke-cs.com/v1/convert",r=e.converterOptions||{},s=t.plugins.get("ExportWord"),i=e.token||s._token,u=!1!==r.auto_pagination,l=e.dataCallback||(e=>e.data.get({pagination:u}));return this.isBusy=!0,this.refresh(),function(e){if(!e)return new Promise((e=>e("")));const t=[];for(const o of e)"EDITOR_STYLES"!==o?t[a("0x1f")](window[a("0x3")](o)[a("0x4")]((e=>e[a("0x24")]()))):t[a("0x1f")](c());return Promise[a("0x19")](t)[a("0x4")]((e=>e[a("0x21")](" ")[a("0x17")]()))}(e.stylesheets||["EDITOR_STYLES"]).then((async o=>{const s=await l(t),a=this._replaceSuggestionTypes(s),c={html:'<div class="ck-content" dir="'+t.locale.contentLanguageDirection+'">'+a+"</div>",css:o,options:{...r,...d(t)}},u={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/docx",...i?{Authorization:i.value}:null},body:JSON.stringify(c)};return window.fetch(n,u).then((e=>{if(200!==e.status)throw e;return e.blob()})).then((t=>{const o="function"==typeof e.fileName?e.fileName():e.fileName;this._downloadFile(t,o||"document.docx")}))})).catch((e=>{throw t.plugins.get("Notification").showWarning(o("An error occurred while generating the Word file.")),e})).finally((()=>{this.isBusy=!1,this.refresh()}))}_replaceSuggestionTypes(e){if(!e)return e;const t=(e,t,o)=>"attribute"===o?t+"formatInline:":e;return e.replace(/<suggestion-(start|end) name="(.*?):/g,((e,o,n)=>t(e,"<suggestion-"+o+' name="',n))).replace(/data-suggestion-(start|end)-(before|after)="(.*?):/g,((e,o,n,r)=>t(e,"data-suggestion-"+o+"-"+n+'="',r)))}_downloadFile(e,t){const o=document.createElement("a");o.href=window.URL.createObjectURL(e),o.download=t,o.click(),o.remove()}}class l extends e.Plugin{static get pluginName(){return"ExportWord"}static get requires(){return["CloudServices",t.Notification]}init(){const e=this.editor,o=e.t,n=e.config.get("exportWord")||{};e.commands.add("exportWord",new u(e)),e.ui.componentFactory.add("exportWord",(r=>{const s=e.commands.get("exportWord"),i=new t.ButtonView(r),a=new t.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(a),i.bind("isOn","isEnabled").to(s,"isBusy","isEnabled"),a.bind("isVisible").to(s,"isBusy"),i.iconView.bind("isVisible").to(s,"isBusy",(e=>!e)),this.listenTo(i,"execute",(()=>{e.execute("exportWord",n),e.editing.view.focus()})),i}));const r=e.plugins.get("CloudServices");!1===n.tokenUrl?this._token=null:n.tokenUrl?r.registerTokenUrl(n.tokenUrl).then((e=>{this._token=e})):this._token=r.token}}})(),(window.CKEditor5=window.CKEditor5||{}).exportWord=n})();
5
+ */(()=>{var e={704:(e,t,o)=>{e.exports=o(79)("./src/core.js")},273:(e,t,o)=>{e.exports=o(79)("./src/ui.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,o),s.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";o.r(n),o.d(n,{ExportWord:()=>u});var e=o(704),t=o(273);const r=["isResolved","map","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.","cssText","length","then","Users","suggestions","indexOf","data-cke","plugins","getCommentThreads","keys","createdAt","comments","TrackChanges","name","join","getSuggestions","DateTimeFormat","all","CommentsRepository","styleSheets","has","resolvedOptions","trim","authorId","content","warn","from","get","push","users","hasAttribute","timezone",":root"];var s,i;s=r,i=154,function(e){for(;--e;)s.push(s.shift())}(++i);const a=function(e,t){return r[e-=0]};function c(){const e=[],t=[];for(const o of Array.from(document[a("0xc")]))if(o.ownerNode[a("0x17")](a("0x23")))for(const n of Array[a("0x13")](o.cssRules))-1!==n.cssText[a("0x22")](".ck-content")?e[a("0x15")](n[a("0x1d")]):-1!==n.cssText[a("0x22")](a("0x19"))&&t[a("0x15")](n.cssText);return e[a("0x1e")]||console[a("0x12")](a("0x1c")),[...t,...e][a("0x7")](" ")[a("0xf")]()}function d(e){const t=e[a("0x0")][a("0xd")](a("0x20")),o=e[a("0x0")][a("0xd")](a("0xb")),n=e[a("0x0")][a("0xd")](a("0x5")),r={};if(t&&o){const t=function(e){const t={};if(!e[a("0x1e")])return t;for(const o of e)o[a("0x4")][a("0x1b")]((e=>{void 0===t[o.id]&&(t[o.id]=[]),t[o.id][a("0x15")]({author:e.author.name,content:e[a("0x11")],created:e[a("0x3")],is_resolved:o[a("0x1a")]})}));return t}(e.plugins[a("0x14")]("CommentsRepository")[a("0x1")]({skipNotAttached:!0,skipEmpty:!0}));Object[a("0x2")](t)[a("0x1e")]&&(r[a("0x4")]=t)}if(t&&n){const t=e[a("0x0")][a("0x14")]("TrackChanges"),o=e[a("0x0")].get(a("0x20")),n=function(e,t){const o={};if(!e[a("0x1e")]||!t[a("0x1e")])return o;for(const n of e)o[n.id]={author:t.get(n[a("0x10")])[a("0x6")],created:n[a("0x3")]};return o}(t[a("0x8")]({toJSON:!0}),o[a("0x16")]);Object[a("0x2")](n).length&&(r[a("0x21")]=n)}return(r[a("0x21")]||r[a("0x4")])&&(r[a("0x18")]=(new(Intl[a("0x9")]))[a("0xe")]().timeZone),r}class l extends e.Command{constructor(e){super(e),this.set("isBusy",!1),this.affectsData=!1}refresh(){this.isEnabled=!this.isBusy,this.value=this.isBusy?"pending":void 0}execute(e={}){const t=this.editor,o=t.t,n=e.converterUrl||"https://docx-converter.cke-cs.com/v1/convert",r=e.converterOptions||{},s=t.plugins.get("ExportWord"),i=e.token||s._token,l=!1!==r.auto_pagination,u=e.dataCallback||(e=>e.data.get({pagination:l}));return this.isBusy=!0,this.refresh(),function(e){if(!e)return new Promise((e=>e("")));const t=[];for(const o of e)"EDITOR_STYLES"!==o?t[a("0x15")](window.fetch(o)[a("0x1f")]((e=>e.text()))):t[a("0x15")](c());return Promise[a("0xa")](t).then((e=>e[a("0x7")](" ")[a("0xf")]()))}(e.stylesheets||["EDITOR_STYLES"]).then((async o=>{const s=await u(t),a=this._replaceSuggestionTypes(s),c={html:'<div class="ck-content" dir="'+t.locale.contentLanguageDirection+'">'+a+"</div>",css:o,options:{...r,...d(t)}},l={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/docx",...i?{Authorization:i.value}:null},body:JSON.stringify(c)};return window.fetch(n,l).then((e=>{if(200!==e.status)throw e;return e.blob()})).then((t=>{const o="function"==typeof e.fileName?e.fileName():e.fileName;this._downloadFile(t,o||"document.docx")}))})).catch((e=>{throw t.plugins.get("Notification").showWarning(o("An error occurred while generating the Word file.")),e})).finally((()=>{this.isBusy=!1,this.refresh()}))}_replaceSuggestionTypes(e){if(!e)return e;const t=(e,t,o)=>"attribute"===o?t+"formatInline:":e;return e.replace(/<suggestion-(start|end) name="(.*?):/g,((e,o,n)=>t(e,"<suggestion-"+o+' name="',n))).replace(/data-suggestion-(start|end)-(before|after)="(.*?):/g,((e,o,n,r)=>t(e,"data-suggestion-"+o+"-"+n+'="',r)))}_downloadFile(e,t){const o=document.createElement("a");o.href=window.URL.createObjectURL(e),o.download=t,o.click(),o.remove()}}class u extends e.Plugin{static get pluginName(){return"ExportWord"}static get requires(){return["CloudServices",t.Notification]}init(){const e=this.editor,o=e.t,n=e.config.get("exportWord")||{};e.commands.add("exportWord",new l(e)),e.ui.componentFactory.add("exportWord",(r=>{const s=e.commands.get("exportWord"),i=new t.ButtonView(r),a=new t.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(a),i.bind("isOn","isEnabled").to(s,"isBusy","isEnabled"),a.bind("isVisible").to(s,"isBusy"),i.iconView.bind("isVisible").to(s,"isBusy",(e=>!e)),this.listenTo(i,"execute",(()=>{e.execute("exportWord",n),e.editing.view.focus()})),i}));const r=e.plugins.get("CloudServices");!1===n.tokenUrl?this._token=null:n.tokenUrl?r.registerTokenUrl(n.tokenUrl).then((e=>{this._token=e})):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-20231221.0",
3
+ "version": "0.0.0-nightly-20231223.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-20231221.0"
33
+ "ckeditor5": "0.0.0-nightly-20231223.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 _0xc280a3}from'ckeditor5/src/core.js';import{ButtonView as _0x5118e6,Notification as _0x159f99,SpinnerView as _0x2fc908}from'ckeditor5/src/ui.js';import _0x115e0c from'./exportwordcommand.js';import _0x18e1e4 from'../theme/icons/exportword.svg';export default class d extends _0xc280a3{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x159f99];}['init'](){const _0x1a2dec=this['editor'],t=_0x1a2dec['t'],_0x42a30d=_0x1a2dec['config']['get']('exportWord')||{};_0x1a2dec['commands']['add']('exportWord',new _0x115e0c(_0x1a2dec)),_0x1a2dec['ui']['componentFactory']['add']('exportWord',_0x4019e4=>{const _0x5aec53=_0x1a2dec['commands']['get']('exportWord'),_0x463bcb=new _0x5118e6(_0x4019e4),_0x55bebd=new _0x2fc908();return _0x463bcb['set']({'label':t('Export\x20to\x20Word'),'icon':_0x18e1e4,'tooltip':!0x0}),_0x463bcb['children']['add'](_0x55bebd),_0x463bcb['bind']('isOn','isEnabled')['to'](_0x5aec53,'isBusy','isEnabled'),_0x55bebd['bind']('isVisible')['to'](_0x5aec53,'isBusy'),_0x463bcb['iconView']['bind']('isVisible')['to'](_0x5aec53,'isBusy',_0x3e8791=>!_0x3e8791),this['listenTo'](_0x463bcb,'execute',()=>{_0x1a2dec['execute']('exportWord',_0x42a30d),_0x1a2dec['editing']['view']['focus']();}),_0x463bcb;});const _0x35fc4f=_0x1a2dec['plugins']['get']('CloudServices');!0x1===_0x42a30d['tokenUrl']?this['_token']=null:_0x42a30d['tokenUrl']?_0x35fc4f['registerTokenUrl'](_0x42a30d['tokenUrl'])['then'](_0x2d03e2=>{this['_token']=_0x2d03e2;}):this['_token']=_0x35fc4f['token'];}}
23
+ import{Plugin as _0x48683c}from'ckeditor5/src/core.js';import{ButtonView as _0x54d487,Notification as _0x1bc398,SpinnerView as _0x10f161}from'ckeditor5/src/ui.js';import _0x44907c from'./exportwordcommand.js';import _0x1b2039 from'../theme/icons/exportword.svg';export default class d extends _0x48683c{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x1bc398];}['init'](){const _0x408ce7=this['editor'],t=_0x408ce7['t'],_0x12ed76=_0x408ce7['config']['get']('exportWord')||{};_0x408ce7['commands']['add']('exportWord',new _0x44907c(_0x408ce7)),_0x408ce7['ui']['componentFactory']['add']('exportWord',_0x9ecce8=>{const _0x5843b0=_0x408ce7['commands']['get']('exportWord'),_0x159dc0=new _0x54d487(_0x9ecce8),_0x34a449=new _0x10f161();return _0x159dc0['set']({'label':t('Export\x20to\x20Word'),'icon':_0x1b2039,'tooltip':!0x0}),_0x159dc0['children']['add'](_0x34a449),_0x159dc0['bind']('isOn','isEnabled')['to'](_0x5843b0,'isBusy','isEnabled'),_0x34a449['bind']('isVisible')['to'](_0x5843b0,'isBusy'),_0x159dc0['iconView']['bind']('isVisible')['to'](_0x5843b0,'isBusy',_0x2e4556=>!_0x2e4556),this['listenTo'](_0x159dc0,'execute',()=>{_0x408ce7['execute']('exportWord',_0x12ed76),_0x408ce7['editing']['view']['focus']();}),_0x159dc0;});const _0x48d7c0=_0x408ce7['plugins']['get']('CloudServices');!0x1===_0x12ed76['tokenUrl']?this['_token']=null:_0x12ed76['tokenUrl']?_0x48d7c0['registerTokenUrl'](_0x12ed76['tokenUrl'])['then'](_0x204c1c=>{this['_token']=_0x204c1c;}):this['_token']=_0x48d7c0['token'];}}
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Command as _0x9e1ef2}from'ckeditor5/src/core.js';import{getConverterOptions as _0x44314c,getStyles as _0x328f6d}from'./utils.js';export default class i extends _0x9e1ef2{constructor(_0x89497a){super(_0x89497a),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x1b0e3b={}){const _0x3660fe=this['editor'],t=_0x3660fe['t'],_0x39aa93=_0x1b0e3b['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x2d8621=_0x1b0e3b['converterOptions']||{},_0x11c452=_0x3660fe['plugins']['get']('ExportWord'),_0x4a1916=_0x1b0e3b['token']||_0x11c452['_token'],_0x33559a=!0x1!==_0x2d8621['auto_pagination'],_0x52b5da=_0x1b0e3b['dataCallback']||(_0x1c6d15=>_0x1c6d15['data']['get']({'pagination':_0x33559a}));return this['isBusy']=!0x0,this['refresh'](),_0x328f6d(_0x1b0e3b['stylesheets']||['EDITOR_STYLES'])['then'](async _0x854452=>{const _0x2cdf8b=await _0x52b5da(_0x3660fe),_0x15d081=this['_replaceSuggestionTypes'](_0x2cdf8b),_0xfe182b={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x3660fe['locale']['contentLanguageDirection']+'\x22>'+_0x15d081+'</div>','css':_0x854452,'options':{..._0x2d8621,..._0x44314c(_0x3660fe)}},_0x17090d={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x4a1916?{'Authorization':_0x4a1916['value']}:null},'body':JSON['stringify'](_0xfe182b)};return window['fetch'](_0x39aa93,_0x17090d)['then'](_0x51c2e1=>{if(0xc8!==_0x51c2e1['status'])throw _0x51c2e1;return _0x51c2e1['blob']();})['then'](_0x2bab1c=>{const _0x1e1a0e='function'==typeof _0x1b0e3b['fileName']?_0x1b0e3b['fileName']():_0x1b0e3b['fileName'];this['_downloadFile'](_0x2bab1c,_0x1e1a0e||'document.docx');});})['catch'](_0xc08d7b=>{throw _0x3660fe['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0xc08d7b;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_replaceSuggestionTypes'](_0x5426c6){if(!_0x5426c6)return _0x5426c6;const _0x40f261=(_0x2a5f1d,_0x3e7959,_0x1d5aeb)=>'attribute'===_0x1d5aeb?_0x3e7959+'formatInline:':_0x2a5f1d;return _0x5426c6['replace'](/<suggestion-(start|end) name="(.*?):/g,(_0x2c8146,_0x1999a8,_0x415c85)=>_0x40f261(_0x2c8146,'<suggestion-'+_0x1999a8+'\x20name=\x22',_0x415c85))['replace'](/data-suggestion-(start|end)-(before|after)="(.*?):/g,(_0x25d6d3,_0x4b39a3,_0x5dba8a,_0x508588)=>_0x40f261(_0x25d6d3,'data-suggestion-'+_0x4b39a3+'-'+_0x5dba8a+'=\x22',_0x508588));}['_downloadFile'](_0x31b304,_0x5849ea){const _0x2c9b58=document['createElement']('a');_0x2c9b58['href']=window['URL']['createObjectURL'](_0x31b304),_0x2c9b58['download']=_0x5849ea,_0x2c9b58['click'](),_0x2c9b58['remove']();}}
23
+ import{Command as _0x34c648}from'ckeditor5/src/core.js';import{getConverterOptions as _0x4c62c0,getStyles as _0x2c3d26}from'./utils.js';export default class i extends _0x34c648{constructor(_0x5585dc){super(_0x5585dc),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x3ffa80={}){const _0x2446e3=this['editor'],t=_0x2446e3['t'],_0x212006=_0x3ffa80['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x193941=_0x3ffa80['converterOptions']||{},_0x5824b5=_0x2446e3['plugins']['get']('ExportWord'),_0x54387f=_0x3ffa80['token']||_0x5824b5['_token'],_0x2c2186=!0x1!==_0x193941['auto_pagination'],_0x48866e=_0x3ffa80['dataCallback']||(_0x304a38=>_0x304a38['data']['get']({'pagination':_0x2c2186}));return this['isBusy']=!0x0,this['refresh'](),_0x2c3d26(_0x3ffa80['stylesheets']||['EDITOR_STYLES'])['then'](async _0x3507f9=>{const _0x4cd74d=await _0x48866e(_0x2446e3),_0x38b2dc=this['_replaceSuggestionTypes'](_0x4cd74d),_0x49ad6f={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x2446e3['locale']['contentLanguageDirection']+'\x22>'+_0x38b2dc+'</div>','css':_0x3507f9,'options':{..._0x193941,..._0x4c62c0(_0x2446e3)}},_0x1d0ae5={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x54387f?{'Authorization':_0x54387f['value']}:null},'body':JSON['stringify'](_0x49ad6f)};return window['fetch'](_0x212006,_0x1d0ae5)['then'](_0x5b33bd=>{if(0xc8!==_0x5b33bd['status'])throw _0x5b33bd;return _0x5b33bd['blob']();})['then'](_0x954e37=>{const _0x1e84bf='function'==typeof _0x3ffa80['fileName']?_0x3ffa80['fileName']():_0x3ffa80['fileName'];this['_downloadFile'](_0x954e37,_0x1e84bf||'document.docx');});})['catch'](_0x556a1b=>{throw _0x2446e3['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x556a1b;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_replaceSuggestionTypes'](_0x156f71){if(!_0x156f71)return _0x156f71;const _0x19f776=(_0x2e0abf,_0x4fb54e,_0x1d7550)=>'attribute'===_0x1d7550?_0x4fb54e+'formatInline:':_0x2e0abf;return _0x156f71['replace'](/<suggestion-(start|end) name="(.*?):/g,(_0x221f4d,_0x1fc71e,_0x1d23a1)=>_0x19f776(_0x221f4d,'<suggestion-'+_0x1fc71e+'\x20name=\x22',_0x1d23a1))['replace'](/data-suggestion-(start|end)-(before|after)="(.*?):/g,(_0x16e108,_0x3d8c01,_0x399432,_0x26ce3a)=>_0x19f776(_0x16e108,'data-suggestion-'+_0x3d8c01+'-'+_0x399432+'=\x22',_0x26ce3a));}['_downloadFile'](_0x31643e,_0x177019){const _0x306e00=document['createElement']('a');_0x306e00['href']=window['URL']['createObjectURL'](_0x31643e),_0x306e00['download']=_0x177019,_0x306e00['click'](),_0x306e00['remove']();}}
package/src/utils.js CHANGED
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x2ff1=['data-cke','cssRules','name','suggestions','isResolved','comments','fetch','then','styleSheets','warn','keys','cssText','length','ownerNode','from','DateTimeFormat','has','CommentsRepository','get','createdAt','content','users','TrackChanges','getSuggestions','author','indexOf','trim','Users','all',':root','hasAttribute','.ck-content','plugins','map','push','timezone','join','resolvedOptions','timeZone','text'];(function(_0x22205d,_0x2ff125){const _0x3e4cf1=function(_0x42992d){while(--_0x42992d){_0x22205d['push'](_0x22205d['shift']());}};_0x3e4cf1(++_0x2ff125);}(_0x2ff1,0xf3));const _0x3e4c=function(_0x22205d,_0x2ff125){_0x22205d=_0x22205d-0x0;let _0x3e4cf1=_0x2ff1[_0x22205d];return _0x3e4cf1;};export function getStyles(_0x587c73){if(!_0x587c73)return new Promise(_0xec3d6d=>_0xec3d6d(''));const _0x582cda=[];for(const _0x4ef564 of _0x587c73)'EDITOR_STYLES'!==_0x4ef564?_0x582cda[_0x3e4c('0x1f')](window[_0x3e4c('0x3')](_0x4ef564)[_0x3e4c('0x4')](_0x3db247=>_0x3db247[_0x3e4c('0x24')]())):_0x582cda[_0x3e4c('0x1f')](u());return Promise[_0x3e4c('0x19')](_0x582cda)[_0x3e4c('0x4')](_0x5b2c22=>_0x5b2c22[_0x3e4c('0x21')]('\x20')[_0x3e4c('0x17')]());}function u(){const _0x5e71ae=[],_0x5e4616=[];for(const _0x3756d0 of Array[_0x3e4c('0xb')](document[_0x3e4c('0x5')])){if(_0x3756d0[_0x3e4c('0xa')][_0x3e4c('0x1b')](_0x3e4c('0x25')))for(const _0x3d32c1 of Array['from'](_0x3756d0[_0x3e4c('0x26')]))-0x1!==_0x3d32c1[_0x3e4c('0x8')][_0x3e4c('0x16')](_0x3e4c('0x1c'))?_0x5e71ae[_0x3e4c('0x1f')](_0x3d32c1[_0x3e4c('0x8')]):-0x1!==_0x3d32c1[_0x3e4c('0x8')][_0x3e4c('0x16')](_0x3e4c('0x1a'))&&_0x5e4616[_0x3e4c('0x1f')](_0x3d32c1[_0x3e4c('0x8')]);}return _0x5e71ae[_0x3e4c('0x9')]||console[_0x3e4c('0x6')]('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.'),[..._0x5e4616,..._0x5e71ae][_0x3e4c('0x21')]('\x20')[_0x3e4c('0x17')]();}export function getConverterOptions(_0xb41cf4){const _0x1667c4=_0xb41cf4[_0x3e4c('0x1d')][_0x3e4c('0xd')](_0x3e4c('0x18')),_0x3ef983=_0xb41cf4[_0x3e4c('0x1d')]['has'](_0x3e4c('0xe')),_0x1e5790=_0xb41cf4[_0x3e4c('0x1d')]['has'](_0x3e4c('0x13')),_0x3bbc0b={};if(_0x1667c4&&_0x3ef983){const _0x114109=getComments(_0xb41cf4[_0x3e4c('0x1d')][_0x3e4c('0xf')](_0x3e4c('0xe'))['getCommentThreads']({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object[_0x3e4c('0x7')](_0x114109)[_0x3e4c('0x9')]&&(_0x3bbc0b['comments']=_0x114109);}if(_0x1667c4&&_0x1e5790){const _0xd9a3fe=_0xb41cf4[_0x3e4c('0x1d')][_0x3e4c('0xf')](_0x3e4c('0x13')),_0x43a9c3=_0xb41cf4[_0x3e4c('0x1d')][_0x3e4c('0xf')](_0x3e4c('0x18')),_0x34d624=getSuggestions(_0xd9a3fe[_0x3e4c('0x14')]({'toJSON':!0x0}),_0x43a9c3[_0x3e4c('0x12')]);Object[_0x3e4c('0x7')](_0x34d624)[_0x3e4c('0x9')]&&(_0x3bbc0b['suggestions']=_0x34d624);}return(_0x3bbc0b[_0x3e4c('0x0')]||_0x3bbc0b[_0x3e4c('0x2')])&&(_0x3bbc0b[_0x3e4c('0x20')]=new Intl[(_0x3e4c('0xc'))]()[_0x3e4c('0x22')]()[_0x3e4c('0x23')]),_0x3bbc0b;}export function getComments(_0x90b162){const _0x20aa3c={};if(!_0x90b162[_0x3e4c('0x9')])return _0x20aa3c;for(const _0xc94a66 of _0x90b162)_0xc94a66[_0x3e4c('0x2')][_0x3e4c('0x1e')](_0x4e3e5c=>{void 0x0===_0x20aa3c[_0xc94a66['id']]&&(_0x20aa3c[_0xc94a66['id']]=[]),_0x20aa3c[_0xc94a66['id']][_0x3e4c('0x1f')]({'author':_0x4e3e5c[_0x3e4c('0x15')][_0x3e4c('0x27')],'content':_0x4e3e5c[_0x3e4c('0x11')],'created':_0x4e3e5c[_0x3e4c('0x10')],'is_resolved':_0xc94a66[_0x3e4c('0x1')]});});return _0x20aa3c;}export function getSuggestions(_0x5ab247,_0x98e967){const _0x4d1c4a={};if(!_0x5ab247[_0x3e4c('0x9')]||!_0x98e967['length'])return _0x4d1c4a;for(const _0xb54864 of _0x5ab247)_0x4d1c4a[_0xb54864['id']]={'author':_0x98e967[_0x3e4c('0xf')](_0xb54864['authorId'])[_0x3e4c('0x27')],'created':_0xb54864['createdAt']};return _0x4d1c4a;}
23
+ const _0x28b8=['isResolved','map','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.','cssText','length','then','Users','suggestions','indexOf','data-cke','plugins','getCommentThreads','keys','createdAt','comments','TrackChanges','name','join','getSuggestions','DateTimeFormat','all','CommentsRepository','styleSheets','has','resolvedOptions','trim','authorId','content','warn','from','get','push','users','hasAttribute','timezone',':root'];(function(_0xcf069f,_0x28b81c){const _0x1c31ad=function(_0x533643){while(--_0x533643){_0xcf069f['push'](_0xcf069f['shift']());}};_0x1c31ad(++_0x28b81c);}(_0x28b8,0x9a));const _0x1c31=function(_0xcf069f,_0x28b81c){_0xcf069f=_0xcf069f-0x0;let _0x1c31ad=_0x28b8[_0xcf069f];return _0x1c31ad;};export function getStyles(_0x14bab4){if(!_0x14bab4)return new Promise(_0x2ad4f9=>_0x2ad4f9(''));const _0x19ffe7=[];for(const _0x591384 of _0x14bab4)'EDITOR_STYLES'!==_0x591384?_0x19ffe7[_0x1c31('0x15')](window['fetch'](_0x591384)[_0x1c31('0x1f')](_0x573faf=>_0x573faf['text']())):_0x19ffe7[_0x1c31('0x15')](u());return Promise[_0x1c31('0xa')](_0x19ffe7)['then'](_0x3bfa4d=>_0x3bfa4d[_0x1c31('0x7')]('\x20')[_0x1c31('0xf')]());}function u(){const _0x2bc09c=[],_0x5078cd=[];for(const _0x5b074a of Array['from'](document[_0x1c31('0xc')])){if(_0x5b074a['ownerNode'][_0x1c31('0x17')](_0x1c31('0x23')))for(const _0x222d68 of Array[_0x1c31('0x13')](_0x5b074a['cssRules']))-0x1!==_0x222d68['cssText'][_0x1c31('0x22')]('.ck-content')?_0x2bc09c[_0x1c31('0x15')](_0x222d68[_0x1c31('0x1d')]):-0x1!==_0x222d68['cssText'][_0x1c31('0x22')](_0x1c31('0x19'))&&_0x5078cd[_0x1c31('0x15')](_0x222d68['cssText']);}return _0x2bc09c[_0x1c31('0x1e')]||console[_0x1c31('0x12')](_0x1c31('0x1c')),[..._0x5078cd,..._0x2bc09c][_0x1c31('0x7')]('\x20')[_0x1c31('0xf')]();}export function getConverterOptions(_0x3f2925){const _0xf34ece=_0x3f2925[_0x1c31('0x0')][_0x1c31('0xd')](_0x1c31('0x20')),_0x280bfd=_0x3f2925[_0x1c31('0x0')][_0x1c31('0xd')](_0x1c31('0xb')),_0x24db86=_0x3f2925[_0x1c31('0x0')][_0x1c31('0xd')](_0x1c31('0x5')),_0x34a3f3={};if(_0xf34ece&&_0x280bfd){const _0x91eac7=getComments(_0x3f2925['plugins'][_0x1c31('0x14')]('CommentsRepository')[_0x1c31('0x1')]({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object[_0x1c31('0x2')](_0x91eac7)[_0x1c31('0x1e')]&&(_0x34a3f3[_0x1c31('0x4')]=_0x91eac7);}if(_0xf34ece&&_0x24db86){const _0x233362=_0x3f2925[_0x1c31('0x0')][_0x1c31('0x14')]('TrackChanges'),_0x15041f=_0x3f2925[_0x1c31('0x0')]['get'](_0x1c31('0x20')),_0x2474f1=getSuggestions(_0x233362[_0x1c31('0x8')]({'toJSON':!0x0}),_0x15041f[_0x1c31('0x16')]);Object[_0x1c31('0x2')](_0x2474f1)['length']&&(_0x34a3f3[_0x1c31('0x21')]=_0x2474f1);}return(_0x34a3f3[_0x1c31('0x21')]||_0x34a3f3[_0x1c31('0x4')])&&(_0x34a3f3[_0x1c31('0x18')]=new Intl[(_0x1c31('0x9'))]()[_0x1c31('0xe')]()['timeZone']),_0x34a3f3;}export function getComments(_0x1564fa){const _0x365418={};if(!_0x1564fa[_0x1c31('0x1e')])return _0x365418;for(const _0x2c3400 of _0x1564fa)_0x2c3400[_0x1c31('0x4')][_0x1c31('0x1b')](_0x29a0f7=>{void 0x0===_0x365418[_0x2c3400['id']]&&(_0x365418[_0x2c3400['id']]=[]),_0x365418[_0x2c3400['id']][_0x1c31('0x15')]({'author':_0x29a0f7['author']['name'],'content':_0x29a0f7[_0x1c31('0x11')],'created':_0x29a0f7[_0x1c31('0x3')],'is_resolved':_0x2c3400[_0x1c31('0x1a')]});});return _0x365418;}export function getSuggestions(_0xc3ecbf,_0x525cb7){const _0x5d6390={};if(!_0xc3ecbf[_0x1c31('0x1e')]||!_0x525cb7[_0x1c31('0x1e')])return _0x5d6390;for(const _0x142223 of _0xc3ecbf)_0x5d6390[_0x142223['id']]={'author':_0x525cb7['get'](_0x142223[_0x1c31('0x10')])[_0x1c31('0x6')],'created':_0x142223[_0x1c31('0x3')]};return _0x5d6390;}