@ckeditor/ckeditor5-export-word 38.1.0 → 38.1.1
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/build/export-word.js.map +1 -0
- package/package.json +2 -2
- package/src/augmentation.d.ts +21 -21
- package/src/exportword.d.ts +232 -232
- package/src/exportword.js +1 -1
- package/src/exportwordcommand.d.ts +36 -36
- package/src/exportwordcommand.js +1 -1
- package/src/index.d.ts +10 -10
- package/src/utils.d.ts +36 -36
- package/src/utils.js +1 -1
package/build/export-word.js
CHANGED
|
@@ -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={345:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var o=n(758),r=n.n(o)()((function(e){return e[1]}));r.push([e.id,":root{--ck-toolbar-spinner-size:18px}.ck-exportword_status-pending{position:relative}.ck.ck-exportword__spinner-container{display:none}.ck.ck-exportword__spinner{border:2px solid var(--ck-color-text);border-radius:50%;border-top:2px solid transparent;height:var(--ck-toolbar-spinner-size);left:0;margin:0 auto;position:absolute;right:0;top:50%;transform:translateY(-50%);width:var(--ck-toolbar-spinner-size);z-index:1}.ck-exportword_status-pending .ck.ck-exportword__spinner-container{animation:rotate 1.5s linear infinite;display:block;height:var(--ck-toolbar-spinner-size);position:absolute;width:var(--ck-toolbar-spinner-size)}.ck-exportword_status-pending .ck.ck-button__icon{color:transparent}@keyframes rotate{to{transform:rotate(1turn)}}",""]);const i=r},758:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,o){"string"==typeof e&&(e=[[null,e,""]]);var r={};if(o)for(var i=0;i<this.length;i++){var s=this[i][0];null!=s&&(r[s]=!0)}for(var a=0;a<e.length;a++){var c=[].concat(e[a]);o&&r[c[0]]||(n&&(c[2]?c[2]="".concat(n," and ").concat(c[2]):c[2]=n),t.push(c))}},t}},278:(e,t,n)=>{"use strict";var o,r=function(){return void 0===o&&(o=Boolean(window&&document&&document.all&&!window.atob)),o},i=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),s=[];function a(e){for(var t=-1,n=0;n<s.length;n++)if(s[n].identifier===e){t=n;break}return t}function c(e,t){for(var n={},o=[],r=0;r<e.length;r++){var i=e[r],c=t.base?i[0]+t.base:i[0],d=n[c]||0,l="".concat(c," ").concat(d);n[c]=d+1;var u=a(l),p={css:i[1],media:i[2],sourceMap:i[3]};-1!==u?(s[u].references++,s[u].updater(p)):s.push({identifier:l,updater:g(p,t),references:1}),o.push(l)}return o}function d(e){var t=document.createElement("style"),o=e.attributes||{};if(void 0===o.nonce){var r=n.nc;r&&(o.nonce=r)}if(Object.keys(o).forEach((function(e){t.setAttribute(e,o[e])})),"function"==typeof e.insert)e.insert(t);else{var s=i(e.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(t)}return t}var l,u=(l=[],function(e,t){return l[e]=t,l.filter(Boolean).join("\n")});function p(e,t,n,o){var r=n?"":o.media?"@media ".concat(o.media," {").concat(o.css,"}"):o.css;if(e.styleSheet)e.styleSheet.cssText=u(t,r);else{var i=document.createTextNode(r),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(i,s[t]):e.appendChild(i)}}function f(e,t,n){var o=n.css,r=n.media,i=n.sourceMap;if(r?e.setAttribute("media",r):e.removeAttribute("media"),i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleSheet)e.styleSheet.cssText=o;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}var h=null,x=0;function g(e,t){var n,o,r;if(t.singleton){var i=x++;n=h||(h=d(t)),o=p.bind(null,n,i,!1),r=p.bind(null,n,i,!0)}else n=d(t),o=f.bind(null,n,t),r=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else r()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=r());var n=c(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var o=0;o<n.length;o++){var r=a(n[o]);s[r].references--}for(var i=c(e,t),d=0;d<n.length;d++){var l=a(n[d]);0===s[l].references&&(s[l].updater(),s.splice(l,1))}n=i}}}},704:(e,t,n)=>{e.exports=n(79)("./src/core.js")},273:(e,t,n)=>{e.exports=n(79)("./src/ui.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0;var o={};(()=>{"use strict";n.r(o),n.d(o,{ExportWord:()=>x});var e=n(704),t=n(273);const r=["then","styleSheets","push","data-cke","comments","keys","suggestions","timeZone","plugins","TrackChanges","warn","length","resolvedOptions","isResolved","hasAttribute","get","trim","all","indexOf","DateTimeFormat",".ck-content","text","CommentsRepository","from","name","authorId","has","getCommentThreads","createdAt","timezone","join","Users","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.","getSuggestions","cssText"];var i,s;i=r,s=244,function(e){for(;--e;)i.push(i.shift())}(++s);const a=function(e,t){return r[e-=0]};function c(){const e=[],t=[];for(const n of Array[a("0x18")](document[a("0x2")]))if(n.ownerNode[a("0xf")](a("0x4")))for(const o of Array[a("0x18")](n.cssRules))-1!==o[a("0x0")][a("0x13")](a("0x15"))?e.push(o[a("0x0")]):-1!==o[a("0x0")][a("0x13")](":root")&&t[a("0x3")](o[a("0x0")]);return e.length||console[a("0xb")](a("0x21")),[...t,...e][a("0x1f")](" ")[a("0x11")]()}function d(e){const t=e[a("0x9")][a("0x1b")](a("0x20")),n=e[a("0x9")][a("0x1b")]("CommentsRepository"),o=e[a("0x9")][a("0x1b")]("TrackChanges"),r={};if(t&&n){const t=function(e){const t={};if(!e.length)return t;for(const n of e)n[a("0x5")].map((e=>{void 0===t[n.id]&&(t[n.id]=[]),t[n.id][a("0x3")]({author:e.author[a("0x19")],content:e.content,created:e[a("0x1d")],is_resolved:n[a("0xe")]})}));return t}(e.plugins[a("0x10")](a("0x17"))[a("0x1c")]({skipNotAttached:!0,skipEmpty:!0}));Object[a("0x6")](t)[a("0xc")]&&(r.comments=t)}if(t&&o){const t=e.plugins.get(a("0xa")),n=e.plugins.get(a("0x20")),o=function(e,t){const n={};if(!e.length||!t[a("0xc")])return n;for(const o of e)n[o.id]={author:t.get(o[a("0x1a")]).name,created:o[a("0x1d")]};return n}(t[a("0x22")]({toJSON:!0}),n.users);Object[a("0x6")](o)[a("0xc")]&&(r.suggestions=o)}return(r[a("0x7")]||r.comments)&&(r[a("0x1e")]=(new(Intl[a("0x14")]))[a("0xd")]()[a("0x8")]),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,n=t.t,o=e.converterUrl||"https://docx-converter.cke-cs.com/v1/convert",r=e.converterOptions||{},i=t.plugins.get("ExportWord"),s=e.token||i._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 n of e)"EDITOR_STYLES"!==n?t[a("0x3")](window.fetch(n).then((e=>e[a("0x16")]()))):t[a("0x3")](c());return Promise[a("0x12")](t)[a("0x1")]((e=>e.join(" ")[a("0x11")]()))}(e.stylesheets||["EDITOR_STYLES"]).then((async n=>{const i=await u(t),a={html:'<div class="ck-content" dir="'+t.locale.contentLanguageDirection+'">'+i+"</div>",css:n,options:{...r,...d(t)}},c={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/docx",...s?{Authorization:s.value}:null},body:JSON.stringify(a)};return window.fetch(o,c).then((e=>{if(200!==e.status)throw e;return e.blob()})).then((t=>{const n="function"==typeof e.fileName?e.fileName():e.fileName;this._downloadFile(t,n||"document.docx")}))})).catch((e=>{throw t.plugins.get("Notification").showWarning(n("An error occurred while generating the Word file.")),e})).finally((()=>{this.isBusy=!1,this.refresh()}))}_downloadFile(e,t){const n=document.createElement("a");n.href=window.URL.createObjectURL(e),n.download=t,n.click(),n.remove()}}var u=n(278),p=n.n(u),f=n(345),h={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};p()(f.Z,h);f.Z.locals;class x extends e.Plugin{static get pluginName(){return"ExportWord"}static get requires(){return["CloudServices",t.Notification]}init(){const e=this.editor,n=e.t,o=e.config.get("exportWord")||{};e.commands.add("exportWord",new l(e)),e.ui.componentFactory.add("exportWord",(r=>{const i=e.commands.get("exportWord"),s=new t.ButtonView(r);s.set({label:n("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.bind("isOn","isEnabled").to(i,"isBusy","isEnabled"),s.extendTemplate({attributes:{class:[s.bindTemplate.if("isOn","ck-exportword_status-pending")]}});const a=new t.View;return a.setTemplate({tag:"span",attributes:{class:["ck","ck-exportword__spinner-container"]},children:[{tag:"span",attributes:{class:["ck","ck-exportword__spinner"]}}]}),s.children.add(a),this.listenTo(s,"execute",(()=>{e.execute("exportWord",o),e.editing.view.focus()})),s}));const r=e.plugins.get("CloudServices");!1===o.tokenUrl?this._token=null:o.tokenUrl?r.registerTokenUrl(o.tokenUrl).then((e=>{this._token=e})):this._token=r.token}}})(),(window.CKEditor5=window.CKEditor5||{}).exportWord=o})();
|
|
5
|
+
*/(()=>{var e={584:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var o=n(758),r=n.n(o)()((function(e){return e[1]}));r.push([e.id,":root{--ck-toolbar-spinner-size:18px}.ck-exportword_status-pending{position:relative}.ck.ck-exportword__spinner-container{display:none}.ck.ck-exportword__spinner{border:2px solid var(--ck-color-text);border-radius:50%;border-top:2px solid transparent;height:var(--ck-toolbar-spinner-size);left:0;margin:0 auto;position:absolute;right:0;top:50%;transform:translateY(-50%);width:var(--ck-toolbar-spinner-size);z-index:1}.ck-exportword_status-pending .ck.ck-exportword__spinner-container{animation:rotate 1.5s linear infinite;display:block;height:var(--ck-toolbar-spinner-size);position:absolute;width:var(--ck-toolbar-spinner-size)}.ck-exportword_status-pending .ck.ck-button__icon{color:transparent}@keyframes rotate{to{transform:rotate(1turn)}}",""]);const i=r},758:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,o){"string"==typeof e&&(e=[[null,e,""]]);var r={};if(o)for(var i=0;i<this.length;i++){var s=this[i][0];null!=s&&(r[s]=!0)}for(var a=0;a<e.length;a++){var c=[].concat(e[a]);o&&r[c[0]]||(n&&(c[2]?c[2]="".concat(n," and ").concat(c[2]):c[2]=n),t.push(c))}},t}},278:(e,t,n)=>{"use strict";var o,r=function(){return void 0===o&&(o=Boolean(window&&document&&document.all&&!window.atob)),o},i=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),s=[];function a(e){for(var t=-1,n=0;n<s.length;n++)if(s[n].identifier===e){t=n;break}return t}function c(e,t){for(var n={},o=[],r=0;r<e.length;r++){var i=e[r],c=t.base?i[0]+t.base:i[0],d=n[c]||0,l="".concat(c," ").concat(d);n[c]=d+1;var u=a(l),p={css:i[1],media:i[2],sourceMap:i[3]};-1!==u?(s[u].references++,s[u].updater(p)):s.push({identifier:l,updater:g(p,t),references:1}),o.push(l)}return o}function d(e){var t=document.createElement("style"),o=e.attributes||{};if(void 0===o.nonce){var r=n.nc;r&&(o.nonce=r)}if(Object.keys(o).forEach((function(e){t.setAttribute(e,o[e])})),"function"==typeof e.insert)e.insert(t);else{var s=i(e.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(t)}return t}var l,u=(l=[],function(e,t){return l[e]=t,l.filter(Boolean).join("\n")});function p(e,t,n,o){var r=n?"":o.media?"@media ".concat(o.media," {").concat(o.css,"}"):o.css;if(e.styleSheet)e.styleSheet.cssText=u(t,r);else{var i=document.createTextNode(r),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(i,s[t]):e.appendChild(i)}}function f(e,t,n){var o=n.css,r=n.media,i=n.sourceMap;if(r?e.setAttribute("media",r):e.removeAttribute("media"),i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleSheet)e.styleSheet.cssText=o;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}var h=null,x=0;function g(e,t){var n,o,r;if(t.singleton){var i=x++;n=h||(h=d(t)),o=p.bind(null,n,i,!1),r=p.bind(null,n,i,!0)}else n=d(t),o=f.bind(null,n,t),r=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else r()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=r());var n=c(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var o=0;o<n.length;o++){var r=a(n[o]);s[r].references--}for(var i=c(e,t),d=0;d<n.length;d++){var l=a(n[d]);0===s[l].references&&(s[l].updater(),s.splice(l,1))}n=i}}}},704:(e,t,n)=>{e.exports=n(79)("./src/core.js")},273:(e,t,n)=>{e.exports=n(79)("./src/ui.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0;var o={};(()=>{"use strict";n.r(o),n.d(o,{ExportWord:()=>x});var e=n(704),t=n(273);const r=["comments","getSuggestions","EDITOR_STYLES","resolvedOptions","timeZone","warn","isResolved","hasAttribute","data-cke","from","createdAt","cssText","CommentsRepository","get","trim","name",".ck-content","content","author","keys","authorId","map","length","getCommentThreads","styleSheets","indexOf","TrackChanges","push",":root","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.","join","text","then","suggestions","has","plugins","Users","fetch"];var i,s;i=r,s=294,function(e){for(;--e;)i.push(i.shift())}(++s);const a=function(e,t){return r[e-=0]};function c(){const e=[],t=[];for(const n of Array[a("0x13")](document[a("0x22")]))if(n.ownerNode[a("0x11")](a("0x12")))for(const o of Array.from(n.cssRules))-1!==o[a("0x15")][a("0x23")](a("0x1a"))?e[a("0x25")](o.cssText):-1!==o[a("0x15")].indexOf(a("0x0"))&&t[a("0x25")](o.cssText);return e[a("0x20")]||console[a("0xf")](a("0x1")),[...t,...e][a("0x2")](" ")[a("0x18")]()}function d(e){const t=e.plugins[a("0x6")](a("0x8")),n=e[a("0x7")][a("0x6")](a("0x16")),o=e[a("0x7")][a("0x6")](a("0x24")),r={};if(t&&n){const t=function(e){const t={};if(!e[a("0x20")])return t;for(const n of e)n[a("0xa")][a("0x1f")]((e=>{void 0===t[n.id]&&(t[n.id]=[]),t[n.id][a("0x25")]({author:e[a("0x1c")].name,content:e[a("0x1b")],created:e.createdAt,is_resolved:n[a("0x10")]})}));return t}(e.plugins[a("0x17")](a("0x16"))[a("0x21")]({skipNotAttached:!0,skipEmpty:!0}));Object[a("0x1d")](t)[a("0x20")]&&(r.comments=t)}if(t&&o){const t=e.plugins[a("0x17")](a("0x24")),n=e.plugins.get("Users"),o=function(e,t){const n={};if(!e.length||!t[a("0x20")])return n;for(const o of e)n[o.id]={author:t.get(o[a("0x1e")])[a("0x19")],created:o[a("0x14")]};return n}(t[a("0xb")]({toJSON:!0}),n.users);Object[a("0x1d")](o)[a("0x20")]&&(r[a("0x5")]=o)}return(r.suggestions||r[a("0xa")])&&(r.timezone=(new Intl.DateTimeFormat)[a("0xd")]()[a("0xe")]),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,n=t.t,o=e.converterUrl||"https://docx-converter.cke-cs.com/v1/convert",r=e.converterOptions||{},i=t.plugins.get("ExportWord"),s=e.token||i._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 n of e)a("0xc")!==n?t.push(window[a("0x9")](n).then((e=>e[a("0x3")]()))):t[a("0x25")](c());return Promise.all(t)[a("0x4")]((e=>e[a("0x2")](" ")[a("0x18")]()))}(e.stylesheets||["EDITOR_STYLES"]).then((async n=>{const i=await u(t),a={html:'<div class="ck-content" dir="'+t.locale.contentLanguageDirection+'">'+i+"</div>",css:n,options:{...r,...d(t)}},c={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/docx",...s?{Authorization:s.value}:null},body:JSON.stringify(a)};return window.fetch(o,c).then((e=>{if(200!==e.status)throw e;return e.blob()})).then((t=>{const n="function"==typeof e.fileName?e.fileName():e.fileName;this._downloadFile(t,n||"document.docx")}))})).catch((e=>{throw t.plugins.get("Notification").showWarning(n("An error occurred while generating the Word file.")),e})).finally((()=>{this.isBusy=!1,this.refresh()}))}_downloadFile(e,t){const n=document.createElement("a");n.href=window.URL.createObjectURL(e),n.download=t,n.click(),n.remove()}}var u=n(278),p=n.n(u),f=n(584),h={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};p()(f.Z,h);f.Z.locals;class x extends e.Plugin{static get pluginName(){return"ExportWord"}static get requires(){return["CloudServices",t.Notification]}init(){const e=this.editor,n=e.t,o=e.config.get("exportWord")||{};e.commands.add("exportWord",new l(e)),e.ui.componentFactory.add("exportWord",(r=>{const i=e.commands.get("exportWord"),s=new t.ButtonView(r);s.set({label:n("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.bind("isOn","isEnabled").to(i,"isBusy","isEnabled"),s.extendTemplate({attributes:{class:[s.bindTemplate.if("isOn","ck-exportword_status-pending")]}});const a=new t.View;return a.setTemplate({tag:"span",attributes:{class:["ck","ck-exportword__spinner-container"]},children:[{tag:"span",attributes:{class:["ck","ck-exportword__spinner"]}}]}),s.children.add(a),this.listenTo(s,"execute",(()=>{e.execute("exportWord",o),e.editing.view.focus()})),s}));const r=e.plugins.get("CloudServices");!1===o.tokenUrl?this._token=null:o.tokenUrl?r.registerTokenUrl(o.tokenUrl).then((e=>{this._token=e})):this._token=r.token}}})(),(window.CKEditor5=window.CKEditor5||{}).exportWord=o})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-word.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAE4C;AACsB;;AAEd;AACO;;AAE1B;;AAEjC;AACA;AACA;AACA;AACA;AACA,uCAAuC,4CAA4C;AACnF;AACA;AACA;AACe,yBAAyB,sDAAM;AAC9C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4BAA4B,0DAAY;AACxC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,yCAAyC,0DAAiB;;AAE1D;AACA;AACA,oBAAoB,wDAAU;;AAE9B;AACA;AACA,UAAU,mEAAc;AACxB;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL,uBAAuB,kDAAI;;AAE3B;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,KAAK;;AAEL;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA,IAAI;;AAEJ;AACA;;AAEA;AACA;AACA;AACA,cAAc,mCAAmC;;AAEjD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,qDAAqD;AACtE;AACA,YAAY,gDAAgD;AAC5D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,QAAQ,sEAAsE;AAC9E;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,mHAAmH;AACxH;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,gBAAgB;AAC5B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,mBAAmB,qBAAqB,GAAG;AACxE,2BAA2B,mBAAmB,sBAAsB,GAAG;AACvE;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,mBAAmB;AACvD;AACA,iBAAiB,kDAAkD;AACnE;AACA;AACA,YAAY,UAAU;AACtB,WAAW,kCAAkC;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,YAAY,uBAAuB;AACnC;;;;;;;;;;;;;;;;;;ACzRA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAE6C;AACY;;AAEzD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,gCAAgC,uDAAO;AACtD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6EAA6E,gCAAgC;;AAE7G;AACA;;AAEA,SAAS,iDAAS;AAClB;AACA;;AAEA;AACA,4CAA4C,wCAAwC,KAAK,YAAY;AACrG;AACA;AACA;AACA,SAAS,2DAAmB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,+BAA+B;AACpD;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;;AAEA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,YAAY,MAAM;AAClB,YAAY,QAAQ;AACpB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;;ACxIA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,WAAW,gBAAgB;AAC3B,aAAa,kBAAkB;AACxB;AACP;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,aAAa,QAAQ;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,kCAAkC;AAC7C,aAAa,QAAQ;AACd;AACP;AACA;AACA;;AAEA;;AAEA;AACA;AACA,wEAAwE,yCAAyC;;AAEjH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2EAA2E,eAAe;;AAE1F;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,gBAAgB;AAC3B,aAAa,QAAQ;AACd;AACP;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL,IAAI;AACJ;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,gBAAgB;AAC3B,WAAW,YAAY;AACvB,aAAa,QAAQ;AACd;AACP;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;;;ACvJA;AACkI;AAC7B;AACrG,8BAA8B,mFAA2B,CAAC,wGAAqC;AAC/F;AACA,gDAAgD,+BAA+B,8BAA8B,kBAAkB,qCAAqC,aAAa,2BAA2B,kBAAkB,QAAQ,OAAO,QAAQ,cAAc,qCAAqC,sCAAsC,kBAAkB,sCAAsC,iCAAiC,2BAA2B,UAAU,mEAAmE,cAAc,kBAAkB,qCAAqC,sCAAsC,sCAAsC,kDAAkD,kBAAkB,kBAAkB,GAAG,yBAAyB,OAAO,4mBAA4mB,oCAAoC,GAAG,mCAAmC,uBAAuB,GAAG,0CAA0C,kBAAkB,GAAG,gCAAgC,uBAAuB,aAAa,YAAY,aAAa,mBAAmB,0CAA0C,2CAA2C,uBAAuB,2CAA2C,kCAAkC,gCAAgC,eAAe,GAAG,wEAAwE,mBAAmB,uBAAuB,0CAA0C,2CAA2C,2CAA2C,GAAG,uDAAuD,uBAAuB,GAAG,uBAAuB,QAAQ,oCAAoC,GAAG,qBAAqB;AACpyE;AACA,iEAAe,uBAAuB,EAAC;;;;;;;;;;;;ACP1B;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;;AAEA;AACA,4CAA4C,qBAAqB;AACjE;;AAEA;AACA,KAAK;AACL,KAAK;AACL;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,sBAAsB,iBAAiB;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB,qBAAqB;AAC1C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;ACjEa;;AAEb,kCAAkC;;AAElC,8BAA8B;;AAE9B,kDAAkD,gBAAgB,gEAAgE,wDAAwD,6DAA6D,sDAAsD;;AAE7S,uCAAuC,uDAAuD,uCAAuC,SAAS,OAAO,oBAAoB;;AAEzK,yCAAyC,8FAA8F,wBAAwB,eAAe,eAAe,gBAAgB,YAAY,MAAM,wBAAwB,+BAA+B,aAAa,qBAAqB,uCAAuC,cAAc,WAAW,YAAY,UAAU,MAAM,mDAAmD,UAAU,sBAAsB;;AAEve,gCAAgC;;AAEhC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,uDAAuD,cAAc;AACrE;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;;;;;;;;;;;;;;ACnCA,iEAAe,2lBAA2lB;;;;;;;;;;;;;;;;;;ACArgB;AACrG,YAA2L;;AAE3L,eAAe,+CAA+C;;AAE9D;AACA;;AAEA,aAAa,0GAAG,CAAC,2JAAO;;;;AAIxB,iEAAe,kKAAc,MAAM;;;;;;;;;;;ACZtB;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA,wDAAwD;;AAExD;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;;AAEA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,gBAAgB,KAAwC,GAAG,sBAAiB,GAAG,CAAI;;AAEnF;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA,qEAAqE,qBAAqB,cAAc;;AAExG;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA,yDAAyD;AACzD,IAAI;;AAEJ;;;AAGA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA,2BAA2B;AAC3B;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,oBAAoB,4BAA4B;AAChD;AACA;AACA;AACA;;AAEA;;AAEA,qBAAqB,6BAA6B;AAClD;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;AC5QA;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;ACNA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEqD","sources":["webpack://CKEditor5.exportWord/./packages/ckeditor5-export-word/src/exportword.js","webpack://CKEditor5.exportWord/./packages/ckeditor5-export-word/src/exportwordcommand.js","webpack://CKEditor5.exportWord/./packages/ckeditor5-export-word/src/utils.js","webpack://CKEditor5.exportWord/./packages/ckeditor5-export-word/theme/exportword.css","webpack://CKEditor5.exportWord/../../node_modules/css-loader/dist/runtime/api.js","webpack://CKEditor5.exportWord/../../node_modules/css-loader/dist/runtime/cssWithMappingToString.js","webpack://CKEditor5.exportWord/./packages/ckeditor5-export-word/theme/icons/exportword.svg","webpack://CKEditor5.exportWord/./packages/ckeditor5-export-word/theme/exportword.css?319c","webpack://CKEditor5.exportWord/../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js","webpack://CKEditor5.exportWord/delegated \"./src/core.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.exportWord/delegated \"./src/ui.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.exportWord/external var \"CKEditor5.dll\"","webpack://CKEditor5.exportWord/webpack/bootstrap","webpack://CKEditor5.exportWord/webpack/runtime/compat get default export","webpack://CKEditor5.exportWord/webpack/runtime/define property getters","webpack://CKEditor5.exportWord/webpack/runtime/hasOwnProperty shorthand","webpack://CKEditor5.exportWord/webpack/runtime/make namespace object","webpack://CKEditor5.exportWord/./packages/ckeditor5-export-word/src/index.js"],"sourcesContent":["/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module export-word/exportword\n * @publicApi\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport { ButtonView, View, Notification } from 'ckeditor5/src/ui';\n\nimport ExportWordCommand from './exportwordcommand';\nimport exportWordIcon from '../theme/icons/exportword.svg';\n\nimport '../theme/exportword.css';\n\n/**\n * The export to Word feature.\n *\n * It allows you to generate a Word file directly from the editor content.\n *\n * For a detailed overview, check the {@glink features/export-word export to Word} feature documentation.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class ExportWord extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'ExportWord';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ 'CloudServices', Notification ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\tconst editor = this.editor;\n\t\tconst t = editor.t;\n\t\tconst config = editor.config.get( 'exportWord' ) || {};\n\n\t\teditor.commands.add( 'exportWord', new ExportWordCommand( editor ) );\n\n\t\teditor.ui.componentFactory.add( 'exportWord', locale => {\n\t\t\tconst command = editor.commands.get( 'exportWord' );\n\t\t\tconst view = new ButtonView( locale );\n\n\t\t\tview.set( {\n\t\t\t\tlabel: t( 'Export to Word' ),\n\t\t\t\ticon: exportWordIcon,\n\t\t\t\ttooltip: true\n\t\t\t} );\n\n\t\t\tview.bind( 'isOn', 'isEnabled' ).to( command, 'isBusy', 'isEnabled' );\n\n\t\t\tview.extendTemplate( {\n\t\t\t\tattributes: {\n\t\t\t\t\tclass: [\n\t\t\t\t\t\tview.bindTemplate.if( 'isOn', 'ck-exportword_status-pending' )\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tconst spinner = new View();\n\n\t\t\tspinner.setTemplate( {\n\t\t\t\ttag: 'span',\n\t\t\t\tattributes: {\n\t\t\t\t\tclass: [ 'ck', 'ck-exportword__spinner-container' ]\n\t\t\t\t},\n\t\t\t\tchildren: [ {\n\t\t\t\t\ttag: 'span',\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\tclass: [ 'ck', 'ck-exportword__spinner' ]\n\t\t\t\t\t}\n\t\t\t\t} ]\n\t\t\t} );\n\n\t\t\tview.children.add( spinner );\n\n\t\t\tthis.listenTo( view, 'execute', () => {\n\t\t\t\teditor.execute( 'exportWord', config );\n\t\t\t\teditor.editing.view.focus();\n\t\t\t} );\n\n\t\t\treturn view;\n\t\t} );\n\n\t\t// Set up the Cloud Services token.\n\t\tconst cloudServices = editor.plugins.get( 'CloudServices' );\n\n\t\t// The authentication token provider.\n\t\t//\n\t\t// @protected\n\t\t// @member {module:cloud-services/token~Token} #_token\n\n\t\t// If the token is strictly disabled - don't use any.\n\t\tif ( config.tokenUrl === false ) {\n\t\t\tthis._token = null;\n\t\t}\n\n\t\t// Initialize the custom token provider.\n\t\telse if ( config.tokenUrl ) {\n\t\t\treturn cloudServices.registerTokenUrl( config.tokenUrl ).then( token => {\n\t\t\t\tthis._token = token;\n\t\t\t} );\n\t\t}\n\n\t\t// Or fall back to the default Cloud Services token provider.\n\t\telse {\n\t\t\tthis._token = cloudServices.token;\n\t\t}\n\t}\n}\n\n/**\n * The configuration of the export to Word feature. It is used by the Word export feature from\n * the `@ckeditor/ckeditor5-export-word` package.\n *\n * Read more in {@link module:export-word/exportword~ExportWordConfig}.\n *\n * @member {module:export-word/exportword~ExportWordConfig} module:core/editor/editorconfig~EditorConfig#exportWord\n */\n\n/**\n * The configuration of the export to Word feature. It is used by the Word export features from\n * the `@ckeditor/ckeditor5-export-word` package.\n *\n *\t\tClassicEditor\n *\t\t\t.create( editorElement, {\n *\t\t\t\texportWord: ... // Export to Word feature options.\n *\t\t\t} )\n *\t\t\t.then( ... )\n *\t\t\t.catch( ... );\n *\n * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.\n *\n * @interface ExportWordConfig\n */\n\n/**\n * Paths to the `.css` files containing additional styling for the editor's content (**the order of provided items matters**).\n *\n *\tconst exportWordConfig = {\n *\t\tstylesheets: [ './path/to/custom-style.css' ]\n *\t}\n *\n * **NOTE:** If `stylesheets` are not provided, the plugin will sent only\n * {@glink builds/guides/integration/content-styles#the-full-list-of-content-styles the default editor content styles} to the converter.\n *\n * **Default editor's content styles**:\n * {@glink builds/guides/integration/content-styles#the-full-list-of-content-styles The default editor content styles}\n * \tare applied to the generated Word file thanks to the 'EDITOR_STYLES' token, which is provided to the `stylesheets` by default.\n * If you don't want them to be applied, you have to omit the token:\n *\n *\tconst exportWordConfig = {\n *\t\tstylesheets: [ './path/to/custom-editor-styles.css' ]\n *\t}\n *\n * **Custom styling:** For more advanced styling, your configuration should look like this:\n *\n *\tconst exportWordConfig = {\n *\t\tstylesheets: [\n *\t\t\t'EDITOR_STYLES',\n *\t\t\t'./path/to/custom-styles.css'\n *\t\t]\n *\t}\n *\n * Defaults to `[ 'EDITOR_STYLES' ]`.\n *\n * @member {Array.<String>} module:export-word/exportword~ExportWordConfig#stylesheets\n */\n\n/**\n * The name of the generated Word file.\n *\n *\tconst exportWordConfig = {\n *\t\tfileName: 'my-document.docx'\n *\t}\n *\n * **NOTE:** The file name must contain the `.docx` extension.\n * Otherwise your operating system or device may have trouble identifying the file type.\n *\n * Defaults to `document.docx`.\n *\n * @member {String} module:export-word/exportword~ExportWordConfig#fileName\n */\n\n/**\n * A URL to the Docx converter.\n *\n *\tconst exportWordConfig = {\n *\t\tconverterUrl: 'https://myconverter.com/v1/'\n *\t}\n *\n * **NOTE:** The plugin uses the default HTML to Word converter delivered by CKEditor Cloud Services.\n * You can provide a URL to an on-premises converter instead.\n *\n * Defaults to `https://docx-converter.cke-cs.com/v1/convert`.\n *\n * @member {String} module:export-word/exportword~ExportWordConfig#converterUrl\n */\n\n/**\n * The CKEditor Cloud Services HTML to DOCX Converter\n * [configuration options](https://docx-converter.cke-cs.com/docs#section/Options).\n *\n * **NOTE:** Configuring the plugin is not mandatory.\n *\n *\tconst exportWordConfig = {\n *\t\tconverterOptions: {\n *\t\t\t...\n *\t\t}\n *\t}\n *\n * Defaults to:\n *\n * \t{\n *\t\tfileName: 'document.docx',\n *\t\tconverterUrl: 'https://docx-converter.cke-cs.com/v1/convert',\n *\t\tconverterOptions: {\n *\t\t\tformat: 'A4',\n *\t\t\tmargin_top: '1in',\n *\t\t\tmargin_bottom: '1in',\n *\t\t\tmargin_right: '1in',\n *\t\t\tmargin_left: '1in',\n *\t\t\theader: undefined,\n *\t\t\tfooter: undefined,\n *\t\t\tcomments: undefined,\n *\t\t\tsuggestions: undefined\n *\t\t}\n *\t}\n *\n * @member {Object} module:export-word/exportword~ExportWordConfig#converterOptions\n *\n */\n\n/**\n * A function to gather the HTML to be converted to Word.\n *\n * **NOTE:** This option may be useful when the editor does not have a `getData()` method,\n * or if the HTML to be converted should be different than the edited one.\n *\n *\tconst exportWordConfig = {\n *\t\tdataCallback: ( editor ) => {\n *\t\t\treturn `\n *\t\t\t\t<header id=\"header\">${ editor.data.get( { rootName: 'header' } ) }</header>\n *\t\t\t\t<div id=\"content\">${ editor.data.get( { rootName: 'content' } ) }</div>\n *\t\t\t`;\n *\t\t}\n *\t}\n *\n * Defaults to\n *\n * \t( editor ) => editor.getData( { pagination: true } )\n *\n * If using the {@glink features/pagination/pagination pagination} feature, the `pagination:true` option inserts additional markers into\n * editor's data. Thanks to that, the Docx converter creates a Word document similar to what is displayed in the editor.\n *\n * @member {Function} module:export-word/exportword~ExportWordConfig#dataCallback\n * @param {module:core/editor/editor~Editor} editor The editor instance.\n */\n\n/**\n * A token URL or a token request function. This field is optional and should be used only when a different `tokenUrl` is required for the\n * export to Word feature.\n *\n * **Note:** The token can be disabled with the `false` value provided.\n *\n * See: {@link module:cloud-services/cloudservices~CloudServicesConfig#tokenUrl}\n *\n * @member {String|Function|false} module:export-word/exportword~ExportWordConfig#tokenUrl\n */\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module export-word/exportwordcommand\n * @publicApi\n */\n\n/* globals document, window */\n\nimport { Command } from 'ckeditor5/src/core';\nimport { getStyles, getConverterOptions } from './utils';\n\nconst PRODUCTION_URL = 'https://docx-converter.cke-cs.com/v1/convert';\n\n/**\n * The export to Word command.\n *\n * It takes the editor's HTML and CSS rules from the document and sends them to the HTML to Word converter.\n * After processing, the converter will send back a Word file for download.\n *\n * @extends module:core/command~Command\n */\nexport default class ExportWordCommand extends Command {\n\t/**\n\t * @inheritDoc\n\t */\n\tconstructor( editor ) {\n\t\tsuper( editor );\n\n\t\t/**\n\t\t * A command state that indicates if the command is currently executing.\n\t\t *\n\t\t * @observable\n\t\t * @member {Boolean} #isBusy\n\t\t */\n\t\tthis.set( 'isBusy', false );\n\n\t\t// It does not affect data so should be enabled in read-only mode.\n\t\tthis.affectsData = false;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\trefresh() {\n\t\tthis.isEnabled = !this.isBusy;\n\t\tthis.value = this.isBusy ? 'pending' : undefined;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\texecute( options = {} ) {\n\t\tconst editor = this.editor;\n\t\tconst t = editor.t;\n\t\tconst url = options.converterUrl || PRODUCTION_URL;\n\t\tconst converterOptions = options.converterOptions || {};\n\t\tconst plugin = editor.plugins.get( 'ExportWord' );\n\t\tconst token = options.token || plugin._token;\n\n\t\t// The pagination automatic page-breaks should not be sent to the converter because they would be ignored anyway.\n\t\tconst useAutoPagination = converterOptions.auto_pagination !== false;\n\t\tconst dataCallback = options.dataCallback || ( editor => editor.getData( { pagination: useAutoPagination } ) );\n\n\t\tthis.isBusy = true;\n\t\tthis.refresh();\n\n\t\treturn getStyles( options.stylesheets || [ 'EDITOR_STYLES' ] )\n\t\t\t.then( css => {\n\t\t\t\tconst editorData = dataCallback( editor );\n\n\t\t\t\tconst data = {\n\t\t\t\t\thtml: `<div class=\"ck-content\" dir=\"${ editor.locale.contentLanguageDirection }\">${ editorData }</div>`,\n\t\t\t\t\tcss,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\t...converterOptions,\n\t\t\t\t\t\t...getConverterOptions( editor )\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst init = {\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t\t\t'Accept': 'application/docx',\n\t\t\t\t\t\t...( token ? { 'Authorization': token.value } : null )\n\t\t\t\t\t\t// TODO What about app-id header?\n\t\t\t\t\t},\n\t\t\t\t\tbody: JSON.stringify( data )\n\t\t\t\t};\n\n\t\t\t\treturn window.fetch( url, init )\n\t\t\t\t\t.then( response => {\n\t\t\t\t\t\tif ( response.status !== 200 ) {\n\t\t\t\t\t\t\tthrow response;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn response.blob();\n\t\t\t\t\t} )\n\t\t\t\t\t.then( blob => {\n\t\t\t\t\t\tthis._downloadFile( blob, options.fileName || 'document.docx' );\n\t\t\t\t\t} );\n\t\t\t} )\n\t\t\t.catch( err => {\n\t\t\t\tconst notification = editor.plugins.get( 'Notification' );\n\n\t\t\t\tnotification.showWarning( t( 'An error occurred while generating the Word file.' ) );\n\n\t\t\t\tthrow err;\n\t\t\t} )\n\t\t\t.finally( () => {\n\t\t\t\tthis.isBusy = false;\n\t\t\t\tthis.refresh();\n\t\t\t} );\n\t}\n\n\t/**\n\t * A helper to create a link for downloading the returned Word file from the server.\n\t *\n\t * @private\n\t * @param {Blob} blob The data object of the returned file.\n\t * @param {String} fileName The file name of the returned Word file.\n\t */\n\n\t/* istanbul ignore next */\n\t_downloadFile( blob, fileName ) {\n\t\tconst link = document.createElement( 'a' );\n\n\t\tlink.href = window.URL.createObjectURL( blob );\n\t\tlink.download = fileName;\n\t\tlink.click();\n\n\t\tlink.remove();\n\t}\n}\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/* globals window, document, console, Intl */\n\n// A helper function for getting concatenated CSS rules from external stylesheets.\n//\n// @param {Array.<String>} [stylesheets] An array of stylesheet paths delivered by the user through the plugin configuration.\n// @returns {Promise.<String>} A Promise that returns concatenated styles.\nexport function getStyles( stylesheets ) {\n\tif ( !stylesheets ) {\n\t\treturn new Promise( resolve => resolve( '' ) );\n\t}\n\n\tconst styles = [];\n\n\tfor ( const stylesheet of stylesheets ) {\n\t\tif ( stylesheet === 'EDITOR_STYLES' ) {\n\t\t\tstyles.push( getEditorStyles() );\n\n\t\t\tcontinue;\n\t\t}\n\n\t\tstyles.push( window.fetch( stylesheet ).then( response => response.text() ) );\n\t}\n\n\treturn Promise.all( styles ).then( values => {\n\t\t// We want to trim the returned value in case of `[ \"\", \"\", \"\", ... ]`.\n\t\treturn values.join( ' ' ).trim();\n\t} );\n}\n\n// A helper function for getting the basic editor content styles for the `.ck-content` class\n// and all CSS variables defined in the document.\n//\n// @returns {String} The editor styles concatenated with CSS variables.\nfunction getEditorStyles() {\n\tconst editorStyles = [];\n\tconst editorCSSVariables = [];\n\n\tfor ( const styleSheet of document.styleSheets ) {\n\t\tif ( styleSheet.ownerNode.hasAttribute( 'data-cke' ) ) {\n\t\t\tfor ( const rule of styleSheet.cssRules ) {\n\t\t\t\tif ( rule.cssText.indexOf( '.ck-content' ) !== -1 ) {\n\t\t\t\t\teditorStyles.push( rule.cssText );\n\t\t\t\t} else if ( rule.cssText.indexOf( ':root' ) !== -1 ) {\n\t\t\t\t\teditorCSSVariables.push( rule.cssText );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( !editorStyles.length ) {\n\t\tconsole.warn(\n\t\t\t'The editor stylesheet could not be found in the document. ' +\n\t\t\t'Check your webpack config – style-loader should use data-cke=true attribute for the editor stylesheet.'\n\t\t);\n\t}\n\n\t// We want to trim the returned value in case of `[ \"\", \"\", ... ]`.\n\treturn [ ...editorCSSVariables, ...editorStyles ].join( ' ' ).trim();\n}\n\n// A helper function for getting a proper options object containing\n// comments, suggestions and the browser's timezone for the \"Export to Word\" converter.\n//\n// @param {module:core/editor/editor~Editor} editor An editor instance.\n// @returns {Object} converterOptions\nexport function getConverterOptions( editor ) {\n\tconst hasUsersPlugin = editor.plugins.has( 'Users' );\n\tconst hasCommentRepositoryPlugin = editor.plugins.has( 'CommentsRepository' );\n\tconst hasTrackChangesPlugin = editor.plugins.has( 'TrackChanges' );\n\n\tconst converterOptions = {};\n\n\tif ( hasUsersPlugin && hasCommentRepositoryPlugin ) {\n\t\tconst commentsRepository = editor.plugins.get( 'CommentsRepository' );\n\t\tconst comments = getComments( commentsRepository.getCommentThreads( { skipNotAttached: true, skipEmpty: true } ) );\n\n\t\tif ( Object.keys( comments ).length ) {\n\t\t\tconverterOptions.comments = comments;\n\t\t}\n\t}\n\n\tif ( hasUsersPlugin && hasTrackChangesPlugin ) {\n\t\tconst trackChangesPlugin = editor.plugins.get( 'TrackChanges' );\n\t\tconst usersPlugin = editor.plugins.get( 'Users' );\n\t\tconst suggestions = getSuggestions( trackChangesPlugin.getSuggestions( { toJSON: true } ), usersPlugin.users );\n\n\t\tif ( Object.keys( suggestions ).length ) {\n\t\t\tconverterOptions.suggestions = suggestions;\n\t\t}\n\t}\n\n\tif ( converterOptions.suggestions || converterOptions.comments ) {\n\t\tconverterOptions.timezone = new Intl.DateTimeFormat().resolvedOptions().timeZone;\n\t}\n\n\treturn converterOptions;\n}\n\n// A helper function for getting a comments object for the converter options.\n//\n// @param {Array.<Object>} threads The comment threads array.\n// @returns {Object} comments\nexport function getComments( threads ) {\n\tconst comments = {};\n\n\tif ( !threads.length ) {\n\t\treturn comments;\n\t}\n\n\tfor ( const thread of threads ) {\n\t\tthread.comments.map( comment => {\n\t\t\tif ( comments[ thread.id ] === undefined ) {\n\t\t\t\tcomments[ thread.id ] = [];\n\t\t\t}\n\n\t\t\tcomments[ thread.id ].push( {\n\t\t\t\tauthor: comment.author.name,\n\t\t\t\tcontent: comment.content,\n\t\t\t\tcreated: comment.createdAt\n\t\t\t} );\n\t\t} );\n\t}\n\n\treturn comments;\n}\n\n// A helper function for getting a suggestions object for the converter options.\n//\n// @param {Array.<Object>} suggestions The suggestions array.\n// @param {Collection} users A list of all users in the editor.\n// @returns {Object} suggestions\nexport function getSuggestions( suggestions, users ) {\n\tconst suggestionsObject = {};\n\n\tif ( !suggestions.length || !users.length ) {\n\t\treturn suggestionsObject;\n\t}\n\n\tfor ( const suggestion of suggestions ) {\n\t\tsuggestionsObject[ suggestion.id ] = {\n\t\t\tauthor: users.get( suggestion.authorId ).name,\n\t\t\tcreated: suggestion.createdAt\n\t\t};\n\t}\n\n\treturn suggestionsObject;\n}\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \":root{--ck-toolbar-spinner-size:18px}.ck-exportword_status-pending{position:relative}.ck.ck-exportword__spinner-container{display:none}.ck.ck-exportword__spinner{position:absolute;top:50%;left:0;right:0;margin:0 auto;width:var(--ck-toolbar-spinner-size);height:var(--ck-toolbar-spinner-size);border-radius:50%;border:2px solid var(--ck-color-text);border-top:2px solid transparent;transform:translateY(-50%);z-index:1}.ck-exportword_status-pending .ck.ck-exportword__spinner-container{display:block;position:absolute;width:var(--ck-toolbar-spinner-size);height:var(--ck-toolbar-spinner-size);animation:rotate 1.5s linear infinite}.ck-exportword_status-pending .ck.ck-button__icon{color:transparent}@keyframes rotate{to{transform:rotate(1turn)}}\", \"\",{\"version\":3,\"sources\":[\"webpack://./packages/ckeditor5-export-word/theme/exportword.css\"],\"names\":[],\"mappings\":\"AAKA,MACC,8BACD,CAEA,8BACC,iBACD,CAEA,qCACC,YACD,CAEA,2BACC,iBAAkB,CAClB,OAAQ,CACR,MAAO,CACP,OAAQ,CACR,aAAc,CACd,oCAAqC,CACrC,qCAAsC,CACtC,iBAAkB,CAElB,qCAA6B,CAA7B,gCAA6B,CAC7B,0BAA2B,CAC3B,SACD,CAEA,mEACC,aAAc,CACd,iBAAkB,CAClB,oCAAqC,CACrC,qCAAsC,CACtC,qCACD,CAEA,kDACC,iBACD,CAEA,kBACC,GACC,uBACD,CACD\",\"sourcesContent\":[\"/*\\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\\n */\\n\\n:root {\\n\\t--ck-toolbar-spinner-size: 18px;\\n}\\n\\n.ck-exportword_status-pending {\\n\\tposition: relative;\\n}\\n\\n.ck.ck-exportword__spinner-container {\\n\\tdisplay: none;\\n}\\n\\n.ck.ck-exportword__spinner {\\n\\tposition: absolute;\\n\\ttop: 50%;\\n\\tleft: 0;\\n\\tright: 0;\\n\\tmargin: 0 auto;\\n\\twidth: var(--ck-toolbar-spinner-size);\\n\\theight: var(--ck-toolbar-spinner-size);\\n\\tborder-radius: 50%;\\n\\tborder: 2px solid var(--ck-color-text);\\n\\tborder-top-color: transparent;\\n\\ttransform: translateY(-50%);\\n\\tz-index: 1;\\n}\\n\\n.ck-exportword_status-pending .ck.ck-exportword__spinner-container {\\n\\tdisplay: block;\\n\\tposition: absolute;\\n\\twidth: var(--ck-toolbar-spinner-size);\\n\\theight: var(--ck-toolbar-spinner-size);\\n\\tanimation: 1.5s infinite rotate linear;\\n}\\n\\n.ck-exportword_status-pending .ck.ck-button__icon {\\n\\tcolor: transparent;\\n}\\n\\n@keyframes rotate {\\n\\tto {\\n\\t\\ttransform: rotate(360deg)\\n\\t}\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","\"use strict\";\n\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\n// eslint-disable-next-line func-names\nmodule.exports = function (cssWithMappingToString) {\n var list = []; // return the list of modules as css string\n\n list.toString = function toString() {\n return this.map(function (item) {\n var content = cssWithMappingToString(item);\n\n if (item[2]) {\n return \"@media \".concat(item[2], \" {\").concat(content, \"}\");\n }\n\n return content;\n }).join(\"\");\n }; // import a list of modules into the list\n // eslint-disable-next-line func-names\n\n\n list.i = function (modules, mediaQuery, dedupe) {\n if (typeof modules === \"string\") {\n // eslint-disable-next-line no-param-reassign\n modules = [[null, modules, \"\"]];\n }\n\n var alreadyImportedModules = {};\n\n if (dedupe) {\n for (var i = 0; i < this.length; i++) {\n // eslint-disable-next-line prefer-destructuring\n var id = this[i][0];\n\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n }\n\n for (var _i = 0; _i < modules.length; _i++) {\n var item = [].concat(modules[_i]);\n\n if (dedupe && alreadyImportedModules[item[0]]) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (mediaQuery) {\n if (!item[2]) {\n item[2] = mediaQuery;\n } else {\n item[2] = \"\".concat(mediaQuery, \" and \").concat(item[2]);\n }\n }\n\n list.push(item);\n }\n };\n\n return list;\n};","\"use strict\";\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nmodule.exports = function cssWithMappingToString(item) {\n var _item = _slicedToArray(item, 4),\n content = _item[1],\n cssMapping = _item[3];\n\n if (!cssMapping) {\n return content;\n }\n\n if (typeof btoa === \"function\") {\n // eslint-disable-next-line no-undef\n var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping))));\n var data = \"sourceMappingURL=data:application/json;charset=utf-8;base64,\".concat(base64);\n var sourceMapping = \"/*# \".concat(data, \" */\");\n var sourceURLs = cssMapping.sources.map(function (source) {\n return \"/*# sourceURL=\".concat(cssMapping.sourceRoot || \"\").concat(source, \" */\");\n });\n return [content].concat(sourceURLs).concat([sourceMapping]).join(\"\\n\");\n }\n\n return [content].join(\"\\n\");\n};","export default \"<svg viewBox=\\\"0 0 20 20\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\"><path d=\\\"m14 0 5 4.5V20H3v-1.5h14.5v-12h-5v-5h-8v4H3V0h11ZM8.5 7a1.5 1.5 0 0 1 1.493 1.356L10 8.5v7a1.5 1.5 0 0 1-1.356 1.493L8.5 17h-7a1.5 1.5 0 0 1-1.493-1.356L0 15.5v-7a1.5 1.5 0 0 1 1.356-1.493L1.5 7h7ZM7.483 9.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.601.601 0 0 0 1.041-.01l.041-.092.88-2.458.925 2.467.046.096a.601.601 0 0 0 1.032 0l.043-.09 1.554-4 .028-.093a.6.6 0 0 0-1.104-.43ZM14 2v3h3.3L14 2Z\\\"/></svg>\\n\";","import api from \"!../../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import content from \"!!../../../../../node_modules/css-loader/dist/cjs.js!../../../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].use[2]!./exportword.css\";\n\nvar options = {\"injectType\":\"singletonStyleTag\",\"attributes\":{\"data-cke\":true}};\n\noptions.insert = \"head\";\noptions.singleton = true;\n\nvar update = api(content, options);\n\n\n\nexport default content.locals || {};","\"use strict\";\n\nvar isOldIE = function isOldIE() {\n var memo;\n return function memorize() {\n if (typeof memo === 'undefined') {\n // Test for IE <= 9 as proposed by Browserhacks\n // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805\n // Tests for existence of standard globals is to allow style-loader\n // to operate correctly into non-standard environments\n // @see https://github.com/webpack-contrib/style-loader/issues/177\n memo = Boolean(window && document && document.all && !window.atob);\n }\n\n return memo;\n };\n}();\n\nvar getTarget = function getTarget() {\n var memo = {};\n return function memorize(target) {\n if (typeof memo[target] === 'undefined') {\n var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself\n\n if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n try {\n // This will throw an exception if access to iframe is blocked\n // due to cross-origin restrictions\n styleTarget = styleTarget.contentDocument.head;\n } catch (e) {\n // istanbul ignore next\n styleTarget = null;\n }\n }\n\n memo[target] = styleTarget;\n }\n\n return memo[target];\n };\n}();\n\nvar stylesInDom = [];\n\nfunction getIndexByIdentifier(identifier) {\n var result = -1;\n\n for (var i = 0; i < stylesInDom.length; i++) {\n if (stylesInDom[i].identifier === identifier) {\n result = i;\n break;\n }\n }\n\n return result;\n}\n\nfunction modulesToDom(list, options) {\n var idCountMap = {};\n var identifiers = [];\n\n for (var i = 0; i < list.length; i++) {\n var item = list[i];\n var id = options.base ? item[0] + options.base : item[0];\n var count = idCountMap[id] || 0;\n var identifier = \"\".concat(id, \" \").concat(count);\n idCountMap[id] = count + 1;\n var index = getIndexByIdentifier(identifier);\n var obj = {\n css: item[1],\n media: item[2],\n sourceMap: item[3]\n };\n\n if (index !== -1) {\n stylesInDom[index].references++;\n stylesInDom[index].updater(obj);\n } else {\n stylesInDom.push({\n identifier: identifier,\n updater: addStyle(obj, options),\n references: 1\n });\n }\n\n identifiers.push(identifier);\n }\n\n return identifiers;\n}\n\nfunction insertStyleElement(options) {\n var style = document.createElement('style');\n var attributes = options.attributes || {};\n\n if (typeof attributes.nonce === 'undefined') {\n var nonce = typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null;\n\n if (nonce) {\n attributes.nonce = nonce;\n }\n }\n\n Object.keys(attributes).forEach(function (key) {\n style.setAttribute(key, attributes[key]);\n });\n\n if (typeof options.insert === 'function') {\n options.insert(style);\n } else {\n var target = getTarget(options.insert || 'head');\n\n if (!target) {\n throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n }\n\n target.appendChild(style);\n }\n\n return style;\n}\n\nfunction removeStyleElement(style) {\n // istanbul ignore if\n if (style.parentNode === null) {\n return false;\n }\n\n style.parentNode.removeChild(style);\n}\n/* istanbul ignore next */\n\n\nvar replaceText = function replaceText() {\n var textStore = [];\n return function replace(index, replacement) {\n textStore[index] = replacement;\n return textStore.filter(Boolean).join('\\n');\n };\n}();\n\nfunction applyToSingletonTag(style, index, remove, obj) {\n var css = remove ? '' : obj.media ? \"@media \".concat(obj.media, \" {\").concat(obj.css, \"}\") : obj.css; // For old IE\n\n /* istanbul ignore if */\n\n if (style.styleSheet) {\n style.styleSheet.cssText = replaceText(index, css);\n } else {\n var cssNode = document.createTextNode(css);\n var childNodes = style.childNodes;\n\n if (childNodes[index]) {\n style.removeChild(childNodes[index]);\n }\n\n if (childNodes.length) {\n style.insertBefore(cssNode, childNodes[index]);\n } else {\n style.appendChild(cssNode);\n }\n }\n}\n\nfunction applyToTag(style, options, obj) {\n var css = obj.css;\n var media = obj.media;\n var sourceMap = obj.sourceMap;\n\n if (media) {\n style.setAttribute('media', media);\n } else {\n style.removeAttribute('media');\n }\n\n if (sourceMap && typeof btoa !== 'undefined') {\n css += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), \" */\");\n } // For old IE\n\n /* istanbul ignore if */\n\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n while (style.firstChild) {\n style.removeChild(style.firstChild);\n }\n\n style.appendChild(document.createTextNode(css));\n }\n}\n\nvar singleton = null;\nvar singletonCounter = 0;\n\nfunction addStyle(obj, options) {\n var style;\n var update;\n var remove;\n\n if (options.singleton) {\n var styleIndex = singletonCounter++;\n style = singleton || (singleton = insertStyleElement(options));\n update = applyToSingletonTag.bind(null, style, styleIndex, false);\n remove = applyToSingletonTag.bind(null, style, styleIndex, true);\n } else {\n style = insertStyleElement(options);\n update = applyToTag.bind(null, style, options);\n\n remove = function remove() {\n removeStyleElement(style);\n };\n }\n\n update(obj);\n return function updateStyle(newObj) {\n if (newObj) {\n if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {\n return;\n }\n\n update(obj = newObj);\n } else {\n remove();\n }\n };\n}\n\nmodule.exports = function (list, options) {\n options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>\n // tags it will allow on a page\n\n if (!options.singleton && typeof options.singleton !== 'boolean') {\n options.singleton = isOldIE();\n }\n\n list = list || [];\n var lastIdentifiers = modulesToDom(list, options);\n return function update(newList) {\n newList = newList || [];\n\n if (Object.prototype.toString.call(newList) !== '[object Array]') {\n return;\n }\n\n for (var i = 0; i < lastIdentifiers.length; i++) {\n var identifier = lastIdentifiers[i];\n var index = getIndexByIdentifier(identifier);\n stylesInDom[index].references--;\n }\n\n var newLastIdentifiers = modulesToDom(newList, options);\n\n for (var _i = 0; _i < lastIdentifiers.length; _i++) {\n var _identifier = lastIdentifiers[_i];\n\n var _index = getIndexByIdentifier(_identifier);\n\n if (stylesInDom[_index].references === 0) {\n stylesInDom[_index].updater();\n\n stylesInDom.splice(_index, 1);\n }\n }\n\n lastIdentifiers = newLastIdentifiers;\n };\n};","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/core.js\");","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/ui.js\");","module.exports = CKEditor5.dll;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module export-word\n */\n\nexport { default as ExportWord } from './exportword';\n"],"names":[],"sourceRoot":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-export-word",
|
|
3
|
-
"version": "38.1.
|
|
3
|
+
"version": "38.1.1",
|
|
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": "38.1.
|
|
32
|
+
"ckeditor5": "38.1.1"
|
|
33
33
|
},
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=16.0.0",
|
package/src/augmentation.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
import type { ExportWordConfig, ExportWord, ExportWordCommand } from './index';
|
|
6
|
-
declare module '@ckeditor/ckeditor5-core' {
|
|
7
|
-
interface EditorConfig {
|
|
8
|
-
/**
|
|
9
|
-
* The configuration of the {@link module:export-word/exportword~ExportWord export to Word feature}.
|
|
10
|
-
*
|
|
11
|
-
* Read more in {@link module:export-word/exportword~ExportWordConfig}.
|
|
12
|
-
*/
|
|
13
|
-
exportWord?: ExportWordConfig;
|
|
14
|
-
}
|
|
15
|
-
interface PluginsMap {
|
|
16
|
-
[ExportWord.pluginName]: ExportWord;
|
|
17
|
-
}
|
|
18
|
-
interface CommandsMap {
|
|
19
|
-
exportWord: ExportWordCommand;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
import type { ExportWordConfig, ExportWord, ExportWordCommand } from './index';
|
|
6
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
7
|
+
interface EditorConfig {
|
|
8
|
+
/**
|
|
9
|
+
* The configuration of the {@link module:export-word/exportword~ExportWord export to Word feature}.
|
|
10
|
+
*
|
|
11
|
+
* Read more in {@link module:export-word/exportword~ExportWordConfig}.
|
|
12
|
+
*/
|
|
13
|
+
exportWord?: ExportWordConfig;
|
|
14
|
+
}
|
|
15
|
+
interface PluginsMap {
|
|
16
|
+
[ExportWord.pluginName]: ExportWord;
|
|
17
|
+
}
|
|
18
|
+
interface CommandsMap {
|
|
19
|
+
exportWord: ExportWordCommand;
|
|
20
|
+
}
|
|
21
|
+
}
|
package/src/exportword.d.ts
CHANGED
|
@@ -1,232 +1,232 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module export-word/exportword
|
|
7
|
-
* @publicApi
|
|
8
|
-
*/
|
|
9
|
-
import { Plugin, type Editor } from 'ckeditor5/src/core';
|
|
10
|
-
import { Notification } from 'ckeditor5/src/ui';
|
|
11
|
-
import type { InitializedToken, TokenUrl } from '@ckeditor/ckeditor5-cloud-services';
|
|
12
|
-
import '../theme/exportword.css';
|
|
13
|
-
/**
|
|
14
|
-
* The export to Word feature.
|
|
15
|
-
*
|
|
16
|
-
* It allows you to generate a Word file directly from the editor content.
|
|
17
|
-
*
|
|
18
|
-
* For a detailed overview, check the {@glink features/converters/export-word export to Word} feature documentation.
|
|
19
|
-
*/
|
|
20
|
-
export default class ExportWord extends Plugin {
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
*/
|
|
24
|
-
static get pluginName(): "ExportWord";
|
|
25
|
-
/**
|
|
26
|
-
* @inheritDoc
|
|
27
|
-
*/
|
|
28
|
-
static get requires(): readonly ["CloudServices", typeof Notification];
|
|
29
|
-
/**
|
|
30
|
-
* @inheritDoc
|
|
31
|
-
*/
|
|
32
|
-
init(): void;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* The configuration of the export to Word feature. It is used by the Word export features from
|
|
36
|
-
* the `@ckeditor/ckeditor5-export-word` package.
|
|
37
|
-
*
|
|
38
|
-
* ```ts
|
|
39
|
-
* ClassicEditor
|
|
40
|
-
* .create( editorElement, {
|
|
41
|
-
* exportWord: ... // Export to Word feature options.
|
|
42
|
-
* } )
|
|
43
|
-
* .then( ... )
|
|
44
|
-
* .catch( ... );
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
48
|
-
*/
|
|
49
|
-
export interface ExportWordConfig {
|
|
50
|
-
/**
|
|
51
|
-
* Paths to the `.css` files containing additional styling for the editor's content (**the order of provided items matters**).
|
|
52
|
-
*
|
|
53
|
-
* ```ts
|
|
54
|
-
* const exportWordConfig = {
|
|
55
|
-
* stylesheets: [ './path/to/custom-style.css' ]
|
|
56
|
-
* }
|
|
57
|
-
* ```
|
|
58
|
-
*
|
|
59
|
-
* **NOTE:** If `stylesheets` are not provided, the plugin will sent only
|
|
60
|
-
* {@glink installation/advanced/content-styles#the-full-list-of-content-styles the default editor content styles} to the converter.
|
|
61
|
-
*
|
|
62
|
-
* **Default editor's content styles**:
|
|
63
|
-
* {@glink installation/advanced/content-styles#the-full-list-of-content-styles The default editor content styles}
|
|
64
|
-
* are applied to the generated Word file thanks to the 'EDITOR_STYLES' token, which is provided to the `stylesheets` by default.
|
|
65
|
-
* If you don't want them to be applied, you have to omit the token:
|
|
66
|
-
*
|
|
67
|
-
* ```ts
|
|
68
|
-
* const exportWordConfig = {
|
|
69
|
-
* stylesheets: [ './path/to/custom-editor-styles.css' ]
|
|
70
|
-
* }
|
|
71
|
-
* ```
|
|
72
|
-
*
|
|
73
|
-
* **Custom styling:** For more advanced styling, your configuration should look like this:
|
|
74
|
-
*
|
|
75
|
-
* ```ts
|
|
76
|
-
* const exportWordConfig = {
|
|
77
|
-
* stylesheets: [
|
|
78
|
-
* 'EDITOR_STYLES',
|
|
79
|
-
* './path/to/custom-styles.css'
|
|
80
|
-
* ]
|
|
81
|
-
* }
|
|
82
|
-
* ```
|
|
83
|
-
*
|
|
84
|
-
* @default `[ 'EDITOR_STYLES' ]`
|
|
85
|
-
*/
|
|
86
|
-
stylesheets?: Array<string>;
|
|
87
|
-
/**
|
|
88
|
-
* The name of the generated Word file.
|
|
89
|
-
*
|
|
90
|
-
* ```ts
|
|
91
|
-
* // Static file name.
|
|
92
|
-
* const exportWordConfig = {
|
|
93
|
-
* fileName: 'my-document.docx'
|
|
94
|
-
* }
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* // Dynamic file name.
|
|
98
|
-
* const exportWordConfig = {
|
|
99
|
-
* fileName: () => {
|
|
100
|
-
* const articleTitle = document.querySelector( '#title' );
|
|
101
|
-
*
|
|
102
|
-
* return `${ articleTitle.value }.docx`;
|
|
103
|
-
* }
|
|
104
|
-
* }
|
|
105
|
-
* ```
|
|
106
|
-
*
|
|
107
|
-
* **NOTE:** The file name must contain the `.docx` extension.
|
|
108
|
-
* Otherwise your operating system or device may have trouble identifying the file type.
|
|
109
|
-
*
|
|
110
|
-
* @default 'document.docx'
|
|
111
|
-
*/
|
|
112
|
-
fileName?: string | (() => string);
|
|
113
|
-
/**
|
|
114
|
-
* A URL to the Docx converter.
|
|
115
|
-
*
|
|
116
|
-
* ```ts
|
|
117
|
-
* const exportWordConfig = {
|
|
118
|
-
* converterUrl: 'https://myconverter.com/v1/'
|
|
119
|
-
* }
|
|
120
|
-
* ```
|
|
121
|
-
*
|
|
122
|
-
* **NOTE:** The plugin uses the default HTML to Word converter delivered by CKEditor Cloud Services.
|
|
123
|
-
* You can provide a URL to an on-premises converter instead.
|
|
124
|
-
*
|
|
125
|
-
* @default 'https://docx-converter.cke-cs.com/v1/convert'
|
|
126
|
-
*/
|
|
127
|
-
converterUrl?: string;
|
|
128
|
-
/**
|
|
129
|
-
* The CKEditor Cloud Services HTML to DOCX Converter [configuration options](https://docx-converter.cke-cs.com/docs#section/Options).
|
|
130
|
-
*
|
|
131
|
-
* **NOTE:** Configuring the plugin is not mandatory.
|
|
132
|
-
*
|
|
133
|
-
* ```ts
|
|
134
|
-
* const exportWordConfig = {
|
|
135
|
-
* converterOptions: {
|
|
136
|
-
* ...
|
|
137
|
-
* }
|
|
138
|
-
* }
|
|
139
|
-
* ```
|
|
140
|
-
*
|
|
141
|
-
* @default `{
|
|
142
|
-
* format: 'A4',
|
|
143
|
-
* margin_top: '1in',
|
|
144
|
-
* margin_bottom: '1in',
|
|
145
|
-
* margin_right: '1in',
|
|
146
|
-
* margin_left: '1in',
|
|
147
|
-
* header: undefined,
|
|
148
|
-
* footer: undefined,
|
|
149
|
-
* comments: undefined,
|
|
150
|
-
* suggestions: undefined,
|
|
151
|
-
* orientation: 'portrait',
|
|
152
|
-
* auto_pagination: true,
|
|
153
|
-
* base_url: undefined,
|
|
154
|
-
* timezone: 'UTC'
|
|
155
|
-
* }`
|
|
156
|
-
*/
|
|
157
|
-
converterOptions?: ExportWordConverterOptions;
|
|
158
|
-
/**
|
|
159
|
-
* A function to gather the HTML to be converted to Word.
|
|
160
|
-
*
|
|
161
|
-
* **NOTE:** This option may be useful when the editor does not have a `getData()` method,
|
|
162
|
-
* or if the HTML to be converted should be different than the edited one.
|
|
163
|
-
*
|
|
164
|
-
* ```ts
|
|
165
|
-
* const exportWordConfig = {
|
|
166
|
-
* dataCallback: ( editor ) => {
|
|
167
|
-
* return `
|
|
168
|
-
* <header id="header">${ editor.data.get( { rootName: 'header' } ) }</header>
|
|
169
|
-
* <div id="content">${ editor.data.get( { rootName: 'content' } ) }</div>
|
|
170
|
-
* `;
|
|
171
|
-
* }
|
|
172
|
-
* }
|
|
173
|
-
* ```
|
|
174
|
-
*
|
|
175
|
-
* @default `( editor ) => editor.getData( { pagination: true } )
|
|
176
|
-
*
|
|
177
|
-
* If using the {@glink features/pagination/pagination pagination} feature, the `pagination:true` option inserts additional markers into
|
|
178
|
-
* editor's data. Thanks to that, the Docx converter creates a Word document similar to what is displayed in the editor.
|
|
179
|
-
*/
|
|
180
|
-
dataCallback?: (editor: Editor) => string;
|
|
181
|
-
/**
|
|
182
|
-
* A token URL or a token request function. This field is optional and should be used only when a different `tokenUrl` is required for
|
|
183
|
-
* the export to Word feature.
|
|
184
|
-
*
|
|
185
|
-
* **Note:** The token can be disabled with the `false` value provided.
|
|
186
|
-
*
|
|
187
|
-
* See: {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl}
|
|
188
|
-
*/
|
|
189
|
-
tokenUrl?: TokenUrl | false;
|
|
190
|
-
/**
|
|
191
|
-
* The authentication token.
|
|
192
|
-
*
|
|
193
|
-
* See: {@link module:cloud-services/cloudservices~CloudServices#token}
|
|
194
|
-
*/
|
|
195
|
-
token?: InitializedToken;
|
|
196
|
-
}
|
|
197
|
-
export type ExportWordConverterOptions = {
|
|
198
|
-
format?: ExportWordConverterFormatOption;
|
|
199
|
-
margin_top?: string;
|
|
200
|
-
margin_bottom?: string;
|
|
201
|
-
margin_right?: string;
|
|
202
|
-
margin_left?: string;
|
|
203
|
-
header?: ExportWordConverterHeaderFooterOption;
|
|
204
|
-
footer?: ExportWordConverterHeaderFooterOption;
|
|
205
|
-
comments?: ExportWordConverterCommentsOption;
|
|
206
|
-
suggestions?: ExportWordConverterSuggestionsOption;
|
|
207
|
-
orientation?: ExportWordConverterOrientationOption;
|
|
208
|
-
auto_pagination?: boolean;
|
|
209
|
-
base_url?: string;
|
|
210
|
-
timezone?: string;
|
|
211
|
-
};
|
|
212
|
-
export type ExportWordConverterFormatOption = 'Letter' | 'Legal' | 'Tabloid' | 'Statement' | 'Executive' | 'A3' | 'A4' | 'A5' | 'A6' | 'B4' | 'B5';
|
|
213
|
-
export type ExportWordConverterOrientationOption = 'portrait' | 'landscape';
|
|
214
|
-
export type ExportWordConverterHeaderFooterOption = Array<{
|
|
215
|
-
html?: string;
|
|
216
|
-
css?: string;
|
|
217
|
-
type?: 'default' | 'even' | 'odd' | 'first';
|
|
218
|
-
}>;
|
|
219
|
-
export type ExportWordConverterCommentsOption = {
|
|
220
|
-
[id: string]: Array<{
|
|
221
|
-
author: string;
|
|
222
|
-
created: Date;
|
|
223
|
-
content?: string;
|
|
224
|
-
is_resolved: boolean;
|
|
225
|
-
}>;
|
|
226
|
-
};
|
|
227
|
-
export type ExportWordConverterSuggestionsOption = {
|
|
228
|
-
[id: string]: {
|
|
229
|
-
author: string;
|
|
230
|
-
created: Date | null;
|
|
231
|
-
};
|
|
232
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module export-word/exportword
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core';
|
|
10
|
+
import { Notification } from 'ckeditor5/src/ui';
|
|
11
|
+
import type { InitializedToken, TokenUrl } from '@ckeditor/ckeditor5-cloud-services';
|
|
12
|
+
import '../theme/exportword.css';
|
|
13
|
+
/**
|
|
14
|
+
* The export to Word feature.
|
|
15
|
+
*
|
|
16
|
+
* It allows you to generate a Word file directly from the editor content.
|
|
17
|
+
*
|
|
18
|
+
* For a detailed overview, check the {@glink features/converters/export-word export to Word} feature documentation.
|
|
19
|
+
*/
|
|
20
|
+
export default class ExportWord extends Plugin {
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
static get pluginName(): "ExportWord";
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
static get requires(): readonly ["CloudServices", typeof Notification];
|
|
29
|
+
/**
|
|
30
|
+
* @inheritDoc
|
|
31
|
+
*/
|
|
32
|
+
init(): void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The configuration of the export to Word feature. It is used by the Word export features from
|
|
36
|
+
* the `@ckeditor/ckeditor5-export-word` package.
|
|
37
|
+
*
|
|
38
|
+
* ```ts
|
|
39
|
+
* ClassicEditor
|
|
40
|
+
* .create( editorElement, {
|
|
41
|
+
* exportWord: ... // Export to Word feature options.
|
|
42
|
+
* } )
|
|
43
|
+
* .then( ... )
|
|
44
|
+
* .catch( ... );
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
48
|
+
*/
|
|
49
|
+
export interface ExportWordConfig {
|
|
50
|
+
/**
|
|
51
|
+
* Paths to the `.css` files containing additional styling for the editor's content (**the order of provided items matters**).
|
|
52
|
+
*
|
|
53
|
+
* ```ts
|
|
54
|
+
* const exportWordConfig = {
|
|
55
|
+
* stylesheets: [ './path/to/custom-style.css' ]
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* **NOTE:** If `stylesheets` are not provided, the plugin will sent only
|
|
60
|
+
* {@glink installation/advanced/content-styles#the-full-list-of-content-styles the default editor content styles} to the converter.
|
|
61
|
+
*
|
|
62
|
+
* **Default editor's content styles**:
|
|
63
|
+
* {@glink installation/advanced/content-styles#the-full-list-of-content-styles The default editor content styles}
|
|
64
|
+
* are applied to the generated Word file thanks to the 'EDITOR_STYLES' token, which is provided to the `stylesheets` by default.
|
|
65
|
+
* If you don't want them to be applied, you have to omit the token:
|
|
66
|
+
*
|
|
67
|
+
* ```ts
|
|
68
|
+
* const exportWordConfig = {
|
|
69
|
+
* stylesheets: [ './path/to/custom-editor-styles.css' ]
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* **Custom styling:** For more advanced styling, your configuration should look like this:
|
|
74
|
+
*
|
|
75
|
+
* ```ts
|
|
76
|
+
* const exportWordConfig = {
|
|
77
|
+
* stylesheets: [
|
|
78
|
+
* 'EDITOR_STYLES',
|
|
79
|
+
* './path/to/custom-styles.css'
|
|
80
|
+
* ]
|
|
81
|
+
* }
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* @default `[ 'EDITOR_STYLES' ]`
|
|
85
|
+
*/
|
|
86
|
+
stylesheets?: Array<string>;
|
|
87
|
+
/**
|
|
88
|
+
* The name of the generated Word file.
|
|
89
|
+
*
|
|
90
|
+
* ```ts
|
|
91
|
+
* // Static file name.
|
|
92
|
+
* const exportWordConfig = {
|
|
93
|
+
* fileName: 'my-document.docx'
|
|
94
|
+
* }
|
|
95
|
+
*
|
|
96
|
+
*
|
|
97
|
+
* // Dynamic file name.
|
|
98
|
+
* const exportWordConfig = {
|
|
99
|
+
* fileName: () => {
|
|
100
|
+
* const articleTitle = document.querySelector( '#title' );
|
|
101
|
+
*
|
|
102
|
+
* return `${ articleTitle.value }.docx`;
|
|
103
|
+
* }
|
|
104
|
+
* }
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* **NOTE:** The file name must contain the `.docx` extension.
|
|
108
|
+
* Otherwise your operating system or device may have trouble identifying the file type.
|
|
109
|
+
*
|
|
110
|
+
* @default 'document.docx'
|
|
111
|
+
*/
|
|
112
|
+
fileName?: string | (() => string);
|
|
113
|
+
/**
|
|
114
|
+
* A URL to the Docx converter.
|
|
115
|
+
*
|
|
116
|
+
* ```ts
|
|
117
|
+
* const exportWordConfig = {
|
|
118
|
+
* converterUrl: 'https://myconverter.com/v1/'
|
|
119
|
+
* }
|
|
120
|
+
* ```
|
|
121
|
+
*
|
|
122
|
+
* **NOTE:** The plugin uses the default HTML to Word converter delivered by CKEditor Cloud Services.
|
|
123
|
+
* You can provide a URL to an on-premises converter instead.
|
|
124
|
+
*
|
|
125
|
+
* @default 'https://docx-converter.cke-cs.com/v1/convert'
|
|
126
|
+
*/
|
|
127
|
+
converterUrl?: string;
|
|
128
|
+
/**
|
|
129
|
+
* The CKEditor Cloud Services HTML to DOCX Converter [configuration options](https://docx-converter.cke-cs.com/docs#section/Options).
|
|
130
|
+
*
|
|
131
|
+
* **NOTE:** Configuring the plugin is not mandatory.
|
|
132
|
+
*
|
|
133
|
+
* ```ts
|
|
134
|
+
* const exportWordConfig = {
|
|
135
|
+
* converterOptions: {
|
|
136
|
+
* ...
|
|
137
|
+
* }
|
|
138
|
+
* }
|
|
139
|
+
* ```
|
|
140
|
+
*
|
|
141
|
+
* @default `{
|
|
142
|
+
* format: 'A4',
|
|
143
|
+
* margin_top: '1in',
|
|
144
|
+
* margin_bottom: '1in',
|
|
145
|
+
* margin_right: '1in',
|
|
146
|
+
* margin_left: '1in',
|
|
147
|
+
* header: undefined,
|
|
148
|
+
* footer: undefined,
|
|
149
|
+
* comments: undefined,
|
|
150
|
+
* suggestions: undefined,
|
|
151
|
+
* orientation: 'portrait',
|
|
152
|
+
* auto_pagination: true,
|
|
153
|
+
* base_url: undefined,
|
|
154
|
+
* timezone: 'UTC'
|
|
155
|
+
* }`
|
|
156
|
+
*/
|
|
157
|
+
converterOptions?: ExportWordConverterOptions;
|
|
158
|
+
/**
|
|
159
|
+
* A function to gather the HTML to be converted to Word.
|
|
160
|
+
*
|
|
161
|
+
* **NOTE:** This option may be useful when the editor does not have a `getData()` method,
|
|
162
|
+
* or if the HTML to be converted should be different than the edited one.
|
|
163
|
+
*
|
|
164
|
+
* ```ts
|
|
165
|
+
* const exportWordConfig = {
|
|
166
|
+
* dataCallback: ( editor ) => {
|
|
167
|
+
* return `
|
|
168
|
+
* <header id="header">${ editor.data.get( { rootName: 'header' } ) }</header>
|
|
169
|
+
* <div id="content">${ editor.data.get( { rootName: 'content' } ) }</div>
|
|
170
|
+
* `;
|
|
171
|
+
* }
|
|
172
|
+
* }
|
|
173
|
+
* ```
|
|
174
|
+
*
|
|
175
|
+
* @default `( editor ) => editor.getData( { pagination: true } )
|
|
176
|
+
*
|
|
177
|
+
* If using the {@glink features/pagination/pagination pagination} feature, the `pagination:true` option inserts additional markers into
|
|
178
|
+
* editor's data. Thanks to that, the Docx converter creates a Word document similar to what is displayed in the editor.
|
|
179
|
+
*/
|
|
180
|
+
dataCallback?: (editor: Editor) => string;
|
|
181
|
+
/**
|
|
182
|
+
* A token URL or a token request function. This field is optional and should be used only when a different `tokenUrl` is required for
|
|
183
|
+
* the export to Word feature.
|
|
184
|
+
*
|
|
185
|
+
* **Note:** The token can be disabled with the `false` value provided.
|
|
186
|
+
*
|
|
187
|
+
* See: {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl}
|
|
188
|
+
*/
|
|
189
|
+
tokenUrl?: TokenUrl | false;
|
|
190
|
+
/**
|
|
191
|
+
* The authentication token.
|
|
192
|
+
*
|
|
193
|
+
* See: {@link module:cloud-services/cloudservices~CloudServices#token}
|
|
194
|
+
*/
|
|
195
|
+
token?: InitializedToken;
|
|
196
|
+
}
|
|
197
|
+
export type ExportWordConverterOptions = {
|
|
198
|
+
format?: ExportWordConverterFormatOption;
|
|
199
|
+
margin_top?: string;
|
|
200
|
+
margin_bottom?: string;
|
|
201
|
+
margin_right?: string;
|
|
202
|
+
margin_left?: string;
|
|
203
|
+
header?: ExportWordConverterHeaderFooterOption;
|
|
204
|
+
footer?: ExportWordConverterHeaderFooterOption;
|
|
205
|
+
comments?: ExportWordConverterCommentsOption;
|
|
206
|
+
suggestions?: ExportWordConverterSuggestionsOption;
|
|
207
|
+
orientation?: ExportWordConverterOrientationOption;
|
|
208
|
+
auto_pagination?: boolean;
|
|
209
|
+
base_url?: string;
|
|
210
|
+
timezone?: string;
|
|
211
|
+
};
|
|
212
|
+
export type ExportWordConverterFormatOption = 'Letter' | 'Legal' | 'Tabloid' | 'Statement' | 'Executive' | 'A3' | 'A4' | 'A5' | 'A6' | 'B4' | 'B5';
|
|
213
|
+
export type ExportWordConverterOrientationOption = 'portrait' | 'landscape';
|
|
214
|
+
export type ExportWordConverterHeaderFooterOption = Array<{
|
|
215
|
+
html?: string;
|
|
216
|
+
css?: string;
|
|
217
|
+
type?: 'default' | 'even' | 'odd' | 'first';
|
|
218
|
+
}>;
|
|
219
|
+
export type ExportWordConverterCommentsOption = {
|
|
220
|
+
[id: string]: Array<{
|
|
221
|
+
author: string;
|
|
222
|
+
created: Date;
|
|
223
|
+
content?: string;
|
|
224
|
+
is_resolved: boolean;
|
|
225
|
+
}>;
|
|
226
|
+
};
|
|
227
|
+
export type ExportWordConverterSuggestionsOption = {
|
|
228
|
+
[id: string]: {
|
|
229
|
+
author: string;
|
|
230
|
+
created: Date | null;
|
|
231
|
+
};
|
|
232
|
+
};
|
package/src/exportword.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Plugin as
|
|
23
|
+
import{Plugin as _0x7e2bd3}from'ckeditor5/src/core';import{ButtonView as _0x6a806,View as _0x5a42a9,Notification as _0x3cfe8e}from'ckeditor5/src/ui';import _0x405b1d from'./exportwordcommand';import _0x334590 from'../theme/icons/exportword.svg';import'../theme/exportword.css';export default class c extends _0x7e2bd3{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x3cfe8e];}['init'](){const _0xe5b460=this['editor'],t=_0xe5b460['t'],_0x2254d7=_0xe5b460['config']['get']('exportWord')||{};_0xe5b460['commands']['add']('exportWord',new _0x405b1d(_0xe5b460)),_0xe5b460['ui']['componentFactory']['add']('exportWord',_0x3d20d8=>{const _0x4036b7=_0xe5b460['commands']['get']('exportWord'),_0x4a2258=new _0x6a806(_0x3d20d8);_0x4a2258['set']({'label':t('Export\x20to\x20Word'),'icon':_0x334590,'tooltip':!0x0}),_0x4a2258['bind']('isOn','isEnabled')['to'](_0x4036b7,'isBusy','isEnabled'),_0x4a2258['extendTemplate']({'attributes':{'class':[_0x4a2258['bindTemplate']['if']('isOn','ck-exportword_status-pending')]}});const _0x5e7e08=new _0x5a42a9();return _0x5e7e08['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-exportword__spinner-container']},'children':[{'tag':'span','attributes':{'class':['ck','ck-exportword__spinner']}}]}),_0x4a2258['children']['add'](_0x5e7e08),this['listenTo'](_0x4a2258,'execute',()=>{_0xe5b460['execute']('exportWord',_0x2254d7),_0xe5b460['editing']['view']['focus']();}),_0x4a2258;});const _0x44dab5=_0xe5b460['plugins']['get']('CloudServices');!0x1===_0x2254d7['tokenUrl']?this['_token']=null:_0x2254d7['tokenUrl']?_0x44dab5['registerTokenUrl'](_0x2254d7['tokenUrl'])['then'](_0xe53240=>{this['_token']=_0xe53240;}):this['_token']=_0x44dab5['token'];}}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module export-word/exportwordcommand
|
|
7
|
-
* @publicApi
|
|
8
|
-
*/
|
|
9
|
-
import { Command, type Editor } from 'ckeditor5/src/core';
|
|
10
|
-
import { type ExportWordConfig } from './exportword';
|
|
11
|
-
/**
|
|
12
|
-
* The export to Word command.
|
|
13
|
-
*
|
|
14
|
-
* It takes the editor's HTML and CSS rules from the document and sends them to the HTML to Word converter.
|
|
15
|
-
* After processing, the converter will send back a Word file for download.
|
|
16
|
-
*/
|
|
17
|
-
export default class ExportWordCommand extends Command {
|
|
18
|
-
/**
|
|
19
|
-
* A command state that indicates if the command is currently executing.
|
|
20
|
-
*
|
|
21
|
-
* @observable
|
|
22
|
-
*/
|
|
23
|
-
isBusy: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* @inheritDoc
|
|
26
|
-
*/
|
|
27
|
-
constructor(editor: Editor);
|
|
28
|
-
/**
|
|
29
|
-
* @inheritDoc
|
|
30
|
-
*/
|
|
31
|
-
refresh(): void;
|
|
32
|
-
/**
|
|
33
|
-
* @inheritDoc
|
|
34
|
-
*/
|
|
35
|
-
execute(options?: ExportWordConfig): Promise<void>;
|
|
36
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module export-word/exportwordcommand
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
import { Command, type Editor } from 'ckeditor5/src/core';
|
|
10
|
+
import { type ExportWordConfig } from './exportword';
|
|
11
|
+
/**
|
|
12
|
+
* The export to Word command.
|
|
13
|
+
*
|
|
14
|
+
* It takes the editor's HTML and CSS rules from the document and sends them to the HTML to Word converter.
|
|
15
|
+
* After processing, the converter will send back a Word file for download.
|
|
16
|
+
*/
|
|
17
|
+
export default class ExportWordCommand extends Command {
|
|
18
|
+
/**
|
|
19
|
+
* A command state that indicates if the command is currently executing.
|
|
20
|
+
*
|
|
21
|
+
* @observable
|
|
22
|
+
*/
|
|
23
|
+
isBusy: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
constructor(editor: Editor);
|
|
28
|
+
/**
|
|
29
|
+
* @inheritDoc
|
|
30
|
+
*/
|
|
31
|
+
refresh(): void;
|
|
32
|
+
/**
|
|
33
|
+
* @inheritDoc
|
|
34
|
+
*/
|
|
35
|
+
execute(options?: ExportWordConfig): Promise<void>;
|
|
36
|
+
}
|
package/src/exportwordcommand.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Command as
|
|
23
|
+
import{Command as _0x134f7f}from'ckeditor5/src/core';import{getStyles as _0x48db5d,getConverterOptions as _0x4fb16a}from'./utils';export default class i extends _0x134f7f{constructor(_0x5a34f4){super(_0x5a34f4),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x4f1366={}){const _0x40e779=this['editor'],t=_0x40e779['t'],_0x555eab=_0x4f1366['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x6fbb5f=_0x4f1366['converterOptions']||{},_0x570a89=_0x40e779['plugins']['get']('ExportWord'),_0x1d82cd=_0x4f1366['token']||_0x570a89['_token'],_0x454d30=!0x1!==_0x6fbb5f['auto_pagination'],_0x115390=_0x4f1366['dataCallback']||(_0x427246=>_0x427246['data']['get']({'pagination':_0x454d30}));return this['isBusy']=!0x0,this['refresh'](),_0x48db5d(_0x4f1366['stylesheets']||['EDITOR_STYLES'])['then'](async _0x5598a6=>{const _0x256386=await _0x115390(_0x40e779),_0x537aa3={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x40e779['locale']['contentLanguageDirection']+'\x22>'+_0x256386+'</div>','css':_0x5598a6,'options':{..._0x6fbb5f,..._0x4fb16a(_0x40e779)}},_0x6c30e3={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x1d82cd?{'Authorization':_0x1d82cd['value']}:null},'body':JSON['stringify'](_0x537aa3)};return window['fetch'](_0x555eab,_0x6c30e3)['then'](_0x1585f6=>{if(0xc8!==_0x1585f6['status'])throw _0x1585f6;return _0x1585f6['blob']();})['then'](_0x4fa4b1=>{const _0x3464f6='function'==typeof _0x4f1366['fileName']?_0x4f1366['fileName']():_0x4f1366['fileName'];this['_downloadFile'](_0x4fa4b1,_0x3464f6||'document.docx');});})['catch'](_0x18b06f=>{throw _0x40e779['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x18b06f;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0x23d4b4,_0x54ffaf){const _0x152019=document['createElement']('a');_0x152019['href']=window['URL']['createObjectURL'](_0x23d4b4),_0x152019['download']=_0x54ffaf,_0x152019['click'](),_0x152019['remove']();}}
|
package/src/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module export-word
|
|
7
|
-
*/
|
|
8
|
-
export { default as ExportWord, ExportWordConfig } from './exportword';
|
|
9
|
-
export type { default as ExportWordCommand } from './exportwordcommand';
|
|
10
|
-
import './augmentation';
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module export-word
|
|
7
|
+
*/
|
|
8
|
+
export { default as ExportWord, ExportWordConfig } from './exportword';
|
|
9
|
+
export type { default as ExportWordCommand } from './exportwordcommand';
|
|
10
|
+
import './augmentation';
|
package/src/utils.d.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
import type { Editor } from 'ckeditor5/src/core';
|
|
6
|
-
import type { Collection } from 'ckeditor5/src/utils';
|
|
7
|
-
import type { ExportWordConverterOptions, ExportWordConverterCommentsOption, ExportWordConverterSuggestionsOption } from './exportword';
|
|
8
|
-
import type { CommentThread } from '@ckeditor/ckeditor5-comments';
|
|
9
|
-
import type { SuggestionJSON } from '@ckeditor/ckeditor5-track-changes';
|
|
10
|
-
import type { User } from '@ckeditor/ckeditor5-collaboration-core';
|
|
11
|
-
/**
|
|
12
|
-
* A helper function for getting concatenated CSS rules from external stylesheets.
|
|
13
|
-
*
|
|
14
|
-
* @param stylesheets An array of stylesheet paths delivered by the user through the plugin configuration.
|
|
15
|
-
*/
|
|
16
|
-
export declare function getStyles(stylesheets?: Array<string>): Promise<string>;
|
|
17
|
-
/**
|
|
18
|
-
* A helper function for getting a proper options object containing
|
|
19
|
-
* comments, suggestions and the browser's timezone for the "Export to Word" converter.
|
|
20
|
-
*
|
|
21
|
-
* @param editor An editor instance.
|
|
22
|
-
*/
|
|
23
|
-
export declare function getConverterOptions(editor: Editor): ExportWordConverterOptions;
|
|
24
|
-
/**
|
|
25
|
-
* A helper function for getting a comments object for the converter options.
|
|
26
|
-
*
|
|
27
|
-
* @param threads The comment threads array.
|
|
28
|
-
*/
|
|
29
|
-
export declare function getComments(threads: Array<CommentThread>): ExportWordConverterCommentsOption;
|
|
30
|
-
/**
|
|
31
|
-
* A helper function for getting a suggestions object for the converter options.
|
|
32
|
-
*
|
|
33
|
-
* @param suggestions The suggestions array.
|
|
34
|
-
* @param users A list of all users in the editor.
|
|
35
|
-
*/
|
|
36
|
-
export declare function getSuggestions(suggestions: Array<SuggestionJSON>, users: Collection<User>): ExportWordConverterSuggestionsOption;
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
import type { Editor } from 'ckeditor5/src/core';
|
|
6
|
+
import type { Collection } from 'ckeditor5/src/utils';
|
|
7
|
+
import type { ExportWordConverterOptions, ExportWordConverterCommentsOption, ExportWordConverterSuggestionsOption } from './exportword';
|
|
8
|
+
import type { CommentThread } from '@ckeditor/ckeditor5-comments';
|
|
9
|
+
import type { SuggestionJSON } from '@ckeditor/ckeditor5-track-changes';
|
|
10
|
+
import type { User } from '@ckeditor/ckeditor5-collaboration-core';
|
|
11
|
+
/**
|
|
12
|
+
* A helper function for getting concatenated CSS rules from external stylesheets.
|
|
13
|
+
*
|
|
14
|
+
* @param stylesheets An array of stylesheet paths delivered by the user through the plugin configuration.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getStyles(stylesheets?: Array<string>): Promise<string>;
|
|
17
|
+
/**
|
|
18
|
+
* A helper function for getting a proper options object containing
|
|
19
|
+
* comments, suggestions and the browser's timezone for the "Export to Word" converter.
|
|
20
|
+
*
|
|
21
|
+
* @param editor An editor instance.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getConverterOptions(editor: Editor): ExportWordConverterOptions;
|
|
24
|
+
/**
|
|
25
|
+
* A helper function for getting a comments object for the converter options.
|
|
26
|
+
*
|
|
27
|
+
* @param threads The comment threads array.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getComments(threads: Array<CommentThread>): ExportWordConverterCommentsOption;
|
|
30
|
+
/**
|
|
31
|
+
* A helper function for getting a suggestions object for the converter options.
|
|
32
|
+
*
|
|
33
|
+
* @param suggestions The suggestions array.
|
|
34
|
+
* @param users A list of all users in the editor.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getSuggestions(suggestions: Array<SuggestionJSON>, users: Collection<User>): ExportWordConverterSuggestionsOption;
|
package/src/utils.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x3fad=['comments','getSuggestions','EDITOR_STYLES','resolvedOptions','timeZone','warn','isResolved','hasAttribute','data-cke','from','createdAt','cssText','CommentsRepository','get','trim','name','.ck-content','content','author','keys','authorId','map','length','getCommentThreads','styleSheets','indexOf','TrackChanges','push',':root','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.','join','text','then','suggestions','has','plugins','Users','fetch'];(function(_0x2e3237,_0x3fad2c){const _0x3b49b7=function(_0x41acc9){while(--_0x41acc9){_0x2e3237['push'](_0x2e3237['shift']());}};_0x3b49b7(++_0x3fad2c);}(_0x3fad,0x126));const _0x3b49=function(_0x2e3237,_0x3fad2c){_0x2e3237=_0x2e3237-0x0;let _0x3b49b7=_0x3fad[_0x2e3237];return _0x3b49b7;};export function getStyles(_0x13882d){if(!_0x13882d)return new Promise(_0x22b702=>_0x22b702(''));const _0x7e8ec2=[];for(const _0x395034 of _0x13882d)_0x3b49('0xc')!==_0x395034?_0x7e8ec2['push'](window[_0x3b49('0x9')](_0x395034)['then'](_0x2cc157=>_0x2cc157[_0x3b49('0x3')]())):_0x7e8ec2[_0x3b49('0x25')](u());return Promise['all'](_0x7e8ec2)[_0x3b49('0x4')](_0x5617e7=>_0x5617e7[_0x3b49('0x2')]('\x20')[_0x3b49('0x18')]());}function u(){const _0x4692d1=[],_0xfdc14=[];for(const _0x1c7995 of Array[_0x3b49('0x13')](document[_0x3b49('0x22')])){if(_0x1c7995['ownerNode'][_0x3b49('0x11')](_0x3b49('0x12')))for(const _0x350157 of Array['from'](_0x1c7995['cssRules']))-0x1!==_0x350157[_0x3b49('0x15')][_0x3b49('0x23')](_0x3b49('0x1a'))?_0x4692d1[_0x3b49('0x25')](_0x350157['cssText']):-0x1!==_0x350157[_0x3b49('0x15')]['indexOf'](_0x3b49('0x0'))&&_0xfdc14[_0x3b49('0x25')](_0x350157['cssText']);}return _0x4692d1[_0x3b49('0x20')]||console[_0x3b49('0xf')](_0x3b49('0x1')),[..._0xfdc14,..._0x4692d1][_0x3b49('0x2')]('\x20')[_0x3b49('0x18')]();}export function getConverterOptions(_0x295ded){const _0x14930c=_0x295ded['plugins'][_0x3b49('0x6')](_0x3b49('0x8')),_0x31f882=_0x295ded[_0x3b49('0x7')][_0x3b49('0x6')](_0x3b49('0x16')),_0x38d140=_0x295ded[_0x3b49('0x7')][_0x3b49('0x6')](_0x3b49('0x24')),_0x5728fc={};if(_0x14930c&&_0x31f882){const _0x4b3e70=getComments(_0x295ded['plugins'][_0x3b49('0x17')](_0x3b49('0x16'))[_0x3b49('0x21')]({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object[_0x3b49('0x1d')](_0x4b3e70)[_0x3b49('0x20')]&&(_0x5728fc['comments']=_0x4b3e70);}if(_0x14930c&&_0x38d140){const _0x2ffcbc=_0x295ded['plugins'][_0x3b49('0x17')](_0x3b49('0x24')),_0x7a1529=_0x295ded['plugins']['get']('Users'),_0x423736=getSuggestions(_0x2ffcbc[_0x3b49('0xb')]({'toJSON':!0x0}),_0x7a1529['users']);Object[_0x3b49('0x1d')](_0x423736)[_0x3b49('0x20')]&&(_0x5728fc[_0x3b49('0x5')]=_0x423736);}return(_0x5728fc['suggestions']||_0x5728fc[_0x3b49('0xa')])&&(_0x5728fc['timezone']=new Intl['DateTimeFormat']()[_0x3b49('0xd')]()[_0x3b49('0xe')]),_0x5728fc;}export function getComments(_0x5ca638){const _0x3f769e={};if(!_0x5ca638[_0x3b49('0x20')])return _0x3f769e;for(const _0x4cf43d of _0x5ca638)_0x4cf43d[_0x3b49('0xa')][_0x3b49('0x1f')](_0x1d04fe=>{void 0x0===_0x3f769e[_0x4cf43d['id']]&&(_0x3f769e[_0x4cf43d['id']]=[]),_0x3f769e[_0x4cf43d['id']][_0x3b49('0x25')]({'author':_0x1d04fe[_0x3b49('0x1c')]['name'],'content':_0x1d04fe[_0x3b49('0x1b')],'created':_0x1d04fe['createdAt'],'is_resolved':_0x4cf43d[_0x3b49('0x10')]});});return _0x3f769e;}export function getSuggestions(_0x424412,_0x143933){const _0x23af58={};if(!_0x424412['length']||!_0x143933[_0x3b49('0x20')])return _0x23af58;for(const _0x27afda of _0x424412)_0x23af58[_0x27afda['id']]={'author':_0x143933['get'](_0x27afda[_0x3b49('0x1e')])[_0x3b49('0x19')],'created':_0x27afda[_0x3b49('0x14')]};return _0x23af58;}
|