@ckeditor/ckeditor5-import-word 0.0.0-nightly-20230629.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/CHANGELOG.md +4 -0
- package/LICENSE.md +18 -0
- package/README.md +38 -0
- package/build/import-word.js +5 -0
- package/build/translations/ar.js +1 -0
- package/build/translations/bg.js +1 -0
- package/build/translations/bn.js +1 -0
- package/build/translations/ca.js +1 -0
- package/build/translations/cs.js +1 -0
- package/build/translations/da.js +1 -0
- package/build/translations/de.js +1 -0
- package/build/translations/el.js +1 -0
- package/build/translations/en-au.js +1 -0
- package/build/translations/es.js +1 -0
- package/build/translations/et.js +1 -0
- package/build/translations/fi.js +1 -0
- package/build/translations/fr.js +1 -0
- package/build/translations/he.js +1 -0
- package/build/translations/hi.js +1 -0
- package/build/translations/hr.js +1 -0
- package/build/translations/hu.js +1 -0
- package/build/translations/id.js +1 -0
- package/build/translations/it.js +1 -0
- package/build/translations/ja.js +1 -0
- package/build/translations/ko.js +1 -0
- package/build/translations/lt.js +1 -0
- package/build/translations/lv.js +1 -0
- package/build/translations/ms.js +1 -0
- package/build/translations/nl.js +1 -0
- package/build/translations/no.js +1 -0
- package/build/translations/pl.js +1 -0
- package/build/translations/pt-br.js +1 -0
- package/build/translations/pt.js +1 -0
- package/build/translations/ro.js +1 -0
- package/build/translations/ru.js +1 -0
- package/build/translations/sk.js +1 -0
- package/build/translations/sr-latn.js +1 -0
- package/build/translations/sr.js +1 -0
- package/build/translations/sv.js +1 -0
- package/build/translations/th.js +1 -0
- package/build/translations/tr.js +1 -0
- package/build/translations/uk.js +1 -0
- package/build/translations/vi.js +1 -0
- package/build/translations/zh-cn.js +1 -0
- package/build/translations/zh.js +1 -0
- package/ckeditor5-metadata.json +21 -0
- package/lang/contexts.json +4 -0
- package/lang/translations/ar.po +25 -0
- package/lang/translations/bg.po +25 -0
- package/lang/translations/bn.po +25 -0
- package/lang/translations/ca.po +25 -0
- package/lang/translations/cs.po +25 -0
- package/lang/translations/da.po +25 -0
- package/lang/translations/de.po +25 -0
- package/lang/translations/el.po +25 -0
- package/lang/translations/en-au.po +25 -0
- package/lang/translations/en.po +25 -0
- package/lang/translations/es.po +25 -0
- package/lang/translations/et.po +25 -0
- package/lang/translations/fi.po +25 -0
- package/lang/translations/fr.po +25 -0
- package/lang/translations/he.po +25 -0
- package/lang/translations/hi.po +25 -0
- package/lang/translations/hr.po +25 -0
- package/lang/translations/hu.po +25 -0
- package/lang/translations/id.po +25 -0
- package/lang/translations/it.po +25 -0
- package/lang/translations/ja.po +25 -0
- package/lang/translations/ko.po +25 -0
- package/lang/translations/lt.po +25 -0
- package/lang/translations/lv.po +25 -0
- package/lang/translations/ms.po +25 -0
- package/lang/translations/nl.po +25 -0
- package/lang/translations/no.po +25 -0
- package/lang/translations/pl.po +25 -0
- package/lang/translations/pt-br.po +25 -0
- package/lang/translations/pt.po +25 -0
- package/lang/translations/ro.po +25 -0
- package/lang/translations/ru.po +25 -0
- package/lang/translations/sk.po +25 -0
- package/lang/translations/sr-latn.po +25 -0
- package/lang/translations/sr.po +25 -0
- package/lang/translations/sv.po +25 -0
- package/lang/translations/th.po +25 -0
- package/lang/translations/tr.po +25 -0
- package/lang/translations/uk.po +25 -0
- package/lang/translations/vi.po +25 -0
- package/lang/translations/zh-cn.po +25 -0
- package/lang/translations/zh.po +25 -0
- package/package.json +53 -0
- package/src/augmentation.d.ts +23 -0
- package/src/augmentation.js +23 -0
- package/src/importword.d.ts +99 -0
- package/src/importword.js +23 -0
- package/src/importwordcommand.d.ts +54 -0
- package/src/importwordcommand.js +23 -0
- package/src/importwordediting.d.ts +39 -0
- package/src/importwordediting.js +23 -0
- package/src/importwordui.d.ts +23 -0
- package/src/importwordui.js +23 -0
- package/src/index.d.ts +12 -0
- package/src/index.js +23 -0
- package/theme/icons/importword.svg +1 -0
- package/theme/importword.css +49 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
2
|
+
#
|
|
3
|
+
# !!! IMPORTANT !!!
|
|
4
|
+
#
|
|
5
|
+
# Before you edit this file, please keep in mind that contributing to the project
|
|
6
|
+
# translations is possible ONLY via the Transifex online service.
|
|
7
|
+
#
|
|
8
|
+
# To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
|
|
9
|
+
#
|
|
10
|
+
# To learn more, check out the official contributor's guide:
|
|
11
|
+
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
|
|
12
|
+
#
|
|
13
|
+
msgid ""
|
|
14
|
+
msgstr ""
|
|
15
|
+
"Language-Team: Turkish (https://app.transifex.com/ckeditor/teams/11143/tr/)\n"
|
|
16
|
+
"Language: tr\n"
|
|
17
|
+
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
|
18
|
+
|
|
19
|
+
msgctxt "A toolbar button tooltip for the import from Word feature."
|
|
20
|
+
msgid "Import from Word"
|
|
21
|
+
msgstr "Word'den içe aktar"
|
|
22
|
+
|
|
23
|
+
msgctxt "An error message shown to the user when an error occurred while importing the Word file."
|
|
24
|
+
msgid "An error occurred while importing the Word file."
|
|
25
|
+
msgstr "Word dosyası içe aktarılırken bir hata oluştu."
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
2
|
+
#
|
|
3
|
+
# !!! IMPORTANT !!!
|
|
4
|
+
#
|
|
5
|
+
# Before you edit this file, please keep in mind that contributing to the project
|
|
6
|
+
# translations is possible ONLY via the Transifex online service.
|
|
7
|
+
#
|
|
8
|
+
# To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
|
|
9
|
+
#
|
|
10
|
+
# To learn more, check out the official contributor's guide:
|
|
11
|
+
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
|
|
12
|
+
#
|
|
13
|
+
msgid ""
|
|
14
|
+
msgstr ""
|
|
15
|
+
"Language-Team: Ukrainian (https://app.transifex.com/ckeditor/teams/11143/uk/)\n"
|
|
16
|
+
"Language: uk\n"
|
|
17
|
+
"Plural-Forms: nplurals=4; plural=(n % 1 == 0 && n % 10 == 1 && n % 100 != 11 ? 0 : n % 1 == 0 && n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14) ? 1 : n % 1 == 0 && (n % 10 ==0 || (n % 10 >=5 && n % 10 <=9) || (n % 100 >=11 && n % 100 <=14 )) ? 2: 3);\n"
|
|
18
|
+
|
|
19
|
+
msgctxt "A toolbar button tooltip for the import from Word feature."
|
|
20
|
+
msgid "Import from Word"
|
|
21
|
+
msgstr "Імпортувати з Word"
|
|
22
|
+
|
|
23
|
+
msgctxt "An error message shown to the user when an error occurred while importing the Word file."
|
|
24
|
+
msgid "An error occurred while importing the Word file."
|
|
25
|
+
msgstr "Під час імпортування файлу Word сталася помилка."
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
2
|
+
#
|
|
3
|
+
# !!! IMPORTANT !!!
|
|
4
|
+
#
|
|
5
|
+
# Before you edit this file, please keep in mind that contributing to the project
|
|
6
|
+
# translations is possible ONLY via the Transifex online service.
|
|
7
|
+
#
|
|
8
|
+
# To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
|
|
9
|
+
#
|
|
10
|
+
# To learn more, check out the official contributor's guide:
|
|
11
|
+
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
|
|
12
|
+
#
|
|
13
|
+
msgid ""
|
|
14
|
+
msgstr ""
|
|
15
|
+
"Language-Team: Vietnamese (https://app.transifex.com/ckeditor/teams/11143/vi/)\n"
|
|
16
|
+
"Language: vi\n"
|
|
17
|
+
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
18
|
+
|
|
19
|
+
msgctxt "A toolbar button tooltip for the import from Word feature."
|
|
20
|
+
msgid "Import from Word"
|
|
21
|
+
msgstr "Nhập từ Word"
|
|
22
|
+
|
|
23
|
+
msgctxt "An error message shown to the user when an error occurred while importing the Word file."
|
|
24
|
+
msgid "An error occurred while importing the Word file."
|
|
25
|
+
msgstr "Đã xảy ra lỗi khi nhập tệp Word."
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
2
|
+
#
|
|
3
|
+
# !!! IMPORTANT !!!
|
|
4
|
+
#
|
|
5
|
+
# Before you edit this file, please keep in mind that contributing to the project
|
|
6
|
+
# translations is possible ONLY via the Transifex online service.
|
|
7
|
+
#
|
|
8
|
+
# To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
|
|
9
|
+
#
|
|
10
|
+
# To learn more, check out the official contributor's guide:
|
|
11
|
+
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
|
|
12
|
+
#
|
|
13
|
+
msgid ""
|
|
14
|
+
msgstr ""
|
|
15
|
+
"Language-Team: Chinese (China) (https://app.transifex.com/ckeditor/teams/11143/zh_CN/)\n"
|
|
16
|
+
"Language: zh_CN\n"
|
|
17
|
+
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
18
|
+
|
|
19
|
+
msgctxt "A toolbar button tooltip for the import from Word feature."
|
|
20
|
+
msgid "Import from Word"
|
|
21
|
+
msgstr "从 Word 导入"
|
|
22
|
+
|
|
23
|
+
msgctxt "An error message shown to the user when an error occurred while importing the Word file."
|
|
24
|
+
msgid "An error occurred while importing the Word file."
|
|
25
|
+
msgstr "导入 Word 文件时出错了。"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
2
|
+
#
|
|
3
|
+
# !!! IMPORTANT !!!
|
|
4
|
+
#
|
|
5
|
+
# Before you edit this file, please keep in mind that contributing to the project
|
|
6
|
+
# translations is possible ONLY via the Transifex online service.
|
|
7
|
+
#
|
|
8
|
+
# To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
|
|
9
|
+
#
|
|
10
|
+
# To learn more, check out the official contributor's guide:
|
|
11
|
+
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
|
|
12
|
+
#
|
|
13
|
+
msgid ""
|
|
14
|
+
msgstr ""
|
|
15
|
+
"Language-Team: Chinese (Taiwan) (https://app.transifex.com/ckeditor/teams/11143/zh_TW/)\n"
|
|
16
|
+
"Language: zh_TW\n"
|
|
17
|
+
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
18
|
+
|
|
19
|
+
msgctxt "A toolbar button tooltip for the import from Word feature."
|
|
20
|
+
msgid "Import from Word"
|
|
21
|
+
msgstr "從 Word 匯入"
|
|
22
|
+
|
|
23
|
+
msgctxt "An error message shown to the user when an error occurred while importing the Word file."
|
|
24
|
+
msgid "An error occurred while importing the Word file."
|
|
25
|
+
msgstr "匯入 Word 檔時發生錯誤。"
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ckeditor/ckeditor5-import-word",
|
|
3
|
+
"version": "0.0.0-nightly-20230629.0",
|
|
4
|
+
"description": "Import from Word feature for CKEditor 5.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ckeditor",
|
|
7
|
+
"ckeditor5",
|
|
8
|
+
"ckeditor 5",
|
|
9
|
+
"ckeditor5-feature",
|
|
10
|
+
"ckeditor5-plugin",
|
|
11
|
+
"WYSIWYG",
|
|
12
|
+
"WYSIWYM",
|
|
13
|
+
"text",
|
|
14
|
+
"rich-text",
|
|
15
|
+
"richtext",
|
|
16
|
+
"ckeditor",
|
|
17
|
+
"editor",
|
|
18
|
+
"editing",
|
|
19
|
+
"html",
|
|
20
|
+
"contentEditable",
|
|
21
|
+
"Word",
|
|
22
|
+
"print Word",
|
|
23
|
+
"open Word",
|
|
24
|
+
"convert from Word",
|
|
25
|
+
"import Word",
|
|
26
|
+
"import from Word",
|
|
27
|
+
"Word converter",
|
|
28
|
+
"Word to HTML"
|
|
29
|
+
],
|
|
30
|
+
"main": "src/index.js",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"ckeditor5": "0.0.0-nightly-20230629.0"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=16.0.0",
|
|
36
|
+
"npm": ">=5.7.1"
|
|
37
|
+
},
|
|
38
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
39
|
+
"author": "CKSource (https://cksource.com/)",
|
|
40
|
+
"homepage": "https://ckeditor.com/ckeditor-5",
|
|
41
|
+
"bugs": "https://support.ckeditor.com/hc/en-us/requests/new",
|
|
42
|
+
"files": [
|
|
43
|
+
"lang",
|
|
44
|
+
"src/**/*.js",
|
|
45
|
+
"src/**/*.d.ts",
|
|
46
|
+
"theme",
|
|
47
|
+
"build",
|
|
48
|
+
"ckeditor5-metadata.json",
|
|
49
|
+
"CHANGELOG.md"
|
|
50
|
+
],
|
|
51
|
+
"types": "src/index.d.ts",
|
|
52
|
+
"obfuscated": true
|
|
53
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, 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
|
+
import type { ImportWordConfig, ImportWord, ImportWordEditing, ImportWordUI, ImportWordCommand } from './index';
|
|
6
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
7
|
+
interface EditorConfig {
|
|
8
|
+
/**
|
|
9
|
+
* The configuration of the {@link module:import-word/importword~ImportWord import from Word feature}.
|
|
10
|
+
*
|
|
11
|
+
* Read more in {@link module:import-word/importword~ImportWordConfig}.
|
|
12
|
+
*/
|
|
13
|
+
importWord?: ImportWordConfig;
|
|
14
|
+
}
|
|
15
|
+
interface PluginsMap {
|
|
16
|
+
[ImportWord.pluginName]: ImportWord;
|
|
17
|
+
[ImportWordEditing.pluginName]: ImportWordEditing;
|
|
18
|
+
[ImportWordUI.pluginName]: ImportWordUI;
|
|
19
|
+
}
|
|
20
|
+
interface CommandsMap {
|
|
21
|
+
importWord: ImportWordCommand;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016 - 2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* +---------------------------------------------------------------------------------+
|
|
8
|
+
* | |
|
|
9
|
+
* | Hello stranger! |
|
|
10
|
+
* | |
|
|
11
|
+
* | |
|
|
12
|
+
* | What you're currently looking at is the source code of a legally protected, |
|
|
13
|
+
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
|
|
14
|
+
* | are forbidden and will result in legal consequences. |
|
|
15
|
+
* | |
|
|
16
|
+
* | |
|
|
17
|
+
* +---------------------------------------------------------------------------------+
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export{};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, 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
|
+
* @module import-word/importword
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
10
|
+
import type { TokenUrl } from '@ckeditor/ckeditor5-cloud-services';
|
|
11
|
+
import ImportWordUI from './importwordui';
|
|
12
|
+
import ImportWordEditing from './importwordediting';
|
|
13
|
+
/**
|
|
14
|
+
* The import from Word feature.
|
|
15
|
+
*
|
|
16
|
+
* It allows importing content from a Word file directly into CKEditor 5.
|
|
17
|
+
*
|
|
18
|
+
* This is a "glue" plugin which enables:
|
|
19
|
+
*
|
|
20
|
+
* * {@link module:import-word/importwordediting~ImportWordEditing},
|
|
21
|
+
* * {@link module:import-word/importwordui~ImportWordUI},
|
|
22
|
+
*
|
|
23
|
+
* For a detailed overview, check the {@glink features/converters/import-word/import-word import from Word} feature documentation.
|
|
24
|
+
*/
|
|
25
|
+
export default class ImportWord extends Plugin {
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
static get pluginName(): "ImportWord";
|
|
30
|
+
/**
|
|
31
|
+
* @inheritDoc
|
|
32
|
+
*/
|
|
33
|
+
static get requires(): readonly [typeof ImportWordEditing, typeof ImportWordUI];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The configuration of the {@link module:import-word/importword~ImportWord import from Word feature}.
|
|
37
|
+
*
|
|
38
|
+
* The configuration for the import from Word feature requires providing the
|
|
39
|
+
* {@link module:import-word/importword~ImportWordConfig#tokenUrl `config.importWord.tokenUrl`}:
|
|
40
|
+
*
|
|
41
|
+
* ```ts
|
|
42
|
+
* ClassicEditor
|
|
43
|
+
* .create( editorElement, {
|
|
44
|
+
* importWord: {
|
|
45
|
+
* tokenUrl: 'https://example.com/cs-token-endpoint'
|
|
46
|
+
* }
|
|
47
|
+
* } )
|
|
48
|
+
* .then( ... )
|
|
49
|
+
* .catch( ... );
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
53
|
+
*/
|
|
54
|
+
export interface ImportWordConfig {
|
|
55
|
+
/**
|
|
56
|
+
* A URL to the Docx converter.
|
|
57
|
+
*
|
|
58
|
+
* ```ts
|
|
59
|
+
* const importWordConfig = {
|
|
60
|
+
* converterUrl: 'https://myconverter.com/v1/'
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* **Note:** The plugin uses the default Word to HTML converter delivered by CKEditor Cloud Services.
|
|
65
|
+
* You can provide a URL to an on-premises converter instead.
|
|
66
|
+
*
|
|
67
|
+
* @default 'https://docx-converter.cke-cs.com/v2/convert/docx-html'
|
|
68
|
+
*/
|
|
69
|
+
converterUrl?: string;
|
|
70
|
+
/**
|
|
71
|
+
* A token URL or a token request function. This field is optional and should be used only when a different `tokenUrl`
|
|
72
|
+
* is required for the Import from Word feature.
|
|
73
|
+
*
|
|
74
|
+
* **Note:** The token can be disabled with the `false` value provided.
|
|
75
|
+
*
|
|
76
|
+
* See: {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl}
|
|
77
|
+
*/
|
|
78
|
+
tokenUrl?: TokenUrl;
|
|
79
|
+
/**
|
|
80
|
+
* If `true`, the converter service preserves the default styles and formatting of the imported Word document.
|
|
81
|
+
*
|
|
82
|
+
* @default false
|
|
83
|
+
*/
|
|
84
|
+
defaultStyles?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Defines which formatting styles should be kept for the imported comments text.
|
|
87
|
+
*
|
|
88
|
+
* Possible values are:
|
|
89
|
+
*
|
|
90
|
+
* * `'basic'` - basic styles are kept (bold, italic, underline, strikethrough and links),
|
|
91
|
+
* * `'none'` - comment text is imported without any styling,
|
|
92
|
+
* * `'full'` - all styles are kept (not recommended).
|
|
93
|
+
*
|
|
94
|
+
* **Note:** Please remember that importing comments requires installing the {@link module:comments/comments~Comments} feature.
|
|
95
|
+
*
|
|
96
|
+
* @default 'basic'
|
|
97
|
+
*/
|
|
98
|
+
commentsStyles?: 'basic' | 'none' | 'full';
|
|
99
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016 - 2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* +---------------------------------------------------------------------------------+
|
|
8
|
+
* | |
|
|
9
|
+
* | Hello stranger! |
|
|
10
|
+
* | |
|
|
11
|
+
* | |
|
|
12
|
+
* | What you're currently looking at is the source code of a legally protected, |
|
|
13
|
+
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
|
|
14
|
+
* | are forbidden and will result in legal consequences. |
|
|
15
|
+
* | |
|
|
16
|
+
* | |
|
|
17
|
+
* +---------------------------------------------------------------------------------+
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
var _0x4b5c=['requires','pluginName'];(function(_0x245f2c,_0x4b5c9c){var _0x4fce35=function(_0x580114){while(--_0x580114){_0x245f2c['push'](_0x245f2c['shift']());}};_0x4fce35(++_0x4b5c9c);}(_0x4b5c,0xfc));var _0x4fce=function(_0x245f2c,_0x4b5c9c){_0x245f2c=_0x245f2c-0x0;var _0x4fce35=_0x4b5c[_0x245f2c];return _0x4fce35;};import{Plugin as _0x2afbb8}from'ckeditor5/src/core';import _0x4130b6 from'./importwordui';import _0x467d45 from'./importwordediting';export default class i extends _0x2afbb8{static get[_0x4fce('0x1')](){return'ImportWord';}static get[_0x4fce('0x0')](){return[_0x467d45,_0x4130b6];}}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, 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
|
+
* @module import-word/importwordcommand
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
import { Command, type Editor } from 'ckeditor5/src/core';
|
|
10
|
+
/**
|
|
11
|
+
* The import from Word command.
|
|
12
|
+
*
|
|
13
|
+
* It sends the Word file to the converter endpoint and inserts its content into the editor.
|
|
14
|
+
*/
|
|
15
|
+
export default class ImportWordCommand extends Command {
|
|
16
|
+
/**
|
|
17
|
+
* A command state that indicates if the command is currently executing.
|
|
18
|
+
*
|
|
19
|
+
* @observable
|
|
20
|
+
*/
|
|
21
|
+
isBusy: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
constructor(editor: Editor);
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
refresh(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Executes the command. Sends the provided file instance to the converter service endpoint and inserts the result into the model.
|
|
32
|
+
*
|
|
33
|
+
* @fires execute
|
|
34
|
+
* @param file The Word file instance to be uploaded for conversion.
|
|
35
|
+
* @param [serviceConfig] Additional options to pass to the converter service.
|
|
36
|
+
*/
|
|
37
|
+
execute(file: File, serviceConfig?: Record<string, unknown>): Promise<unknown>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Fired when the converter service returned the HTML content that will be inserted into the editor.
|
|
41
|
+
*
|
|
42
|
+
* @eventName ~ImportWordCommand#dataInsert
|
|
43
|
+
*/
|
|
44
|
+
export type DataInsertEvent = {
|
|
45
|
+
name: 'dataInsert';
|
|
46
|
+
args: [data: DataInsertEventData];
|
|
47
|
+
};
|
|
48
|
+
interface DataInsertEventData {
|
|
49
|
+
/**
|
|
50
|
+
* The HTML content to insertion.
|
|
51
|
+
*/
|
|
52
|
+
html: string;
|
|
53
|
+
}
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016 - 2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* +---------------------------------------------------------------------------------+
|
|
8
|
+
* | |
|
|
9
|
+
* | Hello stranger! |
|
|
10
|
+
* | |
|
|
11
|
+
* | |
|
|
12
|
+
* | What you're currently looking at is the source code of a legally protected, |
|
|
13
|
+
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
|
|
14
|
+
* | are forbidden and will result in legal consequences. |
|
|
15
|
+
* | |
|
|
16
|
+
* | |
|
|
17
|
+
* +---------------------------------------------------------------------------------+
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
import{Command as _0x235e5b}from'ckeditor5/src/core';import{Range as _0x3b78b2}from'ckeditor5/src/engine';import{logWarning as _0x275e4a,logError as _0x8f5e48,first as _0x53a91f,uid as _0x18ec61}from'ckeditor5/src/utils';export default class d extends _0x235e5b{constructor(_0x1fd065){super(_0x1fd065),this['set']('isBusy',!0x1),this['_importMarker']=null,this['_undoStepBatch']=null,this['_abortController']=null,this['on']('dataInsert',(_0x3a1c69,_0x588d28)=>{const _0x10a8ff=new DataTransfer();_0x10a8ff['setData']('text/html',_0x588d28['html']);const _0x806da7=this['_importMarker']['getRange']();this['editor']['model']['enqueueChange'](this['_undoStepBatch'],_0x27e2e5=>{this['_importMarker']['stopListening'](),_0x27e2e5['setSelection'](_0x806da7),_0x1fd065['editing']['view']['document']['fire']('clipboardInput',{'dataTransfer':_0x10a8ff});});},{'priority':'low'});}['refresh'](){this['isEnabled']=this['_checkEnabled']();}['execute'](_0xe59ae4,_0x1c200d={}){if(this['isBusy'])return Promise['resolve']();const _0x3e86e5=this['editor']['config']['get']('importWord'),_0x4e36f4={'url':_0x3e86e5['converterUrl'],'file':_0xe59ae4,'serviceConfig':{..._0x1c200d,'default_styles':_0x3e86e5['defaultStyles']}};return this['_prepareForImport'](),this['_sendImportRequest'](_0x4e36f4)['then'](this['_handleImportResponse']['bind'](this))['catch'](this['_handleImportFailure']['bind'](this))['finally'](this['_cleanUpAfterImport']['bind'](this));}['_checkEnabled'](){if(this['isBusy'])return!0x1;const _0x2b6ff0=this['editor']['model'],_0x4b93d5=_0x2b6ff0['schema'],_0x1691f2=_0x2b6ff0['document']['selection'],_0x2f1f7c=_0x53a91f(_0x1691f2['getSelectedBlocks']());return!!_0x2f1f7c&&_0x4b93d5['checkChild'](_0x2f1f7c['parent'],'paragraph');}['_prepareForImport'](){const _0x5a91ab=this['editor'],_0x20a434=_0x5a91ab['model'],_0x15c306=_0x20a434['document']['selection'];this['_abortController']=new AbortController(),this['_undoStepBatch']=_0x5a91ab['model']['createBatch']({'isUndoable':!0x0}),_0x20a434['enqueueChange'](this['_undoStepBatch'],_0x5ce1b1=>{_0x15c306['isCollapsed']||_0x20a434['deleteContent'](_0x15c306,{'leaveUnmerged':!0x0});const _0x3438de=_0x15c306['getFirstPosition'](),_0x247998=_0x53a91f(_0x15c306['getSelectedBlocks']());let _0x1a9f00;_0x1a9f00=_0x247998['is']('element','paragraph')&&_0x247998['isEmpty']?_0x3438de:_0x3438de['isAtStart']?_0x20a434['createPositionBefore'](_0x247998):_0x3438de['isAtEnd']?_0x20a434['createPositionAfter'](_0x247998):_0x5ce1b1['split'](_0x3438de)['position'],this['_importMarker']=_0x5ce1b1['addMarker']('importWord:'+_0x18ec61(),{'usingOperation':!0x1,'affectsData':!0x1,'range':new _0x3b78b2(_0x1a9f00)}),this['_importMarker']['on']('change:range',()=>{'$graveyard'===this['_importMarker']['getRange']()['root']['rootName']&&this['_abortController']['abort']();});}),this['isBusy']=!0x0,this['refresh']();}['_cleanUpAfterImport'](){const _0x27edb7=this['editor']['model'];_0x27edb7['markers']['has'](this['_importMarker'])&&_0x27edb7['enqueueChange'](this['_undoStepBatch'],_0x45b36c=>{_0x45b36c['removeMarker'](this['_importMarker']);}),this['_importMarker']=null,this['_undoStepBatch']=null,this['_abortController']=null,this['isBusy']=!0x1,this['refresh']();}['_sendImportRequest']({url:_0x5d2e87,file:_0x39d73f,serviceConfig:_0x2d2616}){const _0x45a674=this['editor']['plugins']['get']('ImportWordEditing')['getToken'](),_0x576f89=new FormData();_0x576f89['set']('config',JSON['stringify'](_0x2d2616)),_0x576f89['set']('file',_0x39d73f);const _0x282886={'method':'POST','headers':{},'body':_0x576f89,'signal':this['_abortController']['signal']};return _0x45a674&&(_0x282886['headers']['Authorization']=_0x45a674['value']),fetch(_0x5d2e87,_0x282886);}['_handleImportResponse'](_0x379160){return _0x379160['ok']?_0x379160['json']()['then'](_0x1c8bb7=>{if(!this['editor']['model']['markers']['has'](this['_importMarker']))return;'$graveyard'!==this['_importMarker']['getRange']()['root']['rootName']&&this['fire']('dataInsert',_0x1c8bb7);}):Promise['reject']();}['_handleImportFailure'](){if(this['_abortController']['signal']['aborted'])return void _0x275e4a('import-word-plugin-import-cancelled');const _0x3e30fd=this['editor'],_0x15a31f=(0x0,_0x3e30fd['t'])('An\x20error\x20occurred\x20while\x20importing\x20the\x20Word\x20file.');_0x3e30fd['plugins']['get']('Notification')['showWarning'](_0x15a31f),_0x8f5e48('import-word-plugin-conversion-failed');}}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, 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
|
+
* @module import-word/importwordediting
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core';
|
|
10
|
+
import { Notification } from 'ckeditor5/src/ui';
|
|
11
|
+
import { ClipboardPipeline } from 'ckeditor5/src/clipboard';
|
|
12
|
+
import type { InitializedToken } from '@ckeditor/ckeditor5-cloud-services';
|
|
13
|
+
/**
|
|
14
|
+
* The editing part of the import from Word feature.
|
|
15
|
+
*
|
|
16
|
+
* It registers the {@link module:import-word/importwordcommand~ImportWordCommand `'importWord'` command}.
|
|
17
|
+
*/
|
|
18
|
+
export default class ImportWordEditing extends Plugin {
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
static get pluginName(): "ImportWordEditing";
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/
|
|
26
|
+
static get requires(): readonly [typeof Notification, typeof ClipboardPipeline, "CloudServices"];
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
constructor(editor: Editor);
|
|
31
|
+
/**
|
|
32
|
+
* @inheritDoc
|
|
33
|
+
*/
|
|
34
|
+
init(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Returns a token used by the import from Word plugin for communication with the Cloud Services.
|
|
37
|
+
*/
|
|
38
|
+
getToken(): InitializedToken | null;
|
|
39
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016 - 2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* +---------------------------------------------------------------------------------+
|
|
8
|
+
* | |
|
|
9
|
+
* | Hello stranger! |
|
|
10
|
+
* | |
|
|
11
|
+
* | |
|
|
12
|
+
* | What you're currently looking at is the source code of a legally protected, |
|
|
13
|
+
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
|
|
14
|
+
* | are forbidden and will result in legal consequences. |
|
|
15
|
+
* | |
|
|
16
|
+
* | |
|
|
17
|
+
* +---------------------------------------------------------------------------------+
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const _0x239e=['get','tokenUrl','ImportWordEditing','_token','config','commands','cloudServices','init','requires','https://docx-converter.cke-cs.com/v2/convert/docx-html','token','importWord','CloudServices','add','getToken','editor','plugins','define'];(function(_0x2f3051,_0x239e8a){const _0x4eb004=function(_0x2542c3){while(--_0x2542c3){_0x2f3051['push'](_0x2f3051['shift']());}};_0x4eb004(++_0x239e8a);}(_0x239e,0x12a));const _0x4eb0=function(_0x2f3051,_0x239e8a){_0x2f3051=_0x2f3051-0x0;let _0x4eb004=_0x239e[_0x2f3051];return _0x4eb004;};import{Plugin as _0x35c532}from'ckeditor5/src/core';import{Notification as _0x19a4c5}from'ckeditor5/src/ui';import{ClipboardPipeline as _0x4670f1}from'ckeditor5/src/clipboard';import _0x16a9dc from'./importwordcommand';export default class e extends _0x35c532{static get['pluginName'](){return _0x4eb0('0xa');}static get[_0x4eb0('0x10')](){return[_0x19a4c5,_0x4670f1,'CloudServices'];}constructor(_0x3be105){super(_0x3be105),this[_0x4eb0('0xb')]=null;}async[_0x4eb0('0xf')](){const _0x1874f2=this[_0x4eb0('0x5')];_0x1874f2['config'][_0x4eb0('0x7')](_0x4eb0('0x1'),{'converterUrl':_0x4eb0('0x11'),'tokenUrl':(_0x1874f2['config'][_0x4eb0('0x8')](_0x4eb0('0xe'))||{})[_0x4eb0('0x9')],'defaultStyles':!0x1}),_0x1874f2[_0x4eb0('0xd')][_0x4eb0('0x3')](_0x4eb0('0x1'),new _0x16a9dc(_0x1874f2));const {tokenUrl:_0x348725}=_0x1874f2[_0x4eb0('0xc')][_0x4eb0('0x8')]('importWord');if(_0x348725){const {tokenUrl:_0xe7445b}=_0x1874f2[_0x4eb0('0xc')][_0x4eb0('0x8')](_0x4eb0('0xe'))||{};this[_0x4eb0('0xb')]=_0x348725===_0xe7445b?_0x1874f2['plugins'][_0x4eb0('0x8')](_0x4eb0('0x2'))[_0x4eb0('0x0')]:await _0x1874f2[_0x4eb0('0x6')]['get'](_0x4eb0('0x2'))['registerTokenUrl'](_0x348725);}}[_0x4eb0('0x4')](){return this['_token'];}}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, 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
|
+
* @module import-word/importwordui
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
10
|
+
import '../theme/importword.css';
|
|
11
|
+
/**
|
|
12
|
+
* The ImportWordUI plugin. It introduces the `'importWord'` toolbar button.
|
|
13
|
+
*/
|
|
14
|
+
export default class ImportWordUI extends Plugin {
|
|
15
|
+
/**
|
|
16
|
+
* @inheritDoc
|
|
17
|
+
*/
|
|
18
|
+
static get pluginName(): "ImportWordUI";
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
init(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016 - 2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* +---------------------------------------------------------------------------------+
|
|
8
|
+
* | |
|
|
9
|
+
* | Hello stranger! |
|
|
10
|
+
* | |
|
|
11
|
+
* | |
|
|
12
|
+
* | What you're currently looking at is the source code of a legally protected, |
|
|
13
|
+
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
|
|
14
|
+
* | are forbidden and will result in legal consequences. |
|
|
15
|
+
* | |
|
|
16
|
+
* | |
|
|
17
|
+
* +---------------------------------------------------------------------------------+
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
import{Plugin as _0x32a8b1}from'ckeditor5/src/core';import{View as _0x28874d}from'ckeditor5/src/ui';import{FileDialogButtonView as _0x1244dc}from'ckeditor5/src/upload';import _0x4b10df from'../theme/icons/importword.svg';import'../theme/importword.css';export default class o extends _0x32a8b1{static get['pluginName'](){return'ImportWordUI';}['init'](){const _0x5a5833=this['editor'],t=_0x5a5833['t'];_0x5a5833['ui']['componentFactory']['add']('importWord',_0x46fec7=>{const _0x1bb061=_0x5a5833['commands']['get']('importWord'),_0x2b86d5=new _0x1244dc(_0x46fec7);_0x2b86d5['set']({'acceptedType':'application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.wordprocessingml.template'}),_0x2b86d5['buttonView']['set']({'label':t('Import\x20from\x20Word'),'icon':_0x4b10df,'tooltip':!0x0}),_0x2b86d5['buttonView']['bind']('isOn','isEnabled')['to'](_0x1bb061,'isBusy','isEnabled'),_0x2b86d5['buttonView']['extendTemplate']({'attributes':{'class':[_0x2b86d5['buttonView']['bindTemplate']['if']('isOn','ck-importword_status-pending')]}});const _0x365da9=new _0x28874d();return _0x365da9['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-importword__spinner-container']},'children':[{'tag':'span','attributes':{'class':['ck','ck-importword__spinner']}}]}),_0x2b86d5['buttonView']['children']['add'](_0x365da9),_0x2b86d5['on']('done',(_0x46336a,_0x4667f7)=>{_0x5a5833['execute']('importWord',_0x4667f7[0x0],{}),_0x5a5833['editing']['view']['focus']();}),_0x2b86d5;});}}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, 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
|
+
* @module import-word
|
|
7
|
+
*/
|
|
8
|
+
export { default as ImportWord, type ImportWordConfig } from './importword';
|
|
9
|
+
export { default as ImportWordEditing } from './importwordediting';
|
|
10
|
+
export { default as ImportWordUI } from './importwordui';
|
|
11
|
+
export type { default as ImportWordCommand } from './importwordcommand';
|
|
12
|
+
import './augmentation';
|
package/src/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016 - 2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* +---------------------------------------------------------------------------------+
|
|
8
|
+
* | |
|
|
9
|
+
* | Hello stranger! |
|
|
10
|
+
* | |
|
|
11
|
+
* | |
|
|
12
|
+
* | What you're currently looking at is the source code of a legally protected, |
|
|
13
|
+
* | proprietary software. Any attempts to deobfuscate / disassemble this code |
|
|
14
|
+
* | are forbidden and will result in legal consequences. |
|
|
15
|
+
* | |
|
|
16
|
+
* | |
|
|
17
|
+
* +---------------------------------------------------------------------------------+
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export{default as ImportWord}from'./importword';export{default as ImportWordEditing}from'./importwordediting';export{default as ImportWordUI}from'./importwordui';import'./augmentation';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m14 0 5 4.5v8.892l-1.5-1.8V6.5h-5v-5h-8v3H3V0h11Zm0 2v3h3.3L14 2Z"/><path d="M10.74 18a2.76 2.76 0 0 1-.469-.5H3V19h9.25v-.374A2.737 2.737 0 0 1 10.74 18Z"/><path d="M8.5 6a1.5 1.5 0 0 1 1.493 1.356L10 7.5v7a1.5 1.5 0 0 1-1.356 1.493L8.5 16h-7a1.5 1.5 0 0 1-1.493-1.356L0 14.5v-7a1.5 1.5 0 0 1 1.356-1.493L1.5 6h7ZM7.483 8.795l-.042.088-.986 2.534-.947-2.528-.043-.092a.601.601 0 0 0-1.042.008l-.042.093-.883 2.465-.937-2.475-.042-.089a.6.6 0 0 0-1.107.42l.027.093 1.514 4 .044.092a.6.6 0 0 0 1.041-.01l.041-.092.88-2.458.925 2.467.046.096a.602.602 0 0 0 1.032 0l.043-.09 1.554-4 .028-.093a.6.6 0 0 0-1.104-.43v.001ZM11.674 15.407a.75.75 0 1 0 1.152.96L14 14.96V20h1.5v-5.04l1.174 1.408a.75.75 0 1 0 1.152-.96l-2.346-2.816a.95.95 0 0 0-1.46 0l-2.346 2.815Z"/></svg>
|