@ckeditor/ckeditor5-editor-balloon 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 +22 -22
- package/LICENSE.md +3 -3
- package/package.json +2 -2
- package/src/ballooneditor.d.ts +177 -177
- package/src/ballooneditor.js +229 -229
- package/src/ballooneditorui.d.ts +42 -42
- package/src/ballooneditorui.js +91 -91
- package/src/ballooneditoruiview.d.ts +32 -32
- package/src/ballooneditoruiview.js +37 -37
- package/src/index.d.ts +8 -8
- package/src/index.js +8 -8
- package/build/editor-balloon.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,32 +5,32 @@ 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-balloon/compare/v18.0.0...v19.0.0) (2020
|
|
8
|
+
## [19.0.0](https://github.com/ckeditor/ckeditor5-editor-balloon/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-balloon/compare/v17.0.0...v18.0.0) (2020
|
|
13
|
+
## [18.0.0](https://github.com/ckeditor/ckeditor5-editor-balloon/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-balloon/compare/v16.0.0...v17.0.0) (2020
|
|
18
|
+
## [17.0.0](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v16.0.0...v17.0.0) (February 19, 2020)
|
|
19
19
|
|
|
20
20
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
## [16.0.0](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v15.0.0...v16.0.0) (2019
|
|
23
|
+
## [16.0.0](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v15.0.0...v16.0.0) (December 4, 2019)
|
|
24
24
|
|
|
25
25
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
## [15.0.0](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v12.2.2...v15.0.0) (2019
|
|
28
|
+
## [15.0.0](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v12.2.2...v15.0.0) (October 23, 2019)
|
|
29
29
|
|
|
30
30
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
## [12.2.2](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v12.2.1...v12.2.2) (2019
|
|
33
|
+
## [12.2.2](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v12.2.1...v12.2.2) (August 26, 2019)
|
|
34
34
|
|
|
35
35
|
### Other changes
|
|
36
36
|
|
|
@@ -38,31 +38,31 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
38
38
|
* Introduced a check that prevents sharing source elements between editor instances. See [ckeditor/ckeditor5#746](https://github.com/ckeditor/ckeditor5/issues/746). ([5159981](https://github.com/ckeditor/ckeditor5-editor-balloon/commit/5159981))
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
## [12.2.1](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v12.2.0...v12.2.1) (2019
|
|
41
|
+
## [12.2.1](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v12.2.0...v12.2.1) (July 10, 2019)
|
|
42
42
|
|
|
43
43
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
## [12.2.0](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v12.1.1...v12.2.0) (2019
|
|
46
|
+
## [12.2.0](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v12.1.1...v12.2.0) (July 4, 2019)
|
|
47
47
|
|
|
48
48
|
### Features
|
|
49
49
|
|
|
50
50
|
* `BalloonEditor.create()` will throw an error, when textarea element is used. ([83552e2](https://github.com/ckeditor/ckeditor5-editor-balloon/commit/83552e2))
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
## [12.1.1](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v12.1.0...v12.1.1) (2019
|
|
53
|
+
## [12.1.1](https://github.com/ckeditor/ckeditor5-editor-balloon/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-balloon/compare/v12.0.0...v12.1.0) (2019
|
|
58
|
+
## [12.1.0](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v12.0.0...v12.1.0) (April 4, 2019)
|
|
59
59
|
|
|
60
60
|
### Features
|
|
61
61
|
|
|
62
62
|
* Introduced `EditorConfig#initialData`. ([678528f](https://github.com/ckeditor/ckeditor5-editor-balloon/commit/678528f))
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
## [12.0.0](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v11.0.2...v12.0.0) (2019
|
|
65
|
+
## [12.0.0](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v11.0.2...v12.0.0) (February 28, 2019)
|
|
66
66
|
|
|
67
67
|
### Features
|
|
68
68
|
|
|
@@ -87,17 +87,17 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
87
87
|
* Removed `BalloonEditorUIView#editableElement`. Instead `BalloonEditorUI#getEditableElement()` method should be used.
|
|
88
88
|
|
|
89
89
|
|
|
90
|
-
## [11.0.2](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v11.0.1...v11.0.2) (2018
|
|
90
|
+
## [11.0.2](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v11.0.1...v11.0.2) (December 5, 2018)
|
|
91
91
|
|
|
92
92
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
93
93
|
|
|
94
94
|
|
|
95
|
-
## [11.0.1](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v11.0.0...v11.0.1) (2018
|
|
95
|
+
## [11.0.1](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v11.0.0...v11.0.1) (October 8, 2018)
|
|
96
96
|
|
|
97
97
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
98
98
|
|
|
99
99
|
|
|
100
|
-
## [11.0.0](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v10.0.1...v11.0.0) (2018
|
|
100
|
+
## [11.0.0](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v10.0.1...v11.0.0) (July 18, 2018)
|
|
101
101
|
|
|
102
102
|
### Features
|
|
103
103
|
|
|
@@ -112,12 +112,12 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
112
112
|
* The `BalloonEditor#element` property was renamed to `BalloonEditor#sourceElement` and `BalloonEditor#updateElement()` method to `BalloonEditor#updateSourceElement()`. See [ckeditor/ckeditor5-core#64](https://github.com/ckeditor/ckeditor5-core/issues/64).
|
|
113
113
|
|
|
114
114
|
|
|
115
|
-
## [10.0.1](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v10.0.0...v10.0.1) (2018
|
|
115
|
+
## [10.0.1](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v10.0.0...v10.0.1) (June 21, 2018)
|
|
116
116
|
|
|
117
117
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
118
118
|
|
|
119
119
|
|
|
120
|
-
## [10.0.0](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v1.0.0-beta.4...v10.0.0) (2018
|
|
120
|
+
## [10.0.0](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v1.0.0-beta.4...v10.0.0) (April 25, 2018)
|
|
121
121
|
|
|
122
122
|
### Other changes
|
|
123
123
|
|
|
@@ -128,31 +128,31 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
128
128
|
* 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.
|
|
129
129
|
|
|
130
130
|
|
|
131
|
-
## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v1.0.0-beta.2...v1.0.0-beta.4) (2018
|
|
131
|
+
## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v1.0.0-beta.2...v1.0.0-beta.4) (April 19, 2018)
|
|
132
132
|
|
|
133
133
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
134
134
|
|
|
135
135
|
|
|
136
|
-
## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2018
|
|
136
|
+
## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v1.0.0-beta.1...v1.0.0-beta.2) (April 10, 2018)
|
|
137
137
|
|
|
138
138
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
139
139
|
|
|
140
140
|
|
|
141
|
-
## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (2018
|
|
141
|
+
## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (March 15, 2018)
|
|
142
142
|
|
|
143
143
|
### Other changes
|
|
144
144
|
|
|
145
145
|
* Migrated the editor styles to PostCSS (see [ckeditor/ckeditor5-ui#144](https://github.com/ckeditor/ckeditor5-ui/issues/144)). ([bd239e9](https://github.com/ckeditor/ckeditor5-editor-balloon/commit/bd239e9))
|
|
146
146
|
|
|
147
147
|
|
|
148
|
-
## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2017
|
|
148
|
+
## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (November 14, 2017)
|
|
149
149
|
|
|
150
150
|
### Other changes
|
|
151
151
|
|
|
152
152
|
* Aligned UI library usage to the [changes in the UI framework](https://github.com/ckeditor/ckeditor5-ui/pull/332).
|
|
153
153
|
|
|
154
154
|
|
|
155
|
-
## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v0.1.0...v1.0.0-alpha.1) (2017
|
|
155
|
+
## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-editor-balloon/compare/v0.1.0...v1.0.0-alpha.1) (October 3, 2017)
|
|
156
156
|
|
|
157
157
|
### Other changes
|
|
158
158
|
|
|
@@ -163,7 +163,7 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
163
163
|
* The editor name has been changed. See [ckeditor/ckeditor5#546](https://github.com/ckeditor/ckeditor5/issues/546).
|
|
164
164
|
|
|
165
165
|
|
|
166
|
-
## 0.1.0 (2017
|
|
166
|
+
## 0.1.0 (September 3, 2017)
|
|
167
167
|
|
|
168
168
|
### Features
|
|
169
169
|
|
package/LICENSE.md
CHANGED
|
@@ -2,7 +2,7 @@ Software License Agreement
|
|
|
2
2
|
==========================
|
|
3
3
|
|
|
4
4
|
**Balloon editor implementation** – https://github.com/ckeditor/ckeditor5-editor-balloon <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-balloon",
|
|
3
|
-
"version": "40.
|
|
3
|
+
"version": "40.2.0",
|
|
4
4
|
"description": "Balloon 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/ballooneditor.d.ts
CHANGED
|
@@ -1,177 +1,177 @@
|
|
|
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-balloon/ballooneditor
|
|
7
|
-
*/
|
|
8
|
-
import { Editor, Context, type EditorConfig } from 'ckeditor5/src/core';
|
|
9
|
-
import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog';
|
|
10
|
-
import BalloonEditorUI from './ballooneditorui';
|
|
11
|
-
declare const BalloonEditor_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#balloon-editor balloon editor}
|
|
14
|
-
* implementation (Medium-like editor).
|
|
15
|
-
* It uses an inline editable and a toolbar based on the {@link module:ui/toolbar/balloon/balloontoolbar~BalloonToolbar}.
|
|
16
|
-
* See the {@glink examples/builds/balloon-editor demo}.
|
|
17
|
-
*
|
|
18
|
-
* In order to create a balloon editor instance, use the static
|
|
19
|
-
* {@link module:editor-balloon/ballooneditor~BalloonEditor.create `BalloonEditor.create()`} method.
|
|
20
|
-
*
|
|
21
|
-
* # Balloon editor and balloon build
|
|
22
|
-
*
|
|
23
|
-
* The balloon editor can be used directly from source (if you installed the
|
|
24
|
-
* [`@ckeditor/ckeditor5-editor-balloon`](https://www.npmjs.com/package/@ckeditor/ckeditor5-editor-balloon) package)
|
|
25
|
-
* but it is also available in the {@glink installation/getting-started/predefined-builds#balloon-editor balloon build}.
|
|
26
|
-
*
|
|
27
|
-
* {@glink installation/getting-started/predefined-builds Builds}
|
|
28
|
-
* are ready-to-use editors with plugins bundled in. When using the editor from
|
|
29
|
-
* source you need to take care of loading all plugins by yourself
|
|
30
|
-
* (through the {@link module:core/editor/editorconfig~EditorConfig#plugins `config.plugins`} option).
|
|
31
|
-
* Using the editor from source gives much better flexibility and allows easier customization.
|
|
32
|
-
*
|
|
33
|
-
* Read more about initializing the editor from source or as a build in
|
|
34
|
-
* {@link module:editor-balloon/ballooneditor~BalloonEditor.create `BalloonEditor.create()`}.
|
|
35
|
-
*/
|
|
36
|
-
export default class BalloonEditor extends BalloonEditor_base {
|
|
37
|
-
/**
|
|
38
|
-
* @inheritDoc
|
|
39
|
-
*/
|
|
40
|
-
readonly ui: BalloonEditorUI;
|
|
41
|
-
/**
|
|
42
|
-
* Creates an instance of the balloon editor.
|
|
43
|
-
*
|
|
44
|
-
* **Note:** do not use the constructor to create editor instances. Use the static
|
|
45
|
-
* {@link module:editor-balloon/ballooneditor~BalloonEditor.create `BalloonEditor.create()`} method instead.
|
|
46
|
-
*
|
|
47
|
-
* @param sourceElementOrData The DOM element that will be the source for the created editor
|
|
48
|
-
* (on which the editor will be initialized) or initial data for the editor. For more information see
|
|
49
|
-
* {@link module:editor-balloon/ballooneditor~BalloonEditor.create `BalloonEditor.create()`}.
|
|
50
|
-
* @param config The editor configuration.
|
|
51
|
-
*/
|
|
52
|
-
protected constructor(sourceElementOrData: HTMLElement | string, config?: EditorConfig);
|
|
53
|
-
/**
|
|
54
|
-
* Destroys the editor instance, releasing all resources used by it.
|
|
55
|
-
*
|
|
56
|
-
* Updates the original editor element with the data if the
|
|
57
|
-
* {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy `updateSourceElementOnDestroy`}
|
|
58
|
-
* configuration option is set to `true`.
|
|
59
|
-
*/
|
|
60
|
-
destroy(): Promise<unknown>;
|
|
61
|
-
/**
|
|
62
|
-
* Creates a new balloon editor instance.
|
|
63
|
-
*
|
|
64
|
-
* There are three general ways how the editor can be initialized.
|
|
65
|
-
*
|
|
66
|
-
* # Using an existing DOM element (and loading data from it)
|
|
67
|
-
*
|
|
68
|
-
* You can initialize the editor using an existing DOM element:
|
|
69
|
-
*
|
|
70
|
-
* ```ts
|
|
71
|
-
* BalloonEditor
|
|
72
|
-
* .create( document.querySelector( '#editor' ) )
|
|
73
|
-
* .then( editor => {
|
|
74
|
-
* console.log( 'Editor was initialized', editor );
|
|
75
|
-
* } )
|
|
76
|
-
* .catch( err => {
|
|
77
|
-
* console.error( err.stack );
|
|
78
|
-
* } );
|
|
79
|
-
* ```
|
|
80
|
-
*
|
|
81
|
-
* The element's content will be used as the editor data and the element will become the editable element.
|
|
82
|
-
*
|
|
83
|
-
* # Creating a detached editor
|
|
84
|
-
*
|
|
85
|
-
* Alternatively, you can initialize the editor by passing the initial data directly as a string.
|
|
86
|
-
* In this case, the editor will render an element that must be inserted into the DOM for the editor to work properly:
|
|
87
|
-
*
|
|
88
|
-
* ```ts
|
|
89
|
-
* BalloonEditor
|
|
90
|
-
* .create( '<p>Hello world!</p>' )
|
|
91
|
-
* .then( editor => {
|
|
92
|
-
* console.log( 'Editor was initialized', editor );
|
|
93
|
-
*
|
|
94
|
-
* // Initial data was provided so the editor UI element needs to be added manually to the DOM.
|
|
95
|
-
* document.body.appendChild( editor.ui.element );
|
|
96
|
-
* } )
|
|
97
|
-
* .catch( err => {
|
|
98
|
-
* console.error( err.stack );
|
|
99
|
-
* } );
|
|
100
|
-
* ```
|
|
101
|
-
*
|
|
102
|
-
* This lets you dynamically append the editor to your web page whenever it is convenient for you. You may use this method if your
|
|
103
|
-
* web page content is generated on the client side and the DOM structure is not ready at the moment when you initialize the editor.
|
|
104
|
-
*
|
|
105
|
-
* # Using an existing DOM element (and data provided in `config.initialData`)
|
|
106
|
-
*
|
|
107
|
-
* You can also mix these two ways by providing a DOM element to be used and passing the initial data through the configuration:
|
|
108
|
-
*
|
|
109
|
-
* ```ts
|
|
110
|
-
* BalloonEditor
|
|
111
|
-
* .create( document.querySelector( '#editor' ), {
|
|
112
|
-
* initialData: '<h2>Initial data</h2><p>Foo bar.</p>'
|
|
113
|
-
* } )
|
|
114
|
-
* .then( editor => {
|
|
115
|
-
* console.log( 'Editor was initialized', editor );
|
|
116
|
-
* } )
|
|
117
|
-
* .catch( err => {
|
|
118
|
-
* console.error( err.stack );
|
|
119
|
-
* } );
|
|
120
|
-
* ```
|
|
121
|
-
*
|
|
122
|
-
* This method can be used to initialize the editor on an existing element with the specified content in case if your integration
|
|
123
|
-
* makes it difficult to set the content of the source element.
|
|
124
|
-
*
|
|
125
|
-
* Note that an error will be thrown if you pass the initial data both as the first parameter and also in the configuration.
|
|
126
|
-
*
|
|
127
|
-
* # Configuring the editor
|
|
128
|
-
*
|
|
129
|
-
* See the {@link module:core/editor/editorconfig~EditorConfig editor configuration documentation} to learn more about
|
|
130
|
-
* customizing plugins, toolbar and more.
|
|
131
|
-
*
|
|
132
|
-
* # Using the editor from source
|
|
133
|
-
*
|
|
134
|
-
* The code samples listed in the previous sections of this documentation assume that you are using an
|
|
135
|
-
* {@glink installation/getting-started/predefined-builds editor build} (for example – `@ckeditor/ckeditor5-build-balloon`).
|
|
136
|
-
*
|
|
137
|
-
* If you want to use the balloon editor from source (`@ckeditor/ckeditor5-editor-balloon/src/ballooneditor`),
|
|
138
|
-
* you need to define the list of
|
|
139
|
-
* {@link module:core/editor/editorconfig~EditorConfig#plugins plugins to be initialized} and
|
|
140
|
-
* {@link module:core/editor/editorconfig~EditorConfig#toolbar toolbar items}. Read more about using the editor from
|
|
141
|
-
* source in the {@glink installation/advanced/alternative-setups/integrating-from-source-webpack dedicated guide}.
|
|
142
|
-
*
|
|
143
|
-
* @param sourceElementOrData The DOM element that will be the source for the created editor
|
|
144
|
-
* or the editor's initial data.
|
|
145
|
-
*
|
|
146
|
-
* If a DOM element is passed, its content will be automatically loaded to the editor upon initialization.
|
|
147
|
-
* The editor data will be set back to the original element once the editor is destroyed only if the
|
|
148
|
-
* {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy updateSourceElementOnDestroy}
|
|
149
|
-
* option is set to `true`.
|
|
150
|
-
*
|
|
151
|
-
* If the initial data is passed, a detached editor will be created. In this case you need to insert it into the DOM manually.
|
|
152
|
-
* It is available under the {@link module:editor-balloon/ballooneditorui~BalloonEditorUI#element `editor.ui.element`} property.
|
|
153
|
-
*
|
|
154
|
-
* @param config The editor configuration.
|
|
155
|
-
* @returns A promise resolved once the editor is ready. The promise resolves with the created editor instance.
|
|
156
|
-
*/
|
|
157
|
-
static create(sourceElementOrData: HTMLElement | string, config?: EditorConfig): Promise<BalloonEditor>;
|
|
158
|
-
/**
|
|
159
|
-
* The {@link module:core/context~Context} class.
|
|
160
|
-
*
|
|
161
|
-
* Exposed as static editor field for easier access in editor builds.
|
|
162
|
-
*/
|
|
163
|
-
static Context: typeof Context;
|
|
164
|
-
/**
|
|
165
|
-
* The {@link module:watchdog/editorwatchdog~EditorWatchdog} class.
|
|
166
|
-
*
|
|
167
|
-
* Exposed as static editor field for easier access in editor builds.
|
|
168
|
-
*/
|
|
169
|
-
static EditorWatchdog: typeof EditorWatchdog;
|
|
170
|
-
/**
|
|
171
|
-
* The {@link module:watchdog/contextwatchdog~ContextWatchdog} class.
|
|
172
|
-
*
|
|
173
|
-
* Exposed as static editor field for easier access in editor builds.
|
|
174
|
-
*/
|
|
175
|
-
static ContextWatchdog: typeof ContextWatchdog;
|
|
176
|
-
}
|
|
177
|
-
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-balloon/ballooneditor
|
|
7
|
+
*/
|
|
8
|
+
import { Editor, Context, type EditorConfig } from 'ckeditor5/src/core';
|
|
9
|
+
import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog';
|
|
10
|
+
import BalloonEditorUI from './ballooneditorui';
|
|
11
|
+
declare const BalloonEditor_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#balloon-editor balloon editor}
|
|
14
|
+
* implementation (Medium-like editor).
|
|
15
|
+
* It uses an inline editable and a toolbar based on the {@link module:ui/toolbar/balloon/balloontoolbar~BalloonToolbar}.
|
|
16
|
+
* See the {@glink examples/builds/balloon-editor demo}.
|
|
17
|
+
*
|
|
18
|
+
* In order to create a balloon editor instance, use the static
|
|
19
|
+
* {@link module:editor-balloon/ballooneditor~BalloonEditor.create `BalloonEditor.create()`} method.
|
|
20
|
+
*
|
|
21
|
+
* # Balloon editor and balloon build
|
|
22
|
+
*
|
|
23
|
+
* The balloon editor can be used directly from source (if you installed the
|
|
24
|
+
* [`@ckeditor/ckeditor5-editor-balloon`](https://www.npmjs.com/package/@ckeditor/ckeditor5-editor-balloon) package)
|
|
25
|
+
* but it is also available in the {@glink installation/getting-started/predefined-builds#balloon-editor balloon build}.
|
|
26
|
+
*
|
|
27
|
+
* {@glink installation/getting-started/predefined-builds Builds}
|
|
28
|
+
* are ready-to-use editors with plugins bundled in. When using the editor from
|
|
29
|
+
* source you need to take care of loading all plugins by yourself
|
|
30
|
+
* (through the {@link module:core/editor/editorconfig~EditorConfig#plugins `config.plugins`} option).
|
|
31
|
+
* Using the editor from source gives much better flexibility and allows easier customization.
|
|
32
|
+
*
|
|
33
|
+
* Read more about initializing the editor from source or as a build in
|
|
34
|
+
* {@link module:editor-balloon/ballooneditor~BalloonEditor.create `BalloonEditor.create()`}.
|
|
35
|
+
*/
|
|
36
|
+
export default class BalloonEditor extends BalloonEditor_base {
|
|
37
|
+
/**
|
|
38
|
+
* @inheritDoc
|
|
39
|
+
*/
|
|
40
|
+
readonly ui: BalloonEditorUI;
|
|
41
|
+
/**
|
|
42
|
+
* Creates an instance of the balloon editor.
|
|
43
|
+
*
|
|
44
|
+
* **Note:** do not use the constructor to create editor instances. Use the static
|
|
45
|
+
* {@link module:editor-balloon/ballooneditor~BalloonEditor.create `BalloonEditor.create()`} method instead.
|
|
46
|
+
*
|
|
47
|
+
* @param sourceElementOrData The DOM element that will be the source for the created editor
|
|
48
|
+
* (on which the editor will be initialized) or initial data for the editor. For more information see
|
|
49
|
+
* {@link module:editor-balloon/ballooneditor~BalloonEditor.create `BalloonEditor.create()`}.
|
|
50
|
+
* @param config The editor configuration.
|
|
51
|
+
*/
|
|
52
|
+
protected constructor(sourceElementOrData: HTMLElement | string, config?: EditorConfig);
|
|
53
|
+
/**
|
|
54
|
+
* Destroys the editor instance, releasing all resources used by it.
|
|
55
|
+
*
|
|
56
|
+
* Updates the original editor element with the data if the
|
|
57
|
+
* {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy `updateSourceElementOnDestroy`}
|
|
58
|
+
* configuration option is set to `true`.
|
|
59
|
+
*/
|
|
60
|
+
destroy(): Promise<unknown>;
|
|
61
|
+
/**
|
|
62
|
+
* Creates a new balloon editor instance.
|
|
63
|
+
*
|
|
64
|
+
* There are three general ways how the editor can be initialized.
|
|
65
|
+
*
|
|
66
|
+
* # Using an existing DOM element (and loading data from it)
|
|
67
|
+
*
|
|
68
|
+
* You can initialize the editor using an existing DOM element:
|
|
69
|
+
*
|
|
70
|
+
* ```ts
|
|
71
|
+
* BalloonEditor
|
|
72
|
+
* .create( document.querySelector( '#editor' ) )
|
|
73
|
+
* .then( editor => {
|
|
74
|
+
* console.log( 'Editor was initialized', editor );
|
|
75
|
+
* } )
|
|
76
|
+
* .catch( err => {
|
|
77
|
+
* console.error( err.stack );
|
|
78
|
+
* } );
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* The element's content will be used as the editor data and the element will become the editable element.
|
|
82
|
+
*
|
|
83
|
+
* # Creating a detached editor
|
|
84
|
+
*
|
|
85
|
+
* Alternatively, you can initialize the editor by passing the initial data directly as a string.
|
|
86
|
+
* In this case, the editor will render an element that must be inserted into the DOM for the editor to work properly:
|
|
87
|
+
*
|
|
88
|
+
* ```ts
|
|
89
|
+
* BalloonEditor
|
|
90
|
+
* .create( '<p>Hello world!</p>' )
|
|
91
|
+
* .then( editor => {
|
|
92
|
+
* console.log( 'Editor was initialized', editor );
|
|
93
|
+
*
|
|
94
|
+
* // Initial data was provided so the editor UI element needs to be added manually to the DOM.
|
|
95
|
+
* document.body.appendChild( editor.ui.element );
|
|
96
|
+
* } )
|
|
97
|
+
* .catch( err => {
|
|
98
|
+
* console.error( err.stack );
|
|
99
|
+
* } );
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* This lets you dynamically append the editor to your web page whenever it is convenient for you. You may use this method if your
|
|
103
|
+
* web page content is generated on the client side and the DOM structure is not ready at the moment when you initialize the editor.
|
|
104
|
+
*
|
|
105
|
+
* # Using an existing DOM element (and data provided in `config.initialData`)
|
|
106
|
+
*
|
|
107
|
+
* You can also mix these two ways by providing a DOM element to be used and passing the initial data through the configuration:
|
|
108
|
+
*
|
|
109
|
+
* ```ts
|
|
110
|
+
* BalloonEditor
|
|
111
|
+
* .create( document.querySelector( '#editor' ), {
|
|
112
|
+
* initialData: '<h2>Initial data</h2><p>Foo bar.</p>'
|
|
113
|
+
* } )
|
|
114
|
+
* .then( editor => {
|
|
115
|
+
* console.log( 'Editor was initialized', editor );
|
|
116
|
+
* } )
|
|
117
|
+
* .catch( err => {
|
|
118
|
+
* console.error( err.stack );
|
|
119
|
+
* } );
|
|
120
|
+
* ```
|
|
121
|
+
*
|
|
122
|
+
* This method can be used to initialize the editor on an existing element with the specified content in case if your integration
|
|
123
|
+
* makes it difficult to set the content of the source element.
|
|
124
|
+
*
|
|
125
|
+
* Note that an error will be thrown if you pass the initial data both as the first parameter and also in the configuration.
|
|
126
|
+
*
|
|
127
|
+
* # Configuring the editor
|
|
128
|
+
*
|
|
129
|
+
* See the {@link module:core/editor/editorconfig~EditorConfig editor configuration documentation} to learn more about
|
|
130
|
+
* customizing plugins, toolbar and more.
|
|
131
|
+
*
|
|
132
|
+
* # Using the editor from source
|
|
133
|
+
*
|
|
134
|
+
* The code samples listed in the previous sections of this documentation assume that you are using an
|
|
135
|
+
* {@glink installation/getting-started/predefined-builds editor build} (for example – `@ckeditor/ckeditor5-build-balloon`).
|
|
136
|
+
*
|
|
137
|
+
* If you want to use the balloon editor from source (`@ckeditor/ckeditor5-editor-balloon/src/ballooneditor`),
|
|
138
|
+
* you need to define the list of
|
|
139
|
+
* {@link module:core/editor/editorconfig~EditorConfig#plugins plugins to be initialized} and
|
|
140
|
+
* {@link module:core/editor/editorconfig~EditorConfig#toolbar toolbar items}. Read more about using the editor from
|
|
141
|
+
* source in the {@glink installation/advanced/alternative-setups/integrating-from-source-webpack dedicated guide}.
|
|
142
|
+
*
|
|
143
|
+
* @param sourceElementOrData The DOM element that will be the source for the created editor
|
|
144
|
+
* or the editor's initial data.
|
|
145
|
+
*
|
|
146
|
+
* If a DOM element is passed, its content will be automatically loaded to the editor upon initialization.
|
|
147
|
+
* The editor data will be set back to the original element once the editor is destroyed only if the
|
|
148
|
+
* {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy updateSourceElementOnDestroy}
|
|
149
|
+
* option is set to `true`.
|
|
150
|
+
*
|
|
151
|
+
* If the initial data is passed, a detached editor will be created. In this case you need to insert it into the DOM manually.
|
|
152
|
+
* It is available under the {@link module:editor-balloon/ballooneditorui~BalloonEditorUI#element `editor.ui.element`} property.
|
|
153
|
+
*
|
|
154
|
+
* @param config The editor configuration.
|
|
155
|
+
* @returns A promise resolved once the editor is ready. The promise resolves with the created editor instance.
|
|
156
|
+
*/
|
|
157
|
+
static create(sourceElementOrData: HTMLElement | string, config?: EditorConfig): Promise<BalloonEditor>;
|
|
158
|
+
/**
|
|
159
|
+
* The {@link module:core/context~Context} class.
|
|
160
|
+
*
|
|
161
|
+
* Exposed as static editor field for easier access in editor builds.
|
|
162
|
+
*/
|
|
163
|
+
static Context: typeof Context;
|
|
164
|
+
/**
|
|
165
|
+
* The {@link module:watchdog/editorwatchdog~EditorWatchdog} class.
|
|
166
|
+
*
|
|
167
|
+
* Exposed as static editor field for easier access in editor builds.
|
|
168
|
+
*/
|
|
169
|
+
static EditorWatchdog: typeof EditorWatchdog;
|
|
170
|
+
/**
|
|
171
|
+
* The {@link module:watchdog/contextwatchdog~ContextWatchdog} class.
|
|
172
|
+
*
|
|
173
|
+
* Exposed as static editor field for easier access in editor builds.
|
|
174
|
+
*/
|
|
175
|
+
static ContextWatchdog: typeof ContextWatchdog;
|
|
176
|
+
}
|
|
177
|
+
export {};
|