@ckeditor/ckeditor5-export-pdf 41.2.0 → 41.3.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/build/export-pdf.js +1 -1
  2. package/dist/content-index.css +4 -0
  3. package/dist/editor-index.css +4 -0
  4. package/dist/index.css +4 -0
  5. package/dist/translations/af.d.ts +8 -0
  6. package/dist/translations/af.js +23 -0
  7. package/dist/translations/ar.d.ts +8 -0
  8. package/dist/translations/ar.js +23 -0
  9. package/dist/translations/bg.d.ts +8 -0
  10. package/dist/translations/bg.js +23 -0
  11. package/dist/translations/bn.d.ts +8 -0
  12. package/dist/translations/bn.js +23 -0
  13. package/dist/translations/ca.d.ts +8 -0
  14. package/dist/translations/ca.js +23 -0
  15. package/dist/translations/cs.d.ts +8 -0
  16. package/dist/translations/cs.js +23 -0
  17. package/dist/translations/da.d.ts +8 -0
  18. package/dist/translations/da.js +23 -0
  19. package/dist/translations/de.d.ts +8 -0
  20. package/dist/translations/de.js +23 -0
  21. package/dist/translations/el.d.ts +8 -0
  22. package/dist/translations/el.js +23 -0
  23. package/dist/translations/en-au.d.ts +8 -0
  24. package/dist/translations/en-au.js +23 -0
  25. package/dist/translations/en.d.ts +8 -0
  26. package/dist/translations/en.js +23 -0
  27. package/dist/translations/es-co.d.ts +8 -0
  28. package/dist/translations/es-co.js +23 -0
  29. package/dist/translations/es.d.ts +8 -0
  30. package/dist/translations/es.js +23 -0
  31. package/dist/translations/et.d.ts +8 -0
  32. package/dist/translations/et.js +23 -0
  33. package/dist/translations/fi.d.ts +8 -0
  34. package/dist/translations/fi.js +23 -0
  35. package/dist/translations/fr.d.ts +8 -0
  36. package/dist/translations/fr.js +23 -0
  37. package/dist/translations/gl.d.ts +8 -0
  38. package/dist/translations/gl.js +23 -0
  39. package/dist/translations/he.d.ts +8 -0
  40. package/dist/translations/he.js +23 -0
  41. package/dist/translations/hi.d.ts +8 -0
  42. package/dist/translations/hi.js +23 -0
  43. package/dist/translations/hr.d.ts +8 -0
  44. package/dist/translations/hr.js +23 -0
  45. package/dist/translations/hu.d.ts +8 -0
  46. package/dist/translations/hu.js +23 -0
  47. package/dist/translations/id.d.ts +8 -0
  48. package/dist/translations/id.js +23 -0
  49. package/dist/translations/it.d.ts +8 -0
  50. package/dist/translations/it.js +23 -0
  51. package/dist/translations/ja.d.ts +8 -0
  52. package/dist/translations/ja.js +23 -0
  53. package/dist/translations/jv.d.ts +8 -0
  54. package/dist/translations/jv.js +23 -0
  55. package/dist/translations/ko.d.ts +8 -0
  56. package/dist/translations/ko.js +23 -0
  57. package/dist/translations/lt.d.ts +8 -0
  58. package/dist/translations/lt.js +23 -0
  59. package/dist/translations/lv.d.ts +8 -0
  60. package/dist/translations/lv.js +23 -0
  61. package/dist/translations/ms.d.ts +8 -0
  62. package/dist/translations/ms.js +23 -0
  63. package/dist/translations/nl.d.ts +8 -0
  64. package/dist/translations/nl.js +23 -0
  65. package/dist/translations/no.d.ts +8 -0
  66. package/dist/translations/no.js +23 -0
  67. package/dist/translations/pl.d.ts +8 -0
  68. package/dist/translations/pl.js +23 -0
  69. package/dist/translations/pt-br.d.ts +8 -0
  70. package/dist/translations/pt-br.js +23 -0
  71. package/dist/translations/pt.d.ts +8 -0
  72. package/dist/translations/pt.js +23 -0
  73. package/dist/translations/ro.d.ts +8 -0
  74. package/dist/translations/ro.js +23 -0
  75. package/dist/translations/ru.d.ts +8 -0
  76. package/dist/translations/ru.js +23 -0
  77. package/dist/translations/sk.d.ts +8 -0
  78. package/dist/translations/sk.js +23 -0
  79. package/dist/translations/sr-latn.d.ts +8 -0
  80. package/dist/translations/sr-latn.js +23 -0
  81. package/dist/translations/sr.d.ts +8 -0
  82. package/dist/translations/sr.js +23 -0
  83. package/dist/translations/sv.d.ts +8 -0
  84. package/dist/translations/sv.js +23 -0
  85. package/dist/translations/th.d.ts +8 -0
  86. package/dist/translations/th.js +23 -0
  87. package/dist/translations/tr.d.ts +8 -0
  88. package/dist/translations/tr.js +23 -0
  89. package/dist/translations/ug.d.ts +8 -0
  90. package/dist/translations/ug.js +23 -0
  91. package/dist/translations/uk.d.ts +8 -0
  92. package/dist/translations/uk.js +23 -0
  93. package/dist/translations/ur.d.ts +8 -0
  94. package/dist/translations/ur.js +23 -0
  95. package/dist/translations/vi.d.ts +8 -0
  96. package/dist/translations/vi.js +23 -0
  97. package/dist/translations/zh-cn.d.ts +8 -0
  98. package/dist/translations/zh-cn.js +23 -0
  99. package/dist/translations/zh.d.ts +8 -0
  100. package/dist/translations/zh.js +23 -0
  101. package/dist/types/augmentation.d.ts +25 -0
  102. package/dist/types/exportpdf.d.ts +224 -0
  103. package/dist/types/exportpdfcommand.d.ts +43 -0
  104. package/dist/types/index.d.ts +14 -0
  105. package/dist/types/utils.d.ts +14 -0
  106. package/package.json +3 -2
  107. package/src/exportpdf.js +1 -1
  108. package/src/exportpdfcommand.js +1 -1
  109. package/src/index.js +1 -1
  110. package/src/utils.js +1 -1
@@ -0,0 +1,224 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module export-pdf/exportpdf
11
+ * @publicApi
12
+ */
13
+ import { Plugin, type Editor } from 'ckeditor5/src/core.js';
14
+ import { Notification } from 'ckeditor5/src/ui.js';
15
+ import type { InitializedToken, TokenUrl } from '@ckeditor/ckeditor5-cloud-services';
16
+ /**
17
+ * The export to PDF feature.
18
+ *
19
+ * It allows you to generate a PDF file directly from the editor content.
20
+ *
21
+ * For a detailed overview, check the {@glink features/converters/export-pdf export to PDF} feature documentation.
22
+ */
23
+ export default class ExportPdf extends Plugin {
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ static get pluginName(): "ExportPdf";
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ static get requires(): readonly ["CloudServices", typeof Notification];
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ init(): void;
36
+ }
37
+ /**
38
+ * The configuration of the export to PDF feature. It is used by the PDF export features from the `@ckeditor/ckeditor5-export-pdf` package.
39
+ *
40
+ * ```ts
41
+ * ClassicEditor
42
+ * .create( editorElement, {
43
+ * exportPdf: ... // Export to PDF feature options.
44
+ * } )
45
+ * .then( ... )
46
+ * .catch( ... );
47
+ * ```
48
+ *
49
+ * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
50
+ */
51
+ export interface ExportPdfConfig {
52
+ /**
53
+ * Paths to the `.css` files containing additional styling for the editor's content (**the order of provided items matters**).
54
+ *
55
+ * ```ts
56
+ * const exportPdfConfig = {
57
+ * stylesheets: [ './path/to/custom-style.css' ]
58
+ * }
59
+ * ```
60
+ *
61
+ * **NOTE:** If `stylesheets` are not provided, the plugin will sent only
62
+ * {@glink installation/advanced/content-styles#the-full-list-of-content-styles the default editor content styles} to the converter.
63
+ *
64
+ * **Default editor's content styles**:
65
+ * {@glink installation/advanced/content-styles#the-full-list-of-content-styles The default editor content styles}
66
+ * are applied to the generated PDF thanks to the 'EDITOR_STYLES' token, which is provided to the `stylesheets` by default.
67
+ * If you don't want them to be applied, you have to omit the token:
68
+ *
69
+ * ```ts
70
+ * const exportPdfConfig = {
71
+ * stylesheets: [ './path/to/custom-editor-styles.css' ]
72
+ * }
73
+ * ```
74
+ *
75
+ * **Web fonts:** If you want to {@glink features/converters/export-pdf#providing-web-font-styles use web fonts} in your PDF document,
76
+ * you should provide a path to the file containing the web font declaration before the `'EDITOR_STYLES'` token:
77
+ *
78
+ * ```ts
79
+ * const exportPdfConfig = {
80
+ * stylesheets: [
81
+ * './path/to/fonts.css',
82
+ * 'EDITOR_STYLES'
83
+ * ]
84
+ * }
85
+ * ```
86
+ *
87
+ * **Web fonts and custom styling:** For more advanced styling, your configuration should look like this:
88
+ *
89
+ * ```ts
90
+ * const exportPdfConfig = {
91
+ * stylesheets: [
92
+ * './path/to/fonts.css',
93
+ * 'EDITOR_STYLES',
94
+ * './path/to/custom-styles.css'
95
+ * ]
96
+ * }
97
+ * ```
98
+ *
99
+ * @default `[ 'EDITOR_STYLES' ]`
100
+ */
101
+ stylesheets?: Array<string>;
102
+ /**
103
+ * The name of the generated PDF file.
104
+ *
105
+ * ```ts
106
+ * // Static file name.
107
+ * const exportPdfConfig = {
108
+ * fileName: 'my-document.pdf'
109
+ * }
110
+ *
111
+ * // Dynamic file name.
112
+ * const exportPdfConfig = {
113
+ * fileName: () => {
114
+ * const articleTitle = document.querySelector( '#title' );
115
+ *
116
+ * return `${ articleTitle.value }.pdf`;
117
+ * }
118
+ * }
119
+ * ```
120
+ *
121
+ * **NOTE:** The file name must contain the `.pdf` extension.
122
+ * Otherwise your operating system or device may have trouble identifying the file type.
123
+ *
124
+ * @default 'document.pdf'
125
+ */
126
+ fileName?: string | (() => string);
127
+ /**
128
+ * A URL to the HTML to PDF converter.
129
+ *
130
+ * ```ts
131
+ * const exportPdfConfig = {
132
+ * converterUrl: 'https://myconverter.com/v1/'
133
+ * }
134
+ * ```
135
+ *
136
+ * **NOTE:** The plugin uses the default HTML to PDF converter delivered by CKEditor Cloud Services.
137
+ * You can provide a URL to an on-premises converter instead.
138
+ *
139
+ * @default 'https://pdf-converter.cke-cs.com/v1/convert'
140
+ */
141
+ converterUrl?: string;
142
+ /**
143
+ * The HTML to PDF converter options.
144
+ *
145
+ * **NOTE:** Configuring the plugin is not mandatory but it is highly recommended,
146
+ * especially if you want to get the most accurate results when generating the PDF file.
147
+ * To learn more, please check the [HTML to PDF converter configuration](https://pdf-converter.cke-cs.com/docs).
148
+ *
149
+ * ```ts
150
+ * const exportPdfConfig = {
151
+ * converterOptions: {
152
+ * ...
153
+ * }
154
+ * }
155
+ * ```
156
+ *
157
+ * @default `{
158
+ * format: 'A4',
159
+ * margin_top: '0',
160
+ * margin_bottom: '0',
161
+ * margin_right: '0',
162
+ * margin_left: '0',
163
+ * page_orientation: 'portrait',
164
+ * header_html: undefined,
165
+ * footer_html: undefined,
166
+ * header_and_footer_css: undefined,
167
+ * wait_for_network: true,
168
+ * wait_time: 0
169
+ * }`
170
+ */
171
+ converterOptions?: ExportPdfConverterOptions;
172
+ /**
173
+ * A function to gather the HTML to be converted to PDF.
174
+ *
175
+ * **NOTE:** This option may be useful when the editor does not have `getData()` method,
176
+ * or if the HTML to be converted should be different than the edited one.
177
+ *
178
+ * ```ts
179
+ * const exportPdfConfig = {
180
+ * dataCallback: ( editor: Editor ) => {
181
+ * return `
182
+ * <header id="header">${ editor.data.get( { rootName: 'header' } ) }</header>
183
+ * <div id="content">${ editor.data.get( { rootName: 'content' } ) }</div>
184
+ * `;
185
+ * }
186
+ * }
187
+ * ```
188
+ *
189
+ * @default `( editor: Editor ) => editor.getData()`
190
+ */
191
+ dataCallback?: (editor: Editor) => string;
192
+ /**
193
+ * A token URL or a token request function. This field is optional and should be used only when a different `tokenUrl` is required for
194
+ * the export to PDF feature.
195
+ *
196
+ * **Note:** The token can be disabled with the `false` value provided.
197
+ *
198
+ * See: {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl}
199
+ */
200
+ tokenUrl?: TokenUrl | false;
201
+ /**
202
+ * The authentication token.
203
+ *
204
+ * See: {@link module:cloud-services/cloudservices~CloudServices#token}
205
+ */
206
+ token?: InitializedToken;
207
+ /**
208
+ * The application unique identifier.
209
+ */
210
+ appID?: string;
211
+ }
212
+ export type ExportPdfConverterOptions = {
213
+ format?: 'Letter' | 'Legal' | 'Tabloid' | 'Ledger' | 'A0' | 'A1' | 'A2' | 'A3' | 'A4' | 'A5' | 'A6';
214
+ margin_top?: string;
215
+ margin_bottom?: string;
216
+ margin_right?: string;
217
+ margin_left?: string;
218
+ header_html?: string;
219
+ footer_html?: string;
220
+ header_and_footer_css?: string;
221
+ page_orientation?: 'portrait' | 'landscape';
222
+ wait_for_network?: boolean;
223
+ wait_time?: number;
224
+ };
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module export-pdf/exportpdfcommand
11
+ * @publicApi
12
+ */
13
+ import { Command, type Editor } from 'ckeditor5/src/core.js';
14
+ import { type ExportPdfConfig } from './exportpdf.js';
15
+ /**
16
+ * The export to PDF command.
17
+ *
18
+ * It takes the editor's HTML and CSS rules from the document and sends them to the HTML to PDF converter.
19
+ * After processing, the converter will send back a PDF file for download.
20
+ */
21
+ export default class ExportPdfCommand extends Command {
22
+ /**
23
+ * A command state that indicates if the command is currently executing.
24
+ *
25
+ * @observable
26
+ */
27
+ isBusy: boolean;
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ constructor(editor: Editor);
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ refresh(): void;
36
+ /**
37
+ * Executes the command.
38
+ *
39
+ * @fires execute
40
+ * @param options Options for the executed command.
41
+ */
42
+ execute(options?: ExportPdfConfig): Promise<void>;
43
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module export-pdf
11
+ */
12
+ export { default as ExportPdf, type ExportPdfConfig } from './exportpdf.js';
13
+ export type { default as ExportPdfCommand } from './exportpdfcommand.js';
14
+ import './augmentation.js';
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * A helper function for getting concatenated CSS rules from external stylesheets and the editor.
11
+ *
12
+ * @param stylesheets An array of stylesheet paths delivered by the user through the plugin configuration.
13
+ */
14
+ export declare function getStyles(stylesheets?: Array<string>): Promise<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-export-pdf",
3
- "version": "41.2.0",
3
+ "version": "41.3.0-alpha.2",
4
4
  "description": "Export to PDF feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -30,13 +30,14 @@
30
30
  "type": "module",
31
31
  "main": "src/index.js",
32
32
  "dependencies": {
33
- "ckeditor5": "41.2.0"
33
+ "ckeditor5": "41.3.0-alpha.2"
34
34
  },
35
35
  "license": "SEE LICENSE IN LICENSE.md",
36
36
  "author": "CKSource (http://cksource.com/)",
37
37
  "homepage": "https://ckeditor.com/ckeditor-5",
38
38
  "bugs": "https://support.ckeditor.com/hc/en-us/requests/new",
39
39
  "files": [
40
+ "dist",
40
41
  "lang",
41
42
  "src/**/*.js",
42
43
  "src/**/*.d.ts",
package/src/exportpdf.js CHANGED
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Plugin as _0x383f68}from'ckeditor5/src/core.js';import{ButtonView as _0x2cb02d,Notification as _0xefae6f,SpinnerView as _0x47e98b}from'ckeditor5/src/ui.js';import _0x130b62 from'./exportpdfcommand.js';import _0x5e7568 from'../theme/icons/exportpdf.svg';export default class p extends _0x383f68{static get['pluginName'](){return'ExportPdf';}static get['requires'](){return['CloudServices',_0xefae6f];}['init'](){const _0x1e81f4=this['editor'],t=_0x1e81f4['t'],_0x1c7ca5=_0x1e81f4['config']['get']('exportPdf')||{};_0x1e81f4['commands']['add']('exportPdf',new _0x130b62(_0x1e81f4)),_0x1e81f4['ui']['componentFactory']['add']('exportPdf',_0x137224=>{const _0x2d5cc6=_0x1e81f4['commands']['get']('exportPdf'),_0x430b76=new _0x2cb02d(_0x137224),_0x443787=new _0x47e98b();return _0x430b76['set']({'label':t('Export\x20to\x20PDF'),'icon':_0x5e7568,'tooltip':!0x0}),_0x430b76['children']['add'](_0x443787),_0x430b76['bind']('isOn','isEnabled')['to'](_0x2d5cc6,'isBusy','isEnabled'),_0x443787['bind']('isVisible')['to'](_0x2d5cc6,'isBusy'),_0x430b76['iconView']['bind']('isVisible')['to'](_0x2d5cc6,'isBusy',_0x2561cb=>!_0x2561cb),this['listenTo'](_0x430b76,'execute',()=>{_0x1e81f4['execute']('exportPdf',_0x1c7ca5),_0x1e81f4['editing']['view']['focus']();}),_0x430b76;});const _0x390923=_0x1e81f4['plugins']['get']('CloudServices');!0x1===_0x1c7ca5['tokenUrl']?this['_token']=null:_0x1c7ca5['tokenUrl']?_0x390923['registerTokenUrl'](_0x1c7ca5['tokenUrl'])['then'](_0x893669=>{this['_token']=_0x893669;}):this['_token']=_0x390923['token'];}}
23
+ import{Plugin as _0x5a053c}from'ckeditor5/src/core.js';import{ButtonView as _0x187b64,Notification as _0x283101,SpinnerView as _0x33ab6d}from'ckeditor5/src/ui.js';import _0x27de78 from'./exportpdfcommand.js';import _0x318c15 from'../theme/icons/exportpdf.svg';export default class p extends _0x5a053c{static get['pluginName'](){return'ExportPdf';}static get['requires'](){return['CloudServices',_0x283101];}['init'](){const _0x72f3aa=this['editor'],t=_0x72f3aa['t'],_0x3ace2e=_0x72f3aa['config']['get']('exportPdf')||{};_0x72f3aa['commands']['add']('exportPdf',new _0x27de78(_0x72f3aa)),_0x72f3aa['ui']['componentFactory']['add']('exportPdf',_0x1e3d39=>{const _0x385473=_0x72f3aa['commands']['get']('exportPdf'),_0x153392=new _0x187b64(_0x1e3d39),_0x4005c8=new _0x33ab6d();return _0x153392['set']({'label':t('Export\x20to\x20PDF'),'icon':_0x318c15,'tooltip':!0x0}),_0x153392['children']['add'](_0x4005c8),_0x153392['bind']('isOn','isEnabled')['to'](_0x385473,'isBusy','isEnabled'),_0x4005c8['bind']('isVisible')['to'](_0x385473,'isBusy'),_0x153392['iconView']['bind']('isVisible')['to'](_0x385473,'isBusy',_0x414904=>!_0x414904),this['listenTo'](_0x153392,'execute',()=>{_0x72f3aa['execute']('exportPdf',_0x3ace2e),_0x72f3aa['editing']['view']['focus']();}),_0x153392;});const _0x18e708=_0x72f3aa['plugins']['get']('CloudServices');!0x1===_0x3ace2e['tokenUrl']?this['_token']=null:_0x3ace2e['tokenUrl']?_0x18e708['registerTokenUrl'](_0x3ace2e['tokenUrl'])['then'](_0x2dea20=>{this['_token']=_0x2dea20;}):this['_token']=_0x18e708['token'];}}
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Command as _0x37c1f5}from'ckeditor5/src/core.js';import{getStyles as _0x5894c8}from'./utils.js';export default class o extends _0x37c1f5{constructor(_0x3b047d){super(_0x3b047d),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x497795={}){const _0x1ec57c=this['editor'],t=_0x1ec57c['t'],_0x196941=_0x497795['converterUrl']||'https://pdf-converter.cke-cs.com/v1/convert/',_0x9db727=_0x497795['dataCallback']||(_0x5bc524=>_0x5bc524['data']['get']()),_0x520885=_0x1ec57c['plugins']['get']('ExportPdf'),_0x515f24=_0x497795['token']||_0x520885['_token'];return this['isBusy']=!0x0,this['refresh'](),_0x5894c8(_0x497795['stylesheets']||['EDITOR_STYLES'])['then'](async _0x41d0fd=>{const _0x4df271={'html':'<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'+_0x1ec57c['locale']['contentLanguageDirection']+'\x22>\x0a\x09\x09\x09\x09\x09\x09\x09\x09'+await _0x9db727(_0x1ec57c)+'\x0a\x09\x09\x09\x09\x09\x09\x09</div>\x0a\x09\x09\x09\x09\x09\x09</body>\x0a\x09\x09\x09\x09\x09</html>','css':_0x41d0fd,'options':_0x497795['converterOptions']},_0x36d2b6={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/pdf',..._0x515f24?{'Authorization':_0x515f24['value']}:null,'x-cs-app-id':_0x497795['appID']||'cke5'},'body':JSON['stringify'](_0x4df271)};return window['fetch'](_0x196941,_0x36d2b6)['then'](_0x461280=>{if(0xc8!==_0x461280['status'])throw _0x461280;return _0x461280['blob']();})['then'](_0x56b0c3=>{const _0x1e3993='function'==typeof _0x497795['fileName']?_0x497795['fileName']():_0x497795['fileName'];this['_downloadFile'](_0x56b0c3,_0x1e3993||'document.pdf');});})['catch'](_0xf6a339=>{throw _0x1ec57c['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20PDF.')),_0xf6a339;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0x3a0586,_0x27307e){const _0x1e67f0=document['createElement']('a');_0x1e67f0['href']=window['URL']['createObjectURL'](_0x3a0586),_0x1e67f0['download']=_0x27307e,_0x1e67f0['click'](),_0x1e67f0['remove']();}}
23
+ import{Command as _0x1e998b}from'ckeditor5/src/core.js';import{getStyles as _0x12b2d9}from'./utils.js';export default class o extends _0x1e998b{constructor(_0x308d92){super(_0x308d92),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x4f8709={}){const _0x26d03d=this['editor'],t=_0x26d03d['t'],_0x4f955a=_0x4f8709['converterUrl']||'https://pdf-converter.cke-cs.com/v1/convert/',_0x14a505=_0x4f8709['dataCallback']||(_0xc18cff=>_0xc18cff['data']['get']()),_0x45d129=_0x26d03d['plugins']['get']('ExportPdf'),_0x3c9d8f=_0x4f8709['token']||_0x45d129['_token'];return this['isBusy']=!0x0,this['refresh'](),_0x12b2d9(_0x4f8709['stylesheets']||['EDITOR_STYLES'])['then'](async _0x3865bc=>{const _0x46a0a4={'html':'<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'+_0x26d03d['locale']['contentLanguageDirection']+'\x22>\x0a\x09\x09\x09\x09\x09\x09\x09\x09'+await _0x14a505(_0x26d03d)+'\x0a\x09\x09\x09\x09\x09\x09\x09</div>\x0a\x09\x09\x09\x09\x09\x09</body>\x0a\x09\x09\x09\x09\x09</html>','css':_0x3865bc,'options':_0x4f8709['converterOptions']},_0x3f69f2={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/pdf',..._0x3c9d8f?{'Authorization':_0x3c9d8f['value']}:null,'x-cs-app-id':_0x4f8709['appID']||'cke5'},'body':JSON['stringify'](_0x46a0a4)};return window['fetch'](_0x4f955a,_0x3f69f2)['then'](_0x392645=>{if(0xc8!==_0x392645['status'])throw _0x392645;return _0x392645['blob']();})['then'](_0x1fc3a0=>{const _0x4c5722='function'==typeof _0x4f8709['fileName']?_0x4f8709['fileName']():_0x4f8709['fileName'];this['_downloadFile'](_0x1fc3a0,_0x4c5722||'document.pdf');});})['catch'](_0x6e2481=>{throw _0x26d03d['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20PDF.')),_0x6e2481;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0x55de4e,_0x4ab41e){const _0x20d811=document['createElement']('a');_0x20d811['href']=window['URL']['createObjectURL'](_0x55de4e),_0x20d811['download']=_0x4ab41e,_0x20d811['click'](),_0x20d811['remove']();}}
package/src/index.js CHANGED
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- (function(_0x199c83,_0x13d57b){var _0x3dba9d=_0x3aa0,_0x4a8930=_0x199c83();while(!![]){try{var _0x2993dc=parseInt(_0x3dba9d(0x1e1))/0x1*(parseInt(_0x3dba9d(0x1e0))/0x2)+parseInt(_0x3dba9d(0x1e2))/0x3*(-parseInt(_0x3dba9d(0x1e4))/0x4)+-parseInt(_0x3dba9d(0x1dd))/0x5+-parseInt(_0x3dba9d(0x1e5))/0x6*(-parseInt(_0x3dba9d(0x1df))/0x7)+parseInt(_0x3dba9d(0x1de))/0x8*(-parseInt(_0x3dba9d(0x1e6))/0x9)+parseInt(_0x3dba9d(0x1e7))/0xa+-parseInt(_0x3dba9d(0x1e3))/0xb;if(_0x2993dc===_0x13d57b)break;else _0x4a8930['push'](_0x4a8930['shift']());}catch(_0x2725ec){_0x4a8930['push'](_0x4a8930['shift']());}}}(_0x1582,0xaec57));function _0x3aa0(_0x20b105,_0x1a8554){var _0x158283=_0x1582();return _0x3aa0=function(_0x3aa0eb,_0x3fb021){_0x3aa0eb=_0x3aa0eb-0x1dd;var _0x41cf3f=_0x158283[_0x3aa0eb];return _0x41cf3f;},_0x3aa0(_0x20b105,_0x1a8554);}export{default as ExportPdf}from'./exportpdf.js';import'./augmentation.js';function _0x1582(){var _0x1640a0=['32ULRurV','6yTqiBt','90xEzIhA','8137010lXTmaP','3788015ZSdmFG','232616EbuTFZ','8788199VeWSYm','240PvdAFh','8675SPhdde','475863SFStME','846494CqSTjT'];_0x1582=function(){return _0x1640a0;};return _0x1582();}
23
+ function _0x1111(){var _0x5de86e=['1112825jOYxSm','43788nMDuOz','821450LHlfib','119427QNtGzc','26667VRANxf','76ewgnAz','1025598NrdTRd','193908gOsGag','15nSZvng','403aszWkA','11EyPdwb','520COAhWe','2BvkQUg'];_0x1111=function(){return _0x5de86e;};return _0x1111();}function _0x4ed6(_0x532114,_0x27fdd2){var _0x1111eb=_0x1111();return _0x4ed6=function(_0x4ed6b3,_0x1f37f3){_0x4ed6b3=_0x4ed6b3-0x103;var _0x2f27e0=_0x1111eb[_0x4ed6b3];return _0x2f27e0;},_0x4ed6(_0x532114,_0x27fdd2);}(function(_0x1eb783,_0x3a13a2){var _0x430f9=_0x4ed6,_0x554526=_0x1eb783();while(!![]){try{var _0xb1f1=-parseInt(_0x430f9(0x10b))/0x1*(parseInt(_0x430f9(0x107))/0x2)+-parseInt(_0x430f9(0x109))/0x3*(-parseInt(_0x430f9(0x10d))/0x4)+parseInt(_0x430f9(0x103))/0x5*(parseInt(_0x430f9(0x10e))/0x6)+-parseInt(_0x430f9(0x108))/0x7+-parseInt(_0x430f9(0x106))/0x8*(-parseInt(_0x430f9(0x10c))/0x9)+-parseInt(_0x430f9(0x10a))/0xa*(-parseInt(_0x430f9(0x105))/0xb)+parseInt(_0x430f9(0x10f))/0xc*(-parseInt(_0x430f9(0x104))/0xd);if(_0xb1f1===_0x3a13a2)break;else _0x554526['push'](_0x554526['shift']());}catch(_0x352918){_0x554526['push'](_0x554526['shift']());}}}(_0x1111,0x45b5c));export{default as ExportPdf}from'./exportpdf.js';import'./augmentation.js';
package/src/utils.js CHANGED
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- (function(_0x5de130,_0x49eeaf){const _0x3e30e2=_0x3041,_0x4cabe2=_0x5de130();while(!![]){try{const _0x206099=parseInt(_0x3e30e2(0x175))/0x1+parseInt(_0x3e30e2(0x185))/0x2+-parseInt(_0x3e30e2(0x18d))/0x3+parseInt(_0x3e30e2(0x182))/0x4*(parseInt(_0x3e30e2(0x186))/0x5)+parseInt(_0x3e30e2(0x18c))/0x6*(parseInt(_0x3e30e2(0x174))/0x7)+parseInt(_0x3e30e2(0x171))/0x8*(parseInt(_0x3e30e2(0x17f))/0x9)+parseInt(_0x3e30e2(0x187))/0xa*(-parseInt(_0x3e30e2(0x183))/0xb);if(_0x206099===_0x49eeaf)break;else _0x4cabe2['push'](_0x4cabe2['shift']());}catch(_0x3b0fd3){_0x4cabe2['push'](_0x4cabe2['shift']());}}}(_0x17dc,0xf0d58));function _0x3041(_0x2e113a,_0x30c282){const _0x17dc3f=_0x17dc();return _0x3041=function(_0x304101,_0x19fd88){_0x304101=_0x304101-0x16e;let _0x425a93=_0x17dc3f[_0x304101];return _0x425a93;},_0x3041(_0x2e113a,_0x30c282);}export function getStyles(_0x8ffb5e){const _0x167cee=_0x3041;if(!_0x8ffb5e)return new Promise(_0x4fccfd=>_0x4fccfd(''));const _0x51a8ca=[];for(const _0x331145 of _0x8ffb5e)_0x167cee(0x17a)!==_0x331145?_0x51a8ca[_0x167cee(0x179)](window[_0x167cee(0x16e)](_0x331145)[_0x167cee(0x17b)](_0x422038=>_0x422038[_0x167cee(0x18a)]())):_0x51a8ca[_0x167cee(0x179)](u());return Promise[_0x167cee(0x176)](_0x51a8ca)[_0x167cee(0x17b)](_0x936c2f=>_0x936c2f[_0x167cee(0x177)]('\x20')[_0x167cee(0x16f)]());}function u(){const _0x2e94c6=_0x3041,_0x21faa2=[],_0x2b1846=[];for(const _0x3ec8e6 of Array[_0x2e94c6(0x17d)](document[_0x2e94c6(0x188)])){if(_0x3ec8e6[_0x2e94c6(0x181)][_0x2e94c6(0x189)](_0x2e94c6(0x170))){for(const _0x425a35 of Array[_0x2e94c6(0x17d)](_0x3ec8e6[_0x2e94c6(0x184)]))-0x1!==_0x425a35[_0x2e94c6(0x180)][_0x2e94c6(0x18b)](_0x2e94c6(0x17c))?_0x21faa2[_0x2e94c6(0x179)](_0x425a35[_0x2e94c6(0x180)]):-0x1!==_0x425a35[_0x2e94c6(0x180)][_0x2e94c6(0x18b)](_0x2e94c6(0x178))&&_0x2b1846[_0x2e94c6(0x179)](_0x425a35[_0x2e94c6(0x180)]);}}return _0x21faa2[_0x2e94c6(0x173)]||console[_0x2e94c6(0x17e)](_0x2e94c6(0x172)),[..._0x2b1846,..._0x21faa2][_0x2e94c6(0x177)]('\x20')[_0x2e94c6(0x16f)]();}function _0x17dc(){const _0x1411d9=['3127020PylGpv','fetch','trim','data-cke','1031312rjSihI','The\x20editor\x20stylesheet\x20could\x20not\x20be\x20found\x20in\x20the\x20document.\x20Check\x20your\x20webpack\x20config\x20–\x20style-loader\x20should\x20use\x20data-cke=true\x20attribute\x20for\x20the\x20editor\x20stylesheet.','length','1295FPGDpW','1557438OcXUmu','all','join',':root','push','EDITOR_STYLES','then','.ck-content','from','warn','9dZtaNr','cssText','ownerNode','676eoAASq','228063TGbjvo','cssRules','55300MarFFJ','41985AceAeH','880iAkBdo','styleSheets','hasAttribute','text','indexOf','23358lWuxmc'];_0x17dc=function(){return _0x1411d9;};return _0x17dc();}
23
+ function _0x36e7(_0x4207e8,_0x17663b){const _0x31581e=_0x3158();return _0x36e7=function(_0x36e79a,_0x1ebefc){_0x36e79a=_0x36e79a-0x70;let _0x553c9d=_0x31581e[_0x36e79a];return _0x553c9d;},_0x36e7(_0x4207e8,_0x17663b);}(function(_0x47c5c5,_0x162999){const _0x3ba703=_0x36e7,_0x2d5a4f=_0x47c5c5();while(!![]){try{const _0x1b5fd=-parseInt(_0x3ba703(0x8d))/0x1+-parseInt(_0x3ba703(0x74))/0x2*(parseInt(_0x3ba703(0x75))/0x3)+-parseInt(_0x3ba703(0x89))/0x4+-parseInt(_0x3ba703(0x86))/0x5+-parseInt(_0x3ba703(0x8e))/0x6+-parseInt(_0x3ba703(0x84))/0x7*(-parseInt(_0x3ba703(0x79))/0x8)+-parseInt(_0x3ba703(0x8c))/0x9*(-parseInt(_0x3ba703(0x70))/0xa);if(_0x1b5fd===_0x162999)break;else _0x2d5a4f['push'](_0x2d5a4f['shift']());}catch(_0x46edfb){_0x2d5a4f['push'](_0x2d5a4f['shift']());}}}(_0x3158,0xbd117));export function getStyles(_0x2f6a73){const _0x298003=_0x36e7;if(!_0x2f6a73)return new Promise(_0x514009=>_0x514009(''));const _0x1ab344=[];for(const _0xcc763d of _0x2f6a73)_0x298003(0x83)!==_0xcc763d?_0x1ab344[_0x298003(0x73)](window[_0x298003(0x76)](_0xcc763d)[_0x298003(0x8a)](_0xda5c56=>_0xda5c56[_0x298003(0x77)]())):_0x1ab344[_0x298003(0x73)](u());return Promise[_0x298003(0x8b)](_0x1ab344)[_0x298003(0x8a)](_0x2fdbd9=>_0x2fdbd9[_0x298003(0x72)]('\x20')[_0x298003(0x7c)]());}function u(){const _0x323102=_0x36e7,_0x2cb499=[],_0x383867=[];for(const _0x56389e of Array[_0x323102(0x71)](document[_0x323102(0x7b)])){if(_0x56389e[_0x323102(0x7f)][_0x323102(0x80)](_0x323102(0x85))){for(const _0x6ce86b of Array[_0x323102(0x71)](_0x56389e[_0x323102(0x87)]))-0x1!==_0x6ce86b[_0x323102(0x81)][_0x323102(0x82)](_0x323102(0x7e))?_0x2cb499[_0x323102(0x73)](_0x6ce86b[_0x323102(0x81)]):-0x1!==_0x6ce86b[_0x323102(0x81)][_0x323102(0x82)](_0x323102(0x7a))&&_0x383867[_0x323102(0x73)](_0x6ce86b[_0x323102(0x81)]);}}return _0x2cb499[_0x323102(0x78)]||console[_0x323102(0x7d)](_0x323102(0x88)),[..._0x383867,..._0x2cb499][_0x323102(0x72)]('\x20')[_0x323102(0x7c)]();}function _0x3158(){const _0x327b40=[':root','styleSheets','trim','warn','.ck-content','ownerNode','hasAttribute','cssText','indexOf','EDITOR_STYLES','2569BRZWoK','data-cke','509895ELpcTs','cssRules','The\x20editor\x20stylesheet\x20could\x20not\x20be\x20found\x20in\x20the\x20document.\x20Check\x20your\x20webpack\x20config\x20–\x20style-loader\x20should\x20use\x20data-cke=true\x20attribute\x20for\x20the\x20editor\x20stylesheet.','4834340OToWeo','then','all','39129138ZfOmzK','860212ZUxaCG','3327396QufcjG','10eNqjhg','from','join','push','2NuSQvT','3773568FrQLsC','fetch','text','length','8936dXghAx'];_0x3158=function(){return _0x327b40;};return _0x3158();}