@ckeditor/ckeditor5-editor-balloon 38.1.1 → 38.2.0-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-editor-balloon",
3
- "version": "38.1.1",
3
+ "version": "38.2.0-alpha.1",
4
4
  "description": "Balloon editor implementation for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -10,8 +10,9 @@
10
10
  "ckeditor5-dll"
11
11
  ],
12
12
  "main": "src/index.js",
13
+ "type": "module",
13
14
  "dependencies": {
14
- "ckeditor5": "38.1.1",
15
+ "ckeditor5": "38.2.0-alpha.1",
15
16
  "lodash-es": "^4.17.15"
16
17
  },
17
18
  "engines": {
@@ -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.js';
9
+ import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog.js';
10
+ import BalloonEditorUI from './ballooneditorui.js';
11
+ declare const BalloonEditor_base: import("ckeditor5/src/utils.js").Mixed<import("ckeditor5/src/utils.js").Mixed<typeof Editor, import("ckeditor5/src/core.js").ElementApi>, import("ckeditor5/src/core.js").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 {};