@ckeditor/ckeditor5-export-pdf 41.2.1 → 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.1",
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.1"
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 _0x589ad3}from'ckeditor5/src/core.js';import{ButtonView as _0xf43004,Notification as _0x4b54f2,SpinnerView as _0x592185}from'ckeditor5/src/ui.js';import _0x21ae7b from'./exportpdfcommand.js';import _0x25148d from'../theme/icons/exportpdf.svg';export default class p extends _0x589ad3{static get['pluginName'](){return'ExportPdf';}static get['requires'](){return['CloudServices',_0x4b54f2];}['init'](){const _0x55c7a6=this['editor'],t=_0x55c7a6['t'],_0x5df203=_0x55c7a6['config']['get']('exportPdf')||{};_0x55c7a6['commands']['add']('exportPdf',new _0x21ae7b(_0x55c7a6)),_0x55c7a6['ui']['componentFactory']['add']('exportPdf',_0x4bed6a=>{const _0x5e9868=_0x55c7a6['commands']['get']('exportPdf'),_0x4ac122=new _0xf43004(_0x4bed6a),_0x1da1e8=new _0x592185();return _0x4ac122['set']({'label':t('Export\x20to\x20PDF'),'icon':_0x25148d,'tooltip':!0x0}),_0x4ac122['children']['add'](_0x1da1e8),_0x4ac122['bind']('isOn','isEnabled')['to'](_0x5e9868,'isBusy','isEnabled'),_0x1da1e8['bind']('isVisible')['to'](_0x5e9868,'isBusy'),_0x4ac122['iconView']['bind']('isVisible')['to'](_0x5e9868,'isBusy',_0x48158a=>!_0x48158a),this['listenTo'](_0x4ac122,'execute',()=>{_0x55c7a6['execute']('exportPdf',_0x5df203),_0x55c7a6['editing']['view']['focus']();}),_0x4ac122;});const _0x5871a4=_0x55c7a6['plugins']['get']('CloudServices');!0x1===_0x5df203['tokenUrl']?this['_token']=null:_0x5df203['tokenUrl']?_0x5871a4['registerTokenUrl'](_0x5df203['tokenUrl'])['then'](_0x4ec0ef=>{this['_token']=_0x4ec0ef;}):this['_token']=_0x5871a4['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 _0x2c785f}from'ckeditor5/src/core.js';import{getStyles as _0x11d644}from'./utils.js';export default class o extends _0x2c785f{constructor(_0xab4979){super(_0xab4979),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x1210f3={}){const _0x21030a=this['editor'],t=_0x21030a['t'],_0x5717b2=_0x1210f3['converterUrl']||'https://pdf-converter.cke-cs.com/v1/convert/',_0x49cc32=_0x1210f3['dataCallback']||(_0x58ca93=>_0x58ca93['data']['get']()),_0x7d7ae9=_0x21030a['plugins']['get']('ExportPdf'),_0x22bb7d=_0x1210f3['token']||_0x7d7ae9['_token'];return this['isBusy']=!0x0,this['refresh'](),_0x11d644(_0x1210f3['stylesheets']||['EDITOR_STYLES'])['then'](async _0x3cbaa4=>{const _0x4e2254={'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'+_0x21030a['locale']['contentLanguageDirection']+'\x22>\x0a\x09\x09\x09\x09\x09\x09\x09\x09'+await _0x49cc32(_0x21030a)+'\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':_0x3cbaa4,'options':_0x1210f3['converterOptions']},_0x589b2b={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/pdf',..._0x22bb7d?{'Authorization':_0x22bb7d['value']}:null,'x-cs-app-id':_0x1210f3['appID']||'cke5'},'body':JSON['stringify'](_0x4e2254)};return window['fetch'](_0x5717b2,_0x589b2b)['then'](_0x5349fe=>{if(0xc8!==_0x5349fe['status'])throw _0x5349fe;return _0x5349fe['blob']();})['then'](_0x5e9117=>{const _0x324087='function'==typeof _0x1210f3['fileName']?_0x1210f3['fileName']():_0x1210f3['fileName'];this['_downloadFile'](_0x5e9117,_0x324087||'document.pdf');});})['catch'](_0x3af3e5=>{throw _0x21030a['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20PDF.')),_0x3af3e5;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0x4970ad,_0x4b3e64){const _0x5f54db=document['createElement']('a');_0x5f54db['href']=window['URL']['createObjectURL'](_0x4970ad),_0x5f54db['download']=_0x4b3e64,_0x5f54db['click'](),_0x5f54db['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(_0x5d908d,_0x273f29){var _0xa15a4b=_0xe21d,_0x1427c2=_0x5d908d();while(!![]){try{var _0x54806a=parseInt(_0xa15a4b(0xda))/0x1*(-parseInt(_0xa15a4b(0xdb))/0x2)+-parseInt(_0xa15a4b(0xde))/0x3+-parseInt(_0xa15a4b(0xd7))/0x4+parseInt(_0xa15a4b(0xdc))/0x5*(-parseInt(_0xa15a4b(0xd8))/0x6)+-parseInt(_0xa15a4b(0xd5))/0x7+-parseInt(_0xa15a4b(0xdd))/0x8+parseInt(_0xa15a4b(0xd9))/0x9*(parseInt(_0xa15a4b(0xd6))/0xa);if(_0x54806a===_0x273f29)break;else _0x1427c2['push'](_0x1427c2['shift']());}catch(_0x1810b5){_0x1427c2['push'](_0x1427c2['shift']());}}}(_0x3302,0x4d568));function _0x3302(){var _0x452dcc=['61717llCTgs','14vECNeH','5060bpfEtV','4782248SfFwyp','1154511EXYHrB','2880101UJHRyk','1370eppzti','707944ptvEUP','2262Ssiqna','177462nATzgr'];_0x3302=function(){return _0x452dcc;};return _0x3302();}function _0xe21d(_0xa7df36,_0x3f8650){var _0x3302d4=_0x3302();return _0xe21d=function(_0xe21d86,_0x598423){_0xe21d86=_0xe21d86-0xd5;var _0x492abd=_0x3302d4[_0xe21d86];return _0x492abd;},_0xe21d(_0xa7df36,_0x3f8650);}export{default as ExportPdf}from'./exportpdf.js';import'./augmentation.js';
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(_0x4daa5d,_0x4425a2){const _0x110db4=_0x108d,_0xd8a070=_0x4daa5d();while(!![]){try{const _0x1744e6=-parseInt(_0x110db4(0xec))/0x1*(-parseInt(_0x110db4(0xf7))/0x2)+parseInt(_0x110db4(0xf1))/0x3+parseInt(_0x110db4(0x10a))/0x4*(parseInt(_0x110db4(0xf0))/0x5)+-parseInt(_0x110db4(0x103))/0x6*(parseInt(_0x110db4(0xf5))/0x7)+-parseInt(_0x110db4(0xfb))/0x8+parseInt(_0x110db4(0x106))/0x9+parseInt(_0x110db4(0xee))/0xa*(-parseInt(_0x110db4(0x104))/0xb);if(_0x1744e6===_0x4425a2)break;else _0xd8a070['push'](_0xd8a070['shift']());}catch(_0x3f7ad9){_0xd8a070['push'](_0xd8a070['shift']());}}}(_0x4c44,0x8ef96));function _0x4c44(){const _0x31f739=['indexOf','238YNJgEF','data-cke','964lbpJCm','styleSheets',':root','warn','201880LiTYfF','trim','cssText','length','join','hasAttribute','cssRules','from','18366QauOsb','17048801WeLZjn','then','10520568poeCrf','all','push','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.','152GPAVuL','ownerNode','975YsOsAR','fetch','10MwoxFf','text','2715KdWxDc','1815858TbmGMB','EDITOR_STYLES','.ck-content'];_0x4c44=function(){return _0x31f739;};return _0x4c44();}function _0x108d(_0x56a744,_0x40d450){const _0x4c4443=_0x4c44();return _0x108d=function(_0x108d22,_0x2f7a64){_0x108d22=_0x108d22-0xec;let _0x7b834c=_0x4c4443[_0x108d22];return _0x7b834c;},_0x108d(_0x56a744,_0x40d450);}export function getStyles(_0x5323b5){const _0x2834da=_0x108d;if(!_0x5323b5)return new Promise(_0x4d90ae=>_0x4d90ae(''));const _0x20061f=[];for(const _0x3af94d of _0x5323b5)_0x2834da(0xf2)!==_0x3af94d?_0x20061f[_0x2834da(0x108)](window[_0x2834da(0xed)](_0x3af94d)[_0x2834da(0x105)](_0x2091fb=>_0x2091fb[_0x2834da(0xef)]())):_0x20061f[_0x2834da(0x108)](u());return Promise[_0x2834da(0x107)](_0x20061f)[_0x2834da(0x105)](_0x50f5fa=>_0x50f5fa[_0x2834da(0xff)]('\x20')[_0x2834da(0xfc)]());}function u(){const _0x2ca424=_0x108d,_0x5e5233=[],_0x312c63=[];for(const _0x97ad91 of Array[_0x2ca424(0x102)](document[_0x2ca424(0xf8)])){if(_0x97ad91[_0x2ca424(0x10b)][_0x2ca424(0x100)](_0x2ca424(0xf6))){for(const _0x39dc80 of Array[_0x2ca424(0x102)](_0x97ad91[_0x2ca424(0x101)]))-0x1!==_0x39dc80[_0x2ca424(0xfd)][_0x2ca424(0xf4)](_0x2ca424(0xf3))?_0x5e5233[_0x2ca424(0x108)](_0x39dc80[_0x2ca424(0xfd)]):-0x1!==_0x39dc80[_0x2ca424(0xfd)][_0x2ca424(0xf4)](_0x2ca424(0xf9))&&_0x312c63[_0x2ca424(0x108)](_0x39dc80[_0x2ca424(0xfd)]);}}return _0x5e5233[_0x2ca424(0xfe)]||console[_0x2ca424(0xfa)](_0x2ca424(0x109)),[..._0x312c63,..._0x5e5233][_0x2ca424(0xff)]('\x20')[_0x2ca424(0xfc)]();}
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();}