UNPKG

@ckeditor/ckeditor5-import-word

Version:

Import from Word feature for CKEditor 5.

23 lines • 9.29 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 _0x44d2(){const _0x272db3=['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\x20error\x20occurred\x20while\x20importing\x20the\x20Word\x20file.','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'];_0x44d2=function(){return _0x272db3;};return _0x44d2();}const _0x5e279b=_0x6951;(function(_0x1774db,_0x41350e){const _0x230697=_0x6951,_0x5c1688=_0x1774db();while(!![]){try{const _0x328c9d=parseInt(_0x230697(0xc5))/0x1*(parseInt(_0x230697(0xe8))/0x2)+parseInt(_0x230697(0x12b))/0x3+-parseInt(_0x230697(0xfc))/0x4*(-parseInt(_0x230697(0xda))/0x5)+-parseInt(_0x230697(0xf9))/0x6*(-parseInt(_0x230697(0xdb))/0x7)+parseInt(_0x230697(0xf5))/0x8*(parseInt(_0x230697(0x112))/0x9)+parseInt(_0x230697(0xc8))/0xa+-parseInt(_0x230697(0xc7))/0xb*(parseInt(_0x230697(0xea))/0xc);if(_0x328c9d===_0x41350e)break;else _0x5c1688['push'](_0x5c1688['shift']());}catch(_0x9295d4){_0x5c1688['push'](_0x5c1688['shift']());}}}(_0x44d2,0x454f3));import{Command as _0x5eebb0}from'ckeditor5/src/core.js';import{Range as _0x56d8af}from'ckeditor5/src/engine.js';function _0x6951(_0x45e6d6,_0x36013a){const _0x44d2c7=_0x44d2();return _0x6951=function(_0x695182,_0x449906){_0x695182=_0x695182-0xc3;let _0x1d291b=_0x44d2c7[_0x695182];return _0x1d291b;},_0x6951(_0x45e6d6,_0x36013a);}import{logWarning as _0x22b128,logError as _0x5a9d5b,first as _0x4caa61,uid as _0x39b20c}from'ckeditor5/src/utils.js';import{getTranslation as _0x35fe50}from'./utils/common-translations.js';export default class d extends _0x5eebb0{constructor(_0x128287){const _0x4807cf=_0x6951;super(_0x128287),this[_0x4807cf(0x102)](_0x4807cf(0xef),!0x1),this[_0x4807cf(0x10d)]=null,this[_0x4807cf(0xfe)]=null,this[_0x4807cf(0xe5)]=null,this['on'](_0x4807cf(0xd7),(_0x4d6c27,_0x1c4634)=>{const _0x4b30=_0x4807cf,_0x133ec1=new DataTransfer();_0x133ec1[_0x4b30(0x107)](_0x4b30(0x10f),_0x1c4634[_0x4b30(0x105)]);const _0x3d3541=this[_0x4b30(0x10d)][_0x4b30(0xee)]();this[_0x4b30(0x115)][_0x4b30(0x10c)][_0x4b30(0xcf)](this[_0x4b30(0xfe)],_0x5d9bb4=>{const _0x3dd7a7=_0x4b30;this[_0x3dd7a7(0x10d)][_0x3dd7a7(0xf1)](),_0x5d9bb4[_0x3dd7a7(0xe9)](_0x3d3541),_0x128287[_0x3dd7a7(0x109)][_0x3dd7a7(0xcb)][_0x3dd7a7(0xd5)][_0x3dd7a7(0x111)](_0x3dd7a7(0xc3),{'dataTransfer':_0x133ec1});});},{'priority':_0x4807cf(0xe3)});}[_0x5e279b(0xd4)](){const _0x2c6daa=_0x5e279b;this[_0x2c6daa(0x126)]=this[_0x2c6daa(0xcd)]();}[_0x5e279b(0xd1)](_0x4ca38f,_0x22ba88={}){const _0x4d55a1=_0x5e279b;if(this[_0x4d55a1(0xef)])return Promise[_0x4d55a1(0x118)]();const _0x1f30ec=this[_0x4d55a1(0x115)][_0x4d55a1(0x110)][_0x4d55a1(0xd9)](_0x4d55a1(0x119));if(this[_0x4d55a1(0x115)][_0x4d55a1(0xf4)][_0x4d55a1(0x10b)](_0x4d55a1(0xe1))){const {prefix:_0x3f8801,suffix:_0x3b92ed}=this[_0x4d55a1(0x115)][_0x4d55a1(0x110)][_0x4d55a1(0xd9)](_0x4d55a1(0x10e));_0x22ba88[_0x4d55a1(0xe7)]={'prefix':_0x3f8801,'suffix':_0x3b92ed};}const _0x46b66e={'url':_0x1f30ec[_0x4d55a1(0x11c)],'file':_0x4ca38f,'serviceConfig':{..._0x22ba88,'formatting':_0x1f30ec[_0x4d55a1(0xcc)],'timezone':new Intl[(_0x4d55a1(0xfd))]()[_0x4d55a1(0xdc)]()[_0x4d55a1(0xce)]}};return this[_0x4d55a1(0x103)](),this[_0x4d55a1(0x101)](_0x46b66e)[_0x4d55a1(0x123)](this[_0x4d55a1(0x129)][_0x4d55a1(0xe0)](this))[_0x4d55a1(0x11f)](this[_0x4d55a1(0xd3)][_0x4d55a1(0xe0)](this))[_0x4d55a1(0xde)](this[_0x4d55a1(0xec)][_0x4d55a1(0xe0)](this));}[_0x5e279b(0xcd)](){const _0x3d0467=_0x5e279b;if(this[_0x3d0467(0xef)])return!0x1;const _0x4d3cb7=this[_0x3d0467(0x115)][_0x3d0467(0x10c)],_0x45a98f=_0x4d3cb7[_0x3d0467(0xdd)],_0x1b709e=_0x4d3cb7[_0x3d0467(0xd5)][_0x3d0467(0xff)],_0xd45957=_0x4caa61(_0x1b709e[_0x3d0467(0xf7)]());return!!_0xd45957&&_0x45a98f[_0x3d0467(0xd6)](_0xd45957[_0x3d0467(0x10a)],_0x3d0467(0xeb));}[_0x5e279b(0x103)](){const _0xff1844=_0x5e279b,_0x47b816=this[_0xff1844(0x115)],_0x45c068=_0x47b816[_0xff1844(0x10c)],_0x2769a8=_0x45c068[_0xff1844(0xd5)][_0xff1844(0xff)];this[_0xff1844(0xe5)]=new AbortController(),this[_0xff1844(0xfe)]=_0x47b816[_0xff1844(0x10c)][_0xff1844(0x116)]({'isUndoable':!0x0}),_0x45c068[_0xff1844(0xcf)](this[_0xff1844(0xfe)],_0x3693fe=>{const _0x5ab31f=_0xff1844;_0x2769a8[_0x5ab31f(0xd8)]||_0x45c068[_0x5ab31f(0xfb)](_0x2769a8,{'leaveUnmerged':!0x0});const _0x228388=_0x2769a8[_0x5ab31f(0xf2)](),_0xa92518=_0x4caa61(_0x2769a8[_0x5ab31f(0xf7)]());let _0x187bb3;_0x187bb3=_0xa92518['is'](_0x5ab31f(0x11e),_0x5ab31f(0xeb))&&_0xa92518[_0x5ab31f(0x127)]?_0x228388:_0x228388[_0x5ab31f(0xd2)]?_0x45c068[_0x5ab31f(0x117)](_0xa92518):_0x228388[_0x5ab31f(0xe6)]?_0x45c068[_0x5ab31f(0x128)](_0xa92518):_0x3693fe[_0x5ab31f(0xed)](_0x228388)[_0x5ab31f(0x125)],this[_0x5ab31f(0x10d)]=_0x3693fe[_0x5ab31f(0xc9)](_0x5ab31f(0xd0)+_0x39b20c(),{'usingOperation':!0x1,'affectsData':!0x1,'range':new _0x56d8af(_0x187bb3)}),this[_0x5ab31f(0x10d)]['on'](_0x5ab31f(0xf0),()=>{const _0x51df5b=_0x5ab31f;_0x51df5b(0xc6)===this[_0x51df5b(0x10d)][_0x51df5b(0xee)]()[_0x51df5b(0x11a)][_0x51df5b(0xdf)]&&this[_0x51df5b(0xe5)][_0x51df5b(0x122)]();});}),this[_0xff1844(0xef)]=!0x0,this[_0xff1844(0xd4)]();}[_0x5e279b(0xec)](){const _0x471bf7=_0x5e279b,_0x4d5897=this[_0x471bf7(0x115)][_0x471bf7(0x10c)];_0x4d5897[_0x471bf7(0xf6)][_0x471bf7(0x10b)](this[_0x471bf7(0x10d)])&&_0x4d5897[_0x471bf7(0xcf)](this[_0x471bf7(0xfe)],_0x5e7ba0=>{const _0x23c77d=_0x471bf7;_0x5e7ba0[_0x23c77d(0xf3)](this[_0x23c77d(0x10d)]);}),this[_0x471bf7(0x10d)]=null,this[_0x471bf7(0xfe)]=null,this[_0x471bf7(0xe5)]=null,this[_0x471bf7(0xef)]=!0x1,this[_0x471bf7(0xd4)]();}[_0x5e279b(0x101)]({url:_0x16893b,file:_0x236ef6,serviceConfig:_0x2a79f8}){const _0x6299c8=_0x5e279b,_0x1bbe60=this[_0x6299c8(0x115)][_0x6299c8(0xf4)][_0x6299c8(0xd9)](_0x6299c8(0x124))[_0x6299c8(0x113)](),_0x49c0d3=new FormData();_0x49c0d3[_0x6299c8(0x102)](_0x6299c8(0x110),JSON[_0x6299c8(0xe2)](_0x2a79f8)),_0x49c0d3[_0x6299c8(0x102)](_0x6299c8(0x100),_0x236ef6);const _0x2e0109={'method':_0x6299c8(0x12a),'headers':{},'body':_0x49c0d3,'signal':this[_0x6299c8(0xe5)][_0x6299c8(0x121)]};return _0x1bbe60&&(_0x2e0109[_0x6299c8(0x11b)][_0x6299c8(0xfa)]=_0x1bbe60[_0x6299c8(0xca)]),fetch(_0x16893b,_0x2e0109);}[_0x5e279b(0x129)](_0x565fb0){const _0x46edcb=_0x5e279b;return _0x565fb0['ok']?_0x565fb0[_0x46edcb(0x114)]()[_0x46edcb(0x123)](_0x305b62=>{const _0x1c2456=_0x46edcb;if(!this[_0x1c2456(0x115)][_0x1c2456(0x10c)][_0x1c2456(0xf6)][_0x1c2456(0x10b)](this[_0x1c2456(0x10d)]))return;_0x1c2456(0xc6)!==this[_0x1c2456(0x10d)][_0x1c2456(0xee)]()[_0x1c2456(0x11a)][_0x1c2456(0xdf)]&&this[_0x1c2456(0x111)](_0x1c2456(0xd7),_0x305b62);}):Promise[_0x46edcb(0x11d)]();}[_0x5e279b(0xd3)](){const _0x37e3cf=_0x5e279b;if(this[_0x37e3cf(0xe5)][_0x37e3cf(0x121)][_0x37e3cf(0xf8)])return void _0x22b128(_0x37e3cf(0x108));const _0x13a274=this[_0x37e3cf(0x115)],_0x30af3a=_0x35fe50(_0x13a274[_0x37e3cf(0x106)],_0x37e3cf(0xc4));_0x13a274[_0x37e3cf(0xf4)][_0x37e3cf(0xd9)](_0x37e3cf(0x104))[_0x37e3cf(0x120)](_0x30af3a),_0x5a9d5b(_0x37e3cf(0xe4));}}