@ckeditor/ckeditor5-export-word 41.3.0 → 41.4.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/export-word.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/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 +236 -0
- package/dist/types/exportwordcommand.d.ts +40 -0
- package/dist/types/exportwordui.d.ts +27 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/utils.d.ts +40 -0
- package/lang/contexts.json +4 -1
- package/package.json +3 -2
- package/src/exportword.js +1 -1
- package/src/exportwordcommand.js +1 -1
- package/src/exportwordui.js +1 -1
- package/src/index.js +1 -1
- package/src/utils.js +1 -1
|
@@ -0,0 +1,236 @@
|
|
|
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
|
+
import ExportWordUI from './exportwordui.js';
|
|
17
|
+
/**
|
|
18
|
+
* The export to Word feature.
|
|
19
|
+
*
|
|
20
|
+
* It allows you to generate a Word file directly from the editor content.
|
|
21
|
+
*
|
|
22
|
+
* For a detailed overview, check the {@glink features/converters/export-word export to Word} feature documentation.
|
|
23
|
+
*/
|
|
24
|
+
export default class ExportWord extends Plugin {
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
static get pluginName(): "ExportWord";
|
|
29
|
+
/**
|
|
30
|
+
* @inheritDoc
|
|
31
|
+
*/
|
|
32
|
+
static get requires(): readonly ["CloudServices", typeof Notification, typeof ExportWordUI];
|
|
33
|
+
/**
|
|
34
|
+
* @inheritDoc
|
|
35
|
+
*/
|
|
36
|
+
init(): void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The configuration of the export to Word feature. It is used by the Word export features from
|
|
40
|
+
* the `@ckeditor/ckeditor5-export-word` package.
|
|
41
|
+
*
|
|
42
|
+
* ```ts
|
|
43
|
+
* ClassicEditor
|
|
44
|
+
* .create( editorElement, {
|
|
45
|
+
* exportWord: ... // Export to Word feature options.
|
|
46
|
+
* } )
|
|
47
|
+
* .then( ... )
|
|
48
|
+
* .catch( ... );
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
52
|
+
*/
|
|
53
|
+
export interface ExportWordConfig {
|
|
54
|
+
/**
|
|
55
|
+
* Paths to the `.css` files containing additional styling for the editor's content (**the order of provided items matters**).
|
|
56
|
+
*
|
|
57
|
+
* ```ts
|
|
58
|
+
* const exportWordConfig = {
|
|
59
|
+
* stylesheets: [ './path/to/custom-style.css' ]
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* **NOTE:** If `stylesheets` are not provided, the plugin will sent only
|
|
64
|
+
* {@glink installation/advanced/content-styles#the-full-list-of-content-styles the default editor content styles} to the converter.
|
|
65
|
+
*
|
|
66
|
+
* **Default editor's content styles**:
|
|
67
|
+
* {@glink installation/advanced/content-styles#the-full-list-of-content-styles The default editor content styles}
|
|
68
|
+
* are applied to the generated Word file thanks to the 'EDITOR_STYLES' token, which is provided to the `stylesheets` by default.
|
|
69
|
+
* If you don't want them to be applied, you have to omit the token:
|
|
70
|
+
*
|
|
71
|
+
* ```ts
|
|
72
|
+
* const exportWordConfig = {
|
|
73
|
+
* stylesheets: [ './path/to/custom-editor-styles.css' ]
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* **Custom styling:** For more advanced styling, your configuration should look like this:
|
|
78
|
+
*
|
|
79
|
+
* ```ts
|
|
80
|
+
* const exportWordConfig = {
|
|
81
|
+
* stylesheets: [
|
|
82
|
+
* 'EDITOR_STYLES',
|
|
83
|
+
* './path/to/custom-styles.css'
|
|
84
|
+
* ]
|
|
85
|
+
* }
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* @default `[ 'EDITOR_STYLES' ]`
|
|
89
|
+
*/
|
|
90
|
+
stylesheets?: Array<string>;
|
|
91
|
+
/**
|
|
92
|
+
* The name of the generated Word file.
|
|
93
|
+
*
|
|
94
|
+
* ```ts
|
|
95
|
+
* // Static file name.
|
|
96
|
+
* const exportWordConfig = {
|
|
97
|
+
* fileName: 'my-document.docx'
|
|
98
|
+
* }
|
|
99
|
+
*
|
|
100
|
+
*
|
|
101
|
+
* // Dynamic file name.
|
|
102
|
+
* const exportWordConfig = {
|
|
103
|
+
* fileName: () => {
|
|
104
|
+
* const articleTitle = document.querySelector( '#title' );
|
|
105
|
+
*
|
|
106
|
+
* return `${ articleTitle.value }.docx`;
|
|
107
|
+
* }
|
|
108
|
+
* }
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* **NOTE:** The file name must contain the `.docx` extension.
|
|
112
|
+
* Otherwise your operating system or device may have trouble identifying the file type.
|
|
113
|
+
*
|
|
114
|
+
* @default 'document.docx'
|
|
115
|
+
*/
|
|
116
|
+
fileName?: string | (() => string);
|
|
117
|
+
/**
|
|
118
|
+
* A URL to the Docx converter.
|
|
119
|
+
*
|
|
120
|
+
* ```ts
|
|
121
|
+
* const exportWordConfig = {
|
|
122
|
+
* converterUrl: 'https://myconverter.com/v1/'
|
|
123
|
+
* }
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* **NOTE:** The plugin uses the default HTML to Word converter delivered by CKEditor Cloud Services.
|
|
127
|
+
* You can provide a URL to an on-premises converter instead.
|
|
128
|
+
*
|
|
129
|
+
* @default 'https://docx-converter.cke-cs.com/v1/convert'
|
|
130
|
+
*/
|
|
131
|
+
converterUrl?: string;
|
|
132
|
+
/**
|
|
133
|
+
* The CKEditor Cloud Services HTML to DOCX Converter [configuration options](https://docx-converter.cke-cs.com/docs#section/Options).
|
|
134
|
+
*
|
|
135
|
+
* **NOTE:** Configuring the plugin is not mandatory.
|
|
136
|
+
*
|
|
137
|
+
* ```ts
|
|
138
|
+
* const exportWordConfig = {
|
|
139
|
+
* converterOptions: {
|
|
140
|
+
* ...
|
|
141
|
+
* }
|
|
142
|
+
* }
|
|
143
|
+
* ```
|
|
144
|
+
*
|
|
145
|
+
* @default `{
|
|
146
|
+
* format: 'A4',
|
|
147
|
+
* margin_top: '1in',
|
|
148
|
+
* margin_bottom: '1in',
|
|
149
|
+
* margin_right: '1in',
|
|
150
|
+
* margin_left: '1in',
|
|
151
|
+
* header: undefined,
|
|
152
|
+
* footer: undefined,
|
|
153
|
+
* comments: undefined,
|
|
154
|
+
* suggestions: undefined,
|
|
155
|
+
* orientation: 'portrait',
|
|
156
|
+
* auto_pagination: true,
|
|
157
|
+
* base_url: undefined,
|
|
158
|
+
* timezone: 'UTC'
|
|
159
|
+
* }`
|
|
160
|
+
*/
|
|
161
|
+
converterOptions?: ExportWordConverterOptions;
|
|
162
|
+
/**
|
|
163
|
+
* A function to gather the HTML to be converted to Word.
|
|
164
|
+
*
|
|
165
|
+
* **NOTE:** This option may be useful when the editor does not have a `getData()` method,
|
|
166
|
+
* or if the HTML to be converted should be different than the edited one.
|
|
167
|
+
*
|
|
168
|
+
* ```ts
|
|
169
|
+
* const exportWordConfig = {
|
|
170
|
+
* dataCallback: ( editor ) => {
|
|
171
|
+
* return `
|
|
172
|
+
* <header id="header">${ editor.data.get( { rootName: 'header' } ) }</header>
|
|
173
|
+
* <div id="content">${ editor.data.get( { rootName: 'content' } ) }</div>
|
|
174
|
+
* `;
|
|
175
|
+
* }
|
|
176
|
+
* }
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
179
|
+
* @default `( editor ) => editor.getData( { pagination: true } )
|
|
180
|
+
*
|
|
181
|
+
* If using the {@glink features/pagination/pagination pagination} feature, the `pagination:true` option inserts additional markers into
|
|
182
|
+
* editor's data. Thanks to that, the Docx converter creates a Word document similar to what is displayed in the editor.
|
|
183
|
+
*/
|
|
184
|
+
dataCallback?: (editor: Editor) => string;
|
|
185
|
+
/**
|
|
186
|
+
* A token URL or a token request function. This field is optional and should be used only when a different `tokenUrl` is required for
|
|
187
|
+
* the export to Word feature.
|
|
188
|
+
*
|
|
189
|
+
* **Note:** The token can be disabled with the `false` value provided.
|
|
190
|
+
*
|
|
191
|
+
* See: {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl}
|
|
192
|
+
*/
|
|
193
|
+
tokenUrl?: TokenUrl | false;
|
|
194
|
+
/**
|
|
195
|
+
* The authentication token.
|
|
196
|
+
*
|
|
197
|
+
* See: {@link module:cloud-services/cloudservices~CloudServices#token}
|
|
198
|
+
*/
|
|
199
|
+
token?: InitializedToken;
|
|
200
|
+
}
|
|
201
|
+
export type ExportWordConverterOptions = {
|
|
202
|
+
format?: ExportWordConverterFormatOption;
|
|
203
|
+
margin_top?: string;
|
|
204
|
+
margin_bottom?: string;
|
|
205
|
+
margin_right?: string;
|
|
206
|
+
margin_left?: string;
|
|
207
|
+
header?: ExportWordConverterHeaderFooterOption;
|
|
208
|
+
footer?: ExportWordConverterHeaderFooterOption;
|
|
209
|
+
comments?: ExportWordConverterCommentsOption;
|
|
210
|
+
suggestions?: ExportWordConverterSuggestionsOption;
|
|
211
|
+
orientation?: ExportWordConverterOrientationOption;
|
|
212
|
+
auto_pagination?: boolean;
|
|
213
|
+
base_url?: string;
|
|
214
|
+
timezone?: string;
|
|
215
|
+
};
|
|
216
|
+
export type ExportWordConverterFormatOption = 'Letter' | 'Legal' | 'Tabloid' | 'Statement' | 'Executive' | 'A3' | 'A4' | 'A5' | 'A6' | 'B4' | 'B5';
|
|
217
|
+
export type ExportWordConverterOrientationOption = 'portrait' | 'landscape';
|
|
218
|
+
export type ExportWordConverterHeaderFooterOption = Array<{
|
|
219
|
+
html?: string;
|
|
220
|
+
css?: string;
|
|
221
|
+
type?: 'default' | 'even' | 'odd' | 'first';
|
|
222
|
+
}>;
|
|
223
|
+
export type ExportWordConverterCommentsOption = {
|
|
224
|
+
[id: string]: Array<{
|
|
225
|
+
author: string;
|
|
226
|
+
created: Date;
|
|
227
|
+
content?: string;
|
|
228
|
+
is_resolved: boolean;
|
|
229
|
+
}>;
|
|
230
|
+
};
|
|
231
|
+
export type ExportWordConverterSuggestionsOption = {
|
|
232
|
+
[id: string]: {
|
|
233
|
+
author: string;
|
|
234
|
+
created: Date | null;
|
|
235
|
+
};
|
|
236
|
+
};
|
|
@@ -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,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-word/exportwordui
|
|
11
|
+
*/
|
|
12
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
13
|
+
/**
|
|
14
|
+
* The export to Word UI feature.
|
|
15
|
+
*
|
|
16
|
+
* It introduces 'Export to Word' button in toolbar and menu bar.
|
|
17
|
+
*/
|
|
18
|
+
export default class ExportWordUI extends Plugin {
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
static get pluginName(): "ExportWordUI";
|
|
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-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/lang/contexts.json
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Export to Word": "A toolbar button tooltip for a Word export feature.",
|
|
3
|
-
"An error occurred while generating the Word file.": "An error message shown to the user when an error occurred during the generation of the Word file."
|
|
3
|
+
"An error occurred while generating the Word file.": "An error message shown to the user when an error occurred during the generation of the Word file.",
|
|
4
|
+
"Word document export started": "Aria status message indicating start of word document export. Example: 'Word document export started'.",
|
|
5
|
+
"Word document export failed": "Aria status message indicating failed Word document export. Example: 'Word document export failed'.",
|
|
6
|
+
"Word document export successful": "Aria status message indicating successful Word document export. Example: 'Word document export successful'."
|
|
4
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-export-word",
|
|
3
|
-
"version": "41.
|
|
3
|
+
"version": "41.4.0-alpha.0",
|
|
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.4.0-alpha.0"
|
|
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
|
-
|
|
23
|
+
const _0x18681e=_0x1ce3;(function(_0x10cbe6,_0x4b5359){const _0x208d9a=_0x1ce3,_0x323769=_0x10cbe6();while(!![]){try{const _0x584398=-parseInt(_0x208d9a(0x1bd))/0x1*(-parseInt(_0x208d9a(0x1d2))/0x2)+parseInt(_0x208d9a(0x1cb))/0x3+parseInt(_0x208d9a(0x1d1))/0x4*(-parseInt(_0x208d9a(0x1cc))/0x5)+parseInt(_0x208d9a(0x1ca))/0x6*(parseInt(_0x208d9a(0x1bc))/0x7)+-parseInt(_0x208d9a(0x1cf))/0x8+-parseInt(_0x208d9a(0x1be))/0x9*(parseInt(_0x208d9a(0x1c2))/0xa)+-parseInt(_0x208d9a(0x1d6))/0xb;if(_0x584398===_0x4b5359)break;else _0x323769['push'](_0x323769['shift']());}catch(_0x215adc){_0x323769['push'](_0x323769['shift']());}}}(_0x4863,0xc99b7));import{Plugin as _0xcf70c6}from'ckeditor5/src/core.js';function _0x4863(){const _0x1ab73a=['4087557cjXknu','243755TuaQzd','ExportWord','registerTokenUrl','9493952VdeTRM','requires','84mLIltw','2JORTnW','plugins','commands','config','5059593qYiSHN','_token','43106UyFfUF','945158hFDjSl','441kzTFJs','then','pluginName','token','31400vqBwNt','get','exportWord','tokenUrl','CloudServices','add','init','editor','1308PBJmki'];_0x4863=function(){return _0x1ab73a;};return _0x4863();}function _0x1ce3(_0xa3ea78,_0x3e1dd7){const _0x48637c=_0x4863();return _0x1ce3=function(_0x1ce3c0,_0x1488dc){_0x1ce3c0=_0x1ce3c0-0x1bb;let _0x4b2f45=_0x48637c[_0x1ce3c0];return _0x4b2f45;},_0x1ce3(_0xa3ea78,_0x3e1dd7);}import{Notification as _0x41d2cd}from'ckeditor5/src/ui.js';import _0x14d5ee from'./exportwordcommand.js';import _0x4bbea0 from'./exportwordui.js';export default class s extends _0xcf70c6{static get[_0x18681e(0x1c0)](){const _0x2cae3f=_0x18681e;return _0x2cae3f(0x1cd);}static get[_0x18681e(0x1d0)](){const _0x1392bb=_0x18681e;return[_0x1392bb(0x1c6),_0x41d2cd,_0x4bbea0];}[_0x18681e(0x1c8)](){const _0x4e3d23=_0x18681e,_0x3f43dc=this[_0x4e3d23(0x1c9)],_0x4c368a=_0x3f43dc[_0x4e3d23(0x1d5)][_0x4e3d23(0x1c3)](_0x4e3d23(0x1c4))||{};_0x3f43dc[_0x4e3d23(0x1d4)][_0x4e3d23(0x1c7)](_0x4e3d23(0x1c4),new _0x14d5ee(_0x3f43dc));const _0x54a96e=_0x3f43dc[_0x4e3d23(0x1d3)][_0x4e3d23(0x1c3)](_0x4e3d23(0x1c6));!0x1===_0x4c368a[_0x4e3d23(0x1c5)]?this[_0x4e3d23(0x1bb)]=null:_0x4c368a[_0x4e3d23(0x1c5)]?_0x54a96e[_0x4e3d23(0x1ce)](_0x4c368a[_0x4e3d23(0x1c5)])[_0x4e3d23(0x1bf)](_0x14dda4=>{const _0x1a83d8=_0x4e3d23;this[_0x1a83d8(0x1bb)]=_0x14dda4;}):this[_0x4e3d23(0x1bb)]=_0x54a96e[_0x4e3d23(0x1c1)];}}
|
package/src/exportwordcommand.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Command as
|
|
23
|
+
import{Command as _0x189a94}from'ckeditor5/src/core.js';import{getStyles as _0x30c618,getConverterOptions as _0x371cde}from'./utils.js';export default class e extends _0x189a94{constructor(_0x56d6c2){super(_0x56d6c2),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x43d3e7={}){const _0x153cfe=this['editor'],t=_0x153cfe['t'],_0x5bd64e=_0x43d3e7['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x2f945e=_0x43d3e7['converterOptions']||{},_0x206b7a=_0x153cfe['plugins']['get']('ExportWord'),_0x5c62d5=_0x43d3e7['token']||_0x206b7a['_token'],_0x41cb1c=!0x1!==_0x2f945e['auto_pagination'],_0x319cb8=_0x43d3e7['dataCallback']||(_0x178220=>_0x178220['data']['get']({'pagination':_0x41cb1c}));return this['isBusy']=!0x0,this['refresh'](),_0x30c618(_0x43d3e7['stylesheets']||['EDITOR_STYLES'])['then'](async _0x149181=>{_0x153cfe['ui']['ariaLiveAnnouncer']['announce'](t('Word\x20document\x20export\x20started'));const _0x2fe711=await _0x319cb8(_0x153cfe),_0x26d03e={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x153cfe['locale']['contentLanguageDirection']+'\x22>'+_0x2fe711+'</div>','css':_0x149181,'options':{..._0x2f945e,..._0x371cde(_0x153cfe)}},_0x21900a={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x5c62d5?{'Authorization':_0x5c62d5['value']}:null},'body':JSON['stringify'](_0x26d03e)};return window['fetch'](_0x5bd64e,_0x21900a)['then'](_0x385826=>{if(0xc8!==_0x385826['status'])throw _0x385826;return _0x385826['blob']();})['then'](_0x122bf7=>{_0x153cfe['ui']['ariaLiveAnnouncer']['announce'](t('Word\x20document\x20export\x20successful'));const _0x53d2d8='function'==typeof _0x43d3e7['fileName']?_0x43d3e7['fileName']():_0x43d3e7['fileName'];this['_downloadFile'](_0x122bf7,_0x53d2d8||'document.docx');});})['catch'](_0x18af91=>{const _0x4848f7=_0x153cfe['plugins']['get']('Notification');throw _0x153cfe['ui']['ariaLiveAnnouncer']['announce'](t('Word\x20document\x20export\x20failed'),{'politeness':'assertive'}),_0x4848f7['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x18af91;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0x115269,_0x286494){const _0x2a576b=document['createElement']('a');_0x2a576b['href']=window['URL']['createObjectURL'](_0x115269),_0x2a576b['download']=_0x286494,_0x2a576b['click'](),_0x2a576b['remove']();}}
|
package/src/exportwordui.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Plugin as
|
|
23
|
+
import{Plugin as _0x350c7c}from'ckeditor5/src/core.js';import{ButtonView as _0x5f0d0e,MenuBarMenuListItemButtonView as _0x54e806,SpinnerView as _0x512e44}from'ckeditor5/src/ui.js';import _0x49094a from'../theme/icons/exportword.svg';export default class i extends _0x350c7c{static get['pluginName'](){return'ExportWordUI';}['init'](){const _0xe821a8=this['editor'];_0xe821a8['ui']['componentFactory']['add']('exportWord',()=>{const _0x28db46=_0xe821a8['commands']['get']('exportWord'),_0x5601b5=this['_createButton'](_0x5f0d0e);return _0x5601b5['set']({'tooltip':!0x0}),_0x5601b5['bind']('isOn')['to'](_0x28db46,'isBusy'),_0x5601b5;}),_0xe821a8['ui']['componentFactory']['add']('menuBar:exportWord',()=>this['_createButton'](_0x54e806));}['_createButton'](_0x1635d3){const _0x5f4069=this['editor'],_0x37239e=_0x5f4069['config']['get']('exportWord')||{},t=_0x5f4069['locale']['t'],_0x1bcebe=_0x5f4069['commands']['get']('exportWord'),_0x47a633=new _0x1635d3(_0x5f4069['locale']),_0x42f2e7=new _0x512e44();return _0x47a633['children']['add'](_0x42f2e7),_0x42f2e7['bind']('isVisible')['to'](_0x1bcebe,'isBusy'),_0x47a633['iconView']['bind']('isVisible')['to'](_0x1bcebe,'isBusy',_0x16c19c=>!_0x16c19c),_0x47a633['set']({'label':t('Export\x20to\x20Word'),'icon':_0x49094a}),_0x47a633['bind']('isEnabled')['to'](_0x1bcebe,'isEnabled'),this['listenTo'](_0x47a633,'execute',()=>{_0x5f4069['execute']('exportWord',_0x37239e),_0x5f4069['editing']['view']['focus']();}),_0x47a633;}}
|
package/src/index.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
(function(
|
|
23
|
+
function _0x4e29(){var _0x5c77e9=['1DRTGbo','33622affgSr','116044onrHdQ','337910XkXuDz','1574454DsUiWQ','2079EWFlSa','6184FSwlTv','15abQNYm','22yRDIJi','1682034qLnICf','945865ibHuBy'];_0x4e29=function(){return _0x5c77e9;};return _0x4e29();}(function(_0x1c1257,_0x1e5ca2){var _0x5b5cc0=_0x4554,_0x4ce7e0=_0x1c1257();while(!![]){try{var _0x24cacb=parseInt(_0x5b5cc0(0x9d))/0x1*(-parseInt(_0x5b5cc0(0x9e))/0x2)+parseInt(_0x5b5cc0(0x99))/0x3*(parseInt(_0x5b5cc0(0x9f))/0x4)+parseInt(_0x5b5cc0(0x9c))/0x5+-parseInt(_0x5b5cc0(0x9b))/0x6+parseInt(_0x5b5cc0(0xa1))/0x7+parseInt(_0x5b5cc0(0x98))/0x8*(-parseInt(_0x5b5cc0(0x97))/0x9)+-parseInt(_0x5b5cc0(0xa0))/0xa*(-parseInt(_0x5b5cc0(0x9a))/0xb);if(_0x24cacb===_0x1e5ca2)break;else _0x4ce7e0['push'](_0x4ce7e0['shift']());}catch(_0x2615d3){_0x4ce7e0['push'](_0x4ce7e0['shift']());}}}(_0x4e29,0x24deb));export{default as ExportWord}from'./exportword.js';function _0x4554(_0x1a97f5,_0x206d50){var _0x4e293d=_0x4e29();return _0x4554=function(_0x455421,_0x48fef0){_0x455421=_0x455421-0x97;var _0x182ff1=_0x4e293d[_0x455421];return _0x182ff1;},_0x4554(_0x1a97f5,_0x206d50);}import'./augmentation.js';
|
package/src/utils.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
(function(_0x1952ed,_0x77cc1d){const _0x4364d4=_0x26ad,_0x300598=_0x1952ed();while(!![]){try{const _0x3a60ce=-parseInt(_0x4364d4(0xac))/0x1*(parseInt(_0x4364d4(0x93))/0x2)+-parseInt(_0x4364d4(0xb9))/0x3*(-parseInt(_0x4364d4(0xb3))/0x4)+-parseInt(_0x4364d4(0xa9))/0x5+-parseInt(_0x4364d4(0xb6))/0x6+-parseInt(_0x4364d4(0xc3))/0x7*(parseInt(_0x4364d4(0x94))/0x8)+-parseInt(_0x4364d4(0xa6))/0x9*(parseInt(_0x4364d4(0xa0))/0xa)+parseInt(_0x4364d4(0xbd))/0xb*(parseInt(_0x4364d4(0x9d))/0xc);if(_0x3a60ce===_0x77cc1d)break;else _0x300598['push'](_0x300598['shift']());}catch(_0x453f75){_0x300598['push'](_0x300598['shift']());}}}(_0x34ab,0x8ef51));function _0x26ad(_0x125bd4,_0x121bf2){const _0x34abda=_0x34ab();return _0x26ad=function(_0x26adc8,_0x417fc2){_0x26adc8=_0x26adc8-0x8c;let _0x431550=_0x34abda[_0x26adc8];return _0x431550;},_0x26ad(_0x125bd4,_0x121bf2);}export function getStyles(_0x2b9895){const _0x1be002=_0x26ad;if(!_0x2b9895)return new Promise(_0x2e63d6=>_0x2e63d6(''));const _0x254ecc=[];for(const _0x101d81 of _0x2b9895)_0x1be002(0xbe)!==_0x101d81?_0x254ecc[_0x1be002(0xb8)](window[_0x1be002(0xad)](_0x101d81)[_0x1be002(0x8d)](_0xa3538c=>_0xa3538c[_0x1be002(0xaf)]())):_0x254ecc[_0x1be002(0xb8)](f());return Promise[_0x1be002(0xae)](_0x254ecc)[_0x1be002(0x8d)](_0x95dbdb=>_0x95dbdb[_0x1be002(0xb1)]('\x20')[_0x1be002(0x8f)]());}function f(){const _0x29b5b5=_0x26ad,_0x57ecdf=[],_0x2ab967=[];for(const _0x43a39d of Array[_0x29b5b5(0xbc)](document[_0x29b5b5(0xab)])){if(_0x43a39d[_0x29b5b5(0x95)][_0x29b5b5(0x91)](_0x29b5b5(0xa4))){for(const _0xbdc5d9 of Array[_0x29b5b5(0xbc)](_0x43a39d[_0x29b5b5(0x9e)]))-0x1!==_0xbdc5d9[_0x29b5b5(0x90)][_0x29b5b5(0x92)](_0x29b5b5(0xb2))?_0x57ecdf[_0x29b5b5(0xb8)](_0xbdc5d9[_0x29b5b5(0x90)]):-0x1!==_0xbdc5d9[_0x29b5b5(0x90)][_0x29b5b5(0x92)](_0x29b5b5(0xba))&&_0x2ab967[_0x29b5b5(0xb8)](_0xbdc5d9[_0x29b5b5(0x90)]);}}return _0x57ecdf[_0x29b5b5(0x99)]||console[_0x29b5b5(0x8e)](_0x29b5b5(0x9c)),[..._0x2ab967,..._0x57ecdf][_0x29b5b5(0xb1)]('\x20')[_0x29b5b5(0x8f)]();}function _0x34ab(){const _0x9209e2=['timezone','styleSheets','21961djZaNe','fetch','all','text','plugins','join','.ck-content','2332rqudqy','DateTimeFormat','Users','6386586CJiViV','map','push','5331azzian',':root','timeZone','from','4962738OkLkpI','EDITOR_STYLES','comments','CommentsRepository','TrackChanges','resolvedOptions','404341MpmYVn','has','then','warn','trim','cssText','hasAttribute','indexOf','56aTBkkb','128BVSYZs','ownerNode','keys','authorId','name','length','get','suggestions','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.','96FVtSOI','cssRules','getSuggestions','790nSuBYV','getCommentThreads','users','isResolved','data-cke','createdAt','117279yghXue','content','author','2133530RzyOSl'];_0x34ab=function(){return _0x9209e2;};return _0x34ab();}export function getConverterOptions(_0x5782d7){const _0x3e35c1=_0x26ad,_0xa5dcfe=_0x5782d7[_0x3e35c1(0xb0)][_0x3e35c1(0x8c)](_0x3e35c1(0xb5)),_0xe75673=_0x5782d7[_0x3e35c1(0xb0)][_0x3e35c1(0x8c)](_0x3e35c1(0xc0)),_0x1dce85=_0x5782d7[_0x3e35c1(0xb0)][_0x3e35c1(0x8c)](_0x3e35c1(0xc1)),_0x4cb205={};if(_0xa5dcfe&&_0xe75673){const _0x4ac05b=getComments(_0x5782d7[_0x3e35c1(0xb0)][_0x3e35c1(0x9a)](_0x3e35c1(0xc0))[_0x3e35c1(0xa1)]({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object[_0x3e35c1(0x96)](_0x4ac05b)[_0x3e35c1(0x99)]&&(_0x4cb205[_0x3e35c1(0xbf)]=_0x4ac05b);}if(_0xa5dcfe&&_0x1dce85){const _0xef04a5=_0x5782d7[_0x3e35c1(0xb0)][_0x3e35c1(0x9a)](_0x3e35c1(0xc1)),_0x4d8cf2=_0x5782d7[_0x3e35c1(0xb0)][_0x3e35c1(0x9a)](_0x3e35c1(0xb5)),_0xaebebb=getSuggestions(_0xef04a5[_0x3e35c1(0x9f)]({'toJSON':!0x0}),_0x4d8cf2[_0x3e35c1(0xa2)]);Object[_0x3e35c1(0x96)](_0xaebebb)[_0x3e35c1(0x99)]&&(_0x4cb205[_0x3e35c1(0x9b)]=_0xaebebb);}return(_0x4cb205[_0x3e35c1(0x9b)]||_0x4cb205[_0x3e35c1(0xbf)])&&(_0x4cb205[_0x3e35c1(0xaa)]=new Intl[(_0x3e35c1(0xb4))]()[_0x3e35c1(0xc2)]()[_0x3e35c1(0xbb)]),_0x4cb205;}export function getComments(_0x4a8516){const _0x2fa1bc=_0x26ad,_0x432b85={};if(!_0x4a8516[_0x2fa1bc(0x99)])return _0x432b85;for(const _0x2089ab of _0x4a8516)_0x2089ab[_0x2fa1bc(0xbf)][_0x2fa1bc(0xb7)](_0x39c047=>{const _0x4059a2=_0x2fa1bc;void 0x0===_0x432b85[_0x2089ab['id']]&&(_0x432b85[_0x2089ab['id']]=[]),_0x432b85[_0x2089ab['id']][_0x4059a2(0xb8)]({'author':_0x39c047[_0x4059a2(0xa8)][_0x4059a2(0x98)],'content':_0x39c047[_0x4059a2(0xa7)],'created':_0x39c047[_0x4059a2(0xa5)],'is_resolved':_0x2089ab[_0x4059a2(0xa3)]});});return _0x432b85;}export function getSuggestions(_0x59c551,_0x4587fb){const _0xb0105d=_0x26ad,_0x663326={};if(!_0x59c551[_0xb0105d(0x99)]||!_0x4587fb[_0xb0105d(0x99)])return _0x663326;for(const _0x423a5e of _0x59c551)_0x663326[_0x423a5e['id']]={'author':_0x4587fb[_0xb0105d(0x9a)](_0x423a5e[_0xb0105d(0x97)])[_0xb0105d(0x98)],'created':_0x423a5e[_0xb0105d(0xa5)]};return _0x663326;}
|