@ckeditor/ckeditor5-export-word 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-word.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/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.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/exportword.d.ts +235 -0
- package/dist/types/exportwordcommand.d.ts +40 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/utils.d.ts +40 -0
- package/package.json +3 -2
- package/src/exportword.js +1 -1
- package/src/exportwordcommand.js +1 -1
- package/src/index.js +1 -1
- package/src/utils.js +1 -1
|
@@ -0,0 +1,235 @@
|
|
|
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-word/exportword
|
|
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 Word feature.
|
|
18
|
+
*
|
|
19
|
+
* It allows you to generate a Word file directly from the editor content.
|
|
20
|
+
*
|
|
21
|
+
* For a detailed overview, check the {@glink features/converters/export-word export to Word} feature documentation.
|
|
22
|
+
*/
|
|
23
|
+
export default class ExportWord extends Plugin {
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
static get pluginName(): "ExportWord";
|
|
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 Word feature. It is used by the Word export features from
|
|
39
|
+
* the `@ckeditor/ckeditor5-export-word` package.
|
|
40
|
+
*
|
|
41
|
+
* ```ts
|
|
42
|
+
* ClassicEditor
|
|
43
|
+
* .create( editorElement, {
|
|
44
|
+
* exportWord: ... // Export to Word feature options.
|
|
45
|
+
* } )
|
|
46
|
+
* .then( ... )
|
|
47
|
+
* .catch( ... );
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
51
|
+
*/
|
|
52
|
+
export interface ExportWordConfig {
|
|
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 exportWordConfig = {
|
|
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 Word file 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 exportWordConfig = {
|
|
72
|
+
* stylesheets: [ './path/to/custom-editor-styles.css' ]
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* **Custom styling:** For more advanced styling, your configuration should look like this:
|
|
77
|
+
*
|
|
78
|
+
* ```ts
|
|
79
|
+
* const exportWordConfig = {
|
|
80
|
+
* stylesheets: [
|
|
81
|
+
* 'EDITOR_STYLES',
|
|
82
|
+
* './path/to/custom-styles.css'
|
|
83
|
+
* ]
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* @default `[ 'EDITOR_STYLES' ]`
|
|
88
|
+
*/
|
|
89
|
+
stylesheets?: Array<string>;
|
|
90
|
+
/**
|
|
91
|
+
* The name of the generated Word file.
|
|
92
|
+
*
|
|
93
|
+
* ```ts
|
|
94
|
+
* // Static file name.
|
|
95
|
+
* const exportWordConfig = {
|
|
96
|
+
* fileName: 'my-document.docx'
|
|
97
|
+
* }
|
|
98
|
+
*
|
|
99
|
+
*
|
|
100
|
+
* // Dynamic file name.
|
|
101
|
+
* const exportWordConfig = {
|
|
102
|
+
* fileName: () => {
|
|
103
|
+
* const articleTitle = document.querySelector( '#title' );
|
|
104
|
+
*
|
|
105
|
+
* return `${ articleTitle.value }.docx`;
|
|
106
|
+
* }
|
|
107
|
+
* }
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* **NOTE:** The file name must contain the `.docx` extension.
|
|
111
|
+
* Otherwise your operating system or device may have trouble identifying the file type.
|
|
112
|
+
*
|
|
113
|
+
* @default 'document.docx'
|
|
114
|
+
*/
|
|
115
|
+
fileName?: string | (() => string);
|
|
116
|
+
/**
|
|
117
|
+
* A URL to the Docx converter.
|
|
118
|
+
*
|
|
119
|
+
* ```ts
|
|
120
|
+
* const exportWordConfig = {
|
|
121
|
+
* converterUrl: 'https://myconverter.com/v1/'
|
|
122
|
+
* }
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* **NOTE:** The plugin uses the default HTML to Word converter delivered by CKEditor Cloud Services.
|
|
126
|
+
* You can provide a URL to an on-premises converter instead.
|
|
127
|
+
*
|
|
128
|
+
* @default 'https://docx-converter.cke-cs.com/v1/convert'
|
|
129
|
+
*/
|
|
130
|
+
converterUrl?: string;
|
|
131
|
+
/**
|
|
132
|
+
* The CKEditor Cloud Services HTML to DOCX Converter [configuration options](https://docx-converter.cke-cs.com/docs#section/Options).
|
|
133
|
+
*
|
|
134
|
+
* **NOTE:** Configuring the plugin is not mandatory.
|
|
135
|
+
*
|
|
136
|
+
* ```ts
|
|
137
|
+
* const exportWordConfig = {
|
|
138
|
+
* converterOptions: {
|
|
139
|
+
* ...
|
|
140
|
+
* }
|
|
141
|
+
* }
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* @default `{
|
|
145
|
+
* format: 'A4',
|
|
146
|
+
* margin_top: '1in',
|
|
147
|
+
* margin_bottom: '1in',
|
|
148
|
+
* margin_right: '1in',
|
|
149
|
+
* margin_left: '1in',
|
|
150
|
+
* header: undefined,
|
|
151
|
+
* footer: undefined,
|
|
152
|
+
* comments: undefined,
|
|
153
|
+
* suggestions: undefined,
|
|
154
|
+
* orientation: 'portrait',
|
|
155
|
+
* auto_pagination: true,
|
|
156
|
+
* base_url: undefined,
|
|
157
|
+
* timezone: 'UTC'
|
|
158
|
+
* }`
|
|
159
|
+
*/
|
|
160
|
+
converterOptions?: ExportWordConverterOptions;
|
|
161
|
+
/**
|
|
162
|
+
* A function to gather the HTML to be converted to Word.
|
|
163
|
+
*
|
|
164
|
+
* **NOTE:** This option may be useful when the editor does not have a `getData()` method,
|
|
165
|
+
* or if the HTML to be converted should be different than the edited one.
|
|
166
|
+
*
|
|
167
|
+
* ```ts
|
|
168
|
+
* const exportWordConfig = {
|
|
169
|
+
* dataCallback: ( editor ) => {
|
|
170
|
+
* return `
|
|
171
|
+
* <header id="header">${ editor.data.get( { rootName: 'header' } ) }</header>
|
|
172
|
+
* <div id="content">${ editor.data.get( { rootName: 'content' } ) }</div>
|
|
173
|
+
* `;
|
|
174
|
+
* }
|
|
175
|
+
* }
|
|
176
|
+
* ```
|
|
177
|
+
*
|
|
178
|
+
* @default `( editor ) => editor.getData( { pagination: true } )
|
|
179
|
+
*
|
|
180
|
+
* If using the {@glink features/pagination/pagination pagination} feature, the `pagination:true` option inserts additional markers into
|
|
181
|
+
* editor's data. Thanks to that, the Docx converter creates a Word document similar to what is displayed in the editor.
|
|
182
|
+
*/
|
|
183
|
+
dataCallback?: (editor: Editor) => string;
|
|
184
|
+
/**
|
|
185
|
+
* A token URL or a token request function. This field is optional and should be used only when a different `tokenUrl` is required for
|
|
186
|
+
* the export to Word feature.
|
|
187
|
+
*
|
|
188
|
+
* **Note:** The token can be disabled with the `false` value provided.
|
|
189
|
+
*
|
|
190
|
+
* See: {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl}
|
|
191
|
+
*/
|
|
192
|
+
tokenUrl?: TokenUrl | false;
|
|
193
|
+
/**
|
|
194
|
+
* The authentication token.
|
|
195
|
+
*
|
|
196
|
+
* See: {@link module:cloud-services/cloudservices~CloudServices#token}
|
|
197
|
+
*/
|
|
198
|
+
token?: InitializedToken;
|
|
199
|
+
}
|
|
200
|
+
export type ExportWordConverterOptions = {
|
|
201
|
+
format?: ExportWordConverterFormatOption;
|
|
202
|
+
margin_top?: string;
|
|
203
|
+
margin_bottom?: string;
|
|
204
|
+
margin_right?: string;
|
|
205
|
+
margin_left?: string;
|
|
206
|
+
header?: ExportWordConverterHeaderFooterOption;
|
|
207
|
+
footer?: ExportWordConverterHeaderFooterOption;
|
|
208
|
+
comments?: ExportWordConverterCommentsOption;
|
|
209
|
+
suggestions?: ExportWordConverterSuggestionsOption;
|
|
210
|
+
orientation?: ExportWordConverterOrientationOption;
|
|
211
|
+
auto_pagination?: boolean;
|
|
212
|
+
base_url?: string;
|
|
213
|
+
timezone?: string;
|
|
214
|
+
};
|
|
215
|
+
export type ExportWordConverterFormatOption = 'Letter' | 'Legal' | 'Tabloid' | 'Statement' | 'Executive' | 'A3' | 'A4' | 'A5' | 'A6' | 'B4' | 'B5';
|
|
216
|
+
export type ExportWordConverterOrientationOption = 'portrait' | 'landscape';
|
|
217
|
+
export type ExportWordConverterHeaderFooterOption = Array<{
|
|
218
|
+
html?: string;
|
|
219
|
+
css?: string;
|
|
220
|
+
type?: 'default' | 'even' | 'odd' | 'first';
|
|
221
|
+
}>;
|
|
222
|
+
export type ExportWordConverterCommentsOption = {
|
|
223
|
+
[id: string]: Array<{
|
|
224
|
+
author: string;
|
|
225
|
+
created: Date;
|
|
226
|
+
content?: string;
|
|
227
|
+
is_resolved: boolean;
|
|
228
|
+
}>;
|
|
229
|
+
};
|
|
230
|
+
export type ExportWordConverterSuggestionsOption = {
|
|
231
|
+
[id: string]: {
|
|
232
|
+
author: string;
|
|
233
|
+
created: Date | null;
|
|
234
|
+
};
|
|
235
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
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-word/exportwordcommand
|
|
11
|
+
* @publicApi
|
|
12
|
+
*/
|
|
13
|
+
import { Command, type Editor } from 'ckeditor5/src/core.js';
|
|
14
|
+
import { type ExportWordConfig } from './exportword.js';
|
|
15
|
+
/**
|
|
16
|
+
* The export to Word command.
|
|
17
|
+
*
|
|
18
|
+
* It takes the editor's HTML and CSS rules from the document and sends them to the HTML to Word converter.
|
|
19
|
+
* After processing, the converter will send back a Word file for download.
|
|
20
|
+
*/
|
|
21
|
+
export default class ExportWordCommand 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
|
+
* @inheritDoc
|
|
38
|
+
*/
|
|
39
|
+
execute(options?: ExportWordConfig): Promise<void>;
|
|
40
|
+
}
|
|
@@ -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-word
|
|
11
|
+
*/
|
|
12
|
+
export { default as ExportWord, type ExportWordConfig } from './exportword.js';
|
|
13
|
+
export type { default as ExportWordCommand } from './exportwordcommand.js';
|
|
14
|
+
import './augmentation.js';
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
import type { Editor } from 'ckeditor5/src/core.js';
|
|
10
|
+
import type { Collection } from 'ckeditor5/src/utils.js';
|
|
11
|
+
import type { ExportWordConverterOptions, ExportWordConverterCommentsOption, ExportWordConverterSuggestionsOption } from './exportword.js';
|
|
12
|
+
import type { CommentThread } from '@ckeditor/ckeditor5-comments';
|
|
13
|
+
import type { SuggestionJSON } from '@ckeditor/ckeditor5-track-changes';
|
|
14
|
+
import type { User } from '@ckeditor/ckeditor5-collaboration-core';
|
|
15
|
+
/**
|
|
16
|
+
* A helper function for getting concatenated CSS rules from external stylesheets.
|
|
17
|
+
*
|
|
18
|
+
* @param stylesheets An array of stylesheet paths delivered by the user through the plugin configuration.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getStyles(stylesheets?: Array<string>): Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* A helper function for getting a proper options object containing
|
|
23
|
+
* comments, suggestions and the browser's timezone for the "Export to Word" converter.
|
|
24
|
+
*
|
|
25
|
+
* @param editor An editor instance.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getConverterOptions(editor: Editor): ExportWordConverterOptions;
|
|
28
|
+
/**
|
|
29
|
+
* A helper function for getting a comments object for the converter options.
|
|
30
|
+
*
|
|
31
|
+
* @param threads The comment threads array.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getComments(threads: Array<CommentThread>): ExportWordConverterCommentsOption;
|
|
34
|
+
/**
|
|
35
|
+
* A helper function for getting a suggestions object for the converter options.
|
|
36
|
+
*
|
|
37
|
+
* @param suggestions The suggestions array.
|
|
38
|
+
* @param users A list of all users in the editor.
|
|
39
|
+
*/
|
|
40
|
+
export declare function getSuggestions(suggestions: Array<SuggestionJSON>, users: Collection<User>): ExportWordConverterSuggestionsOption;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-export-word",
|
|
3
|
-
"version": "41.
|
|
3
|
+
"version": "41.3.0-alpha.3",
|
|
4
4
|
"description": "Export to Word 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 (https://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/exportword.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Plugin as
|
|
23
|
+
import{Plugin as _0x1818da}from'ckeditor5/src/core.js';import{ButtonView as _0x141fea,Notification as _0x4cbfa5,SpinnerView as _0x29c150}from'ckeditor5/src/ui.js';import _0x3b4761 from'./exportwordcommand.js';import _0x12f797 from'../theme/icons/exportword.svg';export default class d extends _0x1818da{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x4cbfa5];}['init'](){const _0x463fdd=this['editor'],t=_0x463fdd['t'],_0x1e5c51=_0x463fdd['config']['get']('exportWord')||{};_0x463fdd['commands']['add']('exportWord',new _0x3b4761(_0x463fdd)),_0x463fdd['ui']['componentFactory']['add']('exportWord',_0xa47b7f=>{const _0x12f800=_0x463fdd['commands']['get']('exportWord'),_0x1306e8=new _0x141fea(_0xa47b7f),_0x453337=new _0x29c150();return _0x1306e8['set']({'label':t('Export\x20to\x20Word'),'icon':_0x12f797,'tooltip':!0x0}),_0x1306e8['children']['add'](_0x453337),_0x1306e8['bind']('isOn','isEnabled')['to'](_0x12f800,'isBusy','isEnabled'),_0x453337['bind']('isVisible')['to'](_0x12f800,'isBusy'),_0x1306e8['iconView']['bind']('isVisible')['to'](_0x12f800,'isBusy',_0x2fe70e=>!_0x2fe70e),this['listenTo'](_0x1306e8,'execute',()=>{_0x463fdd['execute']('exportWord',_0x1e5c51),_0x463fdd['editing']['view']['focus']();}),_0x1306e8;});const _0x4c12d3=_0x463fdd['plugins']['get']('CloudServices');!0x1===_0x1e5c51['tokenUrl']?this['_token']=null:_0x1e5c51['tokenUrl']?_0x4c12d3['registerTokenUrl'](_0x1e5c51['tokenUrl'])['then'](_0x5b3545=>{this['_token']=_0x5b3545;}):this['_token']=_0x4c12d3['token'];}}
|
package/src/exportwordcommand.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Command as
|
|
23
|
+
import{Command as _0x25fc53}from'ckeditor5/src/core.js';import{getStyles as _0x2324b6,getConverterOptions as _0x4ba2c4}from'./utils.js';export default class i extends _0x25fc53{constructor(_0x3913d1){super(_0x3913d1),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x3f0196={}){const _0x262852=this['editor'],t=_0x262852['t'],_0x16f0a5=_0x3f0196['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x1dee69=_0x3f0196['converterOptions']||{},_0xfa3af=_0x262852['plugins']['get']('ExportWord'),_0x393dea=_0x3f0196['token']||_0xfa3af['_token'],_0x4cf77f=!0x1!==_0x1dee69['auto_pagination'],_0x4ce532=_0x3f0196['dataCallback']||(_0x5d1c70=>_0x5d1c70['data']['get']({'pagination':_0x4cf77f}));return this['isBusy']=!0x0,this['refresh'](),_0x2324b6(_0x3f0196['stylesheets']||['EDITOR_STYLES'])['then'](async _0x4f3e49=>{const _0x25eed3=await _0x4ce532(_0x262852),_0x2f9a6d={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x262852['locale']['contentLanguageDirection']+'\x22>'+_0x25eed3+'</div>','css':_0x4f3e49,'options':{..._0x1dee69,..._0x4ba2c4(_0x262852)}},_0x2555b3={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x393dea?{'Authorization':_0x393dea['value']}:null},'body':JSON['stringify'](_0x2f9a6d)};return window['fetch'](_0x16f0a5,_0x2555b3)['then'](_0x9809d6=>{if(0xc8!==_0x9809d6['status'])throw _0x9809d6;return _0x9809d6['blob']();})['then'](_0x515731=>{const _0x387fe0='function'==typeof _0x3f0196['fileName']?_0x3f0196['fileName']():_0x3f0196['fileName'];this['_downloadFile'](_0x515731,_0x387fe0||'document.docx');});})['catch'](_0xe4060b=>{throw _0x262852['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0xe4060b;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0x21213,_0x3e21f4){const _0xd6a3fc=document['createElement']('a');_0xd6a3fc['href']=window['URL']['createObjectURL'](_0x21213),_0xd6a3fc['download']=_0x3e21f4,_0xd6a3fc['click'](),_0xd6a3fc['remove']();}}
|
package/src/index.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
(function(
|
|
23
|
+
function _0x466a(){var _0x17dfa8=['3235450JChOqE','15538380wyHogX','2624792IKjBJV','5824554JxjolD','1571595mQGCJF','64zrlROG','2PeWfqZ','23247EQkLvC','828506PvAiiq','7ldVuRa'];_0x466a=function(){return _0x17dfa8;};return _0x466a();}(function(_0x97dd54,_0x38a839){var _0x1e2968=_0x2a31,_0x3186d6=_0x97dd54();while(!![]){try{var _0x2b65d9=-parseInt(_0x1e2968(0x157))/0x1+parseInt(_0x1e2968(0x155))/0x2*(-parseInt(_0x1e2968(0x153))/0x3)+parseInt(_0x1e2968(0x151))/0x4+parseInt(_0x1e2968(0x14f))/0x5+-parseInt(_0x1e2968(0x152))/0x6*(parseInt(_0x1e2968(0x158))/0x7)+parseInt(_0x1e2968(0x154))/0x8*(-parseInt(_0x1e2968(0x156))/0x9)+parseInt(_0x1e2968(0x150))/0xa;if(_0x2b65d9===_0x38a839)break;else _0x3186d6['push'](_0x3186d6['shift']());}catch(_0x20dedd){_0x3186d6['push'](_0x3186d6['shift']());}}}(_0x466a,0x7d534));export{default as ExportWord}from'./exportword.js';function _0x2a31(_0x748b8c,_0x574b58){var _0x466aaa=_0x466a();return _0x2a31=function(_0x2a31cc,_0x30b47d){_0x2a31cc=_0x2a31cc-0x14f;var _0x1365bc=_0x466aaa[_0x2a31cc];return _0x1365bc;},_0x2a31(_0x748b8c,_0x574b58);}import'./augmentation.js';
|
package/src/utils.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
(function(
|
|
23
|
+
(function(_0x2c1b41,_0x4b6bdf){const _0xba24ce=_0x555a,_0x5196e1=_0x2c1b41();while(!![]){try{const _0x29dab8=-parseInt(_0xba24ce(0xd7))/0x1+parseInt(_0xba24ce(0xf4))/0x2*(parseInt(_0xba24ce(0xe6))/0x3)+-parseInt(_0xba24ce(0xd9))/0x4*(-parseInt(_0xba24ce(0x106))/0x5)+parseInt(_0xba24ce(0xfc))/0x6*(parseInt(_0xba24ce(0xe7))/0x7)+-parseInt(_0xba24ce(0xf8))/0x8*(-parseInt(_0xba24ce(0xf0))/0x9)+parseInt(_0xba24ce(0x102))/0xa*(parseInt(_0xba24ce(0xe0))/0xb)+-parseInt(_0xba24ce(0xe4))/0xc;if(_0x29dab8===_0x4b6bdf)break;else _0x5196e1['push'](_0x5196e1['shift']());}catch(_0x2545aa){_0x5196e1['push'](_0x5196e1['shift']());}}}(_0x5a8b,0x9f27f));export function getStyles(_0x2ff660){const _0x39edfa=_0x555a;if(!_0x2ff660)return new Promise(_0x114d12=>_0x114d12(''));const _0x302603=[];for(const _0xeebe4b of _0x2ff660)_0x39edfa(0xe5)!==_0xeebe4b?_0x302603[_0x39edfa(0xf3)](window[_0x39edfa(0xdf)](_0xeebe4b)[_0x39edfa(0xf5)](_0x1883c1=>_0x1883c1[_0x39edfa(0x103)]())):_0x302603[_0x39edfa(0xf3)](u());return Promise[_0x39edfa(0x107)](_0x302603)[_0x39edfa(0xf5)](_0x1c0051=>_0x1c0051[_0x39edfa(0xec)]('\x20')[_0x39edfa(0xe8)]());}function u(){const _0x57f600=_0x555a,_0x295d04=[],_0xb4ad83=[];for(const _0x1bd2cb of Array[_0x57f600(0x105)](document[_0x57f600(0xee)])){if(_0x1bd2cb[_0x57f600(0xf6)][_0x57f600(0x100)](_0x57f600(0xda))){for(const _0x50ddb1 of Array[_0x57f600(0x105)](_0x1bd2cb[_0x57f600(0xe9)]))-0x1!==_0x50ddb1[_0x57f600(0xd5)][_0x57f600(0xed)](_0x57f600(0xf1))?_0x295d04[_0x57f600(0xf3)](_0x50ddb1[_0x57f600(0xd5)]):-0x1!==_0x50ddb1[_0x57f600(0xd5)][_0x57f600(0xed)](_0x57f600(0xf7))&&_0xb4ad83[_0x57f600(0xf3)](_0x50ddb1[_0x57f600(0xd5)]);}}return _0x295d04[_0x57f600(0xfa)]||console[_0x57f600(0xd8)](_0x57f600(0x101)),[..._0xb4ad83,..._0x295d04][_0x57f600(0xec)]('\x20')[_0x57f600(0xe8)]();}function _0x5a8b(){const _0x6ee39e=['keys','fetch','27038FGYLnR','CommentsRepository','get','users','19051044VauBMO','EDITOR_STYLES','27FWvluD','3039449beBWjT','trim','cssRules','content','name','join','indexOf','styleSheets','authorId','27wsCkOG','.ck-content','createdAt','push','161872CKBXvt','then','ownerNode',':root','1760872BZbxdA','resolvedOptions','length','author','12NwuKrc','getSuggestions','isResolved','timeZone','hasAttribute','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.','470pWoPYd','text','TrackChanges','from','1672795HNFXhB','all','has','timezone','map','plugins','suggestions','cssText','DateTimeFormat','467760kGpxUq','warn','4knMNBt','data-cke','comments','Users','getCommentThreads'];_0x5a8b=function(){return _0x6ee39e;};return _0x5a8b();}function _0x555a(_0x3cbc42,_0x1dba12){const _0x5a8b45=_0x5a8b();return _0x555a=function(_0x555abf,_0x493fee){_0x555abf=_0x555abf-0xd5;let _0xd4fe2f=_0x5a8b45[_0x555abf];return _0xd4fe2f;},_0x555a(_0x3cbc42,_0x1dba12);}export function getConverterOptions(_0x157c81){const _0x488716=_0x555a,_0xf1e314=_0x157c81[_0x488716(0x10b)][_0x488716(0x108)](_0x488716(0xdc)),_0x24b27b=_0x157c81[_0x488716(0x10b)][_0x488716(0x108)](_0x488716(0xe1)),_0x4955ae=_0x157c81[_0x488716(0x10b)][_0x488716(0x108)](_0x488716(0x104)),_0x94afa4={};if(_0xf1e314&&_0x24b27b){const _0x489109=getComments(_0x157c81[_0x488716(0x10b)][_0x488716(0xe2)](_0x488716(0xe1))[_0x488716(0xdd)]({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object[_0x488716(0xde)](_0x489109)[_0x488716(0xfa)]&&(_0x94afa4[_0x488716(0xdb)]=_0x489109);}if(_0xf1e314&&_0x4955ae){const _0x51b160=_0x157c81[_0x488716(0x10b)][_0x488716(0xe2)](_0x488716(0x104)),_0x1ef15b=_0x157c81[_0x488716(0x10b)][_0x488716(0xe2)](_0x488716(0xdc)),_0x1bf8c2=getSuggestions(_0x51b160[_0x488716(0xfd)]({'toJSON':!0x0}),_0x1ef15b[_0x488716(0xe3)]);Object[_0x488716(0xde)](_0x1bf8c2)[_0x488716(0xfa)]&&(_0x94afa4[_0x488716(0x10c)]=_0x1bf8c2);}return(_0x94afa4[_0x488716(0x10c)]||_0x94afa4[_0x488716(0xdb)])&&(_0x94afa4[_0x488716(0x109)]=new Intl[(_0x488716(0xd6))]()[_0x488716(0xf9)]()[_0x488716(0xff)]),_0x94afa4;}export function getComments(_0x1867c9){const _0x15c869=_0x555a,_0x5a55e8={};if(!_0x1867c9[_0x15c869(0xfa)])return _0x5a55e8;for(const _0x19e8da of _0x1867c9)_0x19e8da[_0x15c869(0xdb)][_0x15c869(0x10a)](_0x2148d6=>{const _0xaa387=_0x15c869;void 0x0===_0x5a55e8[_0x19e8da['id']]&&(_0x5a55e8[_0x19e8da['id']]=[]),_0x5a55e8[_0x19e8da['id']][_0xaa387(0xf3)]({'author':_0x2148d6[_0xaa387(0xfb)][_0xaa387(0xeb)],'content':_0x2148d6[_0xaa387(0xea)],'created':_0x2148d6[_0xaa387(0xf2)],'is_resolved':_0x19e8da[_0xaa387(0xfe)]});});return _0x5a55e8;}export function getSuggestions(_0x30184b,_0x2e7ea5){const _0x3349d7=_0x555a,_0x13239={};if(!_0x30184b[_0x3349d7(0xfa)]||!_0x2e7ea5[_0x3349d7(0xfa)])return _0x13239;for(const _0x518a5d of _0x30184b)_0x13239[_0x518a5d['id']]={'author':_0x2e7ea5[_0x3349d7(0xe2)](_0x518a5d[_0x3349d7(0xef)])[_0x3349d7(0xeb)],'created':_0x518a5d[_0x3349d7(0xf2)]};return _0x13239;}
|