@ckeditor/ckeditor5-export-pdf 41.3.1 → 41.4.0-alpha.0
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.
- package/build/export-pdf.js +1 -1
- package/dist/index-content.css +4 -0
- package/dist/index-editor.css +4 -0
- package/dist/index.css +4 -0
- package/dist/index.js +23 -0
- package/dist/translations/af.d.ts +8 -0
- package/dist/translations/af.js +23 -0
- package/dist/translations/ar.d.ts +8 -0
- package/dist/translations/ar.js +23 -0
- package/dist/translations/bg.d.ts +8 -0
- package/dist/translations/bg.js +23 -0
- package/dist/translations/bn.d.ts +8 -0
- package/dist/translations/bn.js +23 -0
- package/dist/translations/ca.d.ts +8 -0
- package/dist/translations/ca.js +23 -0
- package/dist/translations/cs.d.ts +8 -0
- package/dist/translations/cs.js +23 -0
- package/dist/translations/da.d.ts +8 -0
- package/dist/translations/da.js +23 -0
- package/dist/translations/de.d.ts +8 -0
- package/dist/translations/de.js +23 -0
- package/dist/translations/el.d.ts +8 -0
- package/dist/translations/el.js +23 -0
- package/dist/translations/en-au.d.ts +8 -0
- package/dist/translations/en-au.js +23 -0
- package/dist/translations/en.d.ts +8 -0
- package/dist/translations/en.js +23 -0
- package/dist/translations/es-co.d.ts +8 -0
- package/dist/translations/es-co.js +23 -0
- package/dist/translations/es.d.ts +8 -0
- package/dist/translations/es.js +23 -0
- package/dist/translations/et.d.ts +8 -0
- package/dist/translations/et.js +23 -0
- package/dist/translations/fi.d.ts +8 -0
- package/dist/translations/fi.js +23 -0
- package/dist/translations/fr.d.ts +8 -0
- package/dist/translations/fr.js +23 -0
- package/dist/translations/gl.d.ts +8 -0
- package/dist/translations/gl.js +23 -0
- package/dist/translations/he.d.ts +8 -0
- package/dist/translations/he.js +23 -0
- package/dist/translations/hi.d.ts +8 -0
- package/dist/translations/hi.js +23 -0
- package/dist/translations/hr.d.ts +8 -0
- package/dist/translations/hr.js +23 -0
- package/dist/translations/hu.d.ts +8 -0
- package/dist/translations/hu.js +23 -0
- package/dist/translations/id.d.ts +8 -0
- package/dist/translations/id.js +23 -0
- package/dist/translations/it.d.ts +8 -0
- package/dist/translations/it.js +23 -0
- package/dist/translations/ja.d.ts +8 -0
- package/dist/translations/ja.js +23 -0
- package/dist/translations/jv.d.ts +8 -0
- package/dist/translations/jv.js +23 -0
- package/dist/translations/ko.d.ts +8 -0
- package/dist/translations/ko.js +23 -0
- package/dist/translations/lt.d.ts +8 -0
- package/dist/translations/lt.js +23 -0
- package/dist/translations/lv.d.ts +8 -0
- package/dist/translations/lv.js +23 -0
- package/dist/translations/ms.d.ts +8 -0
- package/dist/translations/ms.js +23 -0
- package/dist/translations/nl.d.ts +8 -0
- package/dist/translations/nl.js +23 -0
- package/dist/translations/no.d.ts +8 -0
- package/dist/translations/no.js +23 -0
- package/dist/translations/pl.d.ts +8 -0
- package/dist/translations/pl.js +23 -0
- package/dist/translations/pt-br.d.ts +8 -0
- package/dist/translations/pt-br.js +23 -0
- package/dist/translations/pt.d.ts +8 -0
- package/dist/translations/pt.js +23 -0
- package/dist/translations/ro.d.ts +8 -0
- package/dist/translations/ro.js +23 -0
- package/dist/translations/ru.d.ts +8 -0
- package/dist/translations/ru.js +23 -0
- package/dist/translations/sk.d.ts +8 -0
- package/dist/translations/sk.js +23 -0
- package/dist/translations/sr-latn.d.ts +8 -0
- package/dist/translations/sr-latn.js +23 -0
- package/dist/translations/sr.d.ts +8 -0
- package/dist/translations/sr.js +23 -0
- package/dist/translations/sv.d.ts +8 -0
- package/dist/translations/sv.js +23 -0
- package/dist/translations/th.d.ts +8 -0
- package/dist/translations/th.js +23 -0
- package/dist/translations/tr.d.ts +8 -0
- package/dist/translations/tr.js +23 -0
- package/dist/translations/ug.d.ts +8 -0
- package/dist/translations/ug.js +23 -0
- package/dist/translations/uk.d.ts +8 -0
- package/dist/translations/uk.js +23 -0
- package/dist/translations/ur.d.ts +8 -0
- package/dist/translations/ur.js +23 -0
- package/dist/translations/vi.d.ts +8 -0
- package/dist/translations/vi.js +23 -0
- package/dist/translations/zh-cn.d.ts +8 -0
- package/dist/translations/zh-cn.js +23 -0
- package/dist/translations/zh.d.ts +8 -0
- package/dist/translations/zh.js +23 -0
- package/dist/types/augmentation.d.ts +25 -0
- package/dist/types/exportpdf.d.ts +225 -0
- package/dist/types/exportpdfcommand.d.ts +43 -0
- package/dist/types/exportpdfui.d.ts +27 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/utils.d.ts +14 -0
- package/lang/contexts.json +4 -1
- package/package.json +3 -2
- package/src/exportpdf.js +1 -1
- package/src/exportpdfcommand.js +1 -1
- package/src/exportpdfui.js +1 -1
- package/src/index.js +1 -1
- package/src/utils.js +1 -1
|
@@ -0,0 +1,225 @@
|
|
|
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
|
+
import ExportPdfUI from './exportpdfui.js';
|
|
17
|
+
/**
|
|
18
|
+
* The export to PDF feature.
|
|
19
|
+
*
|
|
20
|
+
* It allows you to generate a PDF file directly from the editor content.
|
|
21
|
+
*
|
|
22
|
+
* For a detailed overview, check the {@glink features/converters/export-pdf export to PDF} feature documentation.
|
|
23
|
+
*/
|
|
24
|
+
export default class ExportPdf extends Plugin {
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
static get pluginName(): "ExportPdf";
|
|
29
|
+
/**
|
|
30
|
+
* @inheritDoc
|
|
31
|
+
*/
|
|
32
|
+
static get requires(): readonly ["CloudServices", typeof Notification, typeof ExportPdfUI];
|
|
33
|
+
/**
|
|
34
|
+
* @inheritDoc
|
|
35
|
+
*/
|
|
36
|
+
init(): void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The configuration of the export to PDF feature. It is used by the PDF export features from the `@ckeditor/ckeditor5-export-pdf` package.
|
|
40
|
+
*
|
|
41
|
+
* ```ts
|
|
42
|
+
* ClassicEditor
|
|
43
|
+
* .create( editorElement, {
|
|
44
|
+
* exportPdf: ... // Export to PDF feature options.
|
|
45
|
+
* } )
|
|
46
|
+
* .then( ... )
|
|
47
|
+
* .catch( ... );
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
51
|
+
*/
|
|
52
|
+
export interface ExportPdfConfig {
|
|
53
|
+
/**
|
|
54
|
+
* Paths to the `.css` files containing additional styling for the editor's content (**the order of provided items matters**).
|
|
55
|
+
*
|
|
56
|
+
* ```ts
|
|
57
|
+
* const exportPdfConfig = {
|
|
58
|
+
* stylesheets: [ './path/to/custom-style.css' ]
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* **NOTE:** If `stylesheets` are not provided, the plugin will sent only
|
|
63
|
+
* {@glink installation/advanced/content-styles#the-full-list-of-content-styles the default editor content styles} to the converter.
|
|
64
|
+
*
|
|
65
|
+
* **Default editor's content styles**:
|
|
66
|
+
* {@glink installation/advanced/content-styles#the-full-list-of-content-styles The default editor content styles}
|
|
67
|
+
* are applied to the generated PDF thanks to the 'EDITOR_STYLES' token, which is provided to the `stylesheets` by default.
|
|
68
|
+
* If you don't want them to be applied, you have to omit the token:
|
|
69
|
+
*
|
|
70
|
+
* ```ts
|
|
71
|
+
* const exportPdfConfig = {
|
|
72
|
+
* stylesheets: [ './path/to/custom-editor-styles.css' ]
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* **Web fonts:** If you want to {@glink features/converters/export-pdf#providing-web-font-styles use web fonts} in your PDF document,
|
|
77
|
+
* you should provide a path to the file containing the web font declaration before the `'EDITOR_STYLES'` token:
|
|
78
|
+
*
|
|
79
|
+
* ```ts
|
|
80
|
+
* const exportPdfConfig = {
|
|
81
|
+
* stylesheets: [
|
|
82
|
+
* './path/to/fonts.css',
|
|
83
|
+
* 'EDITOR_STYLES'
|
|
84
|
+
* ]
|
|
85
|
+
* }
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* **Web fonts and custom styling:** For more advanced styling, your configuration should look like this:
|
|
89
|
+
*
|
|
90
|
+
* ```ts
|
|
91
|
+
* const exportPdfConfig = {
|
|
92
|
+
* stylesheets: [
|
|
93
|
+
* './path/to/fonts.css',
|
|
94
|
+
* 'EDITOR_STYLES',
|
|
95
|
+
* './path/to/custom-styles.css'
|
|
96
|
+
* ]
|
|
97
|
+
* }
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @default `[ 'EDITOR_STYLES' ]`
|
|
101
|
+
*/
|
|
102
|
+
stylesheets?: Array<string>;
|
|
103
|
+
/**
|
|
104
|
+
* The name of the generated PDF file.
|
|
105
|
+
*
|
|
106
|
+
* ```ts
|
|
107
|
+
* // Static file name.
|
|
108
|
+
* const exportPdfConfig = {
|
|
109
|
+
* fileName: 'my-document.pdf'
|
|
110
|
+
* }
|
|
111
|
+
*
|
|
112
|
+
* // Dynamic file name.
|
|
113
|
+
* const exportPdfConfig = {
|
|
114
|
+
* fileName: () => {
|
|
115
|
+
* const articleTitle = document.querySelector( '#title' );
|
|
116
|
+
*
|
|
117
|
+
* return `${ articleTitle.value }.pdf`;
|
|
118
|
+
* }
|
|
119
|
+
* }
|
|
120
|
+
* ```
|
|
121
|
+
*
|
|
122
|
+
* **NOTE:** The file name must contain the `.pdf` extension.
|
|
123
|
+
* Otherwise your operating system or device may have trouble identifying the file type.
|
|
124
|
+
*
|
|
125
|
+
* @default 'document.pdf'
|
|
126
|
+
*/
|
|
127
|
+
fileName?: string | (() => string);
|
|
128
|
+
/**
|
|
129
|
+
* A URL to the HTML to PDF converter.
|
|
130
|
+
*
|
|
131
|
+
* ```ts
|
|
132
|
+
* const exportPdfConfig = {
|
|
133
|
+
* converterUrl: 'https://myconverter.com/v1/'
|
|
134
|
+
* }
|
|
135
|
+
* ```
|
|
136
|
+
*
|
|
137
|
+
* **NOTE:** The plugin uses the default HTML to PDF converter delivered by CKEditor Cloud Services.
|
|
138
|
+
* You can provide a URL to an on-premises converter instead.
|
|
139
|
+
*
|
|
140
|
+
* @default 'https://pdf-converter.cke-cs.com/v1/convert'
|
|
141
|
+
*/
|
|
142
|
+
converterUrl?: string;
|
|
143
|
+
/**
|
|
144
|
+
* The HTML to PDF converter options.
|
|
145
|
+
*
|
|
146
|
+
* **NOTE:** Configuring the plugin is not mandatory but it is highly recommended,
|
|
147
|
+
* especially if you want to get the most accurate results when generating the PDF file.
|
|
148
|
+
* To learn more, please check the [HTML to PDF converter configuration](https://pdf-converter.cke-cs.com/docs).
|
|
149
|
+
*
|
|
150
|
+
* ```ts
|
|
151
|
+
* const exportPdfConfig = {
|
|
152
|
+
* converterOptions: {
|
|
153
|
+
* ...
|
|
154
|
+
* }
|
|
155
|
+
* }
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* @default `{
|
|
159
|
+
* format: 'A4',
|
|
160
|
+
* margin_top: '0',
|
|
161
|
+
* margin_bottom: '0',
|
|
162
|
+
* margin_right: '0',
|
|
163
|
+
* margin_left: '0',
|
|
164
|
+
* page_orientation: 'portrait',
|
|
165
|
+
* header_html: undefined,
|
|
166
|
+
* footer_html: undefined,
|
|
167
|
+
* header_and_footer_css: undefined,
|
|
168
|
+
* wait_for_network: true,
|
|
169
|
+
* wait_time: 0
|
|
170
|
+
* }`
|
|
171
|
+
*/
|
|
172
|
+
converterOptions?: ExportPdfConverterOptions;
|
|
173
|
+
/**
|
|
174
|
+
* A function to gather the HTML to be converted to PDF.
|
|
175
|
+
*
|
|
176
|
+
* **NOTE:** This option may be useful when the editor does not have `getData()` method,
|
|
177
|
+
* or if the HTML to be converted should be different than the edited one.
|
|
178
|
+
*
|
|
179
|
+
* ```ts
|
|
180
|
+
* const exportPdfConfig = {
|
|
181
|
+
* dataCallback: ( editor: Editor ) => {
|
|
182
|
+
* return `
|
|
183
|
+
* <header id="header">${ editor.data.get( { rootName: 'header' } ) }</header>
|
|
184
|
+
* <div id="content">${ editor.data.get( { rootName: 'content' } ) }</div>
|
|
185
|
+
* `;
|
|
186
|
+
* }
|
|
187
|
+
* }
|
|
188
|
+
* ```
|
|
189
|
+
*
|
|
190
|
+
* @default `( editor: Editor ) => editor.getData()`
|
|
191
|
+
*/
|
|
192
|
+
dataCallback?: (editor: Editor) => string;
|
|
193
|
+
/**
|
|
194
|
+
* A token URL or a token request function. This field is optional and should be used only when a different `tokenUrl` is required for
|
|
195
|
+
* the export to PDF feature.
|
|
196
|
+
*
|
|
197
|
+
* **Note:** The token can be disabled with the `false` value provided.
|
|
198
|
+
*
|
|
199
|
+
* See: {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl}
|
|
200
|
+
*/
|
|
201
|
+
tokenUrl?: TokenUrl | false;
|
|
202
|
+
/**
|
|
203
|
+
* The authentication token.
|
|
204
|
+
*
|
|
205
|
+
* See: {@link module:cloud-services/cloudservices~CloudServices#token}
|
|
206
|
+
*/
|
|
207
|
+
token?: InitializedToken;
|
|
208
|
+
/**
|
|
209
|
+
* The application unique identifier.
|
|
210
|
+
*/
|
|
211
|
+
appID?: string;
|
|
212
|
+
}
|
|
213
|
+
export type ExportPdfConverterOptions = {
|
|
214
|
+
format?: 'Letter' | 'Legal' | 'Tabloid' | 'Ledger' | 'A0' | 'A1' | 'A2' | 'A3' | 'A4' | 'A5' | 'A6';
|
|
215
|
+
margin_top?: string;
|
|
216
|
+
margin_bottom?: string;
|
|
217
|
+
margin_right?: string;
|
|
218
|
+
margin_left?: string;
|
|
219
|
+
header_html?: string;
|
|
220
|
+
footer_html?: string;
|
|
221
|
+
header_and_footer_css?: string;
|
|
222
|
+
page_orientation?: 'portrait' | 'landscape';
|
|
223
|
+
wait_for_network?: boolean;
|
|
224
|
+
wait_time?: number;
|
|
225
|
+
};
|
|
@@ -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,27 @@
|
|
|
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/exportpdfui
|
|
11
|
+
*/
|
|
12
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
13
|
+
/**
|
|
14
|
+
* The export to PDF UI feature.
|
|
15
|
+
*
|
|
16
|
+
* It introduces 'Export to PDF' button in toolbar and menu bar.
|
|
17
|
+
*/
|
|
18
|
+
export default class ExportPdfUI extends Plugin {
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
static get pluginName(): "ExportPdfUI";
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/
|
|
26
|
+
init(): void;
|
|
27
|
+
}
|
|
@@ -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/lang/contexts.json
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Export to PDF": "A toolbar button tooltip for a PDF export feature.",
|
|
3
|
-
"An error occurred while generating the PDF.": "An error message shown to the user when an error occurred during the generation of the PDF file."
|
|
3
|
+
"An error occurred while generating the PDF.": "An error message shown to the user when an error occurred during the generation of the PDF file.",
|
|
4
|
+
"PDF export started": "Aria status message indicating start of PDF document export. Example: 'PDF export started'.",
|
|
5
|
+
"PDF export failed": "Aria status message indicating failed PDF document export. Example: 'PDF export failed'.",
|
|
6
|
+
"PDF export successful": "Aria status message indicating successful PDF document export. Example: 'PDF export successful'."
|
|
4
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-export-pdf",
|
|
3
|
-
"version": "41.
|
|
3
|
+
"version": "41.4.0-alpha.0",
|
|
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.
|
|
33
|
+
"ckeditor5": "41.4.0-alpha.0"
|
|
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
|
-
const
|
|
23
|
+
function _0x3024(){const _0x196c07=['614895atyueG','4662309lAnmlk','tokenUrl','requires','2bIlJFy','config','plugins','pluginName','8889642UxgpqS','_token','CloudServices','exportPdf','get','token','then','registerTokenUrl','6125080ZHptNy','add','init','ExportPdf','1168358ZEswQD','1635396TNyABe','commands','editor','78GxSmNG','8884552uiwgjn'];_0x3024=function(){return _0x196c07;};return _0x3024();}const _0x4d634e=_0xd47b;(function(_0x182841,_0x457134){const _0x487364=_0xd47b,_0x93e382=_0x182841();while(!![]){try{const _0x2ac2ec=-parseInt(_0x487364(0x16d))/0x1+-parseInt(_0x487364(0x177))/0x2*(-parseInt(_0x487364(0x174))/0x3)+-parseInt(_0x487364(0x169))/0x4+-parseInt(_0x487364(0x173))/0x5*(-parseInt(_0x487364(0x171))/0x6)+parseInt(_0x487364(0x16e))/0x7+parseInt(_0x487364(0x172))/0x8+-parseInt(_0x487364(0x17b))/0x9;if(_0x2ac2ec===_0x457134)break;else _0x93e382['push'](_0x93e382['shift']());}catch(_0x784031){_0x93e382['push'](_0x93e382['shift']());}}}(_0x3024,0xc5abd));import{Plugin as _0x14cdfa}from'ckeditor5/src/core.js';import{Notification as _0xb70c22}from'ckeditor5/src/ui.js';import _0x302cf7 from'./exportpdfcommand.js';import _0x51ae46 from'./exportpdfui.js';function _0xd47b(_0x3a61a1,_0xb7fbc1){const _0x30246a=_0x3024();return _0xd47b=function(_0xd47b41,_0x311635){_0xd47b41=_0xd47b41-0x168;let _0x10dbac=_0x30246a[_0xd47b41];return _0x10dbac;},_0xd47b(_0x3a61a1,_0xb7fbc1);}export default class s extends _0x14cdfa{static get[_0x4d634e(0x17a)](){const _0x1e91bd=_0x4d634e;return _0x1e91bd(0x16c);}static get[_0x4d634e(0x176)](){const _0x1b90ed=_0x4d634e;return[_0x1b90ed(0x17d),_0xb70c22,_0x51ae46];}[_0x4d634e(0x16b)](){const _0xf706b7=_0x4d634e,_0x476887=this[_0xf706b7(0x170)],_0xa738dd=_0x476887[_0xf706b7(0x178)][_0xf706b7(0x17f)](_0xf706b7(0x17e))||{};_0x476887[_0xf706b7(0x16f)][_0xf706b7(0x16a)](_0xf706b7(0x17e),new _0x302cf7(_0x476887));const _0xb2f921=_0x476887[_0xf706b7(0x179)][_0xf706b7(0x17f)](_0xf706b7(0x17d));!0x1===_0xa738dd[_0xf706b7(0x175)]?this[_0xf706b7(0x17c)]=null:_0xa738dd[_0xf706b7(0x175)]?_0xb2f921[_0xf706b7(0x168)](_0xa738dd[_0xf706b7(0x175)])[_0xf706b7(0x181)](_0x39c528=>{const _0x4a3fcc=_0xf706b7;this[_0x4a3fcc(0x17c)]=_0x39c528;}):this[_0xf706b7(0x17c)]=_0xb2f921[_0xf706b7(0x180)];}}
|
package/src/exportpdfcommand.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Command as
|
|
23
|
+
import{Command as _0x5eeb4e}from'ckeditor5/src/core.js';import{getStyles as _0xd29df1}from'./utils.js';export default class o extends _0x5eeb4e{constructor(_0x4ec486){super(_0x4ec486),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x51cc2d={}){const _0x46cc5b=this['editor'],t=_0x46cc5b['t'],_0x4a62b8=_0x51cc2d['converterUrl']||'https://pdf-converter.cke-cs.com/v1/convert/',_0x588d18=_0x51cc2d['dataCallback']||(_0x176ea1=>_0x176ea1['data']['get']()),_0x5c1171=_0x46cc5b['plugins']['get']('ExportPdf'),_0x21bb72=_0x51cc2d['token']||_0x5c1171['_token'];return this['isBusy']=!0x0,this['refresh'](),_0xd29df1(_0x51cc2d['stylesheets']||['EDITOR_STYLES'])['then'](async _0x9ca653=>{_0x46cc5b['ui']['ariaLiveAnnouncer']['announce'](t('PDF\x20export\x20started'));const _0x4b7f05={'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'+_0x46cc5b['locale']['contentLanguageDirection']+'\x22>\x0a\x09\x09\x09\x09\x09\x09\x09\x09'+await _0x588d18(_0x46cc5b)+'\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':_0x9ca653,'options':_0x51cc2d['converterOptions']},_0x330b2e={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/pdf',..._0x21bb72?{'Authorization':_0x21bb72['value']}:null,'x-cs-app-id':_0x51cc2d['appID']||'cke5'},'body':JSON['stringify'](_0x4b7f05)};return window['fetch'](_0x4a62b8,_0x330b2e)['then'](_0x350202=>{if(0xc8!==_0x350202['status'])throw _0x350202;return _0x350202['blob']();})['then'](_0x1d7b13=>{_0x46cc5b['ui']['ariaLiveAnnouncer']['announce'](t('PDF\x20export\x20successful'));const _0x5de482='function'==typeof _0x51cc2d['fileName']?_0x51cc2d['fileName']():_0x51cc2d['fileName'];this['_downloadFile'](_0x1d7b13,_0x5de482||'document.pdf');});})['catch'](_0x313334=>{const _0x79c594=_0x46cc5b['plugins']['get']('Notification');throw _0x46cc5b['ui']['ariaLiveAnnouncer']['announce'](t('PDF\x20export\x20failed'),{'politeness':'assertive'}),_0x79c594['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20PDF.')),_0x313334;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0x3eff36,_0x4a9c11){const _0x276a6d=document['createElement']('a');_0x276a6d['href']=window['URL']['createObjectURL'](_0x3eff36),_0x276a6d['download']=_0x4a9c11,_0x276a6d['click'](),_0x276a6d['remove']();}}
|
package/src/exportpdfui.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Plugin as
|
|
23
|
+
import{Plugin as _0x6dd82b}from'ckeditor5/src/core.js';import{ButtonView as _0x4c2c09,MenuBarMenuListItemButtonView as _0x5b7373,SpinnerView as _0x203724}from'ckeditor5/src/ui.js';import _0x1eb690 from'../theme/icons/exportpdf.svg';export default class i extends _0x6dd82b{static get['pluginName'](){return'ExportPdfUI';}['init'](){const _0x4bccae=this['editor'];_0x4bccae['ui']['componentFactory']['add']('exportPdf',()=>{const _0x35fa83=this['_createButton'](_0x4c2c09),_0x4e5bd2=_0x4bccae['commands']['get']('exportPdf');return _0x35fa83['set']({'tooltip':!0x0}),_0x35fa83['bind']('isOn')['to'](_0x4e5bd2,'isBusy'),_0x35fa83;}),_0x4bccae['ui']['componentFactory']['add']('menuBar:exportPdf',()=>this['_createButton'](_0x5b7373));}['_createButton'](_0x59c449){const _0x602801=this['editor'],_0xdb5a13=_0x602801['config']['get']('exportPdf')||{},t=_0x602801['locale']['t'],_0x757b8e=_0x602801['commands']['get']('exportPdf'),_0x574564=new _0x59c449(_0x602801['locale']),_0x5dbb36=new _0x203724();return _0x574564['children']['add'](_0x5dbb36),_0x5dbb36['bind']('isVisible')['to'](_0x757b8e,'isBusy'),_0x574564['iconView']['bind']('isVisible')['to'](_0x757b8e,'isBusy',_0x5d069c=>!_0x5d069c),_0x574564['set']({'label':t('Export\x20to\x20PDF'),'icon':_0x1eb690}),_0x574564['bind']('isEnabled')['to'](_0x757b8e,'isEnabled'),this['listenTo'](_0x574564,'execute',()=>{_0x602801['execute']('exportPdf',_0xdb5a13),_0x602801['editing']['view']['focus']();}),_0x574564;}}
|
package/src/index.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
function
|
|
23
|
+
function _0x2298(_0x4a0c1d,_0x149b9c){var _0x7d1448=_0x7d14();return _0x2298=function(_0x2298f0,_0x1ee943){_0x2298f0=_0x2298f0-0xc4;var _0x2ba938=_0x7d1448[_0x2298f0];return _0x2ba938;},_0x2298(_0x4a0c1d,_0x149b9c);}function _0x7d14(){var _0x18fb43=['3165910BpNPPF','1386gxEoiB','283920tbSFcV','8603sxBwLo','556VDkBQz','1407LTUqwW','5139VZMhVm','1416YDKwkS','1164555UcVLIo','467462bZThFG'];_0x7d14=function(){return _0x18fb43;};return _0x7d14();}(function(_0x22f452,_0x438626){var _0x358980=_0x2298,_0x513fdf=_0x22f452();while(!![]){try{var _0x352aca=-parseInt(_0x358980(0xc5))/0x1+-parseInt(_0x358980(0xcc))/0x2+parseInt(_0x358980(0xc8))/0x3*(-parseInt(_0x358980(0xc7))/0x4)+parseInt(_0x358980(0xcb))/0x5+-parseInt(_0x358980(0xc4))/0x6*(-parseInt(_0x358980(0xc6))/0x7)+parseInt(_0x358980(0xca))/0x8*(-parseInt(_0x358980(0xc9))/0x9)+parseInt(_0x358980(0xcd))/0xa;if(_0x352aca===_0x438626)break;else _0x513fdf['push'](_0x513fdf['shift']());}catch(_0x266db7){_0x513fdf['push'](_0x513fdf['shift']());}}}(_0x7d14,0x247f4));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(
|
|
23
|
+
function _0x41c8(){const _0x17bf80=['ownerNode','cssRules','join','length','trim','63eOJIAp','135497TkeLhT','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.','357dMkUYt','fetch','then','4TwqAqW','text','101714pqnRXi','122615FJEuYj','.ck-content','push','19449dAaDDK','EDITOR_STYLES','5238186YnuyyM','260248VbaiiU','indexOf','3160355LNBTRw','all','styleSheets','data-cke','from','cssText','1510YdzWiB','hasAttribute','warn',':root'];_0x41c8=function(){return _0x17bf80;};return _0x41c8();}(function(_0x32af40,_0x31507b){const _0x337727=_0x18f9,_0x311a54=_0x32af40();while(!![]){try{const _0x219751=parseInt(_0x337727(0x1fa))/0x1+-parseInt(_0x337727(0x1e1))/0x2*(parseInt(_0x337727(0x1f9))/0x3)+-parseInt(_0x337727(0x1df))/0x4*(parseInt(_0x337727(0x1e2))/0x5)+parseInt(_0x337727(0x1e7))/0x6+parseInt(_0x337727(0x1fc))/0x7*(parseInt(_0x337727(0x1e8))/0x8)+parseInt(_0x337727(0x1e5))/0x9*(-parseInt(_0x337727(0x1f0))/0xa)+-parseInt(_0x337727(0x1ea))/0xb;if(_0x219751===_0x31507b)break;else _0x311a54['push'](_0x311a54['shift']());}catch(_0x362e9){_0x311a54['push'](_0x311a54['shift']());}}}(_0x41c8,0xeabc1));function _0x18f9(_0x5801e9,_0x24e472){const _0x41c83c=_0x41c8();return _0x18f9=function(_0x18f931,_0x43bc88){_0x18f931=_0x18f931-0x1dd;let _0xb4f4c8=_0x41c83c[_0x18f931];return _0xb4f4c8;},_0x18f9(_0x5801e9,_0x24e472);}export function getStyles(_0x128e51){const _0x44ca8b=_0x18f9;if(!_0x128e51)return new Promise(_0x429a28=>_0x429a28(''));const _0x2f7082=[];for(const _0x42b42a of _0x128e51)_0x44ca8b(0x1e6)!==_0x42b42a?_0x2f7082[_0x44ca8b(0x1e4)](window[_0x44ca8b(0x1dd)](_0x42b42a)[_0x44ca8b(0x1de)](_0x2684b5=>_0x2684b5[_0x44ca8b(0x1e0)]())):_0x2f7082[_0x44ca8b(0x1e4)](a());return Promise[_0x44ca8b(0x1eb)](_0x2f7082)[_0x44ca8b(0x1de)](_0x42bee6=>_0x42bee6[_0x44ca8b(0x1f6)]('\x20')[_0x44ca8b(0x1f8)]());}function a(){const _0x384dd4=_0x18f9,_0x2895f9=[],_0x229bc4=[];for(const _0x17ad66 of Array[_0x384dd4(0x1ee)](document[_0x384dd4(0x1ec)])){if(_0x17ad66[_0x384dd4(0x1f4)][_0x384dd4(0x1f1)](_0x384dd4(0x1ed))){for(const _0x5d63c6 of Array[_0x384dd4(0x1ee)](_0x17ad66[_0x384dd4(0x1f5)]))-0x1!==_0x5d63c6[_0x384dd4(0x1ef)][_0x384dd4(0x1e9)](_0x384dd4(0x1e3))?_0x2895f9[_0x384dd4(0x1e4)](_0x5d63c6[_0x384dd4(0x1ef)]):-0x1!==_0x5d63c6[_0x384dd4(0x1ef)][_0x384dd4(0x1e9)](_0x384dd4(0x1f3))&&_0x229bc4[_0x384dd4(0x1e4)](_0x5d63c6[_0x384dd4(0x1ef)]);}}return _0x2895f9[_0x384dd4(0x1f7)]||console[_0x384dd4(0x1f2)](_0x384dd4(0x1fb)),[..._0x229bc4,..._0x2895f9][_0x384dd4(0x1f6)]('\x20')[_0x384dd4(0x1f8)]();}
|