@ckeditor/ckeditor5-editor-classic 40.0.0 → 40.2.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 +25 -25
- package/LICENSE.md +3 -3
- package/package.json +2 -2
- package/src/classiceditor.d.ts +180 -180
- package/src/classiceditor.js +219 -219
- package/src/classiceditorui.d.ts +67 -67
- package/src/classiceditorui.js +151 -151
- package/src/classiceditoruiview.d.ts +47 -47
- package/src/classiceditoruiview.js +43 -43
- package/src/index.d.ts +8 -8
- package/src/index.js +8 -8
- package/build/editor-classic.js.map +0 -1
package/CHANGELOG.md
CHANGED
@@ -5,64 +5,64 @@ All changes in the package are documented in the main repository. See: https://g
|
|
5
5
|
|
6
6
|
Changes for the past releases are available below.
|
7
7
|
|
8
|
-
## [19.0.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v18.0.0...v19.0.0) (2020
|
8
|
+
## [19.0.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v18.0.0...v19.0.0) (April 29, 2020)
|
9
9
|
|
10
10
|
Internal changes only (updated dependencies, documentation, etc.).
|
11
11
|
|
12
12
|
|
13
|
-
## [18.0.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v17.0.0...v18.0.0) (2020
|
13
|
+
## [18.0.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v17.0.0...v18.0.0) (March 19, 2020)
|
14
14
|
|
15
15
|
Internal changes only (updated dependencies, documentation, etc.).
|
16
16
|
|
17
17
|
|
18
|
-
## [17.0.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v16.0.0...v17.0.0) (2020
|
18
|
+
## [17.0.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v16.0.0...v17.0.0) (February 19, 2020)
|
19
19
|
|
20
20
|
Internal changes only (updated dependencies, documentation, etc.).
|
21
21
|
|
22
|
-
## [16.0.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v15.0.0...v16.0.0) (2019
|
22
|
+
## [16.0.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v15.0.0...v16.0.0) (December 4, 2019)
|
23
23
|
|
24
24
|
### Features
|
25
25
|
|
26
26
|
* The main editor toolbar should respect the `config.toolbar.shouldNotGroupWhenFull` configuration (see [ckeditor/ckeditor5#5692](https://github.com/ckeditor/ckeditor5/issues/5692)). ([9a57e63](https://github.com/ckeditor/ckeditor5-editor-classic/commit/9a57e63))
|
27
27
|
|
28
28
|
|
29
|
-
## [15.0.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v12.1.4...v15.0.0) (2019
|
29
|
+
## [15.0.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v12.1.4...v15.0.0) (October 23, 2019)
|
30
30
|
|
31
31
|
### Features
|
32
32
|
|
33
33
|
* Enabled automatic items grouping in the main editor toolbar when there is not enough space to display them in a single row (see [ckeditor/ckeditor5#416](https://github.com/ckeditor/ckeditor5/issues/416)). ([4d20b70](https://github.com/ckeditor/ckeditor5-editor-classic/commit/4d20b70))
|
34
34
|
|
35
35
|
|
36
|
-
## [12.1.4](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v12.1.3...v12.1.4) (2019
|
36
|
+
## [12.1.4](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v12.1.3...v12.1.4) (August 26, 2019)
|
37
37
|
|
38
38
|
### Other changes
|
39
39
|
|
40
40
|
* The issue tracker for this package was moved to https://github.com/ckeditor/ckeditor5/issues. See [ckeditor/ckeditor5#1988](https://github.com/ckeditor/ckeditor5/issues/1988). ([84ec68f](https://github.com/ckeditor/ckeditor5-editor-classic/commit/84ec68f))
|
41
41
|
|
42
42
|
|
43
|
-
## [12.1.3](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v12.1.2...v12.1.3) (2019
|
43
|
+
## [12.1.3](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v12.1.2...v12.1.3) (July 10, 2019)
|
44
44
|
|
45
45
|
Internal changes only (updated dependencies, documentation, etc.).
|
46
46
|
|
47
47
|
|
48
|
-
## [12.1.2](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v12.1.1...v12.1.2) (2019
|
48
|
+
## [12.1.2](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v12.1.1...v12.1.2) (July 4, 2019)
|
49
49
|
|
50
50
|
Internal changes only (updated dependencies, documentation, etc.).
|
51
51
|
|
52
52
|
|
53
|
-
## [12.1.1](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v12.1.0...v12.1.1) (2019
|
53
|
+
## [12.1.1](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v12.1.0...v12.1.1) (June 6, 2019)
|
54
54
|
|
55
55
|
Internal changes only (updated dependencies, documentation, etc.).
|
56
56
|
|
57
57
|
|
58
|
-
## [12.1.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v12.0.0...v12.1.0) (2019
|
58
|
+
## [12.1.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v12.0.0...v12.1.0) (April 4, 2019)
|
59
59
|
|
60
60
|
### Features
|
61
61
|
|
62
62
|
* Introduced `EditorConfig#initialData`. ([fce3edc](https://github.com/ckeditor/ckeditor5-editor-classic/commit/fce3edc))
|
63
63
|
|
64
64
|
|
65
|
-
## [12.0.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v11.0.2...v12.0.0) (2019
|
65
|
+
## [12.0.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v11.0.2...v12.0.0) (February 28, 2019)
|
66
66
|
|
67
67
|
### Features
|
68
68
|
|
@@ -86,17 +86,17 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
86
86
|
* Removed `ClassicEditorUIView#editableElement`. Instead `ClassicEditorUI#getEditableElement()` method should be used.
|
87
87
|
|
88
88
|
|
89
|
-
## [11.0.2](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v11.0.1...v11.0.2) (2018
|
89
|
+
## [11.0.2](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v11.0.1...v11.0.2) (December 5, 2018)
|
90
90
|
|
91
91
|
Internal changes only (updated dependencies, documentation, etc.).
|
92
92
|
|
93
93
|
|
94
|
-
## [11.0.1](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v11.0.0...v11.0.1) (2018
|
94
|
+
## [11.0.1](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v11.0.0...v11.0.1) (October 8, 2018)
|
95
95
|
|
96
96
|
Internal changes only (updated dependencies, documentation, etc.).
|
97
97
|
|
98
98
|
|
99
|
-
## [11.0.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v10.0.1...v11.0.0) (2018
|
99
|
+
## [11.0.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v10.0.1...v11.0.0) (July 18, 2018)
|
100
100
|
|
101
101
|
### Features
|
102
102
|
|
@@ -111,12 +111,12 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
111
111
|
* The `ClassicEditor#element` property was renamed to `ClassicEditor#sourceElement` and `ClassicEditor#updateElement()` method to `ClassicEditor#updateSourceElement()`. See [ckeditor/ckeditor5-core#64](https://github.com/ckeditor/ckeditor5-core/issues/64).
|
112
112
|
|
113
113
|
|
114
|
-
## [10.0.1](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v10.0.0...v10.0.1) (2018
|
114
|
+
## [10.0.1](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v10.0.0...v10.0.1) (June 21, 2018)
|
115
115
|
|
116
116
|
Internal changes only (updated dependencies, documentation, etc.).
|
117
117
|
|
118
118
|
|
119
|
-
## [10.0.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v1.0.0-beta.4...v10.0.0) (2018
|
119
|
+
## [10.0.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v1.0.0-beta.4...v10.0.0) (April 25, 2018)
|
120
120
|
|
121
121
|
### Other changes
|
122
122
|
|
@@ -127,19 +127,19 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
127
127
|
* The license under which CKEditor 5 is released has been changed from a triple GPL, LGPL and MPL license to a GPL2+ only. See [ckeditor/ckeditor5#991](https://github.com/ckeditor/ckeditor5/issues/991) for more information.
|
128
128
|
|
129
129
|
|
130
|
-
## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v1.0.0-beta.2...v1.0.0-beta.4) (2018
|
130
|
+
## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v1.0.0-beta.2...v1.0.0-beta.4) (April 19, 2018)
|
131
131
|
|
132
132
|
Internal changes only (updated dependencies, documentation, etc.).
|
133
133
|
|
134
134
|
|
135
|
-
## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2018
|
135
|
+
## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v1.0.0-beta.1...v1.0.0-beta.2) (April 10, 2018)
|
136
136
|
|
137
137
|
### Other changes
|
138
138
|
|
139
139
|
* Increased the specificity of CSS rules. Introduced the `.ck` class for editor UI components (see: [ckeditor/ckeditor5#494](https://github.com/ckeditor/ckeditor5/issues/494)). ([e548bd0](https://github.com/ckeditor/ckeditor5-editor-classic/commit/e548bd0))
|
140
140
|
|
141
141
|
|
142
|
-
## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (2018
|
142
|
+
## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (March 15, 2018)
|
143
143
|
|
144
144
|
### Other changes
|
145
145
|
|
@@ -147,14 +147,14 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
147
147
|
* Removed the `.ck-editor-toolbar` class from the toolbar (see [ckeditor/ckeditor5-theme-lark#135](https://github.com/ckeditor/ckeditor5-theme-lark/issues/135)). ([6b4670c](https://github.com/ckeditor/ckeditor5-editor-classic/commit/6b4670c))
|
148
148
|
|
149
149
|
|
150
|
-
## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2017
|
150
|
+
## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (November 14, 2017)
|
151
151
|
|
152
152
|
### Other changes
|
153
153
|
|
154
154
|
* Aligned UI library usage to the [changes in the UI framework](https://github.com/ckeditor/ckeditor5-ui/pull/332).
|
155
155
|
|
156
156
|
|
157
|
-
## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v0.8.0...v1.0.0-alpha.1) (2017
|
157
|
+
## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v0.8.0...v1.0.0-alpha.1) (October 3, 2017)
|
158
158
|
|
159
159
|
### Features
|
160
160
|
|
@@ -165,7 +165,7 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
165
165
|
* The former attributes controlling the position of the toolbar provided by the `StickyToolbarView` are now available under `ClassicEditorUIView#stickyPanel` (`editor.ui.view.stickyPanel`).
|
166
166
|
|
167
167
|
|
168
|
-
## [0.8.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v0.7.3...v0.8.0) (2017
|
168
|
+
## [0.8.0](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v0.7.3...v0.8.0) (September 3, 2017)
|
169
169
|
|
170
170
|
### Bug fixes
|
171
171
|
|
@@ -184,11 +184,11 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
184
184
|
* The `classic.js` file containing `ClassicEditor` class has been renamed to `classiceditor.js`.
|
185
185
|
|
186
186
|
|
187
|
-
## [0.7.3](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v0.7.2...v0.7.3) (2017
|
187
|
+
## [0.7.3](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v0.7.2...v0.7.3) (May 7, 2017)
|
188
188
|
|
189
189
|
Internal changes only (updated dependencies, documentation, etc.).
|
190
190
|
|
191
|
-
## [0.7.2](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v0.7.1...v0.7.2) (2017
|
191
|
+
## [0.7.2](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v0.7.1...v0.7.2) (April 5, 2017)
|
192
192
|
|
193
193
|
### Bug fixes
|
194
194
|
|
@@ -199,7 +199,7 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
199
199
|
* Code refactoring to share API with `ckeditor5-editor-inline`. Closes [#48](https://github.com/ckeditor/ckeditor5-editor-classic/issues/48). ([2bb1e4e](https://github.com/ckeditor/ckeditor5-editor-classic/commit/2bb1e4e))
|
200
200
|
|
201
201
|
|
202
|
-
## [0.7.1](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v0.7.0...v0.7.1) (2017
|
202
|
+
## [0.7.1](https://github.com/ckeditor/ckeditor5-editor-classic/compare/v0.7.0...v0.7.1) (March 6, 2017)
|
203
203
|
|
204
204
|
### Other changes
|
205
205
|
|
package/LICENSE.md
CHANGED
@@ -2,7 +2,7 @@ Software License Agreement
|
|
2
2
|
==========================
|
3
3
|
|
4
4
|
**Classic editor implementation** – https://github.com/ckeditor/ckeditor5-editor-classic <br>
|
5
|
-
Copyright (c) 2003
|
5
|
+
Copyright (c) 2003–2023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
|
6
6
|
|
7
7
|
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
|
8
8
|
|
@@ -13,9 +13,9 @@ Where not otherwise indicated, all CKEditor content is authored by CKSource engi
|
|
13
13
|
|
14
14
|
The following libraries are included in CKEditor under the [MIT license](https://opensource.org/licenses/MIT):
|
15
15
|
|
16
|
-
*
|
16
|
+
* Lodash - Copyright (c) JS Foundation and other contributors https://js.foundation/. Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors http://underscorejs.org/.
|
17
17
|
|
18
18
|
Trademarks
|
19
19
|
----------
|
20
20
|
|
21
|
-
**CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
|
21
|
+
**CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks, or service marks of their respective holders.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-editor-classic",
|
3
|
-
"version": "40.
|
3
|
+
"version": "40.2.0",
|
4
4
|
"description": "Classic editor implementation for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -11,7 +11,7 @@
|
|
11
11
|
],
|
12
12
|
"main": "src/index.js",
|
13
13
|
"dependencies": {
|
14
|
-
"ckeditor5": "40.
|
14
|
+
"ckeditor5": "40.2.0",
|
15
15
|
"lodash-es": "4.17.21"
|
16
16
|
},
|
17
17
|
"author": "CKSource (http://cksource.com/)",
|
package/src/classiceditor.d.ts
CHANGED
@@ -1,180 +1,180 @@
|
|
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 editor-classic/classiceditor
|
7
|
-
*/
|
8
|
-
import ClassicEditorUI from './classiceditorui';
|
9
|
-
import { Editor, Context, type EditorConfig } from 'ckeditor5/src/core';
|
10
|
-
import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog';
|
11
|
-
declare const ClassicEditor_base: import("ckeditor5/src/utils").Mixed<import("ckeditor5/src/utils").Mixed<typeof Editor, import("ckeditor5/src/core").ElementApi>, import("ckeditor5/src/core").DataApi>;
|
12
|
-
/**
|
13
|
-
* The {@glink installation/getting-started/predefined-builds#classic-editor classic editor} implementation.
|
14
|
-
* It uses an inline editable and a sticky toolbar, all enclosed in a boxed UI.
|
15
|
-
* See the {@glink examples/builds/classic-editor demo}.
|
16
|
-
*
|
17
|
-
* In order to create a classic editor instance, use the static
|
18
|
-
* {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`} method.
|
19
|
-
*
|
20
|
-
* # Classic editor and classic build
|
21
|
-
*
|
22
|
-
* The classic editor can be used directly from source (if you installed the
|
23
|
-
* [`@ckeditor/ckeditor5-editor-classic`](https://www.npmjs.com/package/@ckeditor/ckeditor5-editor-classic) package)
|
24
|
-
* but it is also available in the {@glink installation/getting-started/predefined-builds#classic-editor classic build}.
|
25
|
-
*
|
26
|
-
* {@glink installation/getting-started/predefined-builds Builds}
|
27
|
-
* are ready-to-use editors with plugins bundled in. When using the editor from
|
28
|
-
* source you need to take care of loading all plugins by yourself
|
29
|
-
* (through the {@link module:core/editor/editorconfig~EditorConfig#plugins `config.plugins`} option).
|
30
|
-
* Using the editor from source gives much better flexibility and allows easier customization.
|
31
|
-
*
|
32
|
-
* Read more about initializing the editor from source or as a build in
|
33
|
-
* {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}.
|
34
|
-
*/
|
35
|
-
export default class ClassicEditor extends ClassicEditor_base {
|
36
|
-
/**
|
37
|
-
* @inheritDoc
|
38
|
-
*/
|
39
|
-
readonly ui: ClassicEditorUI;
|
40
|
-
/**
|
41
|
-
* Creates an instance of the classic editor.
|
42
|
-
*
|
43
|
-
* **Note:** do not use the constructor to create editor instances. Use the static
|
44
|
-
* {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`} method instead.
|
45
|
-
*
|
46
|
-
* @param sourceElementOrData The DOM element that will be the source for the created editor
|
47
|
-
* or the editor's initial data. For more information see
|
48
|
-
* {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}.
|
49
|
-
* @param config The editor configuration.
|
50
|
-
*/
|
51
|
-
protected constructor(sourceElementOrData: HTMLElement | string, config?: EditorConfig);
|
52
|
-
/**
|
53
|
-
* Destroys the editor instance, releasing all resources used by it.
|
54
|
-
*
|
55
|
-
* Updates the original editor element with the data if the
|
56
|
-
* {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy `updateSourceElementOnDestroy`}
|
57
|
-
* configuration option is set to `true`.
|
58
|
-
*/
|
59
|
-
destroy(): Promise<unknown>;
|
60
|
-
/**
|
61
|
-
* Creates a new classic editor instance.
|
62
|
-
*
|
63
|
-
* There are three ways how the editor can be initialized.
|
64
|
-
*
|
65
|
-
* # Replacing a DOM element (and loading data from it)
|
66
|
-
*
|
67
|
-
* You can initialize the editor using an existing DOM element:
|
68
|
-
*
|
69
|
-
* ```ts
|
70
|
-
* ClassicEditor
|
71
|
-
* .create( document.querySelector( '#editor' ) )
|
72
|
-
* .then( editor => {
|
73
|
-
* console.log( 'Editor was initialized', editor );
|
74
|
-
* } )
|
75
|
-
* .catch( err => {
|
76
|
-
* console.error( err.stack );
|
77
|
-
* } );
|
78
|
-
* ```
|
79
|
-
*
|
80
|
-
* The element's content will be used as the editor data and the element will be replaced by the editor UI.
|
81
|
-
*
|
82
|
-
* # Creating a detached editor
|
83
|
-
*
|
84
|
-
* Alternatively, you can initialize the editor by passing the initial data directly as a string.
|
85
|
-
* In this case, the editor will render an element that must be inserted into the DOM:
|
86
|
-
*
|
87
|
-
* ```ts
|
88
|
-
* ClassicEditor
|
89
|
-
* .create( '<p>Hello world!</p>' )
|
90
|
-
* .then( editor => {
|
91
|
-
* console.log( 'Editor was initialized', editor );
|
92
|
-
*
|
93
|
-
* // Initial data was provided so the editor UI element needs to be added manually to the DOM.
|
94
|
-
* document.body.appendChild( editor.ui.element );
|
95
|
-
* } )
|
96
|
-
* .catch( err => {
|
97
|
-
* console.error( err.stack );
|
98
|
-
* } );
|
99
|
-
* ```
|
100
|
-
*
|
101
|
-
* This lets you dynamically append the editor to your web page whenever it is convenient for you. You may use this method if your
|
102
|
-
* web page content is generated on the client side and the DOM structure is not ready at the moment when you initialize the editor.
|
103
|
-
*
|
104
|
-
* # Replacing a DOM element (and data provided in `config.initialData`)
|
105
|
-
*
|
106
|
-
* You can also mix these two ways by providing a DOM element to be used and passing the initial data through the configuration:
|
107
|
-
*
|
108
|
-
* ```ts
|
109
|
-
* ClassicEditor
|
110
|
-
* .create( document.querySelector( '#editor' ), {
|
111
|
-
* initialData: '<h2>Initial data</h2><p>Foo bar.</p>'
|
112
|
-
* } )
|
113
|
-
* .then( editor => {
|
114
|
-
* console.log( 'Editor was initialized', editor );
|
115
|
-
* } )
|
116
|
-
* .catch( err => {
|
117
|
-
* console.error( err.stack );
|
118
|
-
* } );
|
119
|
-
* ```
|
120
|
-
*
|
121
|
-
* This method can be used to initialize the editor on an existing element with the specified content in case if your integration
|
122
|
-
* makes it difficult to set the content of the source element.
|
123
|
-
*
|
124
|
-
* Note that an error will be thrown if you pass the initial data both as the first parameter and also in the configuration.
|
125
|
-
*
|
126
|
-
* # Configuring the editor
|
127
|
-
*
|
128
|
-
* See the {@link module:core/editor/editorconfig~EditorConfig editor configuration documentation} to learn more about
|
129
|
-
* customizing plugins, toolbar and more.
|
130
|
-
*
|
131
|
-
* # Using the editor from source
|
132
|
-
*
|
133
|
-
* The code samples listed in the previous sections of this documentation assume that you are using an
|
134
|
-
* {@glink installation/getting-started/predefined-builds editor build} (for example – `@ckeditor/ckeditor5-build-classic`).
|
135
|
-
*
|
136
|
-
* If you want to use the classic editor from source (`@ckeditor/ckeditor5-editor-classic/src/classiceditor`),
|
137
|
-
* you need to define the list of
|
138
|
-
* {@link module:core/editor/editorconfig~EditorConfig#plugins plugins to be initialized} and
|
139
|
-
* {@link module:core/editor/editorconfig~EditorConfig#toolbar toolbar items}. Read more about using the editor from
|
140
|
-
* source in the {@glink installation/advanced/alternative-setups/integrating-from-source-webpack dedicated guide}.
|
141
|
-
*
|
142
|
-
* @param sourceElementOrData The DOM element that will be the source for the created editor
|
143
|
-
* or the editor's initial data.
|
144
|
-
*
|
145
|
-
* If a DOM element is passed, its content will be automatically loaded to the editor upon initialization
|
146
|
-
* and the {@link module:editor-classic/classiceditorui~ClassicEditorUI#element editor element} will replace the passed element
|
147
|
-
* in the DOM (the original one will be hidden and the editor will be injected next to it).
|
148
|
-
*
|
149
|
-
* If the {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy updateSourceElementOnDestroy}
|
150
|
-
* option is set to `true`, the editor data will be set back to the original element once the editor is destroyed and when a form,
|
151
|
-
* in which this element is contained, is submitted (if the original element is a `<textarea>`). This ensures seamless integration
|
152
|
-
* with native web forms.
|
153
|
-
*
|
154
|
-
* If the initial data is passed, a detached editor will be created. In this case you need to insert it into the DOM manually.
|
155
|
-
* It is available under the {@link module:editor-classic/classiceditorui~ClassicEditorUI#element `editor.ui.element`} property.
|
156
|
-
*
|
157
|
-
* @param config The editor configuration.
|
158
|
-
* @returns A promise resolved once the editor is ready. The promise resolves with the created editor instance.
|
159
|
-
*/
|
160
|
-
static create(sourceElementOrData: HTMLElement | string, config?: EditorConfig): Promise<ClassicEditor>;
|
161
|
-
/**
|
162
|
-
* The {@link module:core/context~Context} class.
|
163
|
-
*
|
164
|
-
* Exposed as static editor field for easier access in editor builds.
|
165
|
-
*/
|
166
|
-
static Context: typeof Context;
|
167
|
-
/**
|
168
|
-
* The {@link module:watchdog/editorwatchdog~EditorWatchdog} class.
|
169
|
-
*
|
170
|
-
* Exposed as static editor field for easier access in editor builds.
|
171
|
-
*/
|
172
|
-
static EditorWatchdog: typeof EditorWatchdog;
|
173
|
-
/**
|
174
|
-
* The {@link module:watchdog/contextwatchdog~ContextWatchdog} class.
|
175
|
-
*
|
176
|
-
* Exposed as static editor field for easier access in editor builds.
|
177
|
-
*/
|
178
|
-
static ContextWatchdog: typeof ContextWatchdog;
|
179
|
-
}
|
180
|
-
export {};
|
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 editor-classic/classiceditor
|
7
|
+
*/
|
8
|
+
import ClassicEditorUI from './classiceditorui';
|
9
|
+
import { Editor, Context, type EditorConfig } from 'ckeditor5/src/core';
|
10
|
+
import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog';
|
11
|
+
declare const ClassicEditor_base: import("ckeditor5/src/utils").Mixed<import("ckeditor5/src/utils").Mixed<typeof Editor, import("ckeditor5/src/core").ElementApi>, import("ckeditor5/src/core").DataApi>;
|
12
|
+
/**
|
13
|
+
* The {@glink installation/getting-started/predefined-builds#classic-editor classic editor} implementation.
|
14
|
+
* It uses an inline editable and a sticky toolbar, all enclosed in a boxed UI.
|
15
|
+
* See the {@glink examples/builds/classic-editor demo}.
|
16
|
+
*
|
17
|
+
* In order to create a classic editor instance, use the static
|
18
|
+
* {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`} method.
|
19
|
+
*
|
20
|
+
* # Classic editor and classic build
|
21
|
+
*
|
22
|
+
* The classic editor can be used directly from source (if you installed the
|
23
|
+
* [`@ckeditor/ckeditor5-editor-classic`](https://www.npmjs.com/package/@ckeditor/ckeditor5-editor-classic) package)
|
24
|
+
* but it is also available in the {@glink installation/getting-started/predefined-builds#classic-editor classic build}.
|
25
|
+
*
|
26
|
+
* {@glink installation/getting-started/predefined-builds Builds}
|
27
|
+
* are ready-to-use editors with plugins bundled in. When using the editor from
|
28
|
+
* source you need to take care of loading all plugins by yourself
|
29
|
+
* (through the {@link module:core/editor/editorconfig~EditorConfig#plugins `config.plugins`} option).
|
30
|
+
* Using the editor from source gives much better flexibility and allows easier customization.
|
31
|
+
*
|
32
|
+
* Read more about initializing the editor from source or as a build in
|
33
|
+
* {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}.
|
34
|
+
*/
|
35
|
+
export default class ClassicEditor extends ClassicEditor_base {
|
36
|
+
/**
|
37
|
+
* @inheritDoc
|
38
|
+
*/
|
39
|
+
readonly ui: ClassicEditorUI;
|
40
|
+
/**
|
41
|
+
* Creates an instance of the classic editor.
|
42
|
+
*
|
43
|
+
* **Note:** do not use the constructor to create editor instances. Use the static
|
44
|
+
* {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`} method instead.
|
45
|
+
*
|
46
|
+
* @param sourceElementOrData The DOM element that will be the source for the created editor
|
47
|
+
* or the editor's initial data. For more information see
|
48
|
+
* {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}.
|
49
|
+
* @param config The editor configuration.
|
50
|
+
*/
|
51
|
+
protected constructor(sourceElementOrData: HTMLElement | string, config?: EditorConfig);
|
52
|
+
/**
|
53
|
+
* Destroys the editor instance, releasing all resources used by it.
|
54
|
+
*
|
55
|
+
* Updates the original editor element with the data if the
|
56
|
+
* {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy `updateSourceElementOnDestroy`}
|
57
|
+
* configuration option is set to `true`.
|
58
|
+
*/
|
59
|
+
destroy(): Promise<unknown>;
|
60
|
+
/**
|
61
|
+
* Creates a new classic editor instance.
|
62
|
+
*
|
63
|
+
* There are three ways how the editor can be initialized.
|
64
|
+
*
|
65
|
+
* # Replacing a DOM element (and loading data from it)
|
66
|
+
*
|
67
|
+
* You can initialize the editor using an existing DOM element:
|
68
|
+
*
|
69
|
+
* ```ts
|
70
|
+
* ClassicEditor
|
71
|
+
* .create( document.querySelector( '#editor' ) )
|
72
|
+
* .then( editor => {
|
73
|
+
* console.log( 'Editor was initialized', editor );
|
74
|
+
* } )
|
75
|
+
* .catch( err => {
|
76
|
+
* console.error( err.stack );
|
77
|
+
* } );
|
78
|
+
* ```
|
79
|
+
*
|
80
|
+
* The element's content will be used as the editor data and the element will be replaced by the editor UI.
|
81
|
+
*
|
82
|
+
* # Creating a detached editor
|
83
|
+
*
|
84
|
+
* Alternatively, you can initialize the editor by passing the initial data directly as a string.
|
85
|
+
* In this case, the editor will render an element that must be inserted into the DOM:
|
86
|
+
*
|
87
|
+
* ```ts
|
88
|
+
* ClassicEditor
|
89
|
+
* .create( '<p>Hello world!</p>' )
|
90
|
+
* .then( editor => {
|
91
|
+
* console.log( 'Editor was initialized', editor );
|
92
|
+
*
|
93
|
+
* // Initial data was provided so the editor UI element needs to be added manually to the DOM.
|
94
|
+
* document.body.appendChild( editor.ui.element );
|
95
|
+
* } )
|
96
|
+
* .catch( err => {
|
97
|
+
* console.error( err.stack );
|
98
|
+
* } );
|
99
|
+
* ```
|
100
|
+
*
|
101
|
+
* This lets you dynamically append the editor to your web page whenever it is convenient for you. You may use this method if your
|
102
|
+
* web page content is generated on the client side and the DOM structure is not ready at the moment when you initialize the editor.
|
103
|
+
*
|
104
|
+
* # Replacing a DOM element (and data provided in `config.initialData`)
|
105
|
+
*
|
106
|
+
* You can also mix these two ways by providing a DOM element to be used and passing the initial data through the configuration:
|
107
|
+
*
|
108
|
+
* ```ts
|
109
|
+
* ClassicEditor
|
110
|
+
* .create( document.querySelector( '#editor' ), {
|
111
|
+
* initialData: '<h2>Initial data</h2><p>Foo bar.</p>'
|
112
|
+
* } )
|
113
|
+
* .then( editor => {
|
114
|
+
* console.log( 'Editor was initialized', editor );
|
115
|
+
* } )
|
116
|
+
* .catch( err => {
|
117
|
+
* console.error( err.stack );
|
118
|
+
* } );
|
119
|
+
* ```
|
120
|
+
*
|
121
|
+
* This method can be used to initialize the editor on an existing element with the specified content in case if your integration
|
122
|
+
* makes it difficult to set the content of the source element.
|
123
|
+
*
|
124
|
+
* Note that an error will be thrown if you pass the initial data both as the first parameter and also in the configuration.
|
125
|
+
*
|
126
|
+
* # Configuring the editor
|
127
|
+
*
|
128
|
+
* See the {@link module:core/editor/editorconfig~EditorConfig editor configuration documentation} to learn more about
|
129
|
+
* customizing plugins, toolbar and more.
|
130
|
+
*
|
131
|
+
* # Using the editor from source
|
132
|
+
*
|
133
|
+
* The code samples listed in the previous sections of this documentation assume that you are using an
|
134
|
+
* {@glink installation/getting-started/predefined-builds editor build} (for example – `@ckeditor/ckeditor5-build-classic`).
|
135
|
+
*
|
136
|
+
* If you want to use the classic editor from source (`@ckeditor/ckeditor5-editor-classic/src/classiceditor`),
|
137
|
+
* you need to define the list of
|
138
|
+
* {@link module:core/editor/editorconfig~EditorConfig#plugins plugins to be initialized} and
|
139
|
+
* {@link module:core/editor/editorconfig~EditorConfig#toolbar toolbar items}. Read more about using the editor from
|
140
|
+
* source in the {@glink installation/advanced/alternative-setups/integrating-from-source-webpack dedicated guide}.
|
141
|
+
*
|
142
|
+
* @param sourceElementOrData The DOM element that will be the source for the created editor
|
143
|
+
* or the editor's initial data.
|
144
|
+
*
|
145
|
+
* If a DOM element is passed, its content will be automatically loaded to the editor upon initialization
|
146
|
+
* and the {@link module:editor-classic/classiceditorui~ClassicEditorUI#element editor element} will replace the passed element
|
147
|
+
* in the DOM (the original one will be hidden and the editor will be injected next to it).
|
148
|
+
*
|
149
|
+
* If the {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy updateSourceElementOnDestroy}
|
150
|
+
* option is set to `true`, the editor data will be set back to the original element once the editor is destroyed and when a form,
|
151
|
+
* in which this element is contained, is submitted (if the original element is a `<textarea>`). This ensures seamless integration
|
152
|
+
* with native web forms.
|
153
|
+
*
|
154
|
+
* If the initial data is passed, a detached editor will be created. In this case you need to insert it into the DOM manually.
|
155
|
+
* It is available under the {@link module:editor-classic/classiceditorui~ClassicEditorUI#element `editor.ui.element`} property.
|
156
|
+
*
|
157
|
+
* @param config The editor configuration.
|
158
|
+
* @returns A promise resolved once the editor is ready. The promise resolves with the created editor instance.
|
159
|
+
*/
|
160
|
+
static create(sourceElementOrData: HTMLElement | string, config?: EditorConfig): Promise<ClassicEditor>;
|
161
|
+
/**
|
162
|
+
* The {@link module:core/context~Context} class.
|
163
|
+
*
|
164
|
+
* Exposed as static editor field for easier access in editor builds.
|
165
|
+
*/
|
166
|
+
static Context: typeof Context;
|
167
|
+
/**
|
168
|
+
* The {@link module:watchdog/editorwatchdog~EditorWatchdog} class.
|
169
|
+
*
|
170
|
+
* Exposed as static editor field for easier access in editor builds.
|
171
|
+
*/
|
172
|
+
static EditorWatchdog: typeof EditorWatchdog;
|
173
|
+
/**
|
174
|
+
* The {@link module:watchdog/contextwatchdog~ContextWatchdog} class.
|
175
|
+
*
|
176
|
+
* Exposed as static editor field for easier access in editor builds.
|
177
|
+
*/
|
178
|
+
static ContextWatchdog: typeof ContextWatchdog;
|
179
|
+
}
|
180
|
+
export {};
|