@ckeditor/ckeditor5-export-pdf
Version:
Export to PDF feature for CKEditor 5.
23 lines • 10.2 kB
JavaScript
/*
* Copyright (c) 2003-2026, 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 _0x3294c2=_0x5371;(function(_0x30e9de,_0x15c24f){const _0xa992b2=_0x5371,_0xf609c3=_0x30e9de();while(!![]){try{const _0x4cb1fa=parseInt(_0xa992b2(0x1b2))/0x1*(-parseInt(_0xa992b2(0x1d8))/0x2)+-parseInt(_0xa992b2(0x1f6))/0x3*(-parseInt(_0xa992b2(0x1fc))/0x4)+parseInt(_0xa992b2(0x203))/0x5+parseInt(_0xa992b2(0x208))/0x6*(-parseInt(_0xa992b2(0x20e))/0x7)+parseInt(_0xa992b2(0x1ac))/0x8+parseInt(_0xa992b2(0x1b9))/0x9+parseInt(_0xa992b2(0x1c5))/0xa*(-parseInt(_0xa992b2(0x1c0))/0xb);if(_0x4cb1fa===_0x15c24f)break;else _0xf609c3['push'](_0xf609c3['shift']());}catch(_0x470368){_0xf609c3['push'](_0xf609c3['shift']());}}}(_0x3aaf,0x96b6f));import{Command as _0x4f92f3}from'ckeditor5/src/core.js';import{collectStylesheets as _0x4c8a4c}from'ckeditor5/src/utils.js';import{getTranslation as _0x4af1f3}from'./utils/common-translations.js';function _0x3aaf(){const _0x1f7c04=['showWarning','appID','finally','EDITOR_STYLES','4477755BBqgFm','application/json','84.1cm','https://pdf-converter.cke-cs.com/v1/convert/','previewMode','419586ywjBDf','PDF\x20export\x20started','43.2cm','mergeFields','59.4cm','size','91bAcIDm','data','width:calc(','download','wrapInAffixes','set','contentLanguageDirection','right','_token','function','application/pdf','getDefaultValues','fileName','21.0cm','fetch','isBusy','assertive','catch','\x0a\x09\x09\x09\x09\x09\x09\x09</div>\x0a\x09\x09\x09\x09\x09\x09</body>\x0a\x09\x09\x09\x09\x09</html>\x0a\x09\x09\x09\x09','cke5','6836280zskVEx','29.7cm','value','blob','config','\x22>\x0a\x09\x09\x09\x09\x09\x09\x09\x09','1rYsMRO','getMergeFieldsIds','ExportPdf','POST','\x0a\x09\x09\x09\x09\x09<!DOCTYPE\x20html>\x0a\x09\x09\x09\x09\x09<html>\x0a\x09\x09\x09\x09\x09\x09<head>\x0a\x09\x09\x09\x09\x09\x09\x09<title>CKEditor\x205\x20PDF\x20document</title>\x0a\x09\x09\x09\x09\x09\x09\x09<meta\x20charset=\x22utf-8\x22>\x0a\x09\x09\x09\x09\x09\x09</head>\x0a\x09\x09\x09\x09\x09\x09<body>\x0a\x09\x09\x09\x09\x09\x09\x09<div\x20class=\x22ck-content\x22\x20dir=\x22','getLabel','then','2149848QYjWaD','get','Notification','PDF\x20export\x20failed','image','createElement','margin_right','110hPItsb','toLowerCase','\x20-\x20','pending','click','30450bqwHNz','affectsData','version','getDataSetValues','PDF\x20export\x20successful','join','42.0cm','URL','trim','MergeFields','entries','width','object','$defaultValues','margins','editor','_downloadFile','21.6cm','locale','1416288pOVLWM','merge_fields','dataCallback','announce','margin_left','plugins','remove','10.5cm','document','document.pdf','$labels','isEnabled','left','An\x20error\x20occurred\x20while\x20generating\x20the\x20PDF.','format','stringify','35.6cm','118.9cm','createObjectURL','getMergeFieldType','href','filter','execute','converterOptions','has','MergeFieldsEditing','converterUrl','\x22\x20style=\x22','14.8cm','refresh','939cCfzou','options','27.9cm','ariaLiveAnnouncer','token','data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP88B8AAuUB8e2ujYwAAAAASUVORK5CYII=','3528cfjQVT','stylesheets','status'];_0x3aaf=function(){return _0x1f7c04;};return _0x3aaf();}export class ExportPdfCommand extends _0x4f92f3{constructor(_0x7772d3){const _0x1a5911=_0x5371;super(_0x7772d3),this[_0x1a5911(0x213)](_0x1a5911(0x1a7),!0x1),this[_0x1a5911(0x1c6)]=!0x1;}[_0x3294c2(0x1f5)](){const _0xa4b6ea=_0x3294c2;this[_0xa4b6ea(0x1e3)]=!this[_0xa4b6ea(0x1a7)],this[_0xa4b6ea(0x1ae)]=this[_0xa4b6ea(0x1a7)]?_0xa4b6ea(0x1c3):void 0x0;}[_0x3294c2(0x1ee)](_0x14d0be={}){const _0x4769ad=_0x3294c2,_0x33fd4c=this[_0x4769ad(0x1d4)],_0x529ee3=_0x14d0be[_0x4769ad(0x1f2)]||_0x4769ad(0x206),_0x594616=_0x14d0be[_0x4769ad(0x1da)]||(_0x5df6fd=>_0x5df6fd[_0x4769ad(0x20f)][_0x4769ad(0x1ba)]()),_0x1482c9=_0x33fd4c[_0x4769ad(0x1dd)][_0x4769ad(0x1ba)](_0x4769ad(0x1b4)),_0x4bad7f=_0x14d0be[_0x4769ad(0x1fa)]||_0x1482c9[_0x4769ad(0x216)];return this[_0x4769ad(0x1a7)]=!0x0,this[_0x4769ad(0x1f5)](),_0x4c8a4c(_0x14d0be[_0x4769ad(0x1fd)]||[_0x4769ad(0x202)])[_0x4769ad(0x1b8)](async _0x1d6dd7=>{const _0x44666b=_0x4769ad;if(_0x33fd4c['ui'][_0x44666b(0x1f9)][_0x44666b(0x1db)](_0x4af1f3(_0x33fd4c[_0x44666b(0x1d7)],_0x44666b(0x209))),_0x33fd4c[_0x44666b(0x1dd)][_0x44666b(0x1f0)](_0x44666b(0x1ce))){_0x14d0be[_0x44666b(0x1ef)]||(_0x14d0be[_0x44666b(0x1ef)]={});const _0x5e846e=_0x33fd4c[_0x44666b(0x1dd)][_0x44666b(0x1ba)](_0x44666b(0x1f1)),_0x21f956=_0x5e846e[_0x44666b(0x207)],{prefix:_0x251fec,suffix:_0x30e7bb}=_0x33fd4c[_0x44666b(0x1b0)][_0x44666b(0x1ba)](_0x44666b(0x20b)),_0x4a1702=_0x44666b(0x1fb),_0x33ecf9={'prefix':_0x251fec,'suffix':_0x30e7bb,'data':{}};if(_0x44666b(0x1e2)===_0x21f956){for(const _0x270239 of _0x5e846e[_0x44666b(0x1b3)]())_0x44666b(0x1bd)===_0x5e846e[_0x44666b(0x1eb)](_0x270239)?_0x33ecf9[_0x44666b(0x20f)][_0x270239]=_0x4a1702:_0x33ecf9[_0x44666b(0x20f)][_0x270239]=_0x5e846e[_0x44666b(0x212)](_0x5e846e[_0x44666b(0x1b7)](_0x270239)||_0x270239);}else{const _0x3c88ff=_0x44666b(0x1d2)===_0x21f956?_0x5e846e[_0x44666b(0x1a3)]():_0x5e846e[_0x44666b(0x1c8)](_0x21f956,!0x0);for(const _0x3fb226 of Object[_0x44666b(0x1cf)](_0x3c88ff)){const [_0x485abb,_0x52334a]=_0x3fb226;_0x44666b(0x1bd)===_0x5e846e[_0x44666b(0x1eb)](_0x485abb)?_0x33ecf9[_0x44666b(0x20f)][_0x485abb]=null!==_0x52334a?_0x52334a:_0x4a1702:_0x33ecf9[_0x44666b(0x20f)][_0x485abb]=null!==_0x52334a?_0x52334a:_0x5e846e[_0x44666b(0x1b7)](_0x485abb)||_0x485abb;}}_0x14d0be[_0x44666b(0x1ef)][_0x44666b(0x1d9)]=_0x33ecf9;}const _0x5eeff2=0x2===_0x14d0be[_0x44666b(0x1c7)]?function(_0x456f6d){const _0x4868b3=_0x44666b,_0x3720ea=_0x456f6d?.[_0x4868b3(0x1e0)]?.[_0x4868b3(0x1d3)];return a({'pageWidth':m(_0x456f6d?.[_0x4868b3(0x1e0)]?.[_0x4868b3(0x20d)]||'A4'),'marginLeft':_0x3720ea?.[_0x4868b3(0x1e4)],'marginRight':_0x3720ea?.[_0x4868b3(0x215)]});}(_0x14d0be[_0x44666b(0x1ef)]):(_0xc148b9=_0x14d0be[_0x44666b(0x1ef)],a({'pageWidth':m(_0xc148b9?.[_0x44666b(0x1e6)]||'A4'),'marginLeft':_0xc148b9?.[_0x44666b(0x1dc)],'marginRight':_0xc148b9?.[_0x44666b(0x1bf)]}));var _0xc148b9;const _0x37d77f={'html':(_0x44666b(0x1b6)+_0x33fd4c[_0x44666b(0x1d7)][_0x44666b(0x214)]+_0x44666b(0x1f3)+_0x5eeff2+_0x44666b(0x1b1)+await _0x594616(_0x33fd4c)+_0x44666b(0x1aa))[_0x44666b(0x1cd)](),'css':_0x1d6dd7,[0x2===_0x14d0be[_0x44666b(0x1c7)]?_0x44666b(0x1b0):_0x44666b(0x1f7)]:_0x14d0be[_0x44666b(0x1ef)]},_0x4814e3={'method':_0x44666b(0x1b5),'headers':{'Content-Type':_0x44666b(0x204),'Accept':_0x44666b(0x1a2),..._0x4bad7f?{'Authorization':_0x4bad7f[_0x44666b(0x1ae)]}:null,'x-cs-app-id':_0x14d0be[_0x44666b(0x200)]||_0x44666b(0x1ab)},'body':JSON[_0x44666b(0x1e7)](_0x37d77f)};return window[_0x44666b(0x1a6)](_0x529ee3,_0x4814e3)[_0x44666b(0x1b8)](_0x373147=>{const _0x213652=_0x44666b;if(0xc8!==_0x373147[_0x213652(0x1fe)])throw _0x373147;return _0x373147[_0x213652(0x1af)]();})[_0x44666b(0x1b8)](_0x449fb3=>{const _0x326ddb=_0x44666b;_0x33fd4c['ui'][_0x326ddb(0x1f9)][_0x326ddb(0x1db)](_0x4af1f3(_0x33fd4c[_0x326ddb(0x1d7)],_0x326ddb(0x1c9)));const _0xca45f2=_0x326ddb(0x1a1)==typeof _0x14d0be[_0x326ddb(0x1a4)]?_0x14d0be[_0x326ddb(0x1a4)]():_0x14d0be[_0x326ddb(0x1a4)];this[_0x326ddb(0x1d5)](_0x449fb3,_0xca45f2||_0x326ddb(0x1e1));});})[_0x4769ad(0x1a9)](_0x28593a=>{const _0x26a761=_0x4769ad,_0x358c44=_0x33fd4c[_0x26a761(0x1dd)][_0x26a761(0x1ba)](_0x26a761(0x1bb));throw _0x33fd4c['ui'][_0x26a761(0x1f9)][_0x26a761(0x1db)](_0x4af1f3(_0x33fd4c[_0x26a761(0x1d7)],_0x26a761(0x1bc)),{'politeness':_0x26a761(0x1a8)}),_0x358c44[_0x26a761(0x1ff)](_0x4af1f3(_0x33fd4c[_0x26a761(0x1d7)],_0x26a761(0x1e5))),_0x28593a;})[_0x4769ad(0x201)](()=>{const _0x3b52e3=_0x4769ad;this[_0x3b52e3(0x1a7)]=!0x1,this[_0x3b52e3(0x1f5)]();});}[_0x3294c2(0x1d5)](_0x3827bb,_0x32502f){const _0x4dfe0c=_0x3294c2,_0x20284a=document[_0x4dfe0c(0x1be)]('a');_0x20284a[_0x4dfe0c(0x1ec)]=window[_0x4dfe0c(0x1cc)][_0x4dfe0c(0x1ea)](_0x3827bb),_0x20284a[_0x4dfe0c(0x211)]=_0x32502f,_0x20284a[_0x4dfe0c(0x1c4)](),_0x20284a[_0x4dfe0c(0x1de)]();}}function _0x5371(_0x3b292e,_0x402cc4){const _0x3aafec=_0x3aaf();return _0x5371=function(_0x53711a,_0x5cef09){_0x53711a=_0x53711a-0x1a1;let _0x5e24fc=_0x3aafec[_0x53711a];return _0x5e24fc;},_0x5371(_0x3b292e,_0x402cc4);}function a({pageWidth:_0xad0bfd,marginLeft:_0x5b406c,marginRight:_0x3b5450}){const _0x1650f9=_0x3294c2;return _0x1650f9(0x210)+[_0xad0bfd,_0x5b406c,_0x3b5450][_0x1650f9(0x1ed)](Boolean)[_0x1650f9(0x1ca)](_0x1650f9(0x1c2))+');';}function m(_0x105a98){const _0x4b1134=_0x3294c2;if(_0x4b1134(0x1d1)==typeof _0x105a98&&_0x4b1134(0x1d0)in _0x105a98)return _0x105a98[_0x4b1134(0x1d0)];return{'letter':[_0x4b1134(0x1d6),_0x4b1134(0x1f8)],'legal':[_0x4b1134(0x1d6),_0x4b1134(0x1e8)],'tabloid':[_0x4b1134(0x1f8),_0x4b1134(0x20a)],'ledger':[_0x4b1134(0x20a),_0x4b1134(0x1f8)],'a0':[_0x4b1134(0x205),_0x4b1134(0x1e9)],'a1':[_0x4b1134(0x20c),_0x4b1134(0x205)],'a2':[_0x4b1134(0x1cb),_0x4b1134(0x20c)],'a3':[_0x4b1134(0x1ad),_0x4b1134(0x1cb)],'a4':[_0x4b1134(0x1a5),_0x4b1134(0x1ad)],'a5':[_0x4b1134(0x1f4),_0x4b1134(0x1a5)],'a6':[_0x4b1134(0x1df),_0x4b1134(0x1f4)]}[_0x105a98[_0x4b1134(0x1c1)]()][0x0];}