@ckeditor/ckeditor5-export-word 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-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.2",
|
|
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.2"
|
|
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 _0x37ce96}from'ckeditor5/src/core.js';import{ButtonView as _0x28a0c4,Notification as _0x7c8647,SpinnerView as _0x4f0fef}from'ckeditor5/src/ui.js';import _0x35e86f from'./exportwordcommand.js';import _0x9949f7 from'../theme/icons/exportword.svg';export default class d extends _0x37ce96{static get['pluginName'](){return'ExportWord';}static get['requires'](){return['CloudServices',_0x7c8647];}['init'](){const _0x2085a1=this['editor'],t=_0x2085a1['t'],_0x39e734=_0x2085a1['config']['get']('exportWord')||{};_0x2085a1['commands']['add']('exportWord',new _0x35e86f(_0x2085a1)),_0x2085a1['ui']['componentFactory']['add']('exportWord',_0x3f9736=>{const _0x58a10f=_0x2085a1['commands']['get']('exportWord'),_0x805eed=new _0x28a0c4(_0x3f9736),_0x1c9481=new _0x4f0fef();return _0x805eed['set']({'label':t('Export\x20to\x20Word'),'icon':_0x9949f7,'tooltip':!0x0}),_0x805eed['children']['add'](_0x1c9481),_0x805eed['bind']('isOn','isEnabled')['to'](_0x58a10f,'isBusy','isEnabled'),_0x1c9481['bind']('isVisible')['to'](_0x58a10f,'isBusy'),_0x805eed['iconView']['bind']('isVisible')['to'](_0x58a10f,'isBusy',_0x248d13=>!_0x248d13),this['listenTo'](_0x805eed,'execute',()=>{_0x2085a1['execute']('exportWord',_0x39e734),_0x2085a1['editing']['view']['focus']();}),_0x805eed;});const _0x3d4a50=_0x2085a1['plugins']['get']('CloudServices');!0x1===_0x39e734['tokenUrl']?this['_token']=null:_0x39e734['tokenUrl']?_0x3d4a50['registerTokenUrl'](_0x39e734['tokenUrl'])['then'](_0x420371=>{this['_token']=_0x420371;}):this['_token']=_0x3d4a50['token'];}}
|
package/src/exportwordcommand.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Command as
|
|
23
|
+
import{Command as _0x41de20}from'ckeditor5/src/core.js';import{getStyles as _0x1a6a00,getConverterOptions as _0x4ef4fd}from'./utils.js';export default class i extends _0x41de20{constructor(_0x2df3fd){super(_0x2df3fd),this['set']('isBusy',!0x1),this['affectsData']=!0x1;}['refresh'](){this['isEnabled']=!this['isBusy'],this['value']=this['isBusy']?'pending':void 0x0;}['execute'](_0x530f13={}){const _0x5c2a10=this['editor'],t=_0x5c2a10['t'],_0x13e752=_0x530f13['converterUrl']||'https://docx-converter.cke-cs.com/v1/convert',_0x3c2e34=_0x530f13['converterOptions']||{},_0x3ddc4c=_0x5c2a10['plugins']['get']('ExportWord'),_0x41f439=_0x530f13['token']||_0x3ddc4c['_token'],_0x1934ef=!0x1!==_0x3c2e34['auto_pagination'],_0x199fc0=_0x530f13['dataCallback']||(_0x554deb=>_0x554deb['data']['get']({'pagination':_0x1934ef}));return this['isBusy']=!0x0,this['refresh'](),_0x1a6a00(_0x530f13['stylesheets']||['EDITOR_STYLES'])['then'](async _0x2dd152=>{const _0x393590=await _0x199fc0(_0x5c2a10),_0x476a39={'html':'<div\x20class=\x22ck-content\x22\x20dir=\x22'+_0x5c2a10['locale']['contentLanguageDirection']+'\x22>'+_0x393590+'</div>','css':_0x2dd152,'options':{..._0x3c2e34,..._0x4ef4fd(_0x5c2a10)}},_0x6c702={'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/docx',..._0x41f439?{'Authorization':_0x41f439['value']}:null},'body':JSON['stringify'](_0x476a39)};return window['fetch'](_0x13e752,_0x6c702)['then'](_0x93848=>{if(0xc8!==_0x93848['status'])throw _0x93848;return _0x93848['blob']();})['then'](_0x4a466d=>{const _0x54058d='function'==typeof _0x530f13['fileName']?_0x530f13['fileName']():_0x530f13['fileName'];this['_downloadFile'](_0x4a466d,_0x54058d||'document.docx');});})['catch'](_0x3ab842=>{throw _0x5c2a10['plugins']['get']('Notification')['showWarning'](t('An\x20error\x20occurred\x20while\x20generating\x20the\x20Word\x20file.')),_0x3ab842;})['finally'](()=>{this['isBusy']=!0x1,this['refresh']();});}['_downloadFile'](_0xee7470,_0x20ac82){const _0x89497d=document['createElement']('a');_0x89497d['href']=window['URL']['createObjectURL'](_0xee7470),_0x89497d['download']=_0x20ac82,_0x89497d['click'](),_0x89497d['remove']();}}
|
package/src/index.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
(function(
|
|
23
|
+
function _0x4147(_0x50b25c,_0x290935){var _0x81ca35=_0x81ca();return _0x4147=function(_0x4147ef,_0x2af230){_0x4147ef=_0x4147ef-0x8b;var _0x5430c1=_0x81ca35[_0x4147ef];return _0x5430c1;},_0x4147(_0x50b25c,_0x290935);}(function(_0xe705c8,_0x460c2f){var _0x3adf9c=_0x4147,_0x2bb5d1=_0xe705c8();while(!![]){try{var _0x97aa2b=parseInt(_0x3adf9c(0x8f))/0x1+-parseInt(_0x3adf9c(0x92))/0x2*(-parseInt(_0x3adf9c(0x90))/0x3)+-parseInt(_0x3adf9c(0x8b))/0x4*(-parseInt(_0x3adf9c(0x93))/0x5)+parseInt(_0x3adf9c(0x8e))/0x6+-parseInt(_0x3adf9c(0x91))/0x7+parseInt(_0x3adf9c(0x8d))/0x8+-parseInt(_0x3adf9c(0x8c))/0x9;if(_0x97aa2b===_0x460c2f)break;else _0x2bb5d1['push'](_0x2bb5d1['shift']());}catch(_0x5408d1){_0x2bb5d1['push'](_0x2bb5d1['shift']());}}}(_0x81ca,0xd5f81));export{default as ExportWord}from'./exportword.js';import'./augmentation.js';function _0x81ca(){var _0x28d968=['4289148aoLtiL','669840AGzCCI','359430IdUFrN','345399iaRrOP','3768969CXSgSz','3100496BjbMlg','2pIIwRH','1975BCMgew','512gpoAWs'];_0x81ca=function(){return _0x28d968;};return _0x81ca();}
|
package/src/utils.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
(function(
|
|
23
|
+
(function(_0x56a2e5,_0x379a75){const _0x1f66e4=_0x1716,_0x8c7bed=_0x56a2e5();while(!![]){try{const _0x1986d8=-parseInt(_0x1f66e4(0x189))/0x1+-parseInt(_0x1f66e4(0x16e))/0x2+parseInt(_0x1f66e4(0x16a))/0x3+-parseInt(_0x1f66e4(0x15a))/0x4*(-parseInt(_0x1f66e4(0x173))/0x5)+-parseInt(_0x1f66e4(0x183))/0x6*(parseInt(_0x1f66e4(0x180))/0x7)+parseInt(_0x1f66e4(0x184))/0x8*(-parseInt(_0x1f66e4(0x17b))/0x9)+parseInt(_0x1f66e4(0x185))/0xa*(parseInt(_0x1f66e4(0x15b))/0xb);if(_0x1986d8===_0x379a75)break;else _0x8c7bed['push'](_0x8c7bed['shift']());}catch(_0x3c3a4c){_0x8c7bed['push'](_0x8c7bed['shift']());}}}(_0x5a8b,0x43e81));export function getStyles(_0x4becdd){const _0xa68651=_0x1716;if(!_0x4becdd)return new Promise(_0x34d978=>_0x34d978(''));const _0x5cd29c=[];for(const _0x5ddee9 of _0x4becdd)_0xa68651(0x15e)!==_0x5ddee9?_0x5cd29c[_0xa68651(0x18b)](window[_0xa68651(0x181)](_0x5ddee9)[_0xa68651(0x159)](_0x3cb304=>_0x3cb304[_0xa68651(0x15d)]())):_0x5cd29c[_0xa68651(0x18b)](u());return Promise[_0xa68651(0x179)](_0x5cd29c)[_0xa68651(0x159)](_0x5cd45a=>_0x5cd45a[_0xa68651(0x17c)]('\x20')[_0xa68651(0x170)]());}function u(){const _0x91c17d=_0x1716,_0x5ca82c=[],_0x4e9efc=[];for(const _0xb86717 of Array[_0x91c17d(0x176)](document[_0x91c17d(0x188)])){if(_0xb86717[_0x91c17d(0x15c)][_0x91c17d(0x178)](_0x91c17d(0x162))){for(const _0x1955e1 of Array[_0x91c17d(0x176)](_0xb86717[_0x91c17d(0x174)]))-0x1!==_0x1955e1[_0x91c17d(0x187)][_0x91c17d(0x17d)](_0x91c17d(0x160))?_0x5ca82c[_0x91c17d(0x18b)](_0x1955e1[_0x91c17d(0x187)]):-0x1!==_0x1955e1[_0x91c17d(0x187)][_0x91c17d(0x17d)](_0x91c17d(0x17a))&&_0x4e9efc[_0x91c17d(0x18b)](_0x1955e1[_0x91c17d(0x187)]);}}return _0x5ca82c[_0x91c17d(0x161)]||console[_0x91c17d(0x167)](_0x91c17d(0x16c)),[..._0x4e9efc,..._0x5ca82c][_0x91c17d(0x17c)]('\x20')[_0x91c17d(0x170)]();}function _0x5a8b(){const _0x5340e6=['styleSheets','76746AWjRTl','name','push','getCommentThreads','Users','TrackChanges','createdAt','then','12SQtxLS','128194VhWFqe','ownerNode','text','EDITOR_STYLES','keys','.ck-content','length','data-cke','DateTimeFormat','authorId','isResolved','CommentsRepository','warn','plugins','getSuggestions','18720dygpnB','resolvedOptions','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.','comments','41090zjSnWF','get','trim','content','map','680045FBJvrQ','cssRules','has','from','timezone','hasAttribute','all',':root','18NAHPdb','join','indexOf','suggestions','author','7DSFzjq','fetch','users','1645146dlonNo','969816hwekoM','410cSNBBW','timeZone','cssText'];_0x5a8b=function(){return _0x5340e6;};return _0x5a8b();}export function getConverterOptions(_0x49c578){const _0xb4da5b=_0x1716,_0x45ad39=_0x49c578[_0xb4da5b(0x168)][_0xb4da5b(0x175)](_0xb4da5b(0x18d)),_0x184138=_0x49c578[_0xb4da5b(0x168)][_0xb4da5b(0x175)](_0xb4da5b(0x166)),_0x5626f4=_0x49c578[_0xb4da5b(0x168)][_0xb4da5b(0x175)](_0xb4da5b(0x157)),_0x41c677={};if(_0x45ad39&&_0x184138){const _0xee2cd3=getComments(_0x49c578[_0xb4da5b(0x168)][_0xb4da5b(0x16f)](_0xb4da5b(0x166))[_0xb4da5b(0x18c)]({'skipNotAttached':!0x0,'skipEmpty':!0x0}));Object[_0xb4da5b(0x15f)](_0xee2cd3)[_0xb4da5b(0x161)]&&(_0x41c677[_0xb4da5b(0x16d)]=_0xee2cd3);}if(_0x45ad39&&_0x5626f4){const _0x42d3b0=_0x49c578[_0xb4da5b(0x168)][_0xb4da5b(0x16f)](_0xb4da5b(0x157)),_0x5e8ea8=_0x49c578[_0xb4da5b(0x168)][_0xb4da5b(0x16f)](_0xb4da5b(0x18d)),_0x4dcf19=getSuggestions(_0x42d3b0[_0xb4da5b(0x169)]({'toJSON':!0x0}),_0x5e8ea8[_0xb4da5b(0x182)]);Object[_0xb4da5b(0x15f)](_0x4dcf19)[_0xb4da5b(0x161)]&&(_0x41c677[_0xb4da5b(0x17e)]=_0x4dcf19);}return(_0x41c677[_0xb4da5b(0x17e)]||_0x41c677[_0xb4da5b(0x16d)])&&(_0x41c677[_0xb4da5b(0x177)]=new Intl[(_0xb4da5b(0x163))]()[_0xb4da5b(0x16b)]()[_0xb4da5b(0x186)]),_0x41c677;}export function getComments(_0x3343d7){const _0x2cef69=_0x1716,_0x2d8c9d={};if(!_0x3343d7[_0x2cef69(0x161)])return _0x2d8c9d;for(const _0x48e944 of _0x3343d7)_0x48e944[_0x2cef69(0x16d)][_0x2cef69(0x172)](_0x37fdc3=>{const _0xffe958=_0x2cef69;void 0x0===_0x2d8c9d[_0x48e944['id']]&&(_0x2d8c9d[_0x48e944['id']]=[]),_0x2d8c9d[_0x48e944['id']][_0xffe958(0x18b)]({'author':_0x37fdc3[_0xffe958(0x17f)][_0xffe958(0x18a)],'content':_0x37fdc3[_0xffe958(0x171)],'created':_0x37fdc3[_0xffe958(0x158)],'is_resolved':_0x48e944[_0xffe958(0x165)]});});return _0x2d8c9d;}function _0x1716(_0xef81bf,_0x32260a){const _0x5a8bb9=_0x5a8b();return _0x1716=function(_0x1716af,_0x5b03d6){_0x1716af=_0x1716af-0x157;let _0x497c87=_0x5a8bb9[_0x1716af];return _0x497c87;},_0x1716(_0xef81bf,_0x32260a);}export function getSuggestions(_0x1186a7,_0x22509a){const _0x11e0b7=_0x1716,_0x4818ae={};if(!_0x1186a7[_0x11e0b7(0x161)]||!_0x22509a[_0x11e0b7(0x161)])return _0x4818ae;for(const _0x4810c6 of _0x1186a7)_0x4818ae[_0x4810c6['id']]={'author':_0x22509a[_0x11e0b7(0x16f)](_0x4810c6[_0x11e0b7(0x164)])[_0x11e0b7(0x18a)],'created':_0x4810c6[_0x11e0b7(0x158)]};return _0x4818ae;}
|