UNPKG

@ckeditor/ckeditor5-import-word

Version:

Import from Word feature for CKEditor 5.

23 lines • 9.45 kB
/* * 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. | * | | * | | * +---------------------------------------------------------------------------------+ * * * * */ function _0x44a2(){const _0x490108=['fire','refresh','_handleImportFailure','_prepareForImport','DateTimeFormat','120622UtHCrm','editing','3176943uNAQgn','showWarning','Notification','MergeFields','root','removeMarker','html','importWord:','split','57xPRIbR','get','isEnabled','getSelectedBlocks','then','paragraph','isAtStart','finally','view','change:range','formatting','catch','_undoStepBatch','clipboardInput','element','dataInsert','stringify','document','rootName','text/html','isEmpty','$graveyard','stopListening','_sendImportRequest','10BRlsJo','selection','getRange','deleteContent','An\x20error\x20occurred\x20while\x20importing\x20the\x20Word\x20file.','createPositionBefore','678419ivGdxV','json','set','isBusy','getFirstPosition','plugins','file','Authorization','timeZone','setData','bind','has','position','16qmsaLQ','locale','addMarker','getToken','merge_fields','execute','setSelection','createPositionAfter','value','_cleanUpAfterImport','_abortController','_importMarker','import-word-plugin-import-cancelled','model','603003xIkIfv','parent','createBatch','abort','2444355sEhRkE','config','checkChild','converterUrl','POST','resolve','reject','_checkEnabled','5335968sNCXOf','460CsvnBZ','low','ImportWordEditing','signal','import-word-plugin-conversion-failed','markers','_handleImportResponse','isCollapsed','aborted','isAtEnd','importWord','editor','enqueueChange','resolvedOptions','mergeFields','20915yBshah','headers','schema'];_0x44a2=function(){return _0x490108;};return _0x44a2();}const _0xdbc540=_0x1232;(function(_0x29e365,_0x5abcf2){const _0x233ba4=_0x1232,_0x2f50dd=_0x29e365();while(!![]){try{const _0x1b4d96=parseInt(_0x233ba4(0x1c1))/0x1+-parseInt(_0x233ba4(0x17d))/0x2*(-parseInt(_0x233ba4(0x188))/0x3)+-parseInt(_0x233ba4(0x166))/0x4*(-parseInt(_0x233ba4(0x175))/0x5)+-parseInt(_0x233ba4(0x165))/0x6+parseInt(_0x233ba4(0x1a6))/0x7*(-parseInt(_0x233ba4(0x1b3))/0x8)+parseInt(_0x233ba4(0x1c5))/0x9*(-parseInt(_0x233ba4(0x1a0))/0xa)+-parseInt(_0x233ba4(0x17f))/0xb;if(_0x1b4d96===_0x5abcf2)break;else _0x2f50dd['push'](_0x2f50dd['shift']());}catch(_0x257fdc){_0x2f50dd['push'](_0x2f50dd['shift']());}}}(_0x44a2,0x8f293));import{Command as _0x5b25be}from'ckeditor5/src/core.js';import{ModelRange as _0x29d3f5}from'ckeditor5/src/engine.js';import{logWarning as _0x361894,logError as _0x1d8141,first as _0x567c10,uid as _0x2a4f34}from'ckeditor5/src/utils.js';import{getTranslation as _0x5e93b8}from'./utils/common-translations.js';function _0x1232(_0x40486b,_0x1150f9){const _0x44a2b8=_0x44a2();return _0x1232=function(_0x12320d,_0x31ec9e){_0x12320d=_0x12320d-0x163;let _0x47402d=_0x44a2b8[_0x12320d];return _0x47402d;},_0x1232(_0x40486b,_0x1150f9);}export class ImportWordCommand extends _0x5b25be{[_0xdbc540(0x1be)];[_0xdbc540(0x194)];[_0xdbc540(0x1bd)];constructor(_0x37f89f){const _0x164014=_0xdbc540;super(_0x37f89f),this[_0x164014(0x1a8)](_0x164014(0x1a9),!0x1),this[_0x164014(0x1be)]=null,this[_0x164014(0x194)]=null,this[_0x164014(0x1bd)]=null,this['on'](_0x164014(0x197),(_0x276b0c,_0x776f2d)=>{const _0x34b525=_0x164014,_0x1a43ec=new DataTransfer();_0x1a43ec[_0x34b525(0x1af)](_0x34b525(0x19b),_0x776f2d[_0x34b525(0x185)]);const _0x3edf10=this[_0x34b525(0x1be)][_0x34b525(0x1a2)]();this[_0x34b525(0x171)][_0x34b525(0x1c0)][_0x34b525(0x172)](this[_0x34b525(0x194)],_0x118891=>{const _0x268716=_0x34b525;this[_0x268716(0x1be)][_0x268716(0x19e)](),_0x118891[_0x268716(0x1b9)](_0x3edf10),_0x37f89f[_0x268716(0x17e)][_0x268716(0x190)][_0x268716(0x199)][_0x268716(0x178)](_0x268716(0x195),{'dataTransfer':_0x1a43ec});});},{'priority':_0x164014(0x167)});}[_0xdbc540(0x179)](){const _0x3dd68d=_0xdbc540;this[_0x3dd68d(0x18a)]=this[_0x3dd68d(0x164)]();}[_0xdbc540(0x1b8)](_0x2668f3,_0x1ef8f7={}){const _0x316849=_0xdbc540;if(this[_0x316849(0x1a9)])return Promise[_0x316849(0x1ca)]();const _0xacba7b=this[_0x316849(0x171)][_0x316849(0x1c6)][_0x316849(0x189)](_0x316849(0x170));if(this[_0x316849(0x171)][_0x316849(0x1ab)][_0x316849(0x1b1)](_0x316849(0x182))){const {prefix:_0x3821db,suffix:_0x21fd40}=this[_0x316849(0x171)][_0x316849(0x1c6)][_0x316849(0x189)](_0x316849(0x174));_0x1ef8f7[_0x316849(0x1b7)]={'prefix':_0x3821db,'suffix':_0x21fd40};}const _0x49b48d={'url':_0xacba7b[_0x316849(0x1c8)],'file':_0x2668f3,'serviceConfig':{..._0x1ef8f7,'formatting':_0xacba7b[_0x316849(0x192)],'timezone':new Intl[(_0x316849(0x17c))]()[_0x316849(0x173)]()[_0x316849(0x1ae)]}};return this[_0x316849(0x17b)](),this[_0x316849(0x19f)](_0x49b48d)[_0x316849(0x18c)](this[_0x316849(0x16c)][_0x316849(0x1b0)](this))[_0x316849(0x193)](this[_0x316849(0x17a)][_0x316849(0x1b0)](this))[_0x316849(0x18f)](this[_0x316849(0x1bc)][_0x316849(0x1b0)](this));}[_0xdbc540(0x164)](){const _0x40219e=_0xdbc540;if(this[_0x40219e(0x1a9)])return!0x1;const _0x4e6ea5=this[_0x40219e(0x171)][_0x40219e(0x1c0)],_0x33fff8=_0x4e6ea5[_0x40219e(0x177)],_0xc8a124=_0x4e6ea5[_0x40219e(0x199)][_0x40219e(0x1a1)],_0x581594=_0x567c10(_0xc8a124[_0x40219e(0x18b)]());return!!_0x581594&&_0x33fff8[_0x40219e(0x1c7)](_0x581594[_0x40219e(0x1c2)],_0x40219e(0x18d));}[_0xdbc540(0x17b)](){const _0x5803bd=_0xdbc540,_0x9c1ea3=this[_0x5803bd(0x171)],_0x2574c4=_0x9c1ea3[_0x5803bd(0x1c0)],_0x59cf81=_0x2574c4[_0x5803bd(0x199)][_0x5803bd(0x1a1)];this[_0x5803bd(0x1bd)]=new AbortController(),this[_0x5803bd(0x194)]=_0x9c1ea3[_0x5803bd(0x1c0)][_0x5803bd(0x1c3)]({'isUndoable':!0x0}),_0x2574c4[_0x5803bd(0x172)](this[_0x5803bd(0x194)],_0x2dc2f1=>{const _0x52a63a=_0x5803bd;_0x59cf81[_0x52a63a(0x16d)]||_0x2574c4[_0x52a63a(0x1a3)](_0x59cf81,{'leaveUnmerged':!0x0});const _0x1331fb=_0x59cf81[_0x52a63a(0x1aa)](),_0x3714cd=_0x567c10(_0x59cf81[_0x52a63a(0x18b)]());let _0x1e710d;_0x1e710d=_0x3714cd['is'](_0x52a63a(0x196),_0x52a63a(0x18d))&&_0x3714cd[_0x52a63a(0x19c)]?_0x1331fb:_0x1331fb[_0x52a63a(0x18e)]?_0x2574c4[_0x52a63a(0x1a5)](_0x3714cd):_0x1331fb[_0x52a63a(0x16f)]?_0x2574c4[_0x52a63a(0x1ba)](_0x3714cd):_0x2dc2f1[_0x52a63a(0x187)](_0x1331fb)[_0x52a63a(0x1b2)],this[_0x52a63a(0x1be)]=_0x2dc2f1[_0x52a63a(0x1b5)](_0x52a63a(0x186)+_0x2a4f34(),{'usingOperation':!0x1,'affectsData':!0x1,'range':new _0x29d3f5(_0x1e710d)}),this[_0x52a63a(0x1be)]['on'](_0x52a63a(0x191),()=>{const _0x1aa27e=_0x52a63a;_0x1aa27e(0x19d)===this[_0x1aa27e(0x1be)][_0x1aa27e(0x1a2)]()[_0x1aa27e(0x183)][_0x1aa27e(0x19a)]&&this[_0x1aa27e(0x1bd)][_0x1aa27e(0x1c4)]();});}),this[_0x5803bd(0x1a9)]=!0x0,this[_0x5803bd(0x179)]();}[_0xdbc540(0x1bc)](){const _0x479939=_0xdbc540,_0x177bc4=this[_0x479939(0x171)][_0x479939(0x1c0)];_0x177bc4[_0x479939(0x16b)][_0x479939(0x1b1)](this[_0x479939(0x1be)])&&_0x177bc4[_0x479939(0x172)](this[_0x479939(0x194)],_0x476bca=>{const _0x4904bf=_0x479939;_0x476bca[_0x4904bf(0x184)](this[_0x4904bf(0x1be)]);}),this[_0x479939(0x1be)]=null,this[_0x479939(0x194)]=null,this[_0x479939(0x1bd)]=null,this[_0x479939(0x1a9)]=!0x1,this[_0x479939(0x179)]();}[_0xdbc540(0x19f)]({url:_0x58e481,file:_0x486032,serviceConfig:_0x197a0b}){const _0x2fc45d=_0xdbc540,_0x7be898=this[_0x2fc45d(0x171)][_0x2fc45d(0x1ab)][_0x2fc45d(0x189)](_0x2fc45d(0x168))[_0x2fc45d(0x1b6)](),_0x1f91b2=new FormData();_0x1f91b2[_0x2fc45d(0x1a8)](_0x2fc45d(0x1c6),JSON[_0x2fc45d(0x198)](_0x197a0b)),_0x1f91b2[_0x2fc45d(0x1a8)](_0x2fc45d(0x1ac),_0x486032);const _0x30fd6a={'method':_0x2fc45d(0x1c9),'headers':{},'body':_0x1f91b2,'signal':this[_0x2fc45d(0x1bd)][_0x2fc45d(0x169)]};return _0x7be898&&(_0x30fd6a[_0x2fc45d(0x176)][_0x2fc45d(0x1ad)]=_0x7be898[_0x2fc45d(0x1bb)]),fetch(_0x58e481,_0x30fd6a);}[_0xdbc540(0x16c)](_0x18e3d6){const _0x96ad3a=_0xdbc540;return _0x18e3d6['ok']?_0x18e3d6[_0x96ad3a(0x1a7)]()[_0x96ad3a(0x18c)](_0x37bc0e=>{const _0xf6ca1f=_0x96ad3a;if(!this[_0xf6ca1f(0x171)][_0xf6ca1f(0x1c0)][_0xf6ca1f(0x16b)][_0xf6ca1f(0x1b1)](this[_0xf6ca1f(0x1be)]))return;_0xf6ca1f(0x19d)!==this[_0xf6ca1f(0x1be)][_0xf6ca1f(0x1a2)]()[_0xf6ca1f(0x183)][_0xf6ca1f(0x19a)]&&this[_0xf6ca1f(0x178)](_0xf6ca1f(0x197),_0x37bc0e);}):Promise[_0x96ad3a(0x163)]();}[_0xdbc540(0x17a)](){const _0x4c422e=_0xdbc540;if(this[_0x4c422e(0x1bd)][_0x4c422e(0x169)][_0x4c422e(0x16e)])return void _0x361894(_0x4c422e(0x1bf));const _0x5c28cd=this[_0x4c422e(0x171)],_0x4ccf98=_0x5e93b8(_0x5c28cd[_0x4c422e(0x1b4)],_0x4c422e(0x1a4));_0x5c28cd[_0x4c422e(0x1ab)][_0x4c422e(0x189)](_0x4c422e(0x181))[_0x4c422e(0x180)](_0x4ccf98),_0x1d8141(_0x4c422e(0x16a));}}