@ckeditor/ckeditor5-export-pdf 0.0.0-nightly-20240423.0 → 0.0.0-nightly-20240424.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/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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-export-pdf",
|
|
3
|
-
"version": "0.0.0-nightly-
|
|
3
|
+
"version": "0.0.0-nightly-20240424.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": "0.0.0-nightly-
|
|
33
|
+
"ckeditor5": "0.0.0-nightly-20240424.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
|
+
const _0x5b1029=_0x18a9;(function(_0x564bc6,_0x2c4251){const _0x509734=_0x18a9,_0x33e64c=_0x564bc6();while(!![]){try{const _0x17058c=-parseInt(_0x509734(0x1f9))/0x1+-parseInt(_0x509734(0x1e5))/0x2+-parseInt(_0x509734(0x1e6))/0x3*(-parseInt(_0x509734(0x1ed))/0x4)+-parseInt(_0x509734(0x1e1))/0x5*(-parseInt(_0x509734(0x1e8))/0x6)+-parseInt(_0x509734(0x1ea))/0x7*(-parseInt(_0x509734(0x1eb))/0x8)+parseInt(_0x509734(0x1f6))/0x9*(parseInt(_0x509734(0x1e7))/0xa)+-parseInt(_0x509734(0x1e2))/0xb;if(_0x17058c===_0x2c4251)break;else _0x33e64c['push'](_0x33e64c['shift']());}catch(_0x468e75){_0x33e64c['push'](_0x33e64c['shift']());}}}(_0x3f9e,0xad322));import{Plugin as _0x3d23a1}from'ckeditor5/src/core.js';function _0x18a9(_0x588058,_0x34384a){const _0x3f9e9=_0x3f9e();return _0x18a9=function(_0x18a9c5,_0x585a9c){_0x18a9c5=_0x18a9c5-0x1e1;let _0x3186ba=_0x3f9e9[_0x18a9c5];return _0x3186ba;},_0x18a9(_0x588058,_0x34384a);}import{Notification as _0x22225c}from'ckeditor5/src/ui.js';function _0x3f9e(){const _0x1a8e49=['3nrsdRC','20870BoTEqF','1967922BSTlgM','ExportPdf','22463TQdWrs','1264nsNzie','_token','5468168GIyzFE','exportPdf','then','config','plugins','add','editor','token','get','2169RRNaXx','init','registerTokenUrl','90767xOefZu','commands','pluginName','requires','5EtVsbw','17262432saihYI','CloudServices','tokenUrl','671058TJuvzD'];_0x3f9e=function(){return _0x1a8e49;};return _0x3f9e();}import _0x3c73f3 from'./exportpdfcommand.js';import _0x408c16 from'./exportpdfui.js';export default class s extends _0x3d23a1{static get[_0x5b1029(0x1fb)](){const _0x6f6891=_0x5b1029;return _0x6f6891(0x1e9);}static get[_0x5b1029(0x1fc)](){const _0x410f04=_0x5b1029;return[_0x410f04(0x1e3),_0x22225c,_0x408c16];}[_0x5b1029(0x1f7)](){const _0x27e7e4=_0x5b1029,_0x348bc2=this[_0x27e7e4(0x1f3)],_0x13e03b=_0x348bc2[_0x27e7e4(0x1f0)][_0x27e7e4(0x1f5)](_0x27e7e4(0x1ee))||{};_0x348bc2[_0x27e7e4(0x1fa)][_0x27e7e4(0x1f2)](_0x27e7e4(0x1ee),new _0x3c73f3(_0x348bc2));const _0x59dde5=_0x348bc2[_0x27e7e4(0x1f1)][_0x27e7e4(0x1f5)](_0x27e7e4(0x1e3));!0x1===_0x13e03b[_0x27e7e4(0x1e4)]?this[_0x27e7e4(0x1ec)]=null:_0x13e03b[_0x27e7e4(0x1e4)]?_0x59dde5[_0x27e7e4(0x1f8)](_0x13e03b[_0x27e7e4(0x1e4)])[_0x27e7e4(0x1ef)](_0x3a1b39=>{const _0x480d93=_0x27e7e4;this[_0x480d93(0x1ec)]=_0x3a1b39;}):this[_0x27e7e4(0x1ec)]=_0x59dde5[_0x27e7e4(0x1f4)];}}
|
package/src/exportpdfcommand.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Command as
|
|
23
|
+
import{Command as _0x17dc9d}from'ckeditor5/src/core.js';import{getStyles as _0x1e2d7d}from'./utils.js';export default class o extends _0x17dc9d{constructor(_0x598f64){super(_0x598f64),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x4acf18={}){const _0x5e6ef=this['editor'],t=_0x5e6ef['t'],_0x314a3c=_0x4acf18['converterUrl']||'https://pdf-converter.cke-cs.com/v1/convert/',_0x475c09=_0x4acf18['dataCallback']||(_0xc8fd91=>_0xc8fd91['data']['get']()),_0x2639c1=_0x5e6ef['plugins']['get']('ExportPdf'),_0x2b91e9=_0x4acf18['token']||_0x2639c1['_token'];return this['isBusy']=!0x0,this['refresh'](),_0x1e2d7d(_0x4acf18['stylesheets']||['EDITOR_STYLES'])['then'](async _0x46e47a=>{_0x5e6ef['ui']['ariaLiveAnnouncer']['announce'](t('PDF\x20export\x20started'));const _0x3df2e0={'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'+_0x5e6ef['locale']['contentLanguageDirection']+'\x22>\x0a\x09\x09\x09\x09\x09\x09\x09\x09'+await _0x475c09(_0x5e6ef)+'\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':_0x46e47a,'options':_0x4acf18['converterOptions']},_0x236b1b={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/pdf',..._0x2b91e9?{'Authorization':_0x2b91e9['value']}:null,'x-cs-app-id':_0x4acf18['appID']||'cke5'},'body':JSON['stringify'](_0x3df2e0)};return window['fetch'](_0x314a3c,_0x236b1b)['then'](_0x41a88e=>{if(0xc8!==_0x41a88e['status'])throw _0x41a88e;return _0x41a88e['blob']();})['then'](_0x535f14=>{_0x5e6ef['ui']['ariaLiveAnnouncer']['announce'](t('PDF\x20export\x20successful'));const _0x4efdac='function'==typeof _0x4acf18['fileName']?_0x4acf18['fileName']():_0x4acf18['fileName'];this['_downloadFile'](_0x535f14,_0x4efdac||'document.pdf');});})['catch'](_0x39b1e6=>{const _0xda48b1=_0x5e6ef['plugins']['get']('Notification');throw _0x5e6ef['ui']['ariaLiveAnnouncer']['announce'](t('PDF\x20export\x20failed'),{'politeness':'assertive'}),_0xda48b1['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20PDF.')),_0x39b1e6;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0x3f741b,_0x57f70b){const _0xa1a6b5=document['createElement']('a');_0xa1a6b5['href']=window['URL']['createObjectURL'](_0x3f741b),_0xa1a6b5['download']=_0x57f70b,_0xa1a6b5['click'](),_0xa1a6b5['remove']();}}
|
package/src/exportpdfui.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Plugin as
|
|
23
|
+
import{Plugin as _0x12f616}from'ckeditor5/src/core.js';import{ButtonView as _0x160f5d,MenuBarMenuListItemButtonView as _0x5ca388,SpinnerView as _0x5d6a92}from'ckeditor5/src/ui.js';import _0x7d64cc from'../theme/icons/exportpdf.svg';export default class i extends _0x12f616{static get['pluginName'](){return'ExportPdfUI';}['init'](){const _0x178d10=this['editor'];_0x178d10['ui']['componentFactory']['add']('exportPdf',()=>{const _0x43d849=this['_createButton'](_0x160f5d),_0x558579=_0x178d10['commands']['get']('exportPdf');return _0x43d849['set']({'tooltip':!0x0}),_0x43d849['bind']('isOn')['to'](_0x558579,'isBusy'),_0x43d849;}),_0x178d10['ui']['componentFactory']['add']('menuBar:exportPdf',()=>this['_createButton'](_0x5ca388));}['_createButton'](_0xc21526){const _0x233018=this['editor'],_0x3c4673=_0x233018['config']['get']('exportPdf')||{},t=_0x233018['locale']['t'],_0x5bca33=_0x233018['commands']['get']('exportPdf'),_0x4a3f9a=new _0xc21526(_0x233018['locale']),_0x36391f=new _0x5d6a92();return _0x4a3f9a['children']['add'](_0x36391f),_0x36391f['bind']('isVisible')['to'](_0x5bca33,'isBusy'),_0x4a3f9a['iconView']['bind']('isVisible')['to'](_0x5bca33,'isBusy',_0x45af12=>!_0x45af12),_0x4a3f9a['set']({'label':t('Export\x20to\x20PDF'),'icon':_0x7d64cc}),_0x4a3f9a['bind']('isEnabled')['to'](_0x5bca33,'isEnabled'),this['listenTo'](_0x4a3f9a,'execute',()=>{_0x233018['execute']('exportPdf',_0x3c4673),_0x233018['editing']['view']['focus']();}),_0x4a3f9a;}}
|
package/src/index.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
(function(
|
|
23
|
+
(function(_0x1c1431,_0x22f198){var _0x44fac1=_0x52f7,_0x32395d=_0x1c1431();while(!![]){try{var _0xe6cf9b=-parseInt(_0x44fac1(0xfe))/0x1+parseInt(_0x44fac1(0xfc))/0x2*(parseInt(_0x44fac1(0xfd))/0x3)+-parseInt(_0x44fac1(0xfb))/0x4*(-parseInt(_0x44fac1(0x102))/0x5)+parseInt(_0x44fac1(0xff))/0x6+parseInt(_0x44fac1(0x103))/0x7+-parseInt(_0x44fac1(0x101))/0x8+parseInt(_0x44fac1(0x100))/0x9;if(_0xe6cf9b===_0x22f198)break;else _0x32395d['push'](_0x32395d['shift']());}catch(_0x489cc3){_0x32395d['push'](_0x32395d['shift']());}}}(_0x32a8,0x3e181));export{default as ExportPdf}from'./exportpdf.js';import'./augmentation.js';function _0x52f7(_0xc2f6be,_0x5b095e){var _0x32a88f=_0x32a8();return _0x52f7=function(_0x52f71c,_0x24179d){_0x52f71c=_0x52f71c-0xfb;var _0x400cd3=_0x32a88f[_0x52f71c];return _0x400cd3;},_0x52f7(_0xc2f6be,_0x5b095e);}function _0x32a8(){var _0x323ab3=['951020veEFZW','956GDWziB','1696VrVEms','237QZPJPY','171054ujAXDt','598494RrqYzV','2164086eBYdoL','3941240xCIUjM','7845dJTjxu'];_0x32a8=function(){return _0x323ab3;};return _0x32a8();}
|
package/src/utils.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
(function(_0x54d426,_0x432f55){const _0x3eb7a7=_0x2d19,_0x21e813=_0x54d426();while(!![]){try{const _0x5d302e=-parseInt(_0x3eb7a7(0xfc))/0x1+parseInt(_0x3eb7a7(0x100))/0x2+-parseInt(_0x3eb7a7(0x115))/0x3*(parseInt(_0x3eb7a7(0x106))/0x4)+parseInt(_0x3eb7a7(0x10c))/0x5+-parseInt(_0x3eb7a7(0x10d))/0x6*(parseInt(_0x3eb7a7(0x114))/0x7)+-parseInt(_0x3eb7a7(0x105))/0x8+-parseInt(_0x3eb7a7(0xfb))/0x9*(-parseInt(_0x3eb7a7(0xfa))/0xa);if(_0x5d302e===_0x432f55)break;else _0x21e813['push'](_0x21e813['shift']());}catch(_0x247095){_0x21e813['push'](_0x21e813['shift']());}}}(_0x5b57,0xd28bf));function _0x2d19(_0x397073,_0x16b10c){const _0x5b572a=_0x5b57();return _0x2d19=function(_0x2d1995,_0x345924){_0x2d1995=_0x2d1995-0xf9;let _0x33be36=_0x5b572a[_0x2d1995];return _0x33be36;},_0x2d19(_0x397073,_0x16b10c);}export function getStyles(_0x52406e){const _0x3baddd=_0x2d19;if(!_0x52406e)return new Promise(_0xad4314=>_0xad4314(''));const _0x192ef7=[];for(const _0x42008f of _0x52406e)_0x3baddd(0x10a)!==_0x42008f?_0x192ef7[_0x3baddd(0x108)](window[_0x3baddd(0x103)](_0x42008f)[_0x3baddd(0x107)](_0x3ea0bc=>_0x3ea0bc[_0x3baddd(0x112)]())):_0x192ef7[_0x3baddd(0x108)](a());return Promise[_0x3baddd(0x10b)](_0x192ef7)[_0x3baddd(0x107)](_0x2a62cb=>_0x2a62cb[_0x3baddd(0xfe)]('\x20')[_0x3baddd(0x104)]());}function _0x5b57(){const _0x8caa44=['trim','2248840PRGDkx','4GWvscY','then','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.','EDITOR_STYLES','all','300240RkEkJj','1718070ndiuXx','styleSheets','hasAttribute',':root','from','text','warn','7tRUeUL','3808503iqFWJN','.ck-content','indexOf','cssText','180090hJxfwZ','1134dJpsJi','1317172AvnFjc','ownerNode','join','length','3374680DkXiej','data-cke','cssRules','fetch'];_0x5b57=function(){return _0x8caa44;};return _0x5b57();}function a(){const _0x293c75=_0x2d19,_0x20d198=[],_0x3253ca=[];for(const _0x150305 of Array[_0x293c75(0x111)](document[_0x293c75(0x10e)])){if(_0x150305[_0x293c75(0xfd)][_0x293c75(0x10f)](_0x293c75(0x101))){for(const _0x2a6e43 of Array[_0x293c75(0x111)](_0x150305[_0x293c75(0x102)]))-0x1!==_0x2a6e43[_0x293c75(0xf9)][_0x293c75(0x117)](_0x293c75(0x116))?_0x20d198[_0x293c75(0x108)](_0x2a6e43[_0x293c75(0xf9)]):-0x1!==_0x2a6e43[_0x293c75(0xf9)][_0x293c75(0x117)](_0x293c75(0x110))&&_0x3253ca[_0x293c75(0x108)](_0x2a6e43[_0x293c75(0xf9)]);}}return _0x20d198[_0x293c75(0xff)]||console[_0x293c75(0x113)](_0x293c75(0x109)),[..._0x3253ca,..._0x20d198][_0x293c75(0xfe)]('\x20')[_0x293c75(0x104)]();}
|