UNPKG

@ckeditor/ckeditor5-import-word

Version:

Import from Word feature for CKEditor 5.

5 lines • 12.1 kB
!function(t){const r=t.en=t.en||{};r.dictionary=Object.assign(r.dictionary||{},{"An error occurred while importing the Word file.":"An error occurred while importing the Word file.","Import from Word":"Import from Word","Importing Word document":"Importing Word document"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})), /*! * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved. * For licensing, see LICENSE.md. */(()=>{var t={237:t=>{"use strict";t.exports=CKEditor5.dll},311:(t,r,e)=>{t.exports=e(237)("./src/ui.js")},331:(t,r,e)=>{t.exports=e(237)("./src/clipboard.js")},584:(t,r,e)=>{t.exports=e(237)("./src/utils.js")},782:(t,r,e)=>{t.exports=e(237)("./src/core.js")},783:(t,r,e)=>{t.exports=e(237)("./src/engine.js")}},r={};function e(n){var i=r[n];if(void 0!==i)return i.exports;var o=r[n]={exports:{}};return t[n](o,o.exports,e),o.exports}e.d=(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},e.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r),e.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";e.r(n),e.d(n,{ImportWord:()=>x,ImportWordEditing:()=>w,ImportWordUI:()=>c});var t=e(782),r=e(311);function i(t,r){const e=t.t;switch(r){case"Import from Word":return e("Import from Word");case"An error occurred while importing the Word file.":return e("An error occurred while importing the Word file.");case"Importing Word document":return e("Importing Word document");default:return r}}const o=s;function s(t,r){const e=a();return(s=function(t,r){return e[t-=238]})(t,r)}function a(){const t=["Importing Word document","isOfficialPlugin","set","isBusy","814989EIBLXb","1134300FdEmhV","ImportWordUI","1832GhRFxy","1049160ygWPOi","editor","view","486212OIhBum","execute","tooltip","application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.wordprocessingml.template","focus","4383BoSyHv","editing","menuBar:importWord","pluginName","21176VPzPtQ","isPremiumPlugin","isVisible","_createButton","isOn","children","bind","componentFactory","locale","isEnabled","get","done","44691nFEIBr","9sxpwRW","Import from Word","commands","init","add","importWord","iconView","label"];return(a=function(){return t})()}!function(t){const r=s,e=t();for(;;)try{if(118602===parseInt(r(265))/1+parseInt(r(253))/2*(-parseInt(r(266))/3)+parseInt(r(244))/4+-parseInt(r(241))/5+parseInt(r(238))/6+parseInt(r(278))/7+-parseInt(r(240))/8*(parseInt(r(249))/9))break;e.push(e.shift())}catch(t){e.push(e.shift())}}(a);class c extends t.Plugin{static get[o(252)](){return o(239)}static get[o(275)](){return!0}static get[o(254)](){return!0}[o(269)](){const t=o,e=this[t(242)];e.ui[t(260)][t(270)](t(271),(()=>{const n=t,i=this[n(256)](r.FileDialogButtonView),o=e[n(268)][n(263)](n(271));return i[n(259)](n(257)).to(o,n(277)),i[n(246)]=!0,i})),e.ui[t(260)][t(270)](t(251),(()=>this[t(256)](r.MenuBarMenuListItemFileDialogButtonView)))}[o(256)](t){const e=o,n=this[e(242)],s=n[e(268)][e(263)](e(271)),a=new t(n[e(261)]),c=new r.SpinnerView;return a[e(276)]({acceptedType:e(247)}),a[e(276)]({icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m14 0 5 4.5v8.892l-1.5-1.8V6.5h-5v-5h-8v3H3V0h11Zm0 2v3h3.3L14 2Z"/><path d="M10.74 18a2.76 2.76 0 0 1-.469-.5H3V19h9.25v-.374A2.737 2.737 0 0 1 10.74 18Z"/><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.602.602 0 0 0 1.032 0l.043-.09 1.554-4 .028-.093a.6.6 0 0 0-1.104-.43v.001ZM11.674 15.407a.75.75 0 1 0 1.152.96L14 14.96V20h1.5v-5.04l1.174 1.408a.75.75 0 1 0 1.152-.96l-2.346-2.816a.95.95 0 0 0-1.46 0l-2.346 2.815Z"/></svg>\n'}),a[e(259)](e(262)).to(s),a[e(259)](e(273)).to(s,e(277),(t=>i(n[e(261)],e(t?274:267)))),c[e(259)](e(255)).to(s,e(277)),a[e(272)][e(259)](e(255)).to(s,e(277),(t=>!t)),a[e(258)][e(270)](c),a.on(e(264),((t,r)=>{const i=e;n[i(245)](i(271),r[0],{}),n[i(250)][i(243)][i(248)]()})),a}}var u=e(331),p=e(783),l=e(584);function d(){const t=["finally","rootName","bind","MergeFields","stringify","low","import-word-plugin-conversion-failed","_abortController","isAtEnd","merge_fields","2536DtfURe","setSelection","1403076dBDczo","paragraph","_cleanUpAfterImport","split","getRange","isBusy","change:range","stopListening","getFirstPosition","removeMarker","plugins","3017272TcpdZg","markers","getSelectedBlocks","aborted","78096dAtNmS","Authorization","deleteContent","385076LvqIYc","DateTimeFormat","_undoStepBatch","selection","file","_sendImportRequest","set","_prepareForImport","Notification","html","locale","setData","import-word-plugin-import-cancelled","editing","parent","has","model","_importMarker","mergeFields","text/html","config","fire","9SAsOVI","getToken","json","editor","createBatch","createPositionBefore","resolve","importWord","root","headers","converterUrl","reject","element","catch","showWarning","signal","abort","then","ImportWordEditing","position","isEnabled","isEmpty","createPositionAfter","_handleImportResponse","POST","1471779NHvMKk","clipboardInput","An error occurred while importing the Word file.","50wQhCar","$graveyard","121PxhXMy","2953190CqTqMa","addMarker","value","view","formatting","_checkEnabled","timeZone","enqueueChange","importWord:","execute","isAtStart","_handleImportFailure","refresh","document","checkChild","dataInsert","isCollapsed","get","5erFevR","133yGaYIH","resolvedOptions","schema"];return(d=function(){return t})()}const h=f;function f(t,r){const e=d();return(f=function(t,r){return e[t-=195]})(t,r)}!function(t){const r=f,e=t();for(;;)try{if(283891===parseInt(r(197))/1*(parseInt(r(232))/2)+parseInt(r(299))/3+-parseInt(r(252))/4*(-parseInt(r(218))/5)+-parseInt(r(249))/6*(-parseInt(r(219))/7)+parseInt(r(245))/8*(parseInt(r(274))/9)+parseInt(r(200))/10+-parseInt(r(199))/11*(parseInt(r(234))/12))break;e.push(e.shift())}catch(t){e.push(e.shift())}}(d);class m extends t.Command{constructor(t){const r=f;super(t),this[r(258)](r(239),!1),this[r(269)]=null,this[r(254)]=null,this[r(229)]=null,this.on(r(215),((e,n)=>{const i=r,o=new DataTransfer;o[i(263)](i(271),n[i(261)]);const s=this[i(269)][i(238)]();this[i(277)][i(268)][i(207)](this[i(254)],(r=>{const e=i;this[e(269)][e(241)](),r[e(233)](s),t[e(265)][e(203)][e(213)][e(273)](e(195),{dataTransfer:o})}))}),{priority:r(227)})}[h(212)](){const t=h;this[t(294)]=this[t(205)]()}[h(209)](t,r={}){const e=h;if(this[e(239)])return Promise[e(280)]();const n=this[e(277)][e(272)][e(217)](e(281));if(this[e(277)][e(244)][e(267)](e(225))){const{prefix:t,suffix:n}=this[e(277)][e(272)][e(217)](e(270));r[e(231)]={prefix:t,suffix:n}}const i={url:n[e(284)],file:t,serviceConfig:{...r,formatting:n[e(204)],timezone:(new(Intl[e(253)]))[e(220)]()[e(206)]}};return this[e(259)](),this[e(257)](i)[e(291)](this[e(297)][e(224)](this))[e(287)](this[e(211)][e(224)](this))[e(222)](this[e(236)][e(224)](this))}[h(205)](){const t=h;if(this[t(239)])return!1;const r=this[t(277)][t(268)],e=r[t(221)],n=r[t(213)][t(255)],i=(0,l.first)(n[t(247)]());return!!i&&e[t(214)](i[t(266)],t(235))}[h(259)](){const t=h,r=this[t(277)],e=r[t(268)],n=e[t(213)][t(255)];this[t(229)]=new AbortController,this[t(254)]=r[t(268)][t(278)]({isUndoable:!0}),e[t(207)](this[t(254)],(r=>{const i=t;n[i(216)]||e[i(251)](n,{leaveUnmerged:!0});const o=n[i(242)](),s=(0,l.first)(n[i(247)]());let a;a=s.is(i(286),i(235))&&s[i(295)]?o:o[i(210)]?e[i(279)](s):o[i(230)]?e[i(296)](s):r[i(237)](o)[i(293)],this[i(269)]=r[i(201)](i(208)+(0,l.uid)(),{usingOperation:!1,affectsData:!1,range:new p.Range(a)}),this[i(269)].on(i(240),(()=>{const t=i;t(198)===this[t(269)][t(238)]()[t(282)][t(223)]&&this[t(229)][t(290)]()}))})),this[t(239)]=!0,this[t(212)]()}[h(236)](){const t=h,r=this[t(277)][t(268)];r[t(246)][t(267)](this[t(269)])&&r[t(207)](this[t(254)],(r=>{const e=t;r[e(243)](this[e(269)])})),this[t(269)]=null,this[t(254)]=null,this[t(229)]=null,this[t(239)]=!1,this[t(212)]()}[h(257)]({url:t,file:r,serviceConfig:e}){const n=h,i=this[n(277)][n(244)][n(217)](n(292))[n(275)](),o=new FormData;o[n(258)](n(272),JSON[n(226)](e)),o[n(258)](n(256),r);const s={method:n(298),headers:{},body:o,signal:this[n(229)][n(289)]};return i&&(s[n(283)][n(250)]=i[n(202)]),fetch(t,s)}[h(297)](t){const r=h;return t.ok?t[r(276)]()[r(291)]((t=>{const e=r;this[e(277)][e(268)][e(246)][e(267)](this[e(269)])&&e(198)!==this[e(269)][e(238)]()[e(282)][e(223)]&&this[e(273)](e(215),t)})):Promise[r(285)]()}[h(211)](){const t=h;if(this[t(229)][t(289)][t(248)])return void(0,l.logWarning)(t(264));const r=this[t(277)],e=i(r[t(262)],t(196));r[t(244)][t(217)](t(260))[t(288)](e),(0,l.logError)(t(228))}}const g=I;function I(t,r){const e=v();return(I=function(t,r){return e[t-=176]})(t,r)}function v(){const t=["CloudServices","requires","editor","tokenUrl","966kGAbLd","config","3840570bDvHsQ","add","define","75114NjnTFN","get","40dWBYAi","getToken","ImportWordEditing","token","registerTokenUrl","1108366AQazJn","init","37895KdnSOA","isPremiumPlugin","4782hnyHvw","pluginName","8370774tfeUQQ","1234512vyKNuu","isOfficialPlugin","importWord","cloudServices","plugins","https://docx-converter.cke-cs.com/v2/convert/docx-html","commands","inline","none","1568TfCIlF","_token"];return(v=function(){return t})()}!function(t){const r=I,e=t();for(;;)try{if(619452===parseInt(r(181))/1+parseInt(r(195))/2+-parseInt(r(192))/3*(-parseInt(r(204))/4)+parseInt(r(190))/5*(-parseInt(r(176))/6)+parseInt(r(188))/7*(-parseInt(r(183))/8)+parseInt(r(194))/9+parseInt(r(178))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}(v);class w extends t.Plugin{static get[g(193)](){return g(185)}static get[g(196)](){return!0}static get[g(191)](){return!0}static get[g(207)](){const t=g;return[r.Notification,u.ClipboardPipeline,t(206)]}constructor(t){const r=g;super(t),this[r(205)]=null}async[g(189)](){const t=g,r=this[t(208)];r[t(177)][t(180)](t(197),{converterUrl:t(200),tokenUrl:(r[t(177)][t(182)](t(198))||{})[t(209)],formatting:{resets:t(203),defaults:t(203),styles:t(202)}}),r[t(201)][t(179)](t(197),new m(r));const{tokenUrl:e}=r[t(177)][t(182)](t(197));if(e){const{tokenUrl:n}=r[t(177)][t(182)](t(198))||{};this[t(205)]=e===n?r[t(199)][t(182)](t(206))[t(186)]:await r[t(199)][t(182)](t(206))[t(187)](e)}}[g(184)](){return this[g(205)]}}function W(){var t=["5375765wMIGqm","isOfficialPlugin","ImportWord","isPremiumPlugin","1104392AFXlbb","54TTZRnG","512PWkNTR","pluginName","1182979NpiIvM","3733674HxFkOK","991204kuVKIH","requires","222930qTeASo","684651CWtZDp"];return(W=function(){return t})()}var b=y;function y(t,r){var e=W();return(y=function(t,r){return e[t-=250]})(t,r)}!function(t){for(var r=y,e=t();;)try{if(770756===-parseInt(r(258))/1+-parseInt(r(263))/2+parseInt(r(254))/3+-parseInt(r(255))/4+parseInt(r(259))/5+-parseInt(r(250))/6*(-parseInt(r(253))/7)+-parseInt(r(251))/8*(parseInt(r(257))/9))break;e.push(e.shift())}catch(t){e.push(e.shift())}}(W);class x extends t.Plugin{static get[b(252)](){return b(261)}static get[b(260)](){return!0}static get[b(262)](){return!0}static get[b(256)](){return[w,c]}}function k(t,r){var e=P();return(k=function(t,r){return e[t-=136]})(t,r)}function P(){var t=["79056PiUrgf","1031512AUfhZp","117CxodVv","1260896FQCoWD","56361rXZaib","148137aZSiHu","11zoBdeE","10blWLpY","48942QGfkWk","95ajWMmh","5540560oCZBpr"];return(P=function(){return t})()}!function(t){for(var r=k,e=t();;)try{if(160689===parseInt(r(138))/1+-parseInt(r(141))/2*(-parseInt(r(139))/3)+parseInt(r(146))/4+-parseInt(r(143))/5*(parseInt(r(142))/6)+parseInt(r(137))/7+parseInt(r(145))/8*(parseInt(r(136))/9)+-parseInt(r(144))/10*(parseInt(r(140))/11))break;e.push(e.shift())}catch(t){e.push(e.shift())}}(P)})(),(window.CKEditor5=window.CKEditor5||{}).importWord=n})();