UNPKG

@ckeditor/ckeditor5-import-word

Version:

Import from Word feature for CKEditor 5.

23 lines • 9.21 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. | * | | * | | * +---------------------------------------------------------------------------------+ * * * * */ const _0x3a3387=_0x23d6;function _0x5cf0(){const _0x30a1eb=['plugins','locale','isBusy','867385dfCSZn','merge_fields','reject','_handleImportResponse','aborted','file','isCollapsed','POST','set','finally','schema','setData','906574QRFKOF','enqueueChange','createPositionAfter','setSelection','_checkEnabled','importWord','importWord:','addMarker','headers','change:range','import-word-plugin-import-cancelled','execute','json','config','MergeFields','getRange','root','isEnabled','element','catch','deleteContent','_cleanUpAfterImport','1544lbczmr','get','DateTimeFormat','Notification','1086759eBhaAR','showWarning','_sendImportRequest','fire','createPositionBefore','stopListening','4290UaxuSG','editor','$graveyard','paragraph','selection','document','import-word-plugin-conversion-failed','resolve','_handleImportFailure','checkChild','value','isAtEnd','refresh','bind','createBatch','_importMarker','html','dataInsert','timeZone','Authorization','resolvedOptions','80353cKWbRG','has','view','ImportWordEditing','getToken','_prepareForImport','formatting','position','abort','clipboardInput','model','9079884yoNsmE','low','then','_abortController','stringify','rootName','isAtStart','getFirstPosition','converterUrl','240LZsHWf','mergeFields','_undoStepBatch','getSelectedBlocks','signal','2469870jjCRTo','split','text/html','isEmpty','parent','editing','removeMarker','An\x20error\x20occurred\x20while\x20importing\x20the\x20Word\x20file.','markers'];_0x5cf0=function(){return _0x30a1eb;};return _0x5cf0();}(function(_0xb1a4d5,_0x29799a){const _0x3a563a=_0x23d6,_0x3dfa20=_0xb1a4d5();while(!![]){try{const _0x48e2b1=-parseInt(_0x3a563a(0xca))/0x1+parseInt(_0x3a563a(0xd6))/0x2+-parseInt(_0x3a563a(0xf0))/0x3+-parseInt(_0x3a563a(0xec))/0x4*(-parseInt(_0x3a563a(0xf6))/0x5)+parseInt(_0x3a563a(0xbe))/0x6+parseInt(_0x3a563a(0x10b))/0x7*(-parseInt(_0x3a563a(0xb9))/0x8)+parseInt(_0x3a563a(0xb0))/0x9;if(_0x48e2b1===_0x29799a)break;else _0x3dfa20['push'](_0x3dfa20['shift']());}catch(_0x4620d9){_0x3dfa20['push'](_0x3dfa20['shift']());}}}(_0x5cf0,0x9a0cc));import{Command as _0x406cec}from'ckeditor5/src/core.js';import{ModelRange as _0x2668f6}from'ckeditor5/src/engine.js';function _0x23d6(_0x410b5b,_0x9f9b0b){const _0x5cf05d=_0x5cf0();return _0x23d6=function(_0x23d6ab,_0x5e3a3f){_0x23d6ab=_0x23d6ab-0xaa;let _0x1a3f62=_0x5cf05d[_0x23d6ab];return _0x1a3f62;},_0x23d6(_0x410b5b,_0x9f9b0b);}import{logWarning as _0x2c0362,logError as _0x41b47b,first as _0x3ea0c5,uid as _0xbe946c}from'ckeditor5/src/utils.js';import{getTranslation as _0x370384}from'./utils/common-translations.js';export class ImportWordCommand extends _0x406cec{[_0x3a3387(0x105)];[_0x3a3387(0xbb)];[_0x3a3387(0xb3)];constructor(_0x386675){const _0x24aa0c=_0x3a3387;super(_0x386675),this[_0x24aa0c(0xd2)](_0x24aa0c(0xc9),!0x1),this[_0x24aa0c(0x105)]=null,this[_0x24aa0c(0xbb)]=null,this[_0x24aa0c(0xb3)]=null,this['on'](_0x24aa0c(0x107),(_0x118e5c,_0x4ef5ca)=>{const _0x108e47=_0x24aa0c,_0x5de789=new DataTransfer();_0x5de789[_0x108e47(0xd5)](_0x108e47(0xc0),_0x4ef5ca[_0x108e47(0x106)]);const _0x13ee0f=this[_0x108e47(0x105)][_0x108e47(0xe5)]();this[_0x108e47(0xf7)][_0x108e47(0xaf)][_0x108e47(0xd7)](this[_0x108e47(0xbb)],_0x5acfba=>{const _0x5154ca=_0x108e47;this[_0x5154ca(0x105)][_0x5154ca(0xf5)](),_0x5acfba[_0x5154ca(0xd9)](_0x13ee0f),_0x386675[_0x5154ca(0xc3)][_0x5154ca(0x10d)][_0x5154ca(0xfb)][_0x5154ca(0xf3)](_0x5154ca(0xae),{'dataTransfer':_0x5de789});});},{'priority':_0x24aa0c(0xb1)});}[_0x3a3387(0x102)](){const _0x413dbf=_0x3a3387;this[_0x413dbf(0xe7)]=this[_0x413dbf(0xda)]();}[_0x3a3387(0xe1)](_0x887c8a,_0x31f6f3={}){const _0x444eae=_0x3a3387;if(this[_0x444eae(0xc9)])return Promise[_0x444eae(0xfd)]();const _0x32a3e6=this[_0x444eae(0xf7)][_0x444eae(0xe3)][_0x444eae(0xed)](_0x444eae(0xdb));if(this[_0x444eae(0xf7)][_0x444eae(0xc7)][_0x444eae(0x10c)](_0x444eae(0xe4))){const {prefix:_0x1efcde,suffix:_0x5e9817}=this[_0x444eae(0xf7)][_0x444eae(0xe3)][_0x444eae(0xed)](_0x444eae(0xba));_0x31f6f3[_0x444eae(0xcb)]={'prefix':_0x1efcde,'suffix':_0x5e9817};}const _0x522cba={'url':_0x32a3e6[_0x444eae(0xb8)],'file':_0x887c8a,'serviceConfig':{..._0x31f6f3,'formatting':_0x32a3e6[_0x444eae(0xab)],'timezone':new Intl[(_0x444eae(0xee))]()[_0x444eae(0x10a)]()[_0x444eae(0x108)]}};return this[_0x444eae(0xaa)](),this[_0x444eae(0xf2)](_0x522cba)[_0x444eae(0xb2)](this[_0x444eae(0xcd)][_0x444eae(0x103)](this))[_0x444eae(0xe9)](this[_0x444eae(0xfe)][_0x444eae(0x103)](this))[_0x444eae(0xd3)](this[_0x444eae(0xeb)][_0x444eae(0x103)](this));}[_0x3a3387(0xda)](){const _0x1b318f=_0x3a3387;if(this[_0x1b318f(0xc9)])return!0x1;const _0x5c95c9=this[_0x1b318f(0xf7)][_0x1b318f(0xaf)],_0x34b300=_0x5c95c9[_0x1b318f(0xd4)],_0x1936ac=_0x5c95c9[_0x1b318f(0xfb)][_0x1b318f(0xfa)],_0xeee4de=_0x3ea0c5(_0x1936ac[_0x1b318f(0xbc)]());return!!_0xeee4de&&_0x34b300[_0x1b318f(0xff)](_0xeee4de[_0x1b318f(0xc2)],_0x1b318f(0xf9));}[_0x3a3387(0xaa)](){const _0xdbc165=_0x3a3387,_0x1a3411=this[_0xdbc165(0xf7)],_0x599a4a=_0x1a3411[_0xdbc165(0xaf)],_0x2c84b6=_0x599a4a[_0xdbc165(0xfb)][_0xdbc165(0xfa)];this[_0xdbc165(0xb3)]=new AbortController(),this[_0xdbc165(0xbb)]=_0x1a3411[_0xdbc165(0xaf)][_0xdbc165(0x104)]({'isUndoable':!0x0}),_0x599a4a[_0xdbc165(0xd7)](this[_0xdbc165(0xbb)],_0x4f110e=>{const _0x3045dc=_0xdbc165;_0x2c84b6[_0x3045dc(0xd0)]||_0x599a4a[_0x3045dc(0xea)](_0x2c84b6,{'leaveUnmerged':!0x0});const _0x2cc449=_0x2c84b6[_0x3045dc(0xb7)](),_0x43625e=_0x3ea0c5(_0x2c84b6[_0x3045dc(0xbc)]());let _0xffa3b7;_0xffa3b7=_0x43625e['is'](_0x3045dc(0xe8),_0x3045dc(0xf9))&&_0x43625e[_0x3045dc(0xc1)]?_0x2cc449:_0x2cc449[_0x3045dc(0xb6)]?_0x599a4a[_0x3045dc(0xf4)](_0x43625e):_0x2cc449[_0x3045dc(0x101)]?_0x599a4a[_0x3045dc(0xd8)](_0x43625e):_0x4f110e[_0x3045dc(0xbf)](_0x2cc449)[_0x3045dc(0xac)],this[_0x3045dc(0x105)]=_0x4f110e[_0x3045dc(0xdd)](_0x3045dc(0xdc)+_0xbe946c(),{'usingOperation':!0x1,'affectsData':!0x1,'range':new _0x2668f6(_0xffa3b7)}),this[_0x3045dc(0x105)]['on'](_0x3045dc(0xdf),()=>{const _0x410406=_0x3045dc;_0x410406(0xf8)===this[_0x410406(0x105)][_0x410406(0xe5)]()[_0x410406(0xe6)][_0x410406(0xb5)]&&this[_0x410406(0xb3)][_0x410406(0xad)]();});}),this[_0xdbc165(0xc9)]=!0x0,this[_0xdbc165(0x102)]();}[_0x3a3387(0xeb)](){const _0x395a9c=_0x3a3387,_0x2e89ae=this[_0x395a9c(0xf7)][_0x395a9c(0xaf)];_0x2e89ae[_0x395a9c(0xc6)][_0x395a9c(0x10c)](this[_0x395a9c(0x105)])&&_0x2e89ae[_0x395a9c(0xd7)](this[_0x395a9c(0xbb)],_0x17fd10=>{const _0x49c5a2=_0x395a9c;_0x17fd10[_0x49c5a2(0xc4)](this[_0x49c5a2(0x105)]);}),this[_0x395a9c(0x105)]=null,this[_0x395a9c(0xbb)]=null,this[_0x395a9c(0xb3)]=null,this[_0x395a9c(0xc9)]=!0x1,this[_0x395a9c(0x102)]();}[_0x3a3387(0xf2)]({url:_0x444d14,file:_0x49f074,serviceConfig:_0x306630}){const _0x41f903=_0x3a3387,_0xbf20c4=this[_0x41f903(0xf7)][_0x41f903(0xc7)][_0x41f903(0xed)](_0x41f903(0x10e))[_0x41f903(0x10f)](),_0x35dc48=new FormData();_0x35dc48[_0x41f903(0xd2)](_0x41f903(0xe3),JSON[_0x41f903(0xb4)](_0x306630)),_0x35dc48[_0x41f903(0xd2)](_0x41f903(0xcf),_0x49f074);const _0x8527c8={'method':_0x41f903(0xd1),'headers':{},'body':_0x35dc48,'signal':this[_0x41f903(0xb3)][_0x41f903(0xbd)]};return _0xbf20c4&&(_0x8527c8[_0x41f903(0xde)][_0x41f903(0x109)]=_0xbf20c4[_0x41f903(0x100)]),fetch(_0x444d14,_0x8527c8);}[_0x3a3387(0xcd)](_0x30e8c2){const _0x1b848a=_0x3a3387;return _0x30e8c2['ok']?_0x30e8c2[_0x1b848a(0xe2)]()[_0x1b848a(0xb2)](_0x51f056=>{const _0x4ec080=_0x1b848a;if(!this[_0x4ec080(0xf7)][_0x4ec080(0xaf)][_0x4ec080(0xc6)][_0x4ec080(0x10c)](this[_0x4ec080(0x105)]))return;_0x4ec080(0xf8)!==this[_0x4ec080(0x105)][_0x4ec080(0xe5)]()[_0x4ec080(0xe6)][_0x4ec080(0xb5)]&&this[_0x4ec080(0xf3)](_0x4ec080(0x107),_0x51f056);}):Promise[_0x1b848a(0xcc)]();}[_0x3a3387(0xfe)](){const _0x2a4d24=_0x3a3387;if(this[_0x2a4d24(0xb3)][_0x2a4d24(0xbd)][_0x2a4d24(0xce)])return void _0x2c0362(_0x2a4d24(0xe0));const _0x350d04=this[_0x2a4d24(0xf7)],_0x140456=_0x370384(_0x350d04[_0x2a4d24(0xc8)],_0x2a4d24(0xc5));_0x350d04[_0x2a4d24(0xc7)][_0x2a4d24(0xed)](_0x2a4d24(0xef))[_0x2a4d24(0xf1)](_0x140456),_0x41b47b(_0x2a4d24(0xfc));}}