@ckeditor/ckeditor5-export-word 0.0.0-nightly-20231213.0 → 0.0.0-nightly-20231215.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=["timezone","data-cke","cssRules","length","fetch","TrackChanges","EDITOR_STYLES","createdAt","trim","CommentsRepository","isResolved","warn","cssText","from","timeZone","indexOf","name","suggestions","getSuggestions","users","push","content","authorId","ownerNode","plugins","resolvedOptions","has","text","hasAttribute","then","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.","DateTimeFormat","author",".ck-content","all","comments","keys",":root","Users","get"];var s,i;s=r,i=408,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("0xf")](document.styleSheets))if(o[a("0x19")][a("0x1e")](a("0x3")))for(const n of Array[a("0xf")](o[a("0x4")]))-1!==n[a("0xe")].indexOf(a("0x24"))?e.push(n.cssText):-1!==n[a("0xe")][a("0x11")](a("0x28"))&&t[a("0x16")](n[a("0xe")]);return e.length||console[a("0xd")](a("0x21")),[...t,...e].join(" ")[a("0xa")]()}function d(e){const t=e.plugins[a("0x1c")](a("0x0")),o=e[a("0x1a")].has("CommentsRepository"),n=e[a("0x1a")][a("0x1c")](a("0x7")),r={};if(t&&o){const t=function(e){const t={};if(!e.length)return t;for(const o of e)o[a("0x26")].map((e=>{void 0===t[o.id]&&(t[o.id]=[]),t[o.id].push({author:e[a("0x23")][a("0x12")],content:e[a("0x17")],created:e[a("0x9")],is_resolved:o[a("0xc")]})}));return t}(e[a("0x1a")][a("0x1")](a("0xb")).getCommentThreads({skipNotAttached:!0,skipEmpty:!0}));Object.keys(t).length&&(r[a("0x26")]=t)}if(t&&n){const t=e[a("0x1a")][a("0x1")](a("0x7")),o=e[a("0x1a")][a("0x1")](a("0x0")),n=function(e,t){const o={};if(!e[a("0x5")]||!t[a("0x5")])return o;for(const n of e)o[n.id]={author:t[a("0x1")](n[a("0x18")])[a("0x12")],created:n[a("0x9")]};return o}(t[a("0x14")]({toJSON:!0}),o[a("0x15")]);Object[a("0x27")](n)[a("0x5")]&&(r[a("0x13")]=n)}return(r[a("0x13")]||r[a("0x26")])&&(r[a("0x2")]=(new(Intl[a("0x22")]))[a("0x1b")]()[a("0x10")]),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("0x8")!==o?t[a("0x16")](window[a("0x6")](o)[a("0x1f")]((e=>e[a("0x1d")]()))):t.push(c());return Promise[a("0x25")](t)[a("0x1f")]((e=>e[a("0x20")](" ")[a("0xa")]()))}(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=["suggestions","join","map","users","text",".ck-content","length","keys",":root","from","cssRules","timezone","author","content","getSuggestions","trim","DateTimeFormat","hasAttribute","TrackChanges","createdAt","push","data-cke","Users","cssText","plugins","isResolved","has","fetch","resolvedOptions","getCommentThreads","EDITOR_STYLES","all","get","indexOf","timeZone","styleSheets","name","warn","comments","CommentsRepository","then"];var s,i;s=r,i=385,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("0x22")](document[a("0x13")]))if(o.ownerNode[a("0x1")](a("0x5")))for(const n of Array.from(o[a("0x23")]))-1!==n[a("0x7")][a("0x11")](a("0x1e"))?e[a("0x4")](n[a("0x7")]):-1!==n[a("0x7")][a("0x11")](a("0x21"))&&t.push(n[a("0x7")]);return e.length||console[a("0x15")]("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("0x1a")](" ")[a("0x28")]()}function d(e){const t=e[a("0x8")][a("0xa")](a("0x6")),o=e.plugins[a("0xa")](a("0x17")),n=e[a("0x8")].has("TrackChanges"),r={};if(t&&o){const t=function(e){const t={};if(!e[a("0x1f")])return t;for(const o of e)o[a("0x16")][a("0x1b")]((e=>{void 0===t[o.id]&&(t[o.id]=[]),t[o.id].push({author:e[a("0x25")].name,content:e[a("0x26")],created:e[a("0x3")],is_resolved:o[a("0x9")]})}));return t}(e.plugins.get("CommentsRepository")[a("0xd")]({skipNotAttached:!0,skipEmpty:!0}));Object[a("0x20")](t).length&&(r.comments=t)}if(t&&n){const t=e[a("0x8")][a("0x10")](a("0x2")),o=e[a("0x8")].get(a("0x6")),n=function(e,t){const o={};if(!e.length||!t[a("0x1f")])return o;for(const n of e)o[n.id]={author:t.get(n.authorId)[a("0x14")],created:n.createdAt};return o}(t[a("0x27")]({toJSON:!0}),o[a("0x1c")]);Object[a("0x20")](n)[a("0x1f")]&&(r[a("0x19")]=n)}return(r[a("0x19")]||r[a("0x16")])&&(r[a("0x24")]=(new(Intl[a("0x0")]))[a("0xc")]()[a("0x12")]),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("0xe")!==o?t[a("0x4")](window[a("0xb")](o)[a("0x18")]((e=>e[a("0x1d")]()))):t[a("0x4")](c());return Promise[a("0xf")](t)[a("0x18")]((e=>e[a("0x1a")](" ").trim()))}(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-20231213.0",
3
+ "version": "0.0.0-nightly-20231215.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-20231213.0"
32
+ "ckeditor5": "0.0.0-nightly-20231215.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 _0x1fb503}from'ckeditor5/src/core';import{ButtonView as _0x3cb3d9,Notification as _0x2bc3dc,SpinnerView as _0x12b691}from'ckeditor5/src/ui';import _0x10cd0c from'./exportwordcommand';import _0x3cc3cf from'../theme/icons/exportword.svg';export default class d extends _0x1fb503{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x2bc3dc];}['init'](){const _0x3a5cc5=this['editor'],t=_0x3a5cc5['t'],_0x16fe9b=_0x3a5cc5['config']['get']('exportWord')||{};_0x3a5cc5['commands']['add']('exportWord',new _0x10cd0c(_0x3a5cc5)),_0x3a5cc5['ui']['componentFactory']['add']('exportWord',_0x3b694e=>{const _0x5ca852=_0x3a5cc5['commands']['get']('exportWord'),_0x433f06=new _0x3cb3d9(_0x3b694e),_0x779a0e=new _0x12b691();return _0x433f06['set']({'label':t('Export\x20to\x20Word'),'icon':_0x3cc3cf,'tooltip':!0x0}),_0x433f06['children']['add'](_0x779a0e),_0x433f06['bind']('isOn','isEnabled')['to'](_0x5ca852,'isBusy','isEnabled'),_0x779a0e['bind']('isVisible')['to'](_0x5ca852,'isBusy'),_0x433f06['iconView']['bind']('isVisible')['to'](_0x5ca852,'isBusy',_0x5bf1bb=>!_0x5bf1bb),this['listenTo'](_0x433f06,'execute',()=>{_0x3a5cc5['execute']('exportWord',_0x16fe9b),_0x3a5cc5['editing']['view']['focus']();}),_0x433f06;});const _0x272506=_0x3a5cc5['plugins']['get']('CloudServices');!0x1===_0x16fe9b['tokenUrl']?this['_token']=null:_0x16fe9b['tokenUrl']?_0x272506['registerTokenUrl'](_0x16fe9b['tokenUrl'])['then'](_0x5a3a19=>{this['_token']=_0x5a3a19;}):this['_token']=_0x272506['token'];}}
23
+ import{Plugin as _0x1ed3a5}from'ckeditor5/src/core';import{ButtonView as _0x4af6e2,Notification as _0x2e5206,SpinnerView as _0x2b8562}from'ckeditor5/src/ui';import _0x437272 from'./exportwordcommand';import _0x172efe from'../theme/icons/exportword.svg';export default class d extends _0x1ed3a5{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x2e5206];}['init'](){const _0x31d928=this['editor'],t=_0x31d928['t'],_0x3d4e55=_0x31d928['config']['get']('exportWord')||{};_0x31d928['commands']['add']('exportWord',new _0x437272(_0x31d928)),_0x31d928['ui']['componentFactory']['add']('exportWord',_0x283bbe=>{const _0x1f4349=_0x31d928['commands']['get']('exportWord'),_0x3e4809=new _0x4af6e2(_0x283bbe),_0x30a2c2=new _0x2b8562();return _0x3e4809['set']({'label':t('Export\x20to\x20Word'),'icon':_0x172efe,'tooltip':!0x0}),_0x3e4809['children']['add'](_0x30a2c2),_0x3e4809['bind']('isOn','isEnabled')['to'](_0x1f4349,'isBusy','isEnabled'),_0x30a2c2['bind']('isVisible')['to'](_0x1f4349,'isBusy'),_0x3e4809['iconView']['bind']('isVisible')['to'](_0x1f4349,'isBusy',_0x3ac471=>!_0x3ac471),this['listenTo'](_0x3e4809,'execute',()=>{_0x31d928['execute']('exportWord',_0x3d4e55),_0x31d928['editing']['view']['focus']();}),_0x3e4809;});const _0x13eea5=_0x31d928['plugins']['get']('CloudServices');!0x1===_0x3d4e55['tokenUrl']?this['_token']=null:_0x3d4e55['tokenUrl']?_0x13eea5['registerTokenUrl'](_0x3d4e55['tokenUrl'])['then'](_0x2fd1c4=>{this['_token']=_0x2fd1c4;}):this['_token']=_0x13eea5['token'];}}
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Command as _0x4a1d42}from'ckeditor5/src/core';import{getConverterOptions as _0x4bb905,getStyles as _0x2e76e6}from'./utils';export default class s extends _0x4a1d42{constructor(_0x5a7c8a){super(_0x5a7c8a),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x520a07={}){const _0x5bb1a1=this['editor'],t=_0x5bb1a1['t'],_0x2406b4=_0x520a07['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x1a2a8d=_0x520a07['converterOptions']||{},_0x76e3ce=_0x5bb1a1['plugins']['get']('ExportWord'),_0x34708c=_0x520a07['token']||_0x76e3ce['_token'],_0x3e76f6=!0x1!==_0x1a2a8d['auto_pagination'],_0x1646cd=_0x520a07['dataCallback']||(_0x407ab1=>_0x407ab1['data']['get']({'pagination':_0x3e76f6}));return this['isBusy']=!0x0,this['refresh'](),_0x2e76e6(_0x520a07['stylesheets']||['EDITOR_STYLES'])['then'](async _0x229b52=>{const _0x189cc1=await _0x1646cd(_0x5bb1a1),_0x4cf229=this['_replaceSuggestionTypes'](_0x189cc1),_0x3049f3={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x5bb1a1['locale']['contentLanguageDirection']+'\x22>'+_0x4cf229+'</div>','css':_0x229b52,'options':{..._0x1a2a8d,..._0x4bb905(_0x5bb1a1)}},_0x4ecbb6={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x34708c?{'Authorization':_0x34708c['value']}:null},'body':JSON['stringify'](_0x3049f3)};return window['fetch'](_0x2406b4,_0x4ecbb6)['then'](_0x28b434=>{if(0xc8!==_0x28b434['status'])throw _0x28b434;return _0x28b434['blob']();})['then'](_0x3ab5ea=>{const _0x3bce68='function'==typeof _0x520a07['fileName']?_0x520a07['fileName']():_0x520a07['fileName'];this['_downloadFile'](_0x3ab5ea,_0x3bce68||'document.docx');});})['catch'](_0x3abfbb=>{throw _0x5bb1a1['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x3abfbb;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_replaceSuggestionTypes'](_0xae6b7b){if(!_0xae6b7b)return _0xae6b7b;const _0x45a95a=(_0x279e06,_0x3ce5fb,_0x42371)=>'attribute'===_0x42371?_0x3ce5fb+'formatInline:':_0x279e06;return _0xae6b7b['replace'](/<suggestion-(start|end) name="(.*?):/g,(_0x4cd7a2,_0x484c2f,_0x1ccce9)=>_0x45a95a(_0x4cd7a2,'<suggestion-'+_0x484c2f+'\x20name=\x22',_0x1ccce9))['replace'](/data-suggestion-(start|end)-(before|after)="(.*?):/g,(_0x24e4a7,_0x26dc9e,_0x10aa40,_0x5ce9bb)=>_0x45a95a(_0x24e4a7,'data-suggestion-'+_0x26dc9e+'-'+_0x10aa40+'=\x22',_0x5ce9bb));}['_downloadFile'](_0x1e55e7,_0x3f1c1d){const _0x26d890=document['createElement']('a');_0x26d890['href']=window['URL']['createObjectURL'](_0x1e55e7),_0x26d890['download']=_0x3f1c1d,_0x26d890['click'](),_0x26d890['remove']();}}
23
+ import{Command as _0x214ccd}from'ckeditor5/src/core';import{getConverterOptions as _0x50b845,getStyles as _0x50f0be}from'./utils';export default class s extends _0x214ccd{constructor(_0x15c727){super(_0x15c727),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x2b3111={}){const _0xe094ed=this['editor'],t=_0xe094ed['t'],_0x41cb2a=_0x2b3111['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x1b917d=_0x2b3111['converterOptions']||{},_0xd1d717=_0xe094ed['plugins']['get']('ExportWord'),_0xcdbdf0=_0x2b3111['token']||_0xd1d717['_token'],_0x7f62ff=!0x1!==_0x1b917d['auto_pagination'],_0x4380a2=_0x2b3111['dataCallback']||(_0x61b152=>_0x61b152['data']['get']({'pagination':_0x7f62ff}));return this['isBusy']=!0x0,this['refresh'](),_0x50f0be(_0x2b3111['stylesheets']||['EDITOR_STYLES'])['then'](async _0x3e46fc=>{const _0x5d132c=await _0x4380a2(_0xe094ed),_0x5aa280=this['_replaceSuggestionTypes'](_0x5d132c),_0x3813f5={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0xe094ed['locale']['contentLanguageDirection']+'\x22>'+_0x5aa280+'</div>','css':_0x3e46fc,'options':{..._0x1b917d,..._0x50b845(_0xe094ed)}},_0x4e2e0d={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0xcdbdf0?{'Authorization':_0xcdbdf0['value']}:null},'body':JSON['stringify'](_0x3813f5)};return window['fetch'](_0x41cb2a,_0x4e2e0d)['then'](_0x1b531e=>{if(0xc8!==_0x1b531e['status'])throw _0x1b531e;return _0x1b531e['blob']();})['then'](_0x2e1a5a=>{const _0x3517c4='function'==typeof _0x2b3111['fileName']?_0x2b3111['fileName']():_0x2b3111['fileName'];this['_downloadFile'](_0x2e1a5a,_0x3517c4||'document.docx');});})['catch'](_0x283530=>{throw _0xe094ed['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x283530;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_replaceSuggestionTypes'](_0x30b913){if(!_0x30b913)return _0x30b913;const _0x18b2a5=(_0x2ecb66,_0x504cbb,_0x49c63b)=>'attribute'===_0x49c63b?_0x504cbb+'formatInline:':_0x2ecb66;return _0x30b913['replace'](/<suggestion-(start|end) name="(.*?):/g,(_0xb369ce,_0x54d5bc,_0x5d18d7)=>_0x18b2a5(_0xb369ce,'<suggestion-'+_0x54d5bc+'\x20name=\x22',_0x5d18d7))['replace'](/data-suggestion-(start|end)-(before|after)="(.*?):/g,(_0x145c17,_0x2489a0,_0x2fa4ae,_0x378c44)=>_0x18b2a5(_0x145c17,'data-suggestion-'+_0x2489a0+'-'+_0x2fa4ae+'=\x22',_0x378c44));}['_downloadFile'](_0x68729d,_0x4ff8d5){const _0x2fd152=document['createElement']('a');_0x2fd152['href']=window['URL']['createObjectURL'](_0x68729d),_0x2fd152['download']=_0x4ff8d5,_0x2fd152['click'](),_0x2fd152['remove']();}}
package/src/utils.js CHANGED
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x4843=['timezone','data-cke','cssRules','length','fetch','TrackChanges','EDITOR_STYLES','createdAt','trim','CommentsRepository','isResolved','warn','cssText','from','timeZone','indexOf','name','suggestions','getSuggestions','users','push','content','authorId','ownerNode','plugins','resolvedOptions','has','text','hasAttribute','then','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.','DateTimeFormat','author','.ck-content','all','comments','keys',':root','Users','get'];(function(_0x494f5e,_0x484335){const _0x23456c=function(_0x2cdffc){while(--_0x2cdffc){_0x494f5e['push'](_0x494f5e['shift']());}};_0x23456c(++_0x484335);}(_0x4843,0x198));const _0x2345=function(_0x494f5e,_0x484335){_0x494f5e=_0x494f5e-0x0;let _0x23456c=_0x4843[_0x494f5e];return _0x23456c;};export function getStyles(_0x29cb3b){if(!_0x29cb3b)return new Promise(_0x48a3e2=>_0x48a3e2(''));const _0x57e2ac=[];for(const _0x24603 of _0x29cb3b)_0x2345('0x8')!==_0x24603?_0x57e2ac[_0x2345('0x16')](window[_0x2345('0x6')](_0x24603)[_0x2345('0x1f')](_0x1c6302=>_0x1c6302[_0x2345('0x1d')]())):_0x57e2ac['push'](u());return Promise[_0x2345('0x25')](_0x57e2ac)[_0x2345('0x1f')](_0x43647b=>_0x43647b[_0x2345('0x20')]('\x20')[_0x2345('0xa')]());}function u(){const _0x22e07a=[],_0x10c2fa=[];for(const _0x492309 of Array[_0x2345('0xf')](document['styleSheets'])){if(_0x492309[_0x2345('0x19')][_0x2345('0x1e')](_0x2345('0x3')))for(const _0x5a1873 of Array[_0x2345('0xf')](_0x492309[_0x2345('0x4')]))-0x1!==_0x5a1873[_0x2345('0xe')]['indexOf'](_0x2345('0x24'))?_0x22e07a['push'](_0x5a1873['cssText']):-0x1!==_0x5a1873[_0x2345('0xe')][_0x2345('0x11')](_0x2345('0x28'))&&_0x10c2fa[_0x2345('0x16')](_0x5a1873[_0x2345('0xe')]);}return _0x22e07a['length']||console[_0x2345('0xd')](_0x2345('0x21')),[..._0x10c2fa,..._0x22e07a]['join']('\x20')[_0x2345('0xa')]();}export function getConverterOptions(_0x3ad043){const _0x20f5d7=_0x3ad043['plugins'][_0x2345('0x1c')](_0x2345('0x0')),_0xda91ea=_0x3ad043[_0x2345('0x1a')]['has']('CommentsRepository'),_0xf55cec=_0x3ad043[_0x2345('0x1a')][_0x2345('0x1c')](_0x2345('0x7')),_0x2f5317={};if(_0x20f5d7&&_0xda91ea){const _0x1f284e=getComments(_0x3ad043[_0x2345('0x1a')][_0x2345('0x1')](_0x2345('0xb'))['getCommentThreads']({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object['keys'](_0x1f284e)['length']&&(_0x2f5317[_0x2345('0x26')]=_0x1f284e);}if(_0x20f5d7&&_0xf55cec){const _0x14009a=_0x3ad043[_0x2345('0x1a')][_0x2345('0x1')](_0x2345('0x7')),_0x36a566=_0x3ad043[_0x2345('0x1a')][_0x2345('0x1')](_0x2345('0x0')),_0x31dca6=getSuggestions(_0x14009a[_0x2345('0x14')]({'toJSON':!0x0}),_0x36a566[_0x2345('0x15')]);Object[_0x2345('0x27')](_0x31dca6)[_0x2345('0x5')]&&(_0x2f5317[_0x2345('0x13')]=_0x31dca6);}return(_0x2f5317[_0x2345('0x13')]||_0x2f5317[_0x2345('0x26')])&&(_0x2f5317[_0x2345('0x2')]=new Intl[(_0x2345('0x22'))]()[_0x2345('0x1b')]()[_0x2345('0x10')]),_0x2f5317;}export function getComments(_0x46ca6b){const _0x34efe7={};if(!_0x46ca6b['length'])return _0x34efe7;for(const _0x5393a1 of _0x46ca6b)_0x5393a1[_0x2345('0x26')]['map'](_0x4bccc8=>{void 0x0===_0x34efe7[_0x5393a1['id']]&&(_0x34efe7[_0x5393a1['id']]=[]),_0x34efe7[_0x5393a1['id']]['push']({'author':_0x4bccc8[_0x2345('0x23')][_0x2345('0x12')],'content':_0x4bccc8[_0x2345('0x17')],'created':_0x4bccc8[_0x2345('0x9')],'is_resolved':_0x5393a1[_0x2345('0xc')]});});return _0x34efe7;}export function getSuggestions(_0x2ca8f7,_0x1a238b){const _0x15a566={};if(!_0x2ca8f7[_0x2345('0x5')]||!_0x1a238b[_0x2345('0x5')])return _0x15a566;for(const _0x432cb7 of _0x2ca8f7)_0x15a566[_0x432cb7['id']]={'author':_0x1a238b[_0x2345('0x1')](_0x432cb7[_0x2345('0x18')])[_0x2345('0x12')],'created':_0x432cb7[_0x2345('0x9')]};return _0x15a566;}
23
+ const _0x27b1=['suggestions','join','map','users','text','.ck-content','length','keys',':root','from','cssRules','timezone','author','content','getSuggestions','trim','DateTimeFormat','hasAttribute','TrackChanges','createdAt','push','data-cke','Users','cssText','plugins','isResolved','has','fetch','resolvedOptions','getCommentThreads','EDITOR_STYLES','all','get','indexOf','timeZone','styleSheets','name','warn','comments','CommentsRepository','then'];(function(_0x43dda0,_0x27b1a2){const _0xbe5ac4=function(_0x2f69c9){while(--_0x2f69c9){_0x43dda0['push'](_0x43dda0['shift']());}};_0xbe5ac4(++_0x27b1a2);}(_0x27b1,0x181));const _0xbe5a=function(_0x43dda0,_0x27b1a2){_0x43dda0=_0x43dda0-0x0;let _0xbe5ac4=_0x27b1[_0x43dda0];return _0xbe5ac4;};export function getStyles(_0x472dc5){if(!_0x472dc5)return new Promise(_0xa11ef2=>_0xa11ef2(''));const _0x539d05=[];for(const _0x111c0d of _0x472dc5)_0xbe5a('0xe')!==_0x111c0d?_0x539d05[_0xbe5a('0x4')](window[_0xbe5a('0xb')](_0x111c0d)[_0xbe5a('0x18')](_0x5b4dc2=>_0x5b4dc2[_0xbe5a('0x1d')]())):_0x539d05[_0xbe5a('0x4')](u());return Promise[_0xbe5a('0xf')](_0x539d05)[_0xbe5a('0x18')](_0x256cc4=>_0x256cc4[_0xbe5a('0x1a')]('\x20')['trim']());}function u(){const _0x2f3846=[],_0x14d2dc=[];for(const _0xc5e524 of Array[_0xbe5a('0x22')](document[_0xbe5a('0x13')])){if(_0xc5e524['ownerNode'][_0xbe5a('0x1')](_0xbe5a('0x5')))for(const _0x5d4054 of Array['from'](_0xc5e524[_0xbe5a('0x23')]))-0x1!==_0x5d4054[_0xbe5a('0x7')][_0xbe5a('0x11')](_0xbe5a('0x1e'))?_0x2f3846[_0xbe5a('0x4')](_0x5d4054[_0xbe5a('0x7')]):-0x1!==_0x5d4054[_0xbe5a('0x7')][_0xbe5a('0x11')](_0xbe5a('0x21'))&&_0x14d2dc['push'](_0x5d4054[_0xbe5a('0x7')]);}return _0x2f3846['length']||console[_0xbe5a('0x15')]('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.'),[..._0x14d2dc,..._0x2f3846][_0xbe5a('0x1a')]('\x20')[_0xbe5a('0x28')]();}export function getConverterOptions(_0x6dd05d){const _0xa6bf23=_0x6dd05d[_0xbe5a('0x8')][_0xbe5a('0xa')](_0xbe5a('0x6')),_0x409559=_0x6dd05d['plugins'][_0xbe5a('0xa')](_0xbe5a('0x17')),_0x29748c=_0x6dd05d[_0xbe5a('0x8')]['has']('TrackChanges'),_0x24e5f7={};if(_0xa6bf23&&_0x409559){const _0x3938bc=getComments(_0x6dd05d['plugins']['get']('CommentsRepository')[_0xbe5a('0xd')]({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object[_0xbe5a('0x20')](_0x3938bc)['length']&&(_0x24e5f7['comments']=_0x3938bc);}if(_0xa6bf23&&_0x29748c){const _0x4e3c51=_0x6dd05d[_0xbe5a('0x8')][_0xbe5a('0x10')](_0xbe5a('0x2')),_0x5b8a82=_0x6dd05d[_0xbe5a('0x8')]['get'](_0xbe5a('0x6')),_0x402d3b=getSuggestions(_0x4e3c51[_0xbe5a('0x27')]({'toJSON':!0x0}),_0x5b8a82[_0xbe5a('0x1c')]);Object[_0xbe5a('0x20')](_0x402d3b)[_0xbe5a('0x1f')]&&(_0x24e5f7[_0xbe5a('0x19')]=_0x402d3b);}return(_0x24e5f7[_0xbe5a('0x19')]||_0x24e5f7[_0xbe5a('0x16')])&&(_0x24e5f7[_0xbe5a('0x24')]=new Intl[(_0xbe5a('0x0'))]()[_0xbe5a('0xc')]()[_0xbe5a('0x12')]),_0x24e5f7;}export function getComments(_0x4011da){const _0x509a04={};if(!_0x4011da[_0xbe5a('0x1f')])return _0x509a04;for(const _0x3c7f7e of _0x4011da)_0x3c7f7e[_0xbe5a('0x16')][_0xbe5a('0x1b')](_0x9a9d9f=>{void 0x0===_0x509a04[_0x3c7f7e['id']]&&(_0x509a04[_0x3c7f7e['id']]=[]),_0x509a04[_0x3c7f7e['id']]['push']({'author':_0x9a9d9f[_0xbe5a('0x25')]['name'],'content':_0x9a9d9f[_0xbe5a('0x26')],'created':_0x9a9d9f[_0xbe5a('0x3')],'is_resolved':_0x3c7f7e[_0xbe5a('0x9')]});});return _0x509a04;}export function getSuggestions(_0x4e42cc,_0x211209){const _0x5d6839={};if(!_0x4e42cc['length']||!_0x211209[_0xbe5a('0x1f')])return _0x5d6839;for(const _0x37c266 of _0x4e42cc)_0x5d6839[_0x37c266['id']]={'author':_0x211209['get'](_0x37c266['authorId'])[_0xbe5a('0x14')],'created':_0x37c266['createdAt']};return _0x5d6839;}