@ckeditor/ckeditor5-export-pdf 41.2.1 → 41.3.0-alpha.3
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/content-index.css +4 -0
- package/dist/editor-index.css +4 -0
- package/dist/index.css +4 -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 +224 -0
- package/dist/types/exportpdfcommand.d.ts +43 -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/index.js +1 -1
- 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.
|
|
3
|
+
"version": "41.3.0-alpha.3",
|
|
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.3.0-alpha.3"
|
|
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
|
|
23
|
+
import{Plugin as _0x4df85c}from'ckeditor5/src/core.js';import{ButtonView as _0x2953fb,Notification as _0x33bb44,SpinnerView as _0x13a278}from'ckeditor5/src/ui.js';import _0x5f1d4c from'./exportpdfcommand.js';import _0x5e6f5f from'../theme/icons/exportpdf.svg';export default class p extends _0x4df85c{static get['pluginName'](){return'ExportPdf';}static get['requires'](){return['CloudServices',_0x33bb44];}['init'](){const _0x3d52d0=this['editor'],t=_0x3d52d0['t'],_0x196939=_0x3d52d0['config']['get']('exportPdf')||{};_0x3d52d0['commands']['add']('exportPdf',new _0x5f1d4c(_0x3d52d0)),_0x3d52d0['ui']['componentFactory']['add']('exportPdf',_0x5ca657=>{const _0x4f04bc=_0x3d52d0['commands']['get']('exportPdf'),_0x2cab68=new _0x2953fb(_0x5ca657),_0x412ec9=new _0x13a278();return _0x2cab68['set']({'label':t('Export\x20to\x20PDF'),'icon':_0x5e6f5f,'tooltip':!0x0}),_0x2cab68['children']['add'](_0x412ec9),_0x2cab68['bind']('isOn','isEnabled')['to'](_0x4f04bc,'isBusy','isEnabled'),_0x412ec9['bind']('isVisible')['to'](_0x4f04bc,'isBusy'),_0x2cab68['iconView']['bind']('isVisible')['to'](_0x4f04bc,'isBusy',_0x3999e3=>!_0x3999e3),this['listenTo'](_0x2cab68,'execute',()=>{_0x3d52d0['execute']('exportPdf',_0x196939),_0x3d52d0['editing']['view']['focus']();}),_0x2cab68;});const _0x499791=_0x3d52d0['plugins']['get']('CloudServices');!0x1===_0x196939['tokenUrl']?this['_token']=null:_0x196939['tokenUrl']?_0x499791['registerTokenUrl'](_0x196939['tokenUrl'])['then'](_0xc3434e=>{this['_token']=_0xc3434e;}):this['_token']=_0x499791['token'];}}
|
package/src/exportpdfcommand.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Command as
|
|
23
|
+
import{Command as _0x3ad7fe}from'ckeditor5/src/core.js';import{getStyles as _0x455516}from'./utils.js';export default class o extends _0x3ad7fe{constructor(_0x56ae83){super(_0x56ae83),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x404ff8={}){const _0x7ecb0a=this['editor'],t=_0x7ecb0a['t'],_0x3fcb2a=_0x404ff8['converterUrl']||'https://pdf-converter.cke-cs.com/v1/convert/',_0x496294=_0x404ff8['dataCallback']||(_0x1b02b7=>_0x1b02b7['data']['get']()),_0x11341d=_0x7ecb0a['plugins']['get']('ExportPdf'),_0x319939=_0x404ff8['token']||_0x11341d['_token'];return this['isBusy']=!0x0,this['refresh'](),_0x455516(_0x404ff8['stylesheets']||['EDITOR_STYLES'])['then'](async _0x19a6b0=>{const _0x2bfded={'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'+_0x7ecb0a['locale']['contentLanguageDirection']+'\x22>\x0a\x09\x09\x09\x09\x09\x09\x09\x09'+await _0x496294(_0x7ecb0a)+'\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':_0x19a6b0,'options':_0x404ff8['converterOptions']},_0x128dd6={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/pdf',..._0x319939?{'Authorization':_0x319939['value']}:null,'x-cs-app-id':_0x404ff8['appID']||'cke5'},'body':JSON['stringify'](_0x2bfded)};return window['fetch'](_0x3fcb2a,_0x128dd6)['then'](_0x267794=>{if(0xc8!==_0x267794['status'])throw _0x267794;return _0x267794['blob']();})['then'](_0x1824ee=>{const _0x49948f='function'==typeof _0x404ff8['fileName']?_0x404ff8['fileName']():_0x404ff8['fileName'];this['_downloadFile'](_0x1824ee,_0x49948f||'document.pdf');});})['catch'](_0x3fdddc=>{throw _0x7ecb0a['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20PDF.')),_0x3fdddc;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0x5ccc91,_0x26ae4b){const _0x19a0ec=document['createElement']('a');_0x19a0ec['href']=window['URL']['createObjectURL'](_0x5ccc91),_0x19a0ec['download']=_0x26ae4b,_0x19a0ec['click'](),_0x19a0ec['remove']();}}
|
package/src/index.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
(function(
|
|
23
|
+
function _0x1ad8(_0x59b710,_0x7afeb2){var _0x33025d=_0x3302();return _0x1ad8=function(_0x1ad8fd,_0x53fb6f){_0x1ad8fd=_0x1ad8fd-0xf3;var _0x2a162c=_0x33025d[_0x1ad8fd];return _0x2a162c;},_0x1ad8(_0x59b710,_0x7afeb2);}(function(_0x71ef68,_0x385dad){var _0x4b2982=_0x1ad8,_0x4e1f37=_0x71ef68();while(!![]){try{var _0x4fc09f=-parseInt(_0x4b2982(0xfc))/0x1+-parseInt(_0x4b2982(0xf9))/0x2*(-parseInt(_0x4b2982(0xf7))/0x3)+-parseInt(_0x4b2982(0xf5))/0x4*(-parseInt(_0x4b2982(0xf6))/0x5)+-parseInt(_0x4b2982(0xf4))/0x6*(-parseInt(_0x4b2982(0xf8))/0x7)+parseInt(_0x4b2982(0xfa))/0x8+-parseInt(_0x4b2982(0xfb))/0x9+-parseInt(_0x4b2982(0xf3))/0xa;if(_0x4fc09f===_0x385dad)break;else _0x4e1f37['push'](_0x4e1f37['shift']());}catch(_0x2e796c){_0x4e1f37['push'](_0x4e1f37['shift']());}}}(_0x3302,0x1db61));export{default as ExportPdf}from'./exportpdf.js';function _0x3302(){var _0x41d653=['287jxeicH','2XsCFtt','755744tbJLGO','220248xscSaR','118266rhNabI','2246740ltHYPX','23550RHyQUy','52anrHwm','30325PTCLrN','464613DxlVht'];_0x3302=function(){return _0x41d653;};return _0x3302();}import'./augmentation.js';
|
package/src/utils.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
function _0x1776(){const _0x556e07=['2343FPLyyt','1033713sTQyot','hasAttribute','cssText','3322CGyTJx','fetch','1157741sEaHSD','push','trim','cssRules','length','325619GPHiRx','styleSheets','5017304zgwQQA','text',':root','then','637782fThgJN','120oTDeaE','all','EDITOR_STYLES','10mjbwtY','data-cke','ownerNode','indexOf','6281345eWPNec','warn','join','from','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.','.ck-content'];_0x1776=function(){return _0x556e07;};return _0x1776();}(function(_0x997a1b,_0x3252bd){const _0x31273c=_0x52f9,_0x1e7a4d=_0x997a1b();while(!![]){try{const _0x5e4a01=parseInt(_0x31273c(0x99))/0x1+-parseInt(_0x31273c(0x97))/0x2*(parseInt(_0x31273c(0x93))/0x3)+parseInt(_0x31273c(0xa0))/0x4+-parseInt(_0x31273c(0x8d))/0x5+parseInt(_0x31273c(0x85))/0x6+-parseInt(_0x31273c(0x9e))/0x7*(-parseInt(_0x31273c(0x86))/0x8)+parseInt(_0x31273c(0x94))/0x9*(parseInt(_0x31273c(0x89))/0xa);if(_0x5e4a01===_0x3252bd)break;else _0x1e7a4d['push'](_0x1e7a4d['shift']());}catch(_0x558d77){_0x1e7a4d['push'](_0x1e7a4d['shift']());}}}(_0x1776,0xbdcfa));export function getStyles(_0x1acf9e){const _0x20ce54=_0x52f9;if(!_0x1acf9e)return new Promise(_0x3fe410=>_0x3fe410(''));const _0x5dc872=[];for(const _0x5b7bae of _0x1acf9e)_0x20ce54(0x88)!==_0x5b7bae?_0x5dc872[_0x20ce54(0x9a)](window[_0x20ce54(0x98)](_0x5b7bae)[_0x20ce54(0xa3)](_0x2c6c37=>_0x2c6c37[_0x20ce54(0xa1)]())):_0x5dc872[_0x20ce54(0x9a)](u());return Promise[_0x20ce54(0x87)](_0x5dc872)[_0x20ce54(0xa3)](_0x5a792b=>_0x5a792b[_0x20ce54(0x8f)]('\x20')[_0x20ce54(0x9b)]());}function _0x52f9(_0x2b7617,_0x2b3dc0){const _0x1776b2=_0x1776();return _0x52f9=function(_0x52f949,_0x44981d){_0x52f949=_0x52f949-0x85;let _0x14d906=_0x1776b2[_0x52f949];return _0x14d906;},_0x52f9(_0x2b7617,_0x2b3dc0);}function u(){const _0x53db12=_0x52f9,_0x38e6c3=[],_0x36a3fa=[];for(const _0x1dee87 of Array[_0x53db12(0x90)](document[_0x53db12(0x9f)])){if(_0x1dee87[_0x53db12(0x8b)][_0x53db12(0x95)](_0x53db12(0x8a))){for(const _0x4487c7 of Array[_0x53db12(0x90)](_0x1dee87[_0x53db12(0x9c)]))-0x1!==_0x4487c7[_0x53db12(0x96)][_0x53db12(0x8c)](_0x53db12(0x92))?_0x38e6c3[_0x53db12(0x9a)](_0x4487c7[_0x53db12(0x96)]):-0x1!==_0x4487c7[_0x53db12(0x96)][_0x53db12(0x8c)](_0x53db12(0xa2))&&_0x36a3fa[_0x53db12(0x9a)](_0x4487c7[_0x53db12(0x96)]);}}return _0x38e6c3[_0x53db12(0x9d)]||console[_0x53db12(0x8e)](_0x53db12(0x91)),[..._0x36a3fa,..._0x38e6c3][_0x53db12(0x8f)]('\x20')[_0x53db12(0x9b)]();}
|