@ckeditor/ckeditor5-export-pdf 41.2.0 → 41.3.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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.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.
|
|
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
|
|
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'];}}
|
package/src/exportpdfcommand.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Command as
|
|
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(
|
|
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(
|
|
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();}
|