@ckeditor/ckeditor5-export-word 0.0.0-nightly-20231204.0 → 0.0.0-nightly-20231205.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:()=>u});var e=o(704),t=o(273);const r=["warn","name","cssRules","timeZone","author","TrackChanges","hasAttribute","from","styleSheets",".ck-content","has","suggestions","authorId","then","indexOf","map","cssText","Users","length","push","ownerNode","get","createdAt","trim","join","isResolved","comments","EDITOR_STYLES","timezone","plugins","resolvedOptions","CommentsRepository","users"];var s,i;s=r,i=335,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("0x3")]))if(o[a("0xf")][a("0x1")]("data-cke"))for(const n of Array[a("0x2")](o[a("0x1e")]))-1!==n[a("0xb")][a("0x9")](a("0x4"))?e[a("0xe")](n.cssText):-1!==n.cssText[a("0x9")](":root")&&t[a("0xe")](n[a("0xb")]);return e[a("0xd")]||console[a("0x1c")]("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("0x13")](" ")[a("0x12")]()}function d(e){const t=e[a("0x18")][a("0x5")](a("0xc")),o=e[a("0x18")].has(a("0x1a")),n=e[a("0x18")][a("0x5")]("TrackChanges"),r={};if(t&&o){const t=function(e){const t={};if(!e.length)return t;for(const o of e)o[a("0x15")][a("0xa")]((e=>{void 0===t[o.id]&&(t[o.id]=[]),t[o.id].push({author:e[a("0x20")][a("0x1d")],content:e.content,created:e[a("0x11")],is_resolved:o[a("0x14")]})}));return t}(e[a("0x18")][a("0x10")](a("0x1a")).getCommentThreads({skipNotAttached:!0,skipEmpty:!0}));Object.keys(t).length&&(r[a("0x15")]=t)}if(t&&n){const t=e[a("0x18")][a("0x10")](a("0x0")),o=e[a("0x18")][a("0x10")](a("0xc")),n=function(e,t){const o={};if(!e[a("0xd")]||!t[a("0xd")])return o;for(const n of e)o[n.id]={author:t[a("0x10")](n[a("0x7")])[a("0x1d")],created:n[a("0x11")]};return o}(t.getSuggestions({toJSON:!0}),o[a("0x1b")]);Object.keys(n).length&&(r[a("0x6")]=n)}return(r[a("0x6")]||r[a("0x15")])&&(r[a("0x17")]=(new Intl.DateTimeFormat)[a("0x19")]()[a("0x1f")]),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)a("0x16")!==o?t[a("0xe")](window.fetch(o)[a("0x8")]((e=>e.text()))):t[a("0xe")](c());return Promise.all(t).then((e=>e[a("0x13")](" ")[a("0x12")]()))}(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})();
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=["isResolved","users","hasAttribute","all","EDITOR_STYLES","warn","keys",":root","CommentsRepository","DateTimeFormat","push","Users","comments","then",".ck-content","plugins","join","cssRules","get","ownerNode","data-cke","content","timeZone","createdAt","TrackChanges","indexOf","authorId","styleSheets","has","resolvedOptions","name","trim","suggestions","cssText","length","from"];var s,i;s=r,i=466,function(e){for(;--e;)s.push(s.shift())}(++i);const c=function(e,t){return r[e-=0]};function a(){const e=[],t=[];for(const o of Array[c("0x1")](document[c("0x1d")]))if(o[c("0x15")][c("0x4")](c("0x16")))for(const n of Array.from(o[c("0x13")]))-1!==n[c("0x23")].indexOf(c("0x10"))?e[c("0xc")](n.cssText):-1!==n[c("0x23")][c("0x1b")](c("0x9"))&&t[c("0xc")](n[c("0x23")]);return e[c("0x0")]||console[c("0x7")]("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].join(" ")[c("0x21")]()}function d(e){const t=e.plugins[c("0x1e")](c("0xd")),o=e.plugins[c("0x1e")](c("0xa")),n=e.plugins[c("0x1e")](c("0x1a")),r={};if(t&&o){const t=function(e){const t={};if(!e.length)return t;for(const o of e)o[c("0xe")].map((e=>{void 0===t[o.id]&&(t[o.id]=[]),t[o.id].push({author:e.author[c("0x20")],content:e[c("0x17")],created:e[c("0x19")],is_resolved:o[c("0x2")]})}));return t}(e.plugins.get("CommentsRepository").getCommentThreads({skipNotAttached:!0,skipEmpty:!0}));Object[c("0x8")](t)[c("0x0")]&&(r.comments=t)}if(t&&n){const t=e[c("0x11")].get(c("0x1a")),o=e[c("0x11")][c("0x14")](c("0xd")),n=function(e,t){const o={};if(!e[c("0x0")]||!t[c("0x0")])return o;for(const n of e)o[n.id]={author:t.get(n[c("0x1c")])[c("0x20")],created:n[c("0x19")]};return o}(t.getSuggestions({toJSON:!0}),o[c("0x3")]);Object.keys(n)[c("0x0")]&&(r[c("0x22")]=n)}return(r[c("0x22")]||r[c("0xe")])&&(r.timezone=(new(Intl[c("0xb")]))[c("0x1f")]()[c("0x18")]),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)c("0x6")!==o?t[c("0xc")](window.fetch(o)[c("0xf")]((e=>e.text()))):t[c("0xc")](a());return Promise[c("0x5")](t)[c("0xf")]((e=>e[c("0x12")](" ")[c("0x21")]()))}(e.stylesheets||["EDITOR_STYLES"]).then((async o=>{const s=await l(t),c=this._replaceSuggestionTypes(s),a={html:'<div class="ck-content" dir="'+t.locale.contentLanguageDirection+'">'+c+"</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(a)};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),c=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(c),i.bind("isOn","isEnabled").to(s,"isBusy","isEnabled"),c.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-20231204.0",
3
+ "version": "0.0.0-nightly-20231205.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-20231204.0"
32
+ "ckeditor5": "0.0.0-nightly-20231205.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 _0x3f00ec}from'ckeditor5/src/core';import{ButtonView as _0x4ca80a,Notification as _0x2cf56d,SpinnerView as _0xd21323}from'ckeditor5/src/ui';import _0x5905f2 from'./exportwordcommand';import _0x2af196 from'../theme/icons/exportword.svg';export default class d extends _0x3f00ec{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x2cf56d];}['init'](){const _0x13f407=this['editor'],t=_0x13f407['t'],_0xae0193=_0x13f407['config']['get']('exportWord')||{};_0x13f407['commands']['add']('exportWord',new _0x5905f2(_0x13f407)),_0x13f407['ui']['componentFactory']['add']('exportWord',_0x377396=>{const _0xf86efb=_0x13f407['commands']['get']('exportWord'),_0x491c24=new _0x4ca80a(_0x377396),_0x4ea229=new _0xd21323();return _0x491c24['set']({'label':t('Export\x20to\x20Word'),'icon':_0x2af196,'tooltip':!0x0}),_0x491c24['children']['add'](_0x4ea229),_0x491c24['bind']('isOn','isEnabled')['to'](_0xf86efb,'isBusy','isEnabled'),_0x4ea229['bind']('isVisible')['to'](_0xf86efb,'isBusy'),_0x491c24['iconView']['bind']('isVisible')['to'](_0xf86efb,'isBusy',_0x202359=>!_0x202359),this['listenTo'](_0x491c24,'execute',()=>{_0x13f407['execute']('exportWord',_0xae0193),_0x13f407['editing']['view']['focus']();}),_0x491c24;});const _0x2ffa69=_0x13f407['plugins']['get']('CloudServices');!0x1===_0xae0193['tokenUrl']?this['_token']=null:_0xae0193['tokenUrl']?_0x2ffa69['registerTokenUrl'](_0xae0193['tokenUrl'])['then'](_0x9f6fc7=>{this['_token']=_0x9f6fc7;}):this['_token']=_0x2ffa69['token'];}}
23
+ import{Plugin as _0x5ecffc}from'ckeditor5/src/core';import{ButtonView as _0x311716,Notification as _0x477cda,SpinnerView as _0x2fb28a}from'ckeditor5/src/ui';import _0x44229c from'./exportwordcommand';import _0x1db156 from'../theme/icons/exportword.svg';export default class d extends _0x5ecffc{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x477cda];}['init'](){const _0x48539f=this['editor'],t=_0x48539f['t'],_0x19fef5=_0x48539f['config']['get']('exportWord')||{};_0x48539f['commands']['add']('exportWord',new _0x44229c(_0x48539f)),_0x48539f['ui']['componentFactory']['add']('exportWord',_0x5ba4b5=>{const _0xd76311=_0x48539f['commands']['get']('exportWord'),_0x5baad7=new _0x311716(_0x5ba4b5),_0x524531=new _0x2fb28a();return _0x5baad7['set']({'label':t('Export\x20to\x20Word'),'icon':_0x1db156,'tooltip':!0x0}),_0x5baad7['children']['add'](_0x524531),_0x5baad7['bind']('isOn','isEnabled')['to'](_0xd76311,'isBusy','isEnabled'),_0x524531['bind']('isVisible')['to'](_0xd76311,'isBusy'),_0x5baad7['iconView']['bind']('isVisible')['to'](_0xd76311,'isBusy',_0x566b85=>!_0x566b85),this['listenTo'](_0x5baad7,'execute',()=>{_0x48539f['execute']('exportWord',_0x19fef5),_0x48539f['editing']['view']['focus']();}),_0x5baad7;});const _0x5d9844=_0x48539f['plugins']['get']('CloudServices');!0x1===_0x19fef5['tokenUrl']?this['_token']=null:_0x19fef5['tokenUrl']?_0x5d9844['registerTokenUrl'](_0x19fef5['tokenUrl'])['then'](_0x48a5fc=>{this['_token']=_0x48a5fc;}):this['_token']=_0x5d9844['token'];}}
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Command as _0x55c577}from'ckeditor5/src/core';import{getConverterOptions as _0x3cf518,getStyles as _0x2b15b2}from'./utils';export default class s extends _0x55c577{constructor(_0x576075){super(_0x576075),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x160713={}){const _0x206927=this['editor'],t=_0x206927['t'],_0x53c471=_0x160713['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x347529=_0x160713['converterOptions']||{},_0x4b2591=_0x206927['plugins']['get']('ExportWord'),_0x15ac39=_0x160713['token']||_0x4b2591['_token'],_0x3cfd49=!0x1!==_0x347529['auto_pagination'],_0x5b6850=_0x160713['dataCallback']||(_0x5e4546=>_0x5e4546['data']['get']({'pagination':_0x3cfd49}));return this['isBusy']=!0x0,this['refresh'](),_0x2b15b2(_0x160713['stylesheets']||['EDITOR_STYLES'])['then'](async _0x13be8c=>{const _0x2212e2=await _0x5b6850(_0x206927),_0x2390d1=this['_replaceSuggestionTypes'](_0x2212e2),_0x145152={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x206927['locale']['contentLanguageDirection']+'\x22>'+_0x2390d1+'</div>','css':_0x13be8c,'options':{..._0x347529,..._0x3cf518(_0x206927)}},_0x4fb055={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x15ac39?{'Authorization':_0x15ac39['value']}:null},'body':JSON['stringify'](_0x145152)};return window['fetch'](_0x53c471,_0x4fb055)['then'](_0x3ef770=>{if(0xc8!==_0x3ef770['status'])throw _0x3ef770;return _0x3ef770['blob']();})['then'](_0x3ea1cf=>{const _0x22381b='function'==typeof _0x160713['fileName']?_0x160713['fileName']():_0x160713['fileName'];this['_downloadFile'](_0x3ea1cf,_0x22381b||'document.docx');});})['catch'](_0x49a277=>{throw _0x206927['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x49a277;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_replaceSuggestionTypes'](_0x46b5c7){if(!_0x46b5c7)return _0x46b5c7;const _0x59b510=(_0xb4c372,_0x3b251e,_0x260c0c)=>'attribute'===_0x260c0c?_0x3b251e+'formatInline:':_0xb4c372;return _0x46b5c7['replace'](/<suggestion-(start|end) name="(.*?):/g,(_0x513182,_0x587d0f,_0x193528)=>_0x59b510(_0x513182,'<suggestion-'+_0x587d0f+'\x20name=\x22',_0x193528))['replace'](/data-suggestion-(start|end)-(before|after)="(.*?):/g,(_0x4eba17,_0x3c64c8,_0x3fabd3,_0x5691c9)=>_0x59b510(_0x4eba17,'data-suggestion-'+_0x3c64c8+'-'+_0x3fabd3+'=\x22',_0x5691c9));}['_downloadFile'](_0x1766ef,_0x485c22){const _0x570786=document['createElement']('a');_0x570786['href']=window['URL']['createObjectURL'](_0x1766ef),_0x570786['download']=_0x485c22,_0x570786['click'](),_0x570786['remove']();}}
23
+ import{Command as _0x4f5803}from'ckeditor5/src/core';import{getConverterOptions as _0x1a13b6,getStyles as _0x590bac}from'./utils';export default class s extends _0x4f5803{constructor(_0x511111){super(_0x511111),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x5f1811={}){const _0x240a41=this['editor'],t=_0x240a41['t'],_0x188f1f=_0x5f1811['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x469915=_0x5f1811['converterOptions']||{},_0x4297bd=_0x240a41['plugins']['get']('ExportWord'),_0x3f8cad=_0x5f1811['token']||_0x4297bd['_token'],_0x16faa6=!0x1!==_0x469915['auto_pagination'],_0x34a34b=_0x5f1811['dataCallback']||(_0x4d7a86=>_0x4d7a86['data']['get']({'pagination':_0x16faa6}));return this['isBusy']=!0x0,this['refresh'](),_0x590bac(_0x5f1811['stylesheets']||['EDITOR_STYLES'])['then'](async _0x1e8180=>{const _0x150aee=await _0x34a34b(_0x240a41),_0x3a63d4=this['_replaceSuggestionTypes'](_0x150aee),_0x23cf49={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x240a41['locale']['contentLanguageDirection']+'\x22>'+_0x3a63d4+'</div>','css':_0x1e8180,'options':{..._0x469915,..._0x1a13b6(_0x240a41)}},_0x56e0a6={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x3f8cad?{'Authorization':_0x3f8cad['value']}:null},'body':JSON['stringify'](_0x23cf49)};return window['fetch'](_0x188f1f,_0x56e0a6)['then'](_0x5f3ebd=>{if(0xc8!==_0x5f3ebd['status'])throw _0x5f3ebd;return _0x5f3ebd['blob']();})['then'](_0x5f0a6b=>{const _0x48447f='function'==typeof _0x5f1811['fileName']?_0x5f1811['fileName']():_0x5f1811['fileName'];this['_downloadFile'](_0x5f0a6b,_0x48447f||'document.docx');});})['catch'](_0xa8e2fc=>{throw _0x240a41['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0xa8e2fc;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_replaceSuggestionTypes'](_0x3b054e){if(!_0x3b054e)return _0x3b054e;const _0x49c655=(_0x252dc7,_0x120976,_0x345fbd)=>'attribute'===_0x345fbd?_0x120976+'formatInline:':_0x252dc7;return _0x3b054e['replace'](/<suggestion-(start|end) name="(.*?):/g,(_0x8ac5dd,_0x1c7949,_0x21ae80)=>_0x49c655(_0x8ac5dd,'<suggestion-'+_0x1c7949+'\x20name=\x22',_0x21ae80))['replace'](/data-suggestion-(start|end)-(before|after)="(.*?):/g,(_0x2d06b7,_0x31a0ac,_0x46a05f,_0x3aa971)=>_0x49c655(_0x2d06b7,'data-suggestion-'+_0x31a0ac+'-'+_0x46a05f+'=\x22',_0x3aa971));}['_downloadFile'](_0x22a804,_0x3faece){const _0x2e5f22=document['createElement']('a');_0x2e5f22['href']=window['URL']['createObjectURL'](_0x22a804),_0x2e5f22['download']=_0x3faece,_0x2e5f22['click'](),_0x2e5f22['remove']();}}
package/src/utils.js CHANGED
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x3ffb=['warn','name','cssRules','timeZone','author','TrackChanges','hasAttribute','from','styleSheets','.ck-content','has','suggestions','authorId','then','indexOf','map','cssText','Users','length','push','ownerNode','get','createdAt','trim','join','isResolved','comments','EDITOR_STYLES','timezone','plugins','resolvedOptions','CommentsRepository','users'];(function(_0x37f912,_0x3ffb00){const _0x4b7d3d=function(_0x560d0f){while(--_0x560d0f){_0x37f912['push'](_0x37f912['shift']());}};_0x4b7d3d(++_0x3ffb00);}(_0x3ffb,0x14f));const _0x4b7d=function(_0x37f912,_0x3ffb00){_0x37f912=_0x37f912-0x0;let _0x4b7d3d=_0x3ffb[_0x37f912];return _0x4b7d3d;};export function getStyles(_0xf2b172){if(!_0xf2b172)return new Promise(_0x483a28=>_0x483a28(''));const _0x31185a=[];for(const _0xc931e6 of _0xf2b172)_0x4b7d('0x16')!==_0xc931e6?_0x31185a[_0x4b7d('0xe')](window['fetch'](_0xc931e6)[_0x4b7d('0x8')](_0x549f47=>_0x549f47['text']())):_0x31185a[_0x4b7d('0xe')](u());return Promise['all'](_0x31185a)['then'](_0x31c85f=>_0x31c85f[_0x4b7d('0x13')]('\x20')[_0x4b7d('0x12')]());}function u(){const _0x181363=[],_0x27419b=[];for(const _0x4ad565 of Array['from'](document[_0x4b7d('0x3')])){if(_0x4ad565[_0x4b7d('0xf')][_0x4b7d('0x1')]('data-cke'))for(const _0x44620f of Array[_0x4b7d('0x2')](_0x4ad565[_0x4b7d('0x1e')]))-0x1!==_0x44620f[_0x4b7d('0xb')][_0x4b7d('0x9')](_0x4b7d('0x4'))?_0x181363[_0x4b7d('0xe')](_0x44620f['cssText']):-0x1!==_0x44620f['cssText'][_0x4b7d('0x9')](':root')&&_0x27419b[_0x4b7d('0xe')](_0x44620f[_0x4b7d('0xb')]);}return _0x181363[_0x4b7d('0xd')]||console[_0x4b7d('0x1c')]('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.'),[..._0x27419b,..._0x181363][_0x4b7d('0x13')]('\x20')[_0x4b7d('0x12')]();}export function getConverterOptions(_0x5f4565){const _0x13ce82=_0x5f4565[_0x4b7d('0x18')][_0x4b7d('0x5')](_0x4b7d('0xc')),_0x2c99e3=_0x5f4565[_0x4b7d('0x18')]['has'](_0x4b7d('0x1a')),_0x10ddfc=_0x5f4565[_0x4b7d('0x18')][_0x4b7d('0x5')]('TrackChanges'),_0x3561ff={};if(_0x13ce82&&_0x2c99e3){const _0x1419a7=getComments(_0x5f4565[_0x4b7d('0x18')][_0x4b7d('0x10')](_0x4b7d('0x1a'))['getCommentThreads']({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object['keys'](_0x1419a7)['length']&&(_0x3561ff[_0x4b7d('0x15')]=_0x1419a7);}if(_0x13ce82&&_0x10ddfc){const _0x319d4e=_0x5f4565[_0x4b7d('0x18')][_0x4b7d('0x10')](_0x4b7d('0x0')),_0x4f8bb0=_0x5f4565[_0x4b7d('0x18')][_0x4b7d('0x10')](_0x4b7d('0xc')),_0xe20ad0=getSuggestions(_0x319d4e['getSuggestions']({'toJSON':!0x0}),_0x4f8bb0[_0x4b7d('0x1b')]);Object['keys'](_0xe20ad0)['length']&&(_0x3561ff[_0x4b7d('0x6')]=_0xe20ad0);}return(_0x3561ff[_0x4b7d('0x6')]||_0x3561ff[_0x4b7d('0x15')])&&(_0x3561ff[_0x4b7d('0x17')]=new Intl['DateTimeFormat']()[_0x4b7d('0x19')]()[_0x4b7d('0x1f')]),_0x3561ff;}export function getComments(_0x5d4bff){const _0x4cde47={};if(!_0x5d4bff['length'])return _0x4cde47;for(const _0x479424 of _0x5d4bff)_0x479424[_0x4b7d('0x15')][_0x4b7d('0xa')](_0x230045=>{void 0x0===_0x4cde47[_0x479424['id']]&&(_0x4cde47[_0x479424['id']]=[]),_0x4cde47[_0x479424['id']]['push']({'author':_0x230045[_0x4b7d('0x20')][_0x4b7d('0x1d')],'content':_0x230045['content'],'created':_0x230045[_0x4b7d('0x11')],'is_resolved':_0x479424[_0x4b7d('0x14')]});});return _0x4cde47;}export function getSuggestions(_0x15b807,_0x3a0cbd){const _0xdc19a5={};if(!_0x15b807[_0x4b7d('0xd')]||!_0x3a0cbd[_0x4b7d('0xd')])return _0xdc19a5;for(const _0x3ff6f8 of _0x15b807)_0xdc19a5[_0x3ff6f8['id']]={'author':_0x3a0cbd[_0x4b7d('0x10')](_0x3ff6f8[_0x4b7d('0x7')])[_0x4b7d('0x1d')],'created':_0x3ff6f8[_0x4b7d('0x11')]};return _0xdc19a5;}
23
+ const _0x4528=['isResolved','users','hasAttribute','all','EDITOR_STYLES','warn','keys',':root','CommentsRepository','DateTimeFormat','push','Users','comments','then','.ck-content','plugins','join','cssRules','get','ownerNode','data-cke','content','timeZone','createdAt','TrackChanges','indexOf','authorId','styleSheets','has','resolvedOptions','name','trim','suggestions','cssText','length','from'];(function(_0x5719a5,_0x452868){const _0x5a44c2=function(_0x46f27b){while(--_0x46f27b){_0x5719a5['push'](_0x5719a5['shift']());}};_0x5a44c2(++_0x452868);}(_0x4528,0x1d2));const _0x5a44=function(_0x5719a5,_0x452868){_0x5719a5=_0x5719a5-0x0;let _0x5a44c2=_0x4528[_0x5719a5];return _0x5a44c2;};export function getStyles(_0x72330b){if(!_0x72330b)return new Promise(_0x4f90af=>_0x4f90af(''));const _0x16cab2=[];for(const _0x3b6a4d of _0x72330b)_0x5a44('0x6')!==_0x3b6a4d?_0x16cab2[_0x5a44('0xc')](window['fetch'](_0x3b6a4d)[_0x5a44('0xf')](_0x55d00e=>_0x55d00e['text']())):_0x16cab2[_0x5a44('0xc')](u());return Promise[_0x5a44('0x5')](_0x16cab2)[_0x5a44('0xf')](_0x5725d9=>_0x5725d9[_0x5a44('0x12')]('\x20')[_0x5a44('0x21')]());}function u(){const _0x5ebacd=[],_0x86a70a=[];for(const _0x477001 of Array[_0x5a44('0x1')](document[_0x5a44('0x1d')])){if(_0x477001[_0x5a44('0x15')][_0x5a44('0x4')](_0x5a44('0x16')))for(const _0x1a2527 of Array['from'](_0x477001[_0x5a44('0x13')]))-0x1!==_0x1a2527[_0x5a44('0x23')]['indexOf'](_0x5a44('0x10'))?_0x5ebacd[_0x5a44('0xc')](_0x1a2527['cssText']):-0x1!==_0x1a2527[_0x5a44('0x23')][_0x5a44('0x1b')](_0x5a44('0x9'))&&_0x86a70a[_0x5a44('0xc')](_0x1a2527[_0x5a44('0x23')]);}return _0x5ebacd[_0x5a44('0x0')]||console[_0x5a44('0x7')]('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.'),[..._0x86a70a,..._0x5ebacd]['join']('\x20')[_0x5a44('0x21')]();}export function getConverterOptions(_0xedd691){const _0x308912=_0xedd691['plugins'][_0x5a44('0x1e')](_0x5a44('0xd')),_0x25237a=_0xedd691['plugins'][_0x5a44('0x1e')](_0x5a44('0xa')),_0x3b625c=_0xedd691['plugins'][_0x5a44('0x1e')](_0x5a44('0x1a')),_0x5e963f={};if(_0x308912&&_0x25237a){const _0x40b2ac=getComments(_0xedd691['plugins']['get']('CommentsRepository')['getCommentThreads']({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object[_0x5a44('0x8')](_0x40b2ac)[_0x5a44('0x0')]&&(_0x5e963f['comments']=_0x40b2ac);}if(_0x308912&&_0x3b625c){const _0x5df88f=_0xedd691[_0x5a44('0x11')]['get'](_0x5a44('0x1a')),_0x3c7a11=_0xedd691[_0x5a44('0x11')][_0x5a44('0x14')](_0x5a44('0xd')),_0xb814e2=getSuggestions(_0x5df88f['getSuggestions']({'toJSON':!0x0}),_0x3c7a11[_0x5a44('0x3')]);Object['keys'](_0xb814e2)[_0x5a44('0x0')]&&(_0x5e963f[_0x5a44('0x22')]=_0xb814e2);}return(_0x5e963f[_0x5a44('0x22')]||_0x5e963f[_0x5a44('0xe')])&&(_0x5e963f['timezone']=new Intl[(_0x5a44('0xb'))]()[_0x5a44('0x1f')]()[_0x5a44('0x18')]),_0x5e963f;}export function getComments(_0x5e3778){const _0x26a319={};if(!_0x5e3778['length'])return _0x26a319;for(const _0x37ac97 of _0x5e3778)_0x37ac97[_0x5a44('0xe')]['map'](_0x322818=>{void 0x0===_0x26a319[_0x37ac97['id']]&&(_0x26a319[_0x37ac97['id']]=[]),_0x26a319[_0x37ac97['id']]['push']({'author':_0x322818['author'][_0x5a44('0x20')],'content':_0x322818[_0x5a44('0x17')],'created':_0x322818[_0x5a44('0x19')],'is_resolved':_0x37ac97[_0x5a44('0x2')]});});return _0x26a319;}export function getSuggestions(_0x3a80c4,_0x2601e9){const _0x2e241c={};if(!_0x3a80c4[_0x5a44('0x0')]||!_0x2601e9[_0x5a44('0x0')])return _0x2e241c;for(const _0x52bf3a of _0x3a80c4)_0x2e241c[_0x52bf3a['id']]={'author':_0x2601e9['get'](_0x52bf3a[_0x5a44('0x1c')])[_0x5a44('0x20')],'created':_0x52bf3a[_0x5a44('0x19')]};return _0x2e241c;}