@ckeditor/ckeditor5-import-word
Version:
Import from Word feature for CKEditor 5.
23 lines • 9.48 kB
JavaScript
/*
* Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
*
*
*
*
* +---------------------------------------------------------------------------------+
* | |
* | Hello stranger! |
* | |
* | |
* | What you're currently looking at is the source code of a legally protected, |
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
* | are forbidden and will result in legal consequences. |
* | |
* | |
* +---------------------------------------------------------------------------------+
*
*
*
*
*/
const _0x24f20b=_0x129d;(function(_0x218b55,_0x51b7be){const _0x354b2a=_0x129d,_0x439739=_0x218b55();while(!![]){try{const _0x1bedf8=-parseInt(_0x354b2a(0x160))/0x1*(parseInt(_0x354b2a(0x15e))/0x2)+parseInt(_0x354b2a(0x143))/0x3+parseInt(_0x354b2a(0x181))/0x4+-parseInt(_0x354b2a(0x13a))/0x5*(parseInt(_0x354b2a(0x14e))/0x6)+parseInt(_0x354b2a(0x14b))/0x7*(-parseInt(_0x354b2a(0x17c))/0x8)+-parseInt(_0x354b2a(0x196))/0x9*(-parseInt(_0x354b2a(0x16b))/0xa)+parseInt(_0x354b2a(0x149))/0xb*(-parseInt(_0x354b2a(0x19d))/0xc);if(_0x1bedf8===_0x51b7be)break;else _0x439739['push'](_0x439739['shift']());}catch(_0x5de1ec){_0x439739['push'](_0x439739['shift']());}}}(_0x1af3,0xbd5c7));import{Command as _0x35b6d2}from'ckeditor5/src/core.js';import{Range as _0x47a0ea}from'ckeditor5/src/engine.js';import{logWarning as _0xb81e5f,logError as _0x106300,first as _0x14ad72,uid as _0x32e8b3}from'ckeditor5/src/utils.js';function _0x129d(_0x6fb561,_0x50dd6d){const _0x1af336=_0x1af3();return _0x129d=function(_0x129d52,_0x5e4f66){_0x129d52=_0x129d52-0x137;let _0x3f651a=_0x1af336[_0x129d52];return _0x3f651a;},_0x129d(_0x6fb561,_0x50dd6d);}function _0x1af3(){const _0x4e3788=['paragraph','view','isEmpty','_handleImportResponse','set','25528vDFHHf','locale','abort','stopListening','html','3211276tMqwyy','import-word-plugin-import-cancelled','ImportWordEditing','execute','has','An\x20error\x20occurred\x20while\x20importing\x20the\x20Word\x20file.','importWord:','importWord','root','createBatch','DateTimeFormat','model','MergeFields','schema','position','mergeFields','getSelectedBlocks','editing','resolve','isAtStart','deleteContent','140823tsTHad','removeMarker','formatting','editor','setData','setSelection','headers','80556SYimKk','_abortController','checkChild','POST','refresh','createPositionAfter','25WMpaMR','catch','json','_checkEnabled','getFirstPosition','_cleanUpAfterImport','timeZone','isEnabled','_prepareForImport','3465342yZLwPq','isBusy','createPositionBefore','reject','_sendImportRequest','enqueueChange','253dUCjvf','$graveyard','2569TRbRBh','parent','split','1185210lrTdng','signal','getRange','Notification','low','document','showWarning','_importMarker','import-word-plugin-conversion-failed','then','getToken','plugins','dataInsert','get','change:range','config','2148OLtaPU','isAtEnd','98gKOGXD','file','aborted','rootName','selection','converterUrl','clipboardInput','stringify','text/html','finally','isCollapsed','790wgyoLE','fire','value','markers','_handleImportFailure','Authorization','_undoStepBatch','element','addMarker','resolvedOptions','bind','merge_fields'];_0x1af3=function(){return _0x4e3788;};return _0x1af3();}import{getTranslation as _0x551e47}from'./utils/common-translations.js';export default class d extends _0x35b6d2{[_0x24f20b(0x155)];[_0x24f20b(0x171)];[_0x24f20b(0x19e)];constructor(_0x2467cd){const _0xbc99cf=_0x24f20b;super(_0x2467cd),this[_0xbc99cf(0x17b)](_0xbc99cf(0x144),!0x1),this[_0xbc99cf(0x155)]=null,this[_0xbc99cf(0x171)]=null,this[_0xbc99cf(0x19e)]=null,this['on'](_0xbc99cf(0x15a),(_0x36a9c2,_0x51d0a3)=>{const _0x1d07a0=_0xbc99cf,_0x3d3528=new DataTransfer();_0x3d3528[_0x1d07a0(0x19a)](_0x1d07a0(0x168),_0x51d0a3[_0x1d07a0(0x180)]);const _0x5bb354=this[_0x1d07a0(0x155)][_0x1d07a0(0x150)]();this[_0x1d07a0(0x199)][_0x1d07a0(0x18c)][_0x1d07a0(0x148)](this[_0x1d07a0(0x171)],_0x224698=>{const _0x4b05e8=_0x1d07a0;this[_0x4b05e8(0x155)][_0x4b05e8(0x17f)](),_0x224698[_0x4b05e8(0x19b)](_0x5bb354),_0x2467cd[_0x4b05e8(0x192)][_0x4b05e8(0x178)][_0x4b05e8(0x153)][_0x4b05e8(0x16c)](_0x4b05e8(0x166),{'dataTransfer':_0x3d3528});});},{'priority':_0xbc99cf(0x152)});}[_0x24f20b(0x138)](){const _0x115af1=_0x24f20b;this[_0x115af1(0x141)]=this[_0x115af1(0x13d)]();}[_0x24f20b(0x184)](_0x365abf,_0x597b62={}){const _0x5ba16c=_0x24f20b;if(this[_0x5ba16c(0x144)])return Promise[_0x5ba16c(0x193)]();const _0x5469f2=this[_0x5ba16c(0x199)][_0x5ba16c(0x15d)][_0x5ba16c(0x15b)](_0x5ba16c(0x188));if(this[_0x5ba16c(0x199)][_0x5ba16c(0x159)][_0x5ba16c(0x185)](_0x5ba16c(0x18d))){const {prefix:_0x50080f,suffix:_0x4f771c}=this[_0x5ba16c(0x199)][_0x5ba16c(0x15d)][_0x5ba16c(0x15b)](_0x5ba16c(0x190));_0x597b62[_0x5ba16c(0x176)]={'prefix':_0x50080f,'suffix':_0x4f771c};}const _0x9e106c={'url':_0x5469f2[_0x5ba16c(0x165)],'file':_0x365abf,'serviceConfig':{..._0x597b62,'formatting':_0x5469f2[_0x5ba16c(0x198)],'timezone':new Intl[(_0x5ba16c(0x18b))]()[_0x5ba16c(0x174)]()[_0x5ba16c(0x140)]}};return this[_0x5ba16c(0x142)](),this[_0x5ba16c(0x147)](_0x9e106c)[_0x5ba16c(0x157)](this[_0x5ba16c(0x17a)][_0x5ba16c(0x175)](this))[_0x5ba16c(0x13b)](this[_0x5ba16c(0x16f)][_0x5ba16c(0x175)](this))[_0x5ba16c(0x169)](this[_0x5ba16c(0x13f)][_0x5ba16c(0x175)](this));}[_0x24f20b(0x13d)](){const _0x5a0b10=_0x24f20b;if(this[_0x5a0b10(0x144)])return!0x1;const _0x223cb9=this[_0x5a0b10(0x199)][_0x5a0b10(0x18c)],_0xe793b1=_0x223cb9[_0x5a0b10(0x18e)],_0x149ff3=_0x223cb9[_0x5a0b10(0x153)][_0x5a0b10(0x164)],_0x3829af=_0x14ad72(_0x149ff3[_0x5a0b10(0x191)]());return!!_0x3829af&&_0xe793b1[_0x5a0b10(0x19f)](_0x3829af[_0x5a0b10(0x14c)],_0x5a0b10(0x177));}[_0x24f20b(0x142)](){const _0x3945af=_0x24f20b,_0x3f5e33=this[_0x3945af(0x199)],_0x139125=_0x3f5e33[_0x3945af(0x18c)],_0x169fbc=_0x139125[_0x3945af(0x153)][_0x3945af(0x164)];this[_0x3945af(0x19e)]=new AbortController(),this[_0x3945af(0x171)]=_0x3f5e33[_0x3945af(0x18c)][_0x3945af(0x18a)]({'isUndoable':!0x0}),_0x139125[_0x3945af(0x148)](this[_0x3945af(0x171)],_0x4b40be=>{const _0x49fe80=_0x3945af;_0x169fbc[_0x49fe80(0x16a)]||_0x139125[_0x49fe80(0x195)](_0x169fbc,{'leaveUnmerged':!0x0});const _0x1208ae=_0x169fbc[_0x49fe80(0x13e)](),_0x3b833e=_0x14ad72(_0x169fbc[_0x49fe80(0x191)]());let _0x4c9cbb;_0x4c9cbb=_0x3b833e['is'](_0x49fe80(0x172),_0x49fe80(0x177))&&_0x3b833e[_0x49fe80(0x179)]?_0x1208ae:_0x1208ae[_0x49fe80(0x194)]?_0x139125[_0x49fe80(0x145)](_0x3b833e):_0x1208ae[_0x49fe80(0x15f)]?_0x139125[_0x49fe80(0x139)](_0x3b833e):_0x4b40be[_0x49fe80(0x14d)](_0x1208ae)[_0x49fe80(0x18f)],this[_0x49fe80(0x155)]=_0x4b40be[_0x49fe80(0x173)](_0x49fe80(0x187)+_0x32e8b3(),{'usingOperation':!0x1,'affectsData':!0x1,'range':new _0x47a0ea(_0x4c9cbb)}),this[_0x49fe80(0x155)]['on'](_0x49fe80(0x15c),()=>{const _0x30d9d3=_0x49fe80;_0x30d9d3(0x14a)===this[_0x30d9d3(0x155)][_0x30d9d3(0x150)]()[_0x30d9d3(0x189)][_0x30d9d3(0x163)]&&this[_0x30d9d3(0x19e)][_0x30d9d3(0x17e)]();});}),this[_0x3945af(0x144)]=!0x0,this[_0x3945af(0x138)]();}[_0x24f20b(0x13f)](){const _0x17f874=_0x24f20b,_0x52e666=this[_0x17f874(0x199)][_0x17f874(0x18c)];_0x52e666[_0x17f874(0x16e)][_0x17f874(0x185)](this[_0x17f874(0x155)])&&_0x52e666[_0x17f874(0x148)](this[_0x17f874(0x171)],_0x3ef8d3=>{const _0x17790d=_0x17f874;_0x3ef8d3[_0x17790d(0x197)](this[_0x17790d(0x155)]);}),this[_0x17f874(0x155)]=null,this[_0x17f874(0x171)]=null,this[_0x17f874(0x19e)]=null,this[_0x17f874(0x144)]=!0x1,this[_0x17f874(0x138)]();}[_0x24f20b(0x147)]({url:_0x1bf023,file:_0x4373f8,serviceConfig:_0x3d420a}){const _0x3fddde=_0x24f20b,_0x5d7ed8=this[_0x3fddde(0x199)][_0x3fddde(0x159)][_0x3fddde(0x15b)](_0x3fddde(0x183))[_0x3fddde(0x158)](),_0x9f7587=new FormData();_0x9f7587[_0x3fddde(0x17b)](_0x3fddde(0x15d),JSON[_0x3fddde(0x167)](_0x3d420a)),_0x9f7587[_0x3fddde(0x17b)](_0x3fddde(0x161),_0x4373f8);const _0x4a8909={'method':_0x3fddde(0x137),'headers':{},'body':_0x9f7587,'signal':this[_0x3fddde(0x19e)][_0x3fddde(0x14f)]};return _0x5d7ed8&&(_0x4a8909[_0x3fddde(0x19c)][_0x3fddde(0x170)]=_0x5d7ed8[_0x3fddde(0x16d)]),fetch(_0x1bf023,_0x4a8909);}[_0x24f20b(0x17a)](_0x9b3eaa){const _0x230e39=_0x24f20b;return _0x9b3eaa['ok']?_0x9b3eaa[_0x230e39(0x13c)]()[_0x230e39(0x157)](_0x302c88=>{const _0x5219c6=_0x230e39;if(!this[_0x5219c6(0x199)][_0x5219c6(0x18c)][_0x5219c6(0x16e)][_0x5219c6(0x185)](this[_0x5219c6(0x155)]))return;_0x5219c6(0x14a)!==this[_0x5219c6(0x155)][_0x5219c6(0x150)]()[_0x5219c6(0x189)][_0x5219c6(0x163)]&&this[_0x5219c6(0x16c)](_0x5219c6(0x15a),_0x302c88);}):Promise[_0x230e39(0x146)]();}[_0x24f20b(0x16f)](){const _0x4148fa=_0x24f20b;if(this[_0x4148fa(0x19e)][_0x4148fa(0x14f)][_0x4148fa(0x162)])return void _0xb81e5f(_0x4148fa(0x182));const _0x32efb1=this[_0x4148fa(0x199)],_0x5cce14=_0x551e47(_0x32efb1[_0x4148fa(0x17d)],_0x4148fa(0x186));_0x32efb1[_0x4148fa(0x159)][_0x4148fa(0x15b)](_0x4148fa(0x151))[_0x4148fa(0x154)](_0x5cce14),_0x106300(_0x4148fa(0x156));}}