@ckeditor/ckeditor5-export-word 0.0.0-nightly-20231228.0 → 0.0.0-nightly-20231230.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=["getCommentThreads","authorId","users","length","then","comments","hasAttribute","cssText","all","CommentsRepository","EDITOR_STYLES","has","warn","createdAt","keys","join","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.","fetch","styleSheets","plugins","Users","name","TrackChanges","get","text","timezone","from","suggestions","cssRules","ownerNode","DateTimeFormat",".ck-content","trim","getSuggestions","indexOf","isResolved","content","map","push"];var s,i;s=r,i=293,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("0x6")](document[a("0x25")]))if(o[a("0x9")][a("0x19")]("data-cke"))for(const n of Array[a("0x6")](o[a("0x8")]))-1!==n[a("0x1a")][a("0xe")](a("0xb"))?e[a("0x12")](n[a("0x1a")]):-1!==n[a("0x1a")][a("0xe")](":root")&&t[a("0x12")](n[a("0x1a")]);return e[a("0x16")]||console[a("0x1f")](a("0x23")),[...t,...e].join(" ")[a("0xc")]()}function d(e){const t=e[a("0x26")][a("0x1e")](a("0x0")),o=e.plugins.has(a("0x1c")),n=e.plugins[a("0x1e")]("TrackChanges"),r={};if(t&&o){const t=function(e){const t={};if(!e[a("0x16")])return t;for(const o of e)o[a("0x18")][a("0x11")]((e=>{void 0===t[o.id]&&(t[o.id]=[]),t[o.id].push({author:e.author[a("0x1")],content:e[a("0x10")],created:e.createdAt,is_resolved:o[a("0xf")]})}));return t}(e[a("0x26")].get(a("0x1c"))[a("0x13")]({skipNotAttached:!0,skipEmpty:!0}));Object[a("0x21")](t)[a("0x16")]&&(r[a("0x18")]=t)}if(t&&n){const t=e[a("0x26")][a("0x3")](a("0x2")),o=e[a("0x26")][a("0x3")]("Users"),n=function(e,t){const o={};if(!e[a("0x16")]||!t[a("0x16")])return o;for(const n of e)o[n.id]={author:t[a("0x3")](n[a("0x14")]).name,created:n[a("0x20")]};return o}(t[a("0xd")]({toJSON:!0}),o[a("0x15")]);Object.keys(n)[a("0x16")]&&(r[a("0x7")]=n)}return(r.suggestions||r.comments)&&(r[a("0x5")]=(new(Intl[a("0xa")])).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("0x1d")!==o?t[a("0x12")](window[a("0x24")](o)[a("0x17")]((e=>e[a("0x4")]()))):t[a("0x12")](c());return Promise[a("0x1b")](t)[a("0x17")]((e=>e[a("0x22")](" ")[a("0xc")]()))}(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=["DateTimeFormat","has","trim","suggestions","map","TrackChanges","getSuggestions","ownerNode","Users",":root","fetch","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.","author","push","hasAttribute","content","users","name","getCommentThreads","CommentsRepository","indexOf","authorId","join","get","EDITOR_STYLES","all","styleSheets","cssText","timezone","createdAt","warn","comments","cssRules","plugins","from",".ck-content","data-cke","isResolved","then","length"];var s,i;s=r,i=146,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("0x8")](document[a("0x0")]))if(o[a("0x15")][a("0x1c")](a("0xa")))for(const n of Array[a("0x8")](o[a("0x6")]))-1!==n[a("0x1")][a("0x22")](a("0x9"))?e[a("0x1b")](n[a("0x1")]):-1!==n[a("0x1")][a("0x22")](a("0x17"))&&t.push(n.cssText);return e[a("0xd")]||console[a("0x4")](a("0x19")),[...t,...e][a("0x24")](" ").trim()}function d(e){const t=e[a("0x7")][a("0xf")](a("0x16")),o=e[a("0x7")].has(a("0x21")),n=e.plugins.has(a("0x13")),r={};if(t&&o){const t=function(e){const t={};if(!e.length)return t;for(const o of e)o[a("0x5")][a("0x12")]((e=>{void 0===t[o.id]&&(t[o.id]=[]),t[o.id][a("0x1b")]({author:e[a("0x1a")][a("0x1f")],content:e[a("0x1d")],created:e[a("0x3")],is_resolved:o[a("0xb")]})}));return t}(e[a("0x7")][a("0x25")](a("0x21"))[a("0x20")]({skipNotAttached:!0,skipEmpty:!0}));Object.keys(t)[a("0xd")]&&(r[a("0x5")]=t)}if(t&&n){const t=e.plugins[a("0x25")]("TrackChanges"),o=e[a("0x7")][a("0x25")](a("0x16")),n=function(e,t){const o={};if(!e.length||!t[a("0xd")])return o;for(const n of e)o[n.id]={author:t[a("0x25")](n[a("0x23")]).name,created:n.createdAt};return o}(t[a("0x14")]({toJSON:!0}),o[a("0x1e")]);Object.keys(n)[a("0xd")]&&(r[a("0x11")]=n)}return(r[a("0x11")]||r.comments)&&(r[a("0x2")]=(new(Intl[a("0xe")])).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("0x26")!==o?t[a("0x1b")](window[a("0x18")](o)[a("0xc")]((e=>e.text()))):t.push(c());return Promise[a("0x27")](t)[a("0xc")]((e=>e[a("0x24")](" ")[a("0x10")]()))}(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-20231228.0",
3
+ "version": "0.0.0-nightly-20231230.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-20231228.0"
33
+ "ckeditor5": "0.0.0-nightly-20231230.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 _0x25d77e}from'ckeditor5/src/core.js';import{ButtonView as _0x5913db,Notification as _0x33450e,SpinnerView as _0x1017e7}from'ckeditor5/src/ui.js';import _0x30c378 from'./exportwordcommand.js';import _0x256132 from'../theme/icons/exportword.svg';export default class d extends _0x25d77e{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x33450e];}['init'](){const _0x49e015=this['editor'],t=_0x49e015['t'],_0x52a493=_0x49e015['config']['get']('exportWord')||{};_0x49e015['commands']['add']('exportWord',new _0x30c378(_0x49e015)),_0x49e015['ui']['componentFactory']['add']('exportWord',_0x5eba02=>{const _0x42fb29=_0x49e015['commands']['get']('exportWord'),_0x4e2367=new _0x5913db(_0x5eba02),_0x974f96=new _0x1017e7();return _0x4e2367['set']({'label':t('Export\x20to\x20Word'),'icon':_0x256132,'tooltip':!0x0}),_0x4e2367['children']['add'](_0x974f96),_0x4e2367['bind']('isOn','isEnabled')['to'](_0x42fb29,'isBusy','isEnabled'),_0x974f96['bind']('isVisible')['to'](_0x42fb29,'isBusy'),_0x4e2367['iconView']['bind']('isVisible')['to'](_0x42fb29,'isBusy',_0x1d0ad7=>!_0x1d0ad7),this['listenTo'](_0x4e2367,'execute',()=>{_0x49e015['execute']('exportWord',_0x52a493),_0x49e015['editing']['view']['focus']();}),_0x4e2367;});const _0x2d043d=_0x49e015['plugins']['get']('CloudServices');!0x1===_0x52a493['tokenUrl']?this['_token']=null:_0x52a493['tokenUrl']?_0x2d043d['registerTokenUrl'](_0x52a493['tokenUrl'])['then'](_0x4cb97b=>{this['_token']=_0x4cb97b;}):this['_token']=_0x2d043d['token'];}}
23
+ import{Plugin as _0xe5b7e}from'ckeditor5/src/core.js';import{ButtonView as _0xf2ccf6,Notification as _0x309e42,SpinnerView as _0x1f7f0c}from'ckeditor5/src/ui.js';import _0x44f745 from'./exportwordcommand.js';import _0x480fd1 from'../theme/icons/exportword.svg';export default class d extends _0xe5b7e{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x309e42];}['init'](){const _0x49c9a5=this['editor'],t=_0x49c9a5['t'],_0x2824af=_0x49c9a5['config']['get']('exportWord')||{};_0x49c9a5['commands']['add']('exportWord',new _0x44f745(_0x49c9a5)),_0x49c9a5['ui']['componentFactory']['add']('exportWord',_0x1da116=>{const _0x26d895=_0x49c9a5['commands']['get']('exportWord'),_0xfaccad=new _0xf2ccf6(_0x1da116),_0x19ac34=new _0x1f7f0c();return _0xfaccad['set']({'label':t('Export\x20to\x20Word'),'icon':_0x480fd1,'tooltip':!0x0}),_0xfaccad['children']['add'](_0x19ac34),_0xfaccad['bind']('isOn','isEnabled')['to'](_0x26d895,'isBusy','isEnabled'),_0x19ac34['bind']('isVisible')['to'](_0x26d895,'isBusy'),_0xfaccad['iconView']['bind']('isVisible')['to'](_0x26d895,'isBusy',_0x490bf1=>!_0x490bf1),this['listenTo'](_0xfaccad,'execute',()=>{_0x49c9a5['execute']('exportWord',_0x2824af),_0x49c9a5['editing']['view']['focus']();}),_0xfaccad;});const _0x1b16c1=_0x49c9a5['plugins']['get']('CloudServices');!0x1===_0x2824af['tokenUrl']?this['_token']=null:_0x2824af['tokenUrl']?_0x1b16c1['registerTokenUrl'](_0x2824af['tokenUrl'])['then'](_0x2976f0=>{this['_token']=_0x2976f0;}):this['_token']=_0x1b16c1['token'];}}
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Command as _0x4aabb0}from'ckeditor5/src/core.js';import{getConverterOptions as _0x71321b,getStyles as _0xf2e60}from'./utils.js';export default class i extends _0x4aabb0{constructor(_0x238128){super(_0x238128),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x112974={}){const _0x507056=this['editor'],t=_0x507056['t'],_0x1e7e8a=_0x112974['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x1813dc=_0x112974['converterOptions']||{},_0x2c11ff=_0x507056['plugins']['get']('ExportWord'),_0x3905fa=_0x112974['token']||_0x2c11ff['_token'],_0x305e5e=!0x1!==_0x1813dc['auto_pagination'],_0x1e6342=_0x112974['dataCallback']||(_0x4edba9=>_0x4edba9['data']['get']({'pagination':_0x305e5e}));return this['isBusy']=!0x0,this['refresh'](),_0xf2e60(_0x112974['stylesheets']||['EDITOR_STYLES'])['then'](async _0x7121ae=>{const _0x59cb19=await _0x1e6342(_0x507056),_0x5b62b8=this['_replaceSuggestionTypes'](_0x59cb19),_0x12a6a7={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x507056['locale']['contentLanguageDirection']+'\x22>'+_0x5b62b8+'</div>','css':_0x7121ae,'options':{..._0x1813dc,..._0x71321b(_0x507056)}},_0x5419bc={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x3905fa?{'Authorization':_0x3905fa['value']}:null},'body':JSON['stringify'](_0x12a6a7)};return window['fetch'](_0x1e7e8a,_0x5419bc)['then'](_0x3239ad=>{if(0xc8!==_0x3239ad['status'])throw _0x3239ad;return _0x3239ad['blob']();})['then'](_0x1212d8=>{const _0x564e15='function'==typeof _0x112974['fileName']?_0x112974['fileName']():_0x112974['fileName'];this['_downloadFile'](_0x1212d8,_0x564e15||'document.docx');});})['catch'](_0x5886ac=>{throw _0x507056['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x5886ac;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_replaceSuggestionTypes'](_0x8a7340){if(!_0x8a7340)return _0x8a7340;const _0x2a4794=(_0x1bf6b9,_0x87957,_0x28e0eb)=>'attribute'===_0x28e0eb?_0x87957+'formatInline:':_0x1bf6b9;return _0x8a7340['replace'](/<suggestion-(start|end) name="(.*?):/g,(_0x129913,_0x2bb10e,_0x1b58b2)=>_0x2a4794(_0x129913,'<suggestion-'+_0x2bb10e+'\x20name=\x22',_0x1b58b2))['replace'](/data-suggestion-(start|end)-(before|after)="(.*?):/g,(_0x74bf33,_0x119d48,_0x512684,_0x7cef6a)=>_0x2a4794(_0x74bf33,'data-suggestion-'+_0x119d48+'-'+_0x512684+'=\x22',_0x7cef6a));}['_downloadFile'](_0x16a12f,_0x16b6a4){const _0x2092dd=document['createElement']('a');_0x2092dd['href']=window['URL']['createObjectURL'](_0x16a12f),_0x2092dd['download']=_0x16b6a4,_0x2092dd['click'](),_0x2092dd['remove']();}}
23
+ import{Command as _0x3bbdb0}from'ckeditor5/src/core.js';import{getConverterOptions as _0x589d02,getStyles as _0x5b98de}from'./utils.js';export default class i extends _0x3bbdb0{constructor(_0x5e3b8d){super(_0x5e3b8d),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0xd984cc={}){const _0x45b523=this['editor'],t=_0x45b523['t'],_0x4e2bf1=_0xd984cc['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x4030a4=_0xd984cc['converterOptions']||{},_0x298709=_0x45b523['plugins']['get']('ExportWord'),_0x1d1c02=_0xd984cc['token']||_0x298709['_token'],_0x466178=!0x1!==_0x4030a4['auto_pagination'],_0x4265cb=_0xd984cc['dataCallback']||(_0x1a0393=>_0x1a0393['data']['get']({'pagination':_0x466178}));return this['isBusy']=!0x0,this['refresh'](),_0x5b98de(_0xd984cc['stylesheets']||['EDITOR_STYLES'])['then'](async _0x30de82=>{const _0x55f81e=await _0x4265cb(_0x45b523),_0x20816=this['_replaceSuggestionTypes'](_0x55f81e),_0xd29f53={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x45b523['locale']['contentLanguageDirection']+'\x22>'+_0x20816+'</div>','css':_0x30de82,'options':{..._0x4030a4,..._0x589d02(_0x45b523)}},_0x1b55c6={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x1d1c02?{'Authorization':_0x1d1c02['value']}:null},'body':JSON['stringify'](_0xd29f53)};return window['fetch'](_0x4e2bf1,_0x1b55c6)['then'](_0x1f834a=>{if(0xc8!==_0x1f834a['status'])throw _0x1f834a;return _0x1f834a['blob']();})['then'](_0x2e3319=>{const _0x19ff2d='function'==typeof _0xd984cc['fileName']?_0xd984cc['fileName']():_0xd984cc['fileName'];this['_downloadFile'](_0x2e3319,_0x19ff2d||'document.docx');});})['catch'](_0x24b442=>{throw _0x45b523['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x24b442;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_replaceSuggestionTypes'](_0x5f4c28){if(!_0x5f4c28)return _0x5f4c28;const _0x5cc2a4=(_0x30f5c7,_0x4eeca7,_0x846f5c)=>'attribute'===_0x846f5c?_0x4eeca7+'formatInline:':_0x30f5c7;return _0x5f4c28['replace'](/<suggestion-(start|end) name="(.*?):/g,(_0x563a83,_0xccbae5,_0x3d8767)=>_0x5cc2a4(_0x563a83,'<suggestion-'+_0xccbae5+'\x20name=\x22',_0x3d8767))['replace'](/data-suggestion-(start|end)-(before|after)="(.*?):/g,(_0x3abc64,_0x567bd5,_0x16beb0,_0x4fe1e6)=>_0x5cc2a4(_0x3abc64,'data-suggestion-'+_0x567bd5+'-'+_0x16beb0+'=\x22',_0x4fe1e6));}['_downloadFile'](_0x3f0d32,_0x5e0597){const _0x492db0=document['createElement']('a');_0x492db0['href']=window['URL']['createObjectURL'](_0x3f0d32),_0x492db0['download']=_0x5e0597,_0x492db0['click'](),_0x492db0['remove']();}}
package/src/utils.js CHANGED
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x14bd=['getCommentThreads','authorId','users','length','then','comments','hasAttribute','cssText','all','CommentsRepository','EDITOR_STYLES','has','warn','createdAt','keys','join','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.','fetch','styleSheets','plugins','Users','name','TrackChanges','get','text','timezone','from','suggestions','cssRules','ownerNode','DateTimeFormat','.ck-content','trim','getSuggestions','indexOf','isResolved','content','map','push'];(function(_0x2e07a5,_0x14bdf1){const _0x1747ac=function(_0x122658){while(--_0x122658){_0x2e07a5['push'](_0x2e07a5['shift']());}};_0x1747ac(++_0x14bdf1);}(_0x14bd,0x125));const _0x1747=function(_0x2e07a5,_0x14bdf1){_0x2e07a5=_0x2e07a5-0x0;let _0x1747ac=_0x14bd[_0x2e07a5];return _0x1747ac;};export function getStyles(_0x281fc6){if(!_0x281fc6)return new Promise(_0x472d24=>_0x472d24(''));const _0x4c7950=[];for(const _0x175bfc of _0x281fc6)_0x1747('0x1d')!==_0x175bfc?_0x4c7950[_0x1747('0x12')](window[_0x1747('0x24')](_0x175bfc)[_0x1747('0x17')](_0x20563c=>_0x20563c[_0x1747('0x4')]())):_0x4c7950[_0x1747('0x12')](u());return Promise[_0x1747('0x1b')](_0x4c7950)[_0x1747('0x17')](_0xdf722a=>_0xdf722a[_0x1747('0x22')]('\x20')[_0x1747('0xc')]());}function u(){const _0x3ded5a=[],_0x34666d=[];for(const _0x5bf67d of Array[_0x1747('0x6')](document[_0x1747('0x25')])){if(_0x5bf67d[_0x1747('0x9')][_0x1747('0x19')]('data-cke'))for(const _0x10fcd0 of Array[_0x1747('0x6')](_0x5bf67d[_0x1747('0x8')]))-0x1!==_0x10fcd0[_0x1747('0x1a')][_0x1747('0xe')](_0x1747('0xb'))?_0x3ded5a[_0x1747('0x12')](_0x10fcd0[_0x1747('0x1a')]):-0x1!==_0x10fcd0[_0x1747('0x1a')][_0x1747('0xe')](':root')&&_0x34666d[_0x1747('0x12')](_0x10fcd0[_0x1747('0x1a')]);}return _0x3ded5a[_0x1747('0x16')]||console[_0x1747('0x1f')](_0x1747('0x23')),[..._0x34666d,..._0x3ded5a]['join']('\x20')[_0x1747('0xc')]();}export function getConverterOptions(_0x289689){const _0x1c1e08=_0x289689[_0x1747('0x26')][_0x1747('0x1e')](_0x1747('0x0')),_0x203ef1=_0x289689['plugins']['has'](_0x1747('0x1c')),_0x537af2=_0x289689['plugins'][_0x1747('0x1e')]('TrackChanges'),_0x249e56={};if(_0x1c1e08&&_0x203ef1){const _0x2678e9=getComments(_0x289689[_0x1747('0x26')]['get'](_0x1747('0x1c'))[_0x1747('0x13')]({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object[_0x1747('0x21')](_0x2678e9)[_0x1747('0x16')]&&(_0x249e56[_0x1747('0x18')]=_0x2678e9);}if(_0x1c1e08&&_0x537af2){const _0x5e7e6b=_0x289689[_0x1747('0x26')][_0x1747('0x3')](_0x1747('0x2')),_0x58075c=_0x289689[_0x1747('0x26')][_0x1747('0x3')]('Users'),_0x31cf5c=getSuggestions(_0x5e7e6b[_0x1747('0xd')]({'toJSON':!0x0}),_0x58075c[_0x1747('0x15')]);Object['keys'](_0x31cf5c)[_0x1747('0x16')]&&(_0x249e56[_0x1747('0x7')]=_0x31cf5c);}return(_0x249e56['suggestions']||_0x249e56['comments'])&&(_0x249e56[_0x1747('0x5')]=new Intl[(_0x1747('0xa'))]()['resolvedOptions']()['timeZone']),_0x249e56;}export function getComments(_0x241bdd){const _0x3c30b8={};if(!_0x241bdd[_0x1747('0x16')])return _0x3c30b8;for(const _0x419df5 of _0x241bdd)_0x419df5[_0x1747('0x18')][_0x1747('0x11')](_0x4147bf=>{void 0x0===_0x3c30b8[_0x419df5['id']]&&(_0x3c30b8[_0x419df5['id']]=[]),_0x3c30b8[_0x419df5['id']]['push']({'author':_0x4147bf['author'][_0x1747('0x1')],'content':_0x4147bf[_0x1747('0x10')],'created':_0x4147bf['createdAt'],'is_resolved':_0x419df5[_0x1747('0xf')]});});return _0x3c30b8;}export function getSuggestions(_0x45cb13,_0x506500){const _0x77d3f5={};if(!_0x45cb13[_0x1747('0x16')]||!_0x506500[_0x1747('0x16')])return _0x77d3f5;for(const _0x3f7f15 of _0x45cb13)_0x77d3f5[_0x3f7f15['id']]={'author':_0x506500[_0x1747('0x3')](_0x3f7f15[_0x1747('0x14')])['name'],'created':_0x3f7f15[_0x1747('0x20')]};return _0x77d3f5;}
23
+ const _0x3ac4=['DateTimeFormat','has','trim','suggestions','map','TrackChanges','getSuggestions','ownerNode','Users',':root','fetch','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.','author','push','hasAttribute','content','users','name','getCommentThreads','CommentsRepository','indexOf','authorId','join','get','EDITOR_STYLES','all','styleSheets','cssText','timezone','createdAt','warn','comments','cssRules','plugins','from','.ck-content','data-cke','isResolved','then','length'];(function(_0xaff423,_0x3ac434){const _0x53f794=function(_0x3ebbac){while(--_0x3ebbac){_0xaff423['push'](_0xaff423['shift']());}};_0x53f794(++_0x3ac434);}(_0x3ac4,0x92));const _0x53f7=function(_0xaff423,_0x3ac434){_0xaff423=_0xaff423-0x0;let _0x53f794=_0x3ac4[_0xaff423];return _0x53f794;};export function getStyles(_0x59278d){if(!_0x59278d)return new Promise(_0x50eddb=>_0x50eddb(''));const _0x1d3a3d=[];for(const _0x550070 of _0x59278d)_0x53f7('0x26')!==_0x550070?_0x1d3a3d[_0x53f7('0x1b')](window[_0x53f7('0x18')](_0x550070)[_0x53f7('0xc')](_0x1b588d=>_0x1b588d['text']())):_0x1d3a3d['push'](u());return Promise[_0x53f7('0x27')](_0x1d3a3d)[_0x53f7('0xc')](_0x4175db=>_0x4175db[_0x53f7('0x24')]('\x20')[_0x53f7('0x10')]());}function u(){const _0x2fda1c=[],_0x3e5b38=[];for(const _0x11ece5 of Array[_0x53f7('0x8')](document[_0x53f7('0x0')])){if(_0x11ece5[_0x53f7('0x15')][_0x53f7('0x1c')](_0x53f7('0xa')))for(const _0x1409e6 of Array[_0x53f7('0x8')](_0x11ece5[_0x53f7('0x6')]))-0x1!==_0x1409e6[_0x53f7('0x1')][_0x53f7('0x22')](_0x53f7('0x9'))?_0x2fda1c[_0x53f7('0x1b')](_0x1409e6[_0x53f7('0x1')]):-0x1!==_0x1409e6[_0x53f7('0x1')][_0x53f7('0x22')](_0x53f7('0x17'))&&_0x3e5b38['push'](_0x1409e6['cssText']);}return _0x2fda1c[_0x53f7('0xd')]||console[_0x53f7('0x4')](_0x53f7('0x19')),[..._0x3e5b38,..._0x2fda1c][_0x53f7('0x24')]('\x20')['trim']();}export function getConverterOptions(_0x22cc7d){const _0x50b45a=_0x22cc7d[_0x53f7('0x7')][_0x53f7('0xf')](_0x53f7('0x16')),_0x50acea=_0x22cc7d[_0x53f7('0x7')]['has'](_0x53f7('0x21')),_0x378fbe=_0x22cc7d['plugins']['has'](_0x53f7('0x13')),_0x848c92={};if(_0x50b45a&&_0x50acea){const _0x1caeec=getComments(_0x22cc7d[_0x53f7('0x7')][_0x53f7('0x25')](_0x53f7('0x21'))[_0x53f7('0x20')]({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object['keys'](_0x1caeec)[_0x53f7('0xd')]&&(_0x848c92[_0x53f7('0x5')]=_0x1caeec);}if(_0x50b45a&&_0x378fbe){const _0x23ecf3=_0x22cc7d['plugins'][_0x53f7('0x25')]('TrackChanges'),_0x12f9ca=_0x22cc7d[_0x53f7('0x7')][_0x53f7('0x25')](_0x53f7('0x16')),_0x34d17b=getSuggestions(_0x23ecf3[_0x53f7('0x14')]({'toJSON':!0x0}),_0x12f9ca[_0x53f7('0x1e')]);Object['keys'](_0x34d17b)[_0x53f7('0xd')]&&(_0x848c92[_0x53f7('0x11')]=_0x34d17b);}return(_0x848c92[_0x53f7('0x11')]||_0x848c92['comments'])&&(_0x848c92[_0x53f7('0x2')]=new Intl[(_0x53f7('0xe'))]()['resolvedOptions']()['timeZone']),_0x848c92;}export function getComments(_0x1ddf38){const _0xa59df3={};if(!_0x1ddf38['length'])return _0xa59df3;for(const _0xc94d96 of _0x1ddf38)_0xc94d96[_0x53f7('0x5')][_0x53f7('0x12')](_0x256e12=>{void 0x0===_0xa59df3[_0xc94d96['id']]&&(_0xa59df3[_0xc94d96['id']]=[]),_0xa59df3[_0xc94d96['id']][_0x53f7('0x1b')]({'author':_0x256e12[_0x53f7('0x1a')][_0x53f7('0x1f')],'content':_0x256e12[_0x53f7('0x1d')],'created':_0x256e12[_0x53f7('0x3')],'is_resolved':_0xc94d96[_0x53f7('0xb')]});});return _0xa59df3;}export function getSuggestions(_0x37217e,_0x2f2008){const _0xf4bab1={};if(!_0x37217e['length']||!_0x2f2008[_0x53f7('0xd')])return _0xf4bab1;for(const _0x23c2f4 of _0x37217e)_0xf4bab1[_0x23c2f4['id']]={'author':_0x2f2008[_0x53f7('0x25')](_0x23c2f4[_0x53f7('0x23')])['name'],'created':_0x23c2f4['createdAt']};return _0xf4bab1;}