@ckeditor/ckeditor5-export-word 0.0.0-nightly-20240130.0 → 0.0.0-nightly-20240201.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.
- package/build/export-word.js +1 -1
- package/package.json +2 -2
- package/src/exportword.js +1 -1
- package/src/exportwordcommand.js +1 -1
- package/src/utils.js +1 -1
package/build/export-word.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
/*!
|
|
3
3
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
4
4
|
* For licensing, see LICENSE.md.
|
|
5
|
-
*/(()=>{var t={704:(t,e,o)=>{t.exports=o(79)("./src/core.js")},273:(t,e,o)=>{t.exports=o(79)("./src/ui.js")},79:t=>{"use strict";t.exports=CKEditor5.dll}},e={};function o(n){var r=e[n];if(void 0!==r)return r.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,o),i.exports}o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";o.r(n),o.d(n,{ExportWord:()=>u});var t=o(704),e=o(273);const r=["
|
|
5
|
+
*/(()=>{var t={704:(t,e,o)=>{t.exports=o(79)("./src/core.js")},273:(t,e,o)=>{t.exports=o(79)("./src/ui.js")},79:t=>{"use strict";t.exports=CKEditor5.dll}},e={};function o(n){var r=e[n];if(void 0!==r)return r.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,o),i.exports}o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";o.r(n),o.d(n,{ExportWord:()=>u});var t=o(704),e=o(273);const r=["get",".ck-content","keys","TrackChanges","plugins","fetch","cssText","indexOf","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.","has","ownerNode","EDITOR_STYLES","text","suggestions","trim","getSuggestions","getCommentThreads","from","createdAt","CommentsRepository","map","length","then",":root","cssRules","comments","push","name","DateTimeFormat","hasAttribute","join","warn","content","data-cke"];var i,s;i=r,s=355,function(t){for(;--t;)i.push(i.shift())}(++s);const c=function(t,e){return r[t-=0]};function a(){const t=[],e=[];for(const o of Array[c("0x2")](document.styleSheets))if(o[c("0x1d")][c("0xe")](c("0x12")))for(const n of Array[c("0x2")](o[c("0x9")]))-1!==n[c("0x19")][c("0x1a")](c("0x14"))?t[c("0xb")](n[c("0x19")]):-1!==n.cssText.indexOf(c("0x8"))&&e[c("0xb")](n[c("0x19")]);return t.length||console[c("0x10")](c("0x1b")),[...e,...t][c("0xf")](" ").trim()}function d(t){const e=t.plugins[c("0x1c")]("Users"),o=t.plugins.has(c("0x4")),n=t[c("0x17")][c("0x1c")](c("0x16")),r={};if(e&&o){const e=function(t){const e={};if(!t[c("0x6")])return e;for(const o of t)o[c("0xa")][c("0x5")]((t=>{void 0===e[o.id]&&(e[o.id]=[]),e[o.id][c("0xb")]({author:t.author[c("0xc")],content:t[c("0x11")],created:t[c("0x3")],is_resolved:o.isResolved})}));return e}(t.plugins[c("0x13")](c("0x4"))[c("0x1")]({skipNotAttached:!0,skipEmpty:!0}));Object[c("0x15")](e)[c("0x6")]&&(r[c("0xa")]=e)}if(e&&n){const e=t.plugins[c("0x13")]("TrackChanges"),o=t[c("0x17")][c("0x13")]("Users"),n=function(t,e){const o={};if(!t[c("0x6")]||!e[c("0x6")])return o;for(const n of t)o[n.id]={author:e[c("0x13")](n.authorId)[c("0xc")],created:n.createdAt};return o}(e[c("0x0")]({toJSON:!0}),o.users);Object[c("0x15")](n)[c("0x6")]&&(r.suggestions=n)}return(r[c("0x20")]||r[c("0xa")])&&(r.timezone=(new(Intl[c("0xd")])).resolvedOptions().timeZone),r}class l extends t.Command{constructor(t){super(t),this.set("isBusy",!1),this.affectsData=!1}refresh(){this.isEnabled=!this.isBusy,this.value=this.isBusy?"pending":void 0}execute(t={}){const e=this.editor,o=e.t,n=t.converterUrl||"https://docx-converter.cke-cs.com/v1/convert",r=t.converterOptions||{},i=e.plugins.get("ExportWord"),s=t.token||i._token,l=!1!==r.auto_pagination,u=t.dataCallback||(t=>t.data.get({pagination:l}));return this.isBusy=!0,this.refresh(),function(t){if(!t)return new Promise((t=>t("")));const e=[];for(const o of t)c("0x1e")!==o?e[c("0xb")](window[c("0x18")](o).then((t=>t[c("0x1f")]()))):e[c("0xb")](a());return Promise.all(e)[c("0x7")]((t=>t[c("0xf")](" ")[c("0x21")]()))}(t.stylesheets||["EDITOR_STYLES"]).then((async o=>{const i=await u(e),c={html:'<div class="ck-content" dir="'+e.locale.contentLanguageDirection+'">'+i+"</div>",css:o,options:{...r,...d(e)}},a={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/docx",...s?{Authorization:s.value}:null},body:JSON.stringify(c)};return window.fetch(n,a).then((t=>{if(200!==t.status)throw t;return t.blob()})).then((e=>{const o="function"==typeof t.fileName?t.fileName():t.fileName;this._downloadFile(e,o||"document.docx")}))})).catch((t=>{throw e.plugins.get("Notification").showWarning(o("An error occurred while generating the Word file.")),t})).finally((()=>{this.isBusy=!1,this.refresh()}))}_downloadFile(t,e){const o=document.createElement("a");o.href=window.URL.createObjectURL(t),o.download=e,o.click(),o.remove()}}class u extends t.Plugin{static get pluginName(){return"ExportWord"}static get requires(){return["CloudServices",e.Notification]}init(){const t=this.editor,o=t.t,n=t.config.get("exportWord")||{};t.commands.add("exportWord",new l(t)),t.ui.componentFactory.add("exportWord",(r=>{const i=t.commands.get("exportWord"),s=new e.ButtonView(r),c=new e.SpinnerView;return s.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}),s.children.add(c),s.bind("isOn","isEnabled").to(i,"isBusy","isEnabled"),c.bind("isVisible").to(i,"isBusy"),s.iconView.bind("isVisible").to(i,"isBusy",(t=>!t)),this.listenTo(s,"execute",(()=>{t.execute("exportWord",n),t.editing.view.focus()})),s}));const r=t.plugins.get("CloudServices");!1===n.tokenUrl?this._token=null:n.tokenUrl?r.registerTokenUrl(n.tokenUrl).then((t=>{this._token=t})):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-
|
|
3
|
+
"version": "0.0.0-nightly-20240201.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-
|
|
33
|
+
"ckeditor5": "0.0.0-nightly-20240201.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
|
|
23
|
+
import{Plugin as _0x1794a0}from'ckeditor5/src/core.js';import{ButtonView as _0xc4cf02,Notification as _0x3a9992,SpinnerView as _0x513838}from'ckeditor5/src/ui.js';import _0x5bd005 from'./exportwordcommand.js';import _0x2bf464 from'../theme/icons/exportword.svg';export default class d extends _0x1794a0{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x3a9992];}['init'](){const _0x538a2c=this['editor'],t=_0x538a2c['t'],_0x27a188=_0x538a2c['config']['get']('exportWord')||{};_0x538a2c['commands']['add']('exportWord',new _0x5bd005(_0x538a2c)),_0x538a2c['ui']['componentFactory']['add']('exportWord',_0x992c25=>{const _0x16b40b=_0x538a2c['commands']['get']('exportWord'),_0x143be9=new _0xc4cf02(_0x992c25),_0x5c287b=new _0x513838();return _0x143be9['set']({'label':t('Export\x20to\x20Word'),'icon':_0x2bf464,'tooltip':!0x0}),_0x143be9['children']['add'](_0x5c287b),_0x143be9['bind']('isOn','isEnabled')['to'](_0x16b40b,'isBusy','isEnabled'),_0x5c287b['bind']('isVisible')['to'](_0x16b40b,'isBusy'),_0x143be9['iconView']['bind']('isVisible')['to'](_0x16b40b,'isBusy',_0x1fa2af=>!_0x1fa2af),this['listenTo'](_0x143be9,'execute',()=>{_0x538a2c['execute']('exportWord',_0x27a188),_0x538a2c['editing']['view']['focus']();}),_0x143be9;});const _0x266c38=_0x538a2c['plugins']['get']('CloudServices');!0x1===_0x27a188['tokenUrl']?this['_token']=null:_0x27a188['tokenUrl']?_0x266c38['registerTokenUrl'](_0x27a188['tokenUrl'])['then'](_0x216d18=>{this['_token']=_0x216d18;}):this['_token']=_0x266c38['token'];}}
|
package/src/exportwordcommand.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Command as
|
|
23
|
+
import{Command as _0x500d86}from'ckeditor5/src/core.js';import{getStyles as _0x2cb926,getConverterOptions as _0x545677}from'./utils.js';export default class i extends _0x500d86{constructor(_0x1e4f63){super(_0x1e4f63),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0xba2ee2={}){const _0xab9a99=this['editor'],t=_0xab9a99['t'],_0x45cba8=_0xba2ee2['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x3e0824=_0xba2ee2['converterOptions']||{},_0x449bb4=_0xab9a99['plugins']['get']('ExportWord'),_0x33b928=_0xba2ee2['token']||_0x449bb4['_token'],_0x6833=!0x1!==_0x3e0824['auto_pagination'],_0x157c67=_0xba2ee2['dataCallback']||(_0x2b8b83=>_0x2b8b83['data']['get']({'pagination':_0x6833}));return this['isBusy']=!0x0,this['refresh'](),_0x2cb926(_0xba2ee2['stylesheets']||['EDITOR_STYLES'])['then'](async _0x38ecd3=>{const _0x1070d5=await _0x157c67(_0xab9a99),_0xfaf914={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0xab9a99['locale']['contentLanguageDirection']+'\x22>'+_0x1070d5+'</div>','css':_0x38ecd3,'options':{..._0x3e0824,..._0x545677(_0xab9a99)}},_0x70dc28={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x33b928?{'Authorization':_0x33b928['value']}:null},'body':JSON['stringify'](_0xfaf914)};return window['fetch'](_0x45cba8,_0x70dc28)['then'](_0x3fdb77=>{if(0xc8!==_0x3fdb77['status'])throw _0x3fdb77;return _0x3fdb77['blob']();})['then'](_0x1bf8a8=>{const _0x262a73='function'==typeof _0xba2ee2['fileName']?_0xba2ee2['fileName']():_0xba2ee2['fileName'];this['_downloadFile'](_0x1bf8a8,_0x262a73||'document.docx');});})['catch'](_0x473dd9=>{throw _0xab9a99['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x473dd9;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0x20493a,_0x2d399d){const _0x39e9ca=document['createElement']('a');_0x39e9ca['href']=window['URL']['createObjectURL'](_0x20493a),_0x39e9ca['download']=_0x2d399d,_0x39e9ca['click'](),_0x39e9ca['remove']();}}
|
package/src/utils.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0xdd5b=['get','.ck-content','keys','TrackChanges','plugins','fetch','cssText','indexOf','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.','has','ownerNode','EDITOR_STYLES','text','suggestions','trim','getSuggestions','getCommentThreads','from','createdAt','CommentsRepository','map','length','then',':root','cssRules','comments','push','name','DateTimeFormat','hasAttribute','join','warn','content','data-cke'];(function(_0x3cc6cf,_0xdd5bfc){const _0xff97bf=function(_0x5cd808){while(--_0x5cd808){_0x3cc6cf['push'](_0x3cc6cf['shift']());}};_0xff97bf(++_0xdd5bfc);}(_0xdd5b,0x163));const _0xff97=function(_0x3cc6cf,_0xdd5bfc){_0x3cc6cf=_0x3cc6cf-0x0;let _0xff97bf=_0xdd5b[_0x3cc6cf];return _0xff97bf;};export function getStyles(_0x1090ec){if(!_0x1090ec)return new Promise(_0x333074=>_0x333074(''));const _0x12cf57=[];for(const _0x5e7672 of _0x1090ec)_0xff97('0x1e')!==_0x5e7672?_0x12cf57[_0xff97('0xb')](window[_0xff97('0x18')](_0x5e7672)['then'](_0x3e6681=>_0x3e6681[_0xff97('0x1f')]())):_0x12cf57[_0xff97('0xb')](u());return Promise['all'](_0x12cf57)[_0xff97('0x7')](_0xe98f1d=>_0xe98f1d[_0xff97('0xf')]('\x20')[_0xff97('0x21')]());}function u(){const _0x586b8e=[],_0x56150c=[];for(const _0x2d0395 of Array[_0xff97('0x2')](document['styleSheets'])){if(_0x2d0395[_0xff97('0x1d')][_0xff97('0xe')](_0xff97('0x12')))for(const _0x30c523 of Array[_0xff97('0x2')](_0x2d0395[_0xff97('0x9')]))-0x1!==_0x30c523[_0xff97('0x19')][_0xff97('0x1a')](_0xff97('0x14'))?_0x586b8e[_0xff97('0xb')](_0x30c523[_0xff97('0x19')]):-0x1!==_0x30c523['cssText']['indexOf'](_0xff97('0x8'))&&_0x56150c[_0xff97('0xb')](_0x30c523[_0xff97('0x19')]);}return _0x586b8e['length']||console[_0xff97('0x10')](_0xff97('0x1b')),[..._0x56150c,..._0x586b8e][_0xff97('0xf')]('\x20')['trim']();}export function getConverterOptions(_0x57b2b4){const _0x5f4940=_0x57b2b4['plugins'][_0xff97('0x1c')]('Users'),_0x5cfdb6=_0x57b2b4['plugins']['has'](_0xff97('0x4')),_0x2f9030=_0x57b2b4[_0xff97('0x17')][_0xff97('0x1c')](_0xff97('0x16')),_0x2ab113={};if(_0x5f4940&&_0x5cfdb6){const _0x4445aa=getComments(_0x57b2b4['plugins'][_0xff97('0x13')](_0xff97('0x4'))[_0xff97('0x1')]({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object[_0xff97('0x15')](_0x4445aa)[_0xff97('0x6')]&&(_0x2ab113[_0xff97('0xa')]=_0x4445aa);}if(_0x5f4940&&_0x2f9030){const _0x3b002c=_0x57b2b4['plugins'][_0xff97('0x13')]('TrackChanges'),_0x755cab=_0x57b2b4[_0xff97('0x17')][_0xff97('0x13')]('Users'),_0x16d084=getSuggestions(_0x3b002c[_0xff97('0x0')]({'toJSON':!0x0}),_0x755cab['users']);Object[_0xff97('0x15')](_0x16d084)[_0xff97('0x6')]&&(_0x2ab113['suggestions']=_0x16d084);}return(_0x2ab113[_0xff97('0x20')]||_0x2ab113[_0xff97('0xa')])&&(_0x2ab113['timezone']=new Intl[(_0xff97('0xd'))]()['resolvedOptions']()['timeZone']),_0x2ab113;}export function getComments(_0x4cd068){const _0x40cdd5={};if(!_0x4cd068[_0xff97('0x6')])return _0x40cdd5;for(const _0x2d7464 of _0x4cd068)_0x2d7464[_0xff97('0xa')][_0xff97('0x5')](_0x212740=>{void 0x0===_0x40cdd5[_0x2d7464['id']]&&(_0x40cdd5[_0x2d7464['id']]=[]),_0x40cdd5[_0x2d7464['id']][_0xff97('0xb')]({'author':_0x212740['author'][_0xff97('0xc')],'content':_0x212740[_0xff97('0x11')],'created':_0x212740[_0xff97('0x3')],'is_resolved':_0x2d7464['isResolved']});});return _0x40cdd5;}export function getSuggestions(_0x384faa,_0x5c07ef){const _0x17c9c2={};if(!_0x384faa[_0xff97('0x6')]||!_0x5c07ef[_0xff97('0x6')])return _0x17c9c2;for(const _0x1c3c55 of _0x384faa)_0x17c9c2[_0x1c3c55['id']]={'author':_0x5c07ef[_0xff97('0x13')](_0x1c3c55['authorId'])[_0xff97('0xc')],'created':_0x1c3c55['createdAt']};return _0x17c9c2;}
|