@ckeditor/ckeditor5-export-word 0.0.0-nightly-20231206.0 → 0.0.0-nightly-20231208.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=["EDITOR_STYLES","comments","plugins","TrackChanges","push","keys","map","cssText","getSuggestions","hasAttribute","createdAt","styleSheets","length","CommentsRepository","then","isResolved","get","name","trim","data-cke","author","cssRules","Users","all","content","join","has","ownerNode","from","text",":root","warn","suggestions","indexOf",".ck-content","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."];var s,i;s=r,i=401,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("0x17")](document[a("0x6")]))if(o[a("0x16")][a("0x4")](a("0xe")))for(const n of Array[a("0x17")](o[a("0x10")]))-1!==n[a("0x2")][a("0x1c")](a("0x1d"))?e[a("0x23")](n[a("0x2")]):-1!==n[a("0x2")][a("0x1c")](a("0x19"))&&t[a("0x23")](n[a("0x2")]);return e[a("0x7")]||console[a("0x1a")](a("0x1e")),[...t,...e][a("0x14")](" ")[a("0xd")]()}function d(e){const t=e[a("0x21")][a("0x15")]("Users"),o=e.plugins[a("0x15")]("CommentsRepository"),n=e.plugins[a("0x15")](a("0x22")),r={};if(t&&o){const t=function(e){const t={};if(!e[a("0x7")])return t;for(const o of e)o[a("0x20")][a("0x1")]((e=>{void 0===t[o.id]&&(t[o.id]=[]),t[o.id].push({author:e[a("0xf")][a("0xc")],content:e[a("0x13")],created:e[a("0x5")],is_resolved:o[a("0xa")]})}));return t}(e[a("0x21")][a("0xb")](a("0x8")).getCommentThreads({skipNotAttached:!0,skipEmpty:!0}));Object.keys(t).length&&(r[a("0x20")]=t)}if(t&&n){const t=e[a("0x21")][a("0xb")](a("0x22")),o=e[a("0x21")][a("0xb")](a("0x11")),n=function(e,t){const o={};if(!e.length||!t[a("0x7")])return o;for(const n of e)o[n.id]={author:t.get(n.authorId)[a("0xc")],created:n[a("0x5")]};return o}(t[a("0x3")]({toJSON:!0}),o.users);Object[a("0x0")](n)[a("0x7")]&&(r[a("0x1b")]=n)}return(r[a("0x1b")]||r.comments)&&(r.timezone=(new Intl.DateTimeFormat).resolvedOptions().timeZone),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)a("0x1f")!==o?t[a("0x23")](window.fetch(o)[a("0x9")]((e=>e[a("0x18")]()))):t.push(c());return Promise[a("0x12")](t)[a("0x9")]((e=>e[a("0x14")](" ").trim()))}(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:()=>l});var e=o(704),t=o(273);const r=["users","cssText","Users",".ck-content","TrackChanges","authorId","isResolved","name","from","content","cssRules","has","createdAt","hasAttribute","timezone","ownerNode","styleSheets","join","author","then","all","push","get","map","keys","getCommentThreads","CommentsRepository","comments","length","text","plugins","indexOf","EDITOR_STYLES","data-cke","timeZone","warn","trim","DateTimeFormat","suggestions"];var s,i;s=r,i=477,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("0x26")](document[a("0x7")]))if(o[a("0x6")][a("0x4")](a("0x18")))for(const n of Array[a("0x26")](o[a("0x1")]))-1!==n[a("0x1f")][a("0x16")](a("0x21"))?e.push(n[a("0x1f")]):-1!==n[a("0x1f")][a("0x16")](":root")&&t[a("0xc")](n[a("0x1f")]);return e.length||console[a("0x1a")]("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("0x8")](" ")[a("0x1b")]()}function d(e){const t=e[a("0x15")].has(a("0x20")),o=e[a("0x15")][a("0x2")]("CommentsRepository"),n=e[a("0x15")][a("0x2")](a("0x22")),r={};if(t&&o){const t=function(e){const t={};if(!e[a("0x13")])return t;for(const o of e)o[a("0x12")][a("0xe")]((e=>{void 0===t[o.id]&&(t[o.id]=[]),t[o.id][a("0xc")]({author:e[a("0x9")].name,content:e[a("0x0")],created:e[a("0x3")],is_resolved:o[a("0x24")]})}));return t}(e[a("0x15")][a("0xd")](a("0x11"))[a("0x10")]({skipNotAttached:!0,skipEmpty:!0}));Object[a("0xf")](t)[a("0x13")]&&(r[a("0x12")]=t)}if(t&&n){const t=e.plugins[a("0xd")](a("0x22")),o=e[a("0x15")][a("0xd")](a("0x20")),n=function(e,t){const o={};if(!e[a("0x13")]||!t[a("0x13")])return o;for(const n of e)o[n.id]={author:t[a("0xd")](n[a("0x23")])[a("0x25")],created:n[a("0x3")]};return o}(t.getSuggestions({toJSON:!0}),o[a("0x1e")]);Object.keys(n)[a("0x13")]&&(r[a("0x1d")]=n)}return(r[a("0x1d")]||r.comments)&&(r[a("0x5")]=(new(Intl[a("0x1c")])).resolvedOptions()[a("0x19")]),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)a("0x17")!==o?t[a("0xc")](window.fetch(o).then((e=>e[a("0x14")]()))):t.push(c());return Promise[a("0xb")](t)[a("0xa")]((e=>e.join(" ")[a("0x1b")]()))}(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})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-export-word",
3
- "version": "0.0.0-nightly-20231206.0",
3
+ "version": "0.0.0-nightly-20231208.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-20231206.0"
32
+ "ckeditor5": "0.0.0-nightly-20231208.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 _0x462fe5}from'ckeditor5/src/core';import{ButtonView as _0x499290,Notification as _0x2aec4f,SpinnerView as _0x274a32}from'ckeditor5/src/ui';import _0x2de016 from'./exportwordcommand';import _0x263451 from'../theme/icons/exportword.svg';export default class d extends _0x462fe5{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x2aec4f];}['init'](){const _0x31a227=this['editor'],t=_0x31a227['t'],_0xbbebc4=_0x31a227['config']['get']('exportWord')||{};_0x31a227['commands']['add']('exportWord',new _0x2de016(_0x31a227)),_0x31a227['ui']['componentFactory']['add']('exportWord',_0x55819b=>{const _0x46c087=_0x31a227['commands']['get']('exportWord'),_0x566a12=new _0x499290(_0x55819b),_0x4dc5b8=new _0x274a32();return _0x566a12['set']({'label':t('Export\x20to\x20Word'),'icon':_0x263451,'tooltip':!0x0}),_0x566a12['children']['add'](_0x4dc5b8),_0x566a12['bind']('isOn','isEnabled')['to'](_0x46c087,'isBusy','isEnabled'),_0x4dc5b8['bind']('isVisible')['to'](_0x46c087,'isBusy'),_0x566a12['iconView']['bind']('isVisible')['to'](_0x46c087,'isBusy',_0x3fb6b0=>!_0x3fb6b0),this['listenTo'](_0x566a12,'execute',()=>{_0x31a227['execute']('exportWord',_0xbbebc4),_0x31a227['editing']['view']['focus']();}),_0x566a12;});const _0x38e5af=_0x31a227['plugins']['get']('CloudServices');!0x1===_0xbbebc4['tokenUrl']?this['_token']=null:_0xbbebc4['tokenUrl']?_0x38e5af['registerTokenUrl'](_0xbbebc4['tokenUrl'])['then'](_0x196bfd=>{this['_token']=_0x196bfd;}):this['_token']=_0x38e5af['token'];}}
23
+ import{Plugin as _0x56a9c8}from'ckeditor5/src/core';import{ButtonView as _0x1b9d22,Notification as _0x44d4bf,SpinnerView as _0x13f6d5}from'ckeditor5/src/ui';import _0x145125 from'./exportwordcommand';import _0xc97234 from'../theme/icons/exportword.svg';export default class d extends _0x56a9c8{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x44d4bf];}['init'](){const _0x31a5f9=this['editor'],t=_0x31a5f9['t'],_0x4db400=_0x31a5f9['config']['get']('exportWord')||{};_0x31a5f9['commands']['add']('exportWord',new _0x145125(_0x31a5f9)),_0x31a5f9['ui']['componentFactory']['add']('exportWord',_0x398355=>{const _0x1f9b72=_0x31a5f9['commands']['get']('exportWord'),_0x48859c=new _0x1b9d22(_0x398355),_0x430e2=new _0x13f6d5();return _0x48859c['set']({'label':t('Export\x20to\x20Word'),'icon':_0xc97234,'tooltip':!0x0}),_0x48859c['children']['add'](_0x430e2),_0x48859c['bind']('isOn','isEnabled')['to'](_0x1f9b72,'isBusy','isEnabled'),_0x430e2['bind']('isVisible')['to'](_0x1f9b72,'isBusy'),_0x48859c['iconView']['bind']('isVisible')['to'](_0x1f9b72,'isBusy',_0x46516c=>!_0x46516c),this['listenTo'](_0x48859c,'execute',()=>{_0x31a5f9['execute']('exportWord',_0x4db400),_0x31a5f9['editing']['view']['focus']();}),_0x48859c;});const _0x1c1964=_0x31a5f9['plugins']['get']('CloudServices');!0x1===_0x4db400['tokenUrl']?this['_token']=null:_0x4db400['tokenUrl']?_0x1c1964['registerTokenUrl'](_0x4db400['tokenUrl'])['then'](_0x4b5927=>{this['_token']=_0x4b5927;}):this['_token']=_0x1c1964['token'];}}
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Command as _0x50564f}from'ckeditor5/src/core';import{getConverterOptions as _0x8e2dcf,getStyles as _0x5a61a6}from'./utils';export default class s extends _0x50564f{constructor(_0x1a3e3c){super(_0x1a3e3c),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x35b455={}){const _0x6fa1c6=this['editor'],t=_0x6fa1c6['t'],_0x172568=_0x35b455['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x4db639=_0x35b455['converterOptions']||{},_0x596e5d=_0x6fa1c6['plugins']['get']('ExportWord'),_0x384871=_0x35b455['token']||_0x596e5d['_token'],_0x4fbfe0=!0x1!==_0x4db639['auto_pagination'],_0x39974a=_0x35b455['dataCallback']||(_0x548ec5=>_0x548ec5['data']['get']({'pagination':_0x4fbfe0}));return this['isBusy']=!0x0,this['refresh'](),_0x5a61a6(_0x35b455['stylesheets']||['EDITOR_STYLES'])['then'](async _0x23c816=>{const _0x29908a=await _0x39974a(_0x6fa1c6),_0x293b29=this['_replaceSuggestionTypes'](_0x29908a),_0x3daed4={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x6fa1c6['locale']['contentLanguageDirection']+'\x22>'+_0x293b29+'</div>','css':_0x23c816,'options':{..._0x4db639,..._0x8e2dcf(_0x6fa1c6)}},_0x50aefe={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x384871?{'Authorization':_0x384871['value']}:null},'body':JSON['stringify'](_0x3daed4)};return window['fetch'](_0x172568,_0x50aefe)['then'](_0x36808d=>{if(0xc8!==_0x36808d['status'])throw _0x36808d;return _0x36808d['blob']();})['then'](_0x3a0343=>{const _0x5a6e01='function'==typeof _0x35b455['fileName']?_0x35b455['fileName']():_0x35b455['fileName'];this['_downloadFile'](_0x3a0343,_0x5a6e01||'document.docx');});})['catch'](_0x1a40d3=>{throw _0x6fa1c6['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x1a40d3;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_replaceSuggestionTypes'](_0x8204aa){if(!_0x8204aa)return _0x8204aa;const _0x4e4e40=(_0x29d8cf,_0x40c468,_0x44b7bb)=>'attribute'===_0x44b7bb?_0x40c468+'formatInline:':_0x29d8cf;return _0x8204aa['replace'](/<suggestion-(start|end) name="(.*?):/g,(_0x4789b1,_0xff78c8,_0x12cbd5)=>_0x4e4e40(_0x4789b1,'<suggestion-'+_0xff78c8+'\x20name=\x22',_0x12cbd5))['replace'](/data-suggestion-(start|end)-(before|after)="(.*?):/g,(_0x12dddb,_0x1452e9,_0x58574b,_0xb0b73b)=>_0x4e4e40(_0x12dddb,'data-suggestion-'+_0x1452e9+'-'+_0x58574b+'=\x22',_0xb0b73b));}['_downloadFile'](_0x5eaa19,_0x464395){const _0x10a5bc=document['createElement']('a');_0x10a5bc['href']=window['URL']['createObjectURL'](_0x5eaa19),_0x10a5bc['download']=_0x464395,_0x10a5bc['click'](),_0x10a5bc['remove']();}}
23
+ import{Command as _0x3da98a}from'ckeditor5/src/core';import{getConverterOptions as _0x3400aa,getStyles as _0x5c2c64}from'./utils';export default class s extends _0x3da98a{constructor(_0x44bbf8){super(_0x44bbf8),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x53ff7b={}){const _0x14b7a4=this['editor'],t=_0x14b7a4['t'],_0x5f0f7f=_0x53ff7b['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x499418=_0x53ff7b['converterOptions']||{},_0x41ab57=_0x14b7a4['plugins']['get']('ExportWord'),_0x22fbeb=_0x53ff7b['token']||_0x41ab57['_token'],_0x34f1ed=!0x1!==_0x499418['auto_pagination'],_0x1c26d3=_0x53ff7b['dataCallback']||(_0x12f6a5=>_0x12f6a5['data']['get']({'pagination':_0x34f1ed}));return this['isBusy']=!0x0,this['refresh'](),_0x5c2c64(_0x53ff7b['stylesheets']||['EDITOR_STYLES'])['then'](async _0x14198b=>{const _0x2527cc=await _0x1c26d3(_0x14b7a4),_0x5bf3d1=this['_replaceSuggestionTypes'](_0x2527cc),_0x5222b0={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x14b7a4['locale']['contentLanguageDirection']+'\x22>'+_0x5bf3d1+'</div>','css':_0x14198b,'options':{..._0x499418,..._0x3400aa(_0x14b7a4)}},_0x1b2f95={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x22fbeb?{'Authorization':_0x22fbeb['value']}:null},'body':JSON['stringify'](_0x5222b0)};return window['fetch'](_0x5f0f7f,_0x1b2f95)['then'](_0x101740=>{if(0xc8!==_0x101740['status'])throw _0x101740;return _0x101740['blob']();})['then'](_0x500bd1=>{const _0x5e3bc3='function'==typeof _0x53ff7b['fileName']?_0x53ff7b['fileName']():_0x53ff7b['fileName'];this['_downloadFile'](_0x500bd1,_0x5e3bc3||'document.docx');});})['catch'](_0x2b48be=>{throw _0x14b7a4['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x2b48be;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_replaceSuggestionTypes'](_0x3fb024){if(!_0x3fb024)return _0x3fb024;const _0x512609=(_0x233357,_0x57f9ae,_0x317bf4)=>'attribute'===_0x317bf4?_0x57f9ae+'formatInline:':_0x233357;return _0x3fb024['replace'](/<suggestion-(start|end) name="(.*?):/g,(_0x92aded,_0x3356f8,_0x3140e6)=>_0x512609(_0x92aded,'<suggestion-'+_0x3356f8+'\x20name=\x22',_0x3140e6))['replace'](/data-suggestion-(start|end)-(before|after)="(.*?):/g,(_0x51f623,_0x5a27e6,_0x47174d,_0x238a55)=>_0x512609(_0x51f623,'data-suggestion-'+_0x5a27e6+'-'+_0x47174d+'=\x22',_0x238a55));}['_downloadFile'](_0x3f966f,_0x25f4c0){const _0x447508=document['createElement']('a');_0x447508['href']=window['URL']['createObjectURL'](_0x3f966f),_0x447508['download']=_0x25f4c0,_0x447508['click'](),_0x447508['remove']();}}
package/src/utils.js CHANGED
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0xf668=['EDITOR_STYLES','comments','plugins','TrackChanges','push','keys','map','cssText','getSuggestions','hasAttribute','createdAt','styleSheets','length','CommentsRepository','then','isResolved','get','name','trim','data-cke','author','cssRules','Users','all','content','join','has','ownerNode','from','text',':root','warn','suggestions','indexOf','.ck-content','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.'];(function(_0x47cc41,_0xf668fc){const _0x1c6a61=function(_0x3b00b9){while(--_0x3b00b9){_0x47cc41['push'](_0x47cc41['shift']());}};_0x1c6a61(++_0xf668fc);}(_0xf668,0x191));const _0x1c6a=function(_0x47cc41,_0xf668fc){_0x47cc41=_0x47cc41-0x0;let _0x1c6a61=_0xf668[_0x47cc41];return _0x1c6a61;};export function getStyles(_0x48d098){if(!_0x48d098)return new Promise(_0x136e2b=>_0x136e2b(''));const _0x58e4f5=[];for(const _0x49700a of _0x48d098)_0x1c6a('0x1f')!==_0x49700a?_0x58e4f5[_0x1c6a('0x23')](window['fetch'](_0x49700a)[_0x1c6a('0x9')](_0x317323=>_0x317323[_0x1c6a('0x18')]())):_0x58e4f5['push'](u());return Promise[_0x1c6a('0x12')](_0x58e4f5)[_0x1c6a('0x9')](_0xe8992e=>_0xe8992e[_0x1c6a('0x14')]('\x20')['trim']());}function u(){const _0x1a5bb3=[],_0x4b1e89=[];for(const _0x35bb32 of Array[_0x1c6a('0x17')](document[_0x1c6a('0x6')])){if(_0x35bb32[_0x1c6a('0x16')][_0x1c6a('0x4')](_0x1c6a('0xe')))for(const _0x2e2b35 of Array[_0x1c6a('0x17')](_0x35bb32[_0x1c6a('0x10')]))-0x1!==_0x2e2b35[_0x1c6a('0x2')][_0x1c6a('0x1c')](_0x1c6a('0x1d'))?_0x1a5bb3[_0x1c6a('0x23')](_0x2e2b35[_0x1c6a('0x2')]):-0x1!==_0x2e2b35[_0x1c6a('0x2')][_0x1c6a('0x1c')](_0x1c6a('0x19'))&&_0x4b1e89[_0x1c6a('0x23')](_0x2e2b35[_0x1c6a('0x2')]);}return _0x1a5bb3[_0x1c6a('0x7')]||console[_0x1c6a('0x1a')](_0x1c6a('0x1e')),[..._0x4b1e89,..._0x1a5bb3][_0x1c6a('0x14')]('\x20')[_0x1c6a('0xd')]();}export function getConverterOptions(_0x1f0015){const _0x4a4789=_0x1f0015[_0x1c6a('0x21')][_0x1c6a('0x15')]('Users'),_0x3c9fd7=_0x1f0015['plugins'][_0x1c6a('0x15')]('CommentsRepository'),_0xc8517a=_0x1f0015['plugins'][_0x1c6a('0x15')](_0x1c6a('0x22')),_0x5b1187={};if(_0x4a4789&&_0x3c9fd7){const _0x111306=getComments(_0x1f0015[_0x1c6a('0x21')][_0x1c6a('0xb')](_0x1c6a('0x8'))['getCommentThreads']({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object['keys'](_0x111306)['length']&&(_0x5b1187[_0x1c6a('0x20')]=_0x111306);}if(_0x4a4789&&_0xc8517a){const _0x88543e=_0x1f0015[_0x1c6a('0x21')][_0x1c6a('0xb')](_0x1c6a('0x22')),_0x2862c9=_0x1f0015[_0x1c6a('0x21')][_0x1c6a('0xb')](_0x1c6a('0x11')),_0x492d76=getSuggestions(_0x88543e[_0x1c6a('0x3')]({'toJSON':!0x0}),_0x2862c9['users']);Object[_0x1c6a('0x0')](_0x492d76)[_0x1c6a('0x7')]&&(_0x5b1187[_0x1c6a('0x1b')]=_0x492d76);}return(_0x5b1187[_0x1c6a('0x1b')]||_0x5b1187['comments'])&&(_0x5b1187['timezone']=new Intl['DateTimeFormat']()['resolvedOptions']()['timeZone']),_0x5b1187;}export function getComments(_0x5b2f67){const _0x34dc6b={};if(!_0x5b2f67[_0x1c6a('0x7')])return _0x34dc6b;for(const _0x53cc2f of _0x5b2f67)_0x53cc2f[_0x1c6a('0x20')][_0x1c6a('0x1')](_0x539b1d=>{void 0x0===_0x34dc6b[_0x53cc2f['id']]&&(_0x34dc6b[_0x53cc2f['id']]=[]),_0x34dc6b[_0x53cc2f['id']]['push']({'author':_0x539b1d[_0x1c6a('0xf')][_0x1c6a('0xc')],'content':_0x539b1d[_0x1c6a('0x13')],'created':_0x539b1d[_0x1c6a('0x5')],'is_resolved':_0x53cc2f[_0x1c6a('0xa')]});});return _0x34dc6b;}export function getSuggestions(_0x4c5fb5,_0x174124){const _0x19774e={};if(!_0x4c5fb5['length']||!_0x174124[_0x1c6a('0x7')])return _0x19774e;for(const _0x179f7c of _0x4c5fb5)_0x19774e[_0x179f7c['id']]={'author':_0x174124['get'](_0x179f7c['authorId'])[_0x1c6a('0xc')],'created':_0x179f7c[_0x1c6a('0x5')]};return _0x19774e;}
23
+ const _0x5c3b=['users','cssText','Users','.ck-content','TrackChanges','authorId','isResolved','name','from','content','cssRules','has','createdAt','hasAttribute','timezone','ownerNode','styleSheets','join','author','then','all','push','get','map','keys','getCommentThreads','CommentsRepository','comments','length','text','plugins','indexOf','EDITOR_STYLES','data-cke','timeZone','warn','trim','DateTimeFormat','suggestions'];(function(_0x59cd5e,_0x5c3be7){const _0x226f3b=function(_0x14a779){while(--_0x14a779){_0x59cd5e['push'](_0x59cd5e['shift']());}};_0x226f3b(++_0x5c3be7);}(_0x5c3b,0x1dd));const _0x226f=function(_0x59cd5e,_0x5c3be7){_0x59cd5e=_0x59cd5e-0x0;let _0x226f3b=_0x5c3b[_0x59cd5e];return _0x226f3b;};export function getStyles(_0x567ce4){if(!_0x567ce4)return new Promise(_0xe4a9c4=>_0xe4a9c4(''));const _0xcefe27=[];for(const _0x2608d3 of _0x567ce4)_0x226f('0x17')!==_0x2608d3?_0xcefe27[_0x226f('0xc')](window['fetch'](_0x2608d3)['then'](_0x1f975a=>_0x1f975a[_0x226f('0x14')]())):_0xcefe27['push'](u());return Promise[_0x226f('0xb')](_0xcefe27)[_0x226f('0xa')](_0x29480c=>_0x29480c['join']('\x20')[_0x226f('0x1b')]());}function u(){const _0x415629=[],_0x338f70=[];for(const _0x93788e of Array[_0x226f('0x26')](document[_0x226f('0x7')])){if(_0x93788e[_0x226f('0x6')][_0x226f('0x4')](_0x226f('0x18')))for(const _0x1ba4d1 of Array[_0x226f('0x26')](_0x93788e[_0x226f('0x1')]))-0x1!==_0x1ba4d1[_0x226f('0x1f')][_0x226f('0x16')](_0x226f('0x21'))?_0x415629['push'](_0x1ba4d1[_0x226f('0x1f')]):-0x1!==_0x1ba4d1[_0x226f('0x1f')][_0x226f('0x16')](':root')&&_0x338f70[_0x226f('0xc')](_0x1ba4d1[_0x226f('0x1f')]);}return _0x415629['length']||console[_0x226f('0x1a')]('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.'),[..._0x338f70,..._0x415629][_0x226f('0x8')]('\x20')[_0x226f('0x1b')]();}export function getConverterOptions(_0x13198c){const _0x208fc5=_0x13198c[_0x226f('0x15')]['has'](_0x226f('0x20')),_0x56e860=_0x13198c[_0x226f('0x15')][_0x226f('0x2')]('CommentsRepository'),_0xa5ffef=_0x13198c[_0x226f('0x15')][_0x226f('0x2')](_0x226f('0x22')),_0x1d3e62={};if(_0x208fc5&&_0x56e860){const _0x5f1733=getComments(_0x13198c[_0x226f('0x15')][_0x226f('0xd')](_0x226f('0x11'))[_0x226f('0x10')]({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object[_0x226f('0xf')](_0x5f1733)[_0x226f('0x13')]&&(_0x1d3e62[_0x226f('0x12')]=_0x5f1733);}if(_0x208fc5&&_0xa5ffef){const _0x152f45=_0x13198c['plugins'][_0x226f('0xd')](_0x226f('0x22')),_0x438dc3=_0x13198c[_0x226f('0x15')][_0x226f('0xd')](_0x226f('0x20')),_0x38a81c=getSuggestions(_0x152f45['getSuggestions']({'toJSON':!0x0}),_0x438dc3[_0x226f('0x1e')]);Object['keys'](_0x38a81c)[_0x226f('0x13')]&&(_0x1d3e62[_0x226f('0x1d')]=_0x38a81c);}return(_0x1d3e62[_0x226f('0x1d')]||_0x1d3e62['comments'])&&(_0x1d3e62[_0x226f('0x5')]=new Intl[(_0x226f('0x1c'))]()['resolvedOptions']()[_0x226f('0x19')]),_0x1d3e62;}export function getComments(_0xdb7eab){const _0x508833={};if(!_0xdb7eab[_0x226f('0x13')])return _0x508833;for(const _0x1c2a59 of _0xdb7eab)_0x1c2a59[_0x226f('0x12')][_0x226f('0xe')](_0x55b4d8=>{void 0x0===_0x508833[_0x1c2a59['id']]&&(_0x508833[_0x1c2a59['id']]=[]),_0x508833[_0x1c2a59['id']][_0x226f('0xc')]({'author':_0x55b4d8[_0x226f('0x9')]['name'],'content':_0x55b4d8[_0x226f('0x0')],'created':_0x55b4d8[_0x226f('0x3')],'is_resolved':_0x1c2a59[_0x226f('0x24')]});});return _0x508833;}export function getSuggestions(_0x1f73c3,_0x17ebe5){const _0x220b3d={};if(!_0x1f73c3[_0x226f('0x13')]||!_0x17ebe5[_0x226f('0x13')])return _0x220b3d;for(const _0x1f7d92 of _0x1f73c3)_0x220b3d[_0x1f7d92['id']]={'author':_0x17ebe5[_0x226f('0xd')](_0x1f7d92[_0x226f('0x23')])[_0x226f('0x25')],'created':_0x1f7d92[_0x226f('0x3')]};return _0x220b3d;}