@ckeditor/ckeditor5-export-pdf
Version:
Export to PDF feature for CKEditor 5.
5 lines • 10.5 kB
JavaScript
!function(t){const e=t.en=t.en||{};e.dictionary=Object.assign(e.dictionary||{},{"An error occurred while generating the PDF.":"An error occurred while generating the PDF.","Export to PDF":"Export to PDF","Exporting PDF document":"Exporting PDF document","PDF export failed":"PDF export failed","PDF export started":"PDF export started","PDF export successful":"PDF export successful"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),
/*!
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md.
*/(()=>{var t={237:t=>{"use strict";t.exports=CKEditor5.dll},311:(t,e,n)=>{t.exports=n(237)("./src/ui.js")},355:(t,e,n)=>{t.exports=n(237)("./src/icons.js")},584:(t,e,n)=>{t.exports=n(237)("./src/utils.js")},782:(t,e,n)=>{t.exports=n(237)("./src/core.js")}},e={};function n(r){var s=e[r];if(void 0!==s)return s.exports;var o=e[r]={exports:{}};return t[r](o,o.exports,n),o.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{ExportPdf:()=>D,ExportPdfCommand:()=>c});var t=n(782),e=n(584);function s(t,e){const n=t.t;switch(e){case"Export to PDF":return n("Export to PDF");case"An error occurred while generating the PDF.":return n("An error occurred while generating the PDF.");case"PDF export started":return n("PDF export started");case"PDF export failed":return n("PDF export failed");case"PDF export successful":return n("PDF export successful");case"Exporting PDF document":return n("Exporting PDF document");default:return e}}const o=a;function i(){const t=["showWarning","appID","finally","EDITOR_STYLES","4477755BBqgFm","application/json","84.1cm","https://pdf-converter.cke-cs.com/v1/convert/","previewMode","419586ywjBDf","PDF export started","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","\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</body>\n\t\t\t\t\t</html>\n\t\t\t\t","cke5","6836280zskVEx","29.7cm","value","blob","config",'">\n\t\t\t\t\t\t\t\t',"1rYsMRO","getMergeFieldsIds","ExportPdf","POST",'\n\t\t\t\t\t<!DOCTYPE html>\n\t\t\t\t\t<html>\n\t\t\t\t\t\t<head>\n\t\t\t\t\t\t\t<title>CKEditor 5 PDF document</title>\n\t\t\t\t\t\t\t<meta charset="utf-8">\n\t\t\t\t\t\t</head>\n\t\t\t\t\t\t<body>\n\t\t\t\t\t\t\t<div class="ck-content" dir="',"getLabel","then","2149848QYjWaD","get","Notification","PDF export failed","image","createElement","margin_right","110hPItsb","toLowerCase"," - ","pending","click","30450bqwHNz","affectsData","version","getDataSetValues","PDF export successful","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 error occurred while generating the PDF.","format","stringify","35.6cm","118.9cm","createObjectURL","getMergeFieldType","href","filter","execute","converterOptions","has","MergeFieldsEditing","converterUrl",'" style="',"14.8cm","refresh","939cCfzou","options","27.9cm","ariaLiveAnnouncer","token","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP88B8AAuUB8e2ujYwAAAAASUVORK5CYII=","3528cfjQVT","stylesheets","status"];return(i=function(){return t})()}!function(t){const e=a,n=t();for(;;)try{if(617327===parseInt(e(434))/1*(-parseInt(e(472))/2)+-parseInt(e(502))/3*(-parseInt(e(508))/4)+parseInt(e(515))/5+parseInt(e(520))/6*(-parseInt(e(526))/7)+parseInt(e(428))/8+parseInt(e(441))/9+parseInt(e(453))/10*(-parseInt(e(448))/11))break;n.push(n.shift())}catch(t){n.push(n.shift())}}(i);class c extends t.Command{constructor(t){const e=a;super(t),this[e(531)](e(423),!1),this[e(454)]=!1}[o(501)](){const t=o;this[t(483)]=!this[t(423)],this[t(430)]=this[t(423)]?t(451):void 0}[o(494)](t={}){const n=o,r=this[n(468)],i=t[n(498)]||n(518),c=t[n(474)]||(t=>t[n(527)][n(442)]()),a=r[n(477)][n(442)](n(436)),d=t[n(506)]||a[n(534)];return this[n(423)]=!0,this[n(501)](),(0,e.collectStylesheets)(t[n(509)]||[n(514)])[n(440)](async e=>{const o=n;if(r.ui[o(505)][o(475)](s(r[o(471)],o(521))),r[o(477)][o(496)](o(462))){t[o(495)]||(t[o(495)]={});const e=r[o(477)][o(442)](o(497)),n=e[o(519)],{prefix:s,suffix:i}=r[o(432)][o(442)](o(523)),c=o(507),a={prefix:s,suffix:i,data:{}};if(o(482)===n)for(const t of e[o(435)]())o(445)===e[o(491)](t)?a[o(527)][t]=c:a[o(527)][t]=e[o(530)](e[o(439)](t)||t);else{const t=o(466)===n?e[o(419)]():e[o(456)](n,!0);for(const n of Object[o(463)](t)){const[t,r]=n;o(445)===e[o(491)](t)?a[o(527)][t]=null!==r?r:c:a[o(527)][t]=null!==r?r:e[o(439)](t)||t}}t[o(495)][o(473)]=a}const a=2===t[o(455)]?function(t){const e=o,n=t?.[e(480)]?.[e(467)];return u({pageWidth:p(t?.[e(480)]?.[e(525)]||"A4"),marginLeft:n?.[e(484)],marginRight:n?.[e(533)]})}(t[o(495)]):(f=t[o(495)],u({pageWidth:p(f?.[o(486)]||"A4"),marginLeft:f?.[o(476)],marginRight:f?.[o(447)]}));var f;const l={html:(o(438)+r[o(471)][o(532)]+o(499)+a+o(433)+await c(r)+o(426))[o(461)](),css:e,[2===t[o(455)]?o(432):o(503)]:t[o(495)]},g={method:o(437),headers:{"Content-Type":o(516),Accept:o(418),...d?{Authorization:d[o(430)]}:null,"x-cs-app-id":t[o(512)]||o(427)},body:JSON[o(487)](l)};return window[o(422)](i,g)[o(440)](t=>{const e=o;if(200!==t[e(510)])throw t;return t[e(431)]()})[o(440)](e=>{const n=o;r.ui[n(505)][n(475)](s(r[n(471)],n(457)));const i=n(417)==typeof t[n(420)]?t[n(420)]():t[n(420)];this[n(469)](e,i||n(481))})})[n(425)](t=>{const e=n,o=r[e(477)][e(442)](e(443));throw r.ui[e(505)][e(475)](s(r[e(471)],e(444)),{politeness:e(424)}),o[e(511)](s(r[e(471)],e(485))),t})[n(513)](()=>{const t=n;this[t(423)]=!1,this[t(501)]()})}[o(469)](t,e){const n=o,r=document[n(446)]("a");r[n(492)]=window[n(460)][n(490)](t),r[n(529)]=e,r[n(452)](),r[n(478)]()}}function a(t,e){const n=i();return(a=function(t,e){return n[t-=417]})(t,e)}function u({pageWidth:t,marginLeft:e,marginRight:n}){const r=o;return r(528)+[t,e,n][r(493)](Boolean)[r(458)](r(450))+");"}function p(t){const e=o;return e(465)==typeof t&&e(464)in t?t[e(464)]:{letter:[e(470),e(504)],legal:[e(470),e(488)],tabloid:[e(504),e(522)],ledger:[e(522),e(504)],a0:[e(517),e(489)],a1:[e(524),e(517)],a2:[e(459),e(524)],a3:[e(429),e(459)],a4:[e(421),e(429)],a5:[e(500),e(421)],a6:[e(479),e(500)]}[t[e(449)]()][0]}var d=n(311),f=n(355);const l=g;function g(t,e){const n=h();return(g=function(t,e){return n[t-=179]})(t,e)}function h(){const t=["2780436fqQDPV","35quIvap","get","set","iconView","view","pluginName","menuBar:exportPdf","bind","1348668dEGIxA","791hRtnKP","exportPdf","componentFactory","8620887SguJsn","editing","isOn","add","init","editor","52863nzPHNC","4976DVAJxn","listenTo","commands","isOfficialPlugin","children","3260547XrmDJr","execute","2AZWufl","_createButton","focus","config","isBusy","isVisible","label","Export to PDF","ExportPdfUI","locale","isPremiumPlugin","10nRJkNh","isEnabled","34232zXdMRM","Exporting PDF document"];return(h=function(){return t})()}!function(t){const e=g,n=t();for(;;)try{if(275521===-parseInt(e(201))/1*(-parseInt(e(209))/2)+-parseInt(e(191))/3+parseInt(e(180))/4*(parseInt(e(183))/5)+-parseInt(e(182))/6+-parseInt(e(192))/7*(parseInt(e(202))/8)+parseInt(e(207))/9*(parseInt(e(220))/10)+parseInt(e(195))/11)break;n.push(n.shift())}catch(t){n.push(n.shift())}}(h);class m extends t.Plugin{static get[l(188)](){return l(217)}static get[l(205)](){return!0}static get[l(219)](){return!0}[l(199)](){const t=l,e=this[t(200)];e.ui[t(194)][t(198)](t(193),()=>{const n=t,r=this[n(210)](d.ButtonView),s=e[n(204)][n(184)](n(193));return r[n(185)]({tooltip:!0}),r[n(190)](n(197)).to(s,n(213)),r}),e.ui[t(194)][t(198)](t(189),()=>this[t(210)](d.MenuBarMenuListItemButtonView))}[l(210)](t){const e=l,n=this[e(200)],r=n[e(212)][e(184)](e(193))||{},o=n[e(204)][e(184)](e(193)),i=new t(n[e(218)]),c=new d.SpinnerView;return i[e(206)][e(198)](c),c[e(190)](e(214)).to(o,e(213)),i[e(186)][e(190)](e(214)).to(o,e(213),t=>!t),i[e(185)]({icon:f.IconExportPdf}),i[e(190)](e(179)).to(o,e(179)),i[e(190)](e(215)).to(o,e(213),t=>s(n[e(218)],e(t?181:216))),this[e(203)](i,e(208),()=>{const t=e;n[t(208)](t(193),r),n[t(196)][t(187)][t(211)]()}),i}}const I=P;function x(){const t=["pluginName","init","add","5rkERmL","exportPdf","plugins","83842DnHXgT","config","_token","tokenUrl","244OAvDGX","isPremiumPlugin","requires","4350016IXMODd","token","514297taLpkg","ExportPdf","12xIGydQ","then","105435gxNNSS","isOfficialPlugin","commands","CloudServices","1284970cSRAto","editor","4635yynpvB","registerTokenUrl","9DbGSeg","32ZdNLJh","get","467868xdhpQB"];return(x=function(){return t})()}function P(t,e){const n=x();return(P=function(t,e){return n[t-=271]})(t,e)}!function(t){const e=P,n=t();for(;;)try{if(211536===-parseInt(e(295))/1*(parseInt(e(274))/2)+-parseInt(e(293))/3*(-parseInt(e(278))/4)+-parseInt(e(271))/5*(parseInt(e(298))/6)+-parseInt(e(283))/7*(-parseInt(e(296))/8)+parseInt(e(287))/9+-parseInt(e(291))/10+-parseInt(e(281))/11*(-parseInt(e(285))/12))break;n.push(n.shift())}catch(t){n.push(n.shift())}}(x);class D extends t.Plugin{[I(276)];static get[I(299)](){return I(284)}static get[I(288)](){return!0}static get[I(279)](){return!0}static get[I(280)](){return[I(290),d.Notification,m]}[I(300)](){const t=I,e=this[t(292)],n=e[t(275)][t(297)](t(272))||{};e[t(289)][t(301)](t(272),new c(e));const r=e[t(273)][t(297)](t(290));!1===n[t(277)]?this[t(276)]=null:n[t(277)]?r[t(294)](n[t(277)])[t(286)](e=>{this[t(276)]=e}):this[t(276)]=r[t(282)]}}function A(t,e){var n=w();return(A=function(t,e){return n[t-=279]})(t,e)}function w(){var t=["1330785HvlKYr","2175428UqSLMB","130122rTBMkc","2800904oZeCTC","420112mlEIqt","1094769PdnVmf","18TWNnJT","5333797wqZkGk","4EKDDuW"];return(w=function(){return t})()}!function(t){for(var e=A,n=t();;)try{if(524217===-parseInt(e(285))/1*(-parseInt(e(280))/2)+parseInt(e(286))/3+parseInt(e(282))/4+parseInt(e(281))/5*(-parseInt(e(287))/6)+-parseInt(e(279))/7+parseInt(e(284))/8+-parseInt(e(283))/9)break;n.push(n.shift())}catch(t){n.push(n.shift())}}(w)})(),(window.CKEditor5=window.CKEditor5||{}).exportPdf=r})();