@ckeditor/ckeditor5-editor-inline 48.2.0 → 48.3.0-alpha.1

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.
@@ -1,235 +1,235 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module editor-inline/inlineeditor
7
- */
8
- import { Editor, type EditorConfig } from '@ckeditor/ckeditor5-core';
9
- import { InlineEditorUI } from './inlineeditorui.js';
10
- declare const InlineEditor_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof Editor, import("@ckeditor/ckeditor5-core").ElementApi>;
6
+ * @module editor-inline/inlineeditor
7
+ */
8
+ import { Editor, type EditorConfig, type ElementApiMixinConstructor } from "@ckeditor/ckeditor5-core";
9
+ import { InlineEditorUI } from "./inlineeditorui.js";
10
+ declare const InlineEditorBase: ElementApiMixinConstructor<typeof Editor>;
11
11
  /**
12
- * The inline editor implementation. It uses an inline editable and a floating toolbar.
13
- * See the {@glink examples/builds/inline-editor demo}.
14
- *
15
- * In order to create a inline editor instance, use the static
16
- * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`} method.
17
- */
18
- export declare class InlineEditor extends /* #__PURE__ */ InlineEditor_base {
19
- /**
20
- * @inheritDoc
21
- */
22
- static get editorName(): 'InlineEditor';
23
- /**
24
- * @inheritDoc
25
- */
26
- readonly ui: InlineEditorUI;
27
- /**
28
- * Creates an instance of the inline editor.
29
- *
30
- * **Note:** Do not use the constructor to create editor instances. Use the static
31
- * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`} method instead.
32
- *
33
- * @param config The editor configuration.
34
- */
35
- protected constructor(config: EditorConfig);
36
- /**
37
- * Creates an instance of the inline editor.
38
- *
39
- * **Note:** Do not use the constructor to create editor instances. Use the static
40
- * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`} method instead.
41
- *
42
- * **Note**: This constructor signature is deprecated and will be removed in the future release.
43
- *
44
- * @deprecated
45
- * @param sourceElementOrData The DOM element that will be the source for the created editor
46
- * (on which the editor will be initialized) or initial data for the editor. For more information see
47
- * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`}.
48
- * @param config The editor configuration.
49
- */
50
- protected constructor(sourceElementOrData: HTMLElement | string, config: EditorConfig);
51
- /**
52
- * Destroys the editor instance, releasing all resources used by it.
53
- *
54
- * Updates the original editor element with the data if the
55
- * {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy `updateSourceElementOnDestroy`}
56
- * configuration option is set to `true`.
57
- */
58
- destroy(): Promise<unknown>;
59
- /**
60
- * Creates a new inline editor instance.
61
- *
62
- * There are three general ways how the editor can be initialized.
63
- *
64
- * # Using an existing DOM element (and loading data from it)
65
- *
66
- * You can initialize the editor using an existing DOM element:
67
- *
68
- * ```ts
69
- * InlineEditor
70
- * .create( {
71
- * root: {
72
- * element: document.querySelector( '#editor' )
73
- * }
74
- * } )
75
- * .then( editor => {
76
- * console.log( 'Editor was initialized', editor );
77
- * } )
78
- * .catch( err => {
79
- * console.error( err.stack );
80
- * } );
81
- * ```
82
- *
83
- * The element's content will be used as the editor data and the element will become the editable element.
84
- *
85
- * # Creating a detached editor
86
- *
87
- * Alternatively, you can initialize the editor by passing the initial data directly as a `String`.
88
- * In this case, the editor will render an element that must be inserted into the DOM for the editor to work properly:
89
- *
90
- * ```ts
91
- * InlineEditor
92
- * .create( {
93
- * root: {
94
- * initialData: '<p>Hello world!</p>'
95
- * }
96
- * } )
97
- * .then( editor => {
98
- * console.log( 'Editor was initialized', editor );
99
- *
100
- * // Initial data was provided so the editor UI element needs to be added manually to the DOM.
101
- * document.body.appendChild( editor.ui.element );
102
- * } )
103
- * .catch( err => {
104
- * console.error( err.stack );
105
- * } );
106
- * ```
107
- *
108
- * This lets you dynamically append the editor to your web page whenever it is convenient for you. You may use this method if your
109
- * web page content is generated on the client side and the DOM structure is not ready at the moment when you initialize the editor.
110
- *
111
- * # Using an existing DOM element (and data provided in `config.root.initialData`)
112
- *
113
- * You can also mix these two ways by providing a DOM element to be used and passing the initial data through the configuration:
114
- *
115
- * ```ts
116
- * InlineEditor
117
- * .create( {
118
- * root: {
119
- * element: document.querySelector( '#editor' ),
120
- * initialData: '<h2>Initial data</h2><p>Foo bar.</p>'
121
- * }
122
- * } )
123
- * .then( editor => {
124
- * console.log( 'Editor was initialized', editor );
125
- * } )
126
- * .catch( err => {
127
- * console.error( err.stack );
128
- * } );
129
- * ```
130
- *
131
- * This method can be used to initialize the editor on an existing element with the specified content in case if your integration
132
- * makes it difficult to set the content of the source element.
133
- *
134
- * # Configuring the editor
135
- *
136
- * See the {@link module:core/editor/editorconfig~EditorConfig editor configuration documentation} to learn more about
137
- * customizing plugins, toolbar and more.
138
- *
139
- * @param config The editor configuration.
140
- * @returns A promise resolved once the editor is ready. The promise resolves with the created editor instance.
141
- */
142
- static create(config: EditorConfig): Promise<InlineEditor>;
143
- /**
144
- * Creates a new inline editor instance.
145
- *
146
- * **Note**: This method signature is deprecated and will be removed in the future release.
147
- *
148
- * There are three general ways how the editor can be initialized.
149
- *
150
- * # Using an existing DOM element (and loading data from it)
151
- *
152
- * You can initialize the editor using an existing DOM element:
153
- *
154
- * ```ts
155
- * InlineEditor
156
- * .create( document.querySelector( '#editor' ) )
157
- * .then( editor => {
158
- * console.log( 'Editor was initialized', editor );
159
- * } )
160
- * .catch( err => {
161
- * console.error( err.stack );
162
- * } );
163
- * ```
164
- *
165
- * The element's content will be used as the editor data and the element will become the editable element.
166
- *
167
- * # Creating a detached editor
168
- *
169
- * Alternatively, you can initialize the editor by passing the initial data directly as a `String`.
170
- * In this case, the editor will render an element that must be inserted into the DOM for the editor to work properly:
171
- *
172
- * ```ts
173
- * InlineEditor
174
- * .create( '<p>Hello world!</p>' )
175
- * .then( editor => {
176
- * console.log( 'Editor was initialized', editor );
177
- *
178
- * // Initial data was provided so the editor UI element needs to be added manually to the DOM.
179
- * document.body.appendChild( editor.ui.element );
180
- * } )
181
- * .catch( err => {
182
- * console.error( err.stack );
183
- * } );
184
- * ```
185
- *
186
- * This lets you dynamically append the editor to your web page whenever it is convenient for you. You may use this method if your
187
- * web page content is generated on the client side and the DOM structure is not ready at the moment when you initialize the editor.
188
- *
189
- * # Using an existing DOM element (and data provided in `config.root.initialData`)
190
- *
191
- * You can also mix these two ways by providing a DOM element to be used and passing the initial data through the configuration:
192
- *
193
- * ```ts
194
- * InlineEditor
195
- * .create( document.querySelector( '#editor' ), {
196
- * root: {
197
- * initialData: '<h2>Initial data</h2><p>Foo bar.</p>'
198
- * }
199
- * } )
200
- * .then( editor => {
201
- * console.log( 'Editor was initialized', editor );
202
- * } )
203
- * .catch( err => {
204
- * console.error( err.stack );
205
- * } );
206
- * ```
207
- *
208
- * This method can be used to initialize the editor on an existing element with the specified content in case if your integration
209
- * makes it difficult to set the content of the source element.
210
- *
211
- * Note that an error will be thrown if you pass the initial data both as the first parameter and also in the configuration.
212
- *
213
- * # Configuring the editor
214
- *
215
- * See the {@link module:core/editor/editorconfig~EditorConfig editor configuration documentation} to learn more about
216
- * customizing plugins, toolbar and more.
217
- *
218
- * @deprecated
219
- * @param sourceElementOrData The DOM element that will be the source for the created editor
220
- * or the editor's initial data.
221
- *
222
- * If a DOM element is passed, its content will be automatically loaded to the editor upon initialization.
223
- * The editor data will be set back to the original element once the editor is destroyed only if the
224
- * {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy updateSourceElementOnDestroy}
225
- * option is set to `true`.
226
- *
227
- * If the initial data is passed, a detached editor will be created. In this case you need to insert it into the DOM manually.
228
- * It is available under the {@link module:editor-inline/inlineeditorui~InlineEditorUI#element `editor.ui.element`} property.
229
- *
230
- * @param config The editor configuration.
231
- * @returns A promise resolved once the editor is ready. The promise resolves with the created editor instance.
232
- */
233
- static create(sourceElementOrData: HTMLElement | string, config: EditorConfig): Promise<InlineEditor>;
12
+ * The inline editor implementation. It uses an inline editable and a floating toolbar.
13
+ * See the {@glink examples/builds/inline-editor demo}.
14
+ *
15
+ * In order to create a inline editor instance, use the static
16
+ * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`} method.
17
+ */
18
+ export declare class InlineEditor extends InlineEditorBase {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static override get editorName(): "InlineEditor";
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ readonly ui: InlineEditorUI;
27
+ /**
28
+ * Creates an instance of the inline editor.
29
+ *
30
+ * **Note:** Do not use the constructor to create editor instances. Use the static
31
+ * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`} method instead.
32
+ *
33
+ * @param config The editor configuration.
34
+ */
35
+ protected constructor(config: EditorConfig);
36
+ /**
37
+ * Creates an instance of the inline editor.
38
+ *
39
+ * **Note:** Do not use the constructor to create editor instances. Use the static
40
+ * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`} method instead.
41
+ *
42
+ * **Note**: This constructor signature is deprecated and will be removed in the future release.
43
+ *
44
+ * @deprecated
45
+ * @param sourceElementOrData The DOM element that will be the source for the created editor
46
+ * (on which the editor will be initialized) or initial data for the editor. For more information see
47
+ * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`}.
48
+ * @param config The editor configuration.
49
+ */
50
+ protected constructor(sourceElementOrData: HTMLElement | string, config: EditorConfig);
51
+ /**
52
+ * Destroys the editor instance, releasing all resources used by it.
53
+ *
54
+ * Updates the original editor element with the data if the
55
+ * {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy `updateSourceElementOnDestroy`}
56
+ * configuration option is set to `true`.
57
+ */
58
+ override destroy(): Promise<unknown>;
59
+ /**
60
+ * Creates a new inline editor instance.
61
+ *
62
+ * There are three general ways how the editor can be initialized.
63
+ *
64
+ * # Using an existing DOM element (and loading data from it)
65
+ *
66
+ * You can initialize the editor using an existing DOM element:
67
+ *
68
+ * ```ts
69
+ * InlineEditor
70
+ * .create( {
71
+ * root: {
72
+ * element: document.querySelector( '#editor' )
73
+ * }
74
+ * } )
75
+ * .then( editor => {
76
+ * console.log( 'Editor was initialized', editor );
77
+ * } )
78
+ * .catch( err => {
79
+ * console.error( err.stack );
80
+ * } );
81
+ * ```
82
+ *
83
+ * The element's content will be used as the editor data and the element will become the editable element.
84
+ *
85
+ * # Creating a detached editor
86
+ *
87
+ * Alternatively, you can initialize the editor by passing the initial data directly as a `String`.
88
+ * In this case, the editor will render an element that must be inserted into the DOM for the editor to work properly:
89
+ *
90
+ * ```ts
91
+ * InlineEditor
92
+ * .create( {
93
+ * root: {
94
+ * initialData: '<p>Hello world!</p>'
95
+ * }
96
+ * } )
97
+ * .then( editor => {
98
+ * console.log( 'Editor was initialized', editor );
99
+ *
100
+ * // Initial data was provided so the editor UI element needs to be added manually to the DOM.
101
+ * document.body.appendChild( editor.ui.element );
102
+ * } )
103
+ * .catch( err => {
104
+ * console.error( err.stack );
105
+ * } );
106
+ * ```
107
+ *
108
+ * This lets you dynamically append the editor to your web page whenever it is convenient for you. You may use this method if your
109
+ * web page content is generated on the client side and the DOM structure is not ready at the moment when you initialize the editor.
110
+ *
111
+ * # Using an existing DOM element (and data provided in `config.root.initialData`)
112
+ *
113
+ * You can also mix these two ways by providing a DOM element to be used and passing the initial data through the configuration:
114
+ *
115
+ * ```ts
116
+ * InlineEditor
117
+ * .create( {
118
+ * root: {
119
+ * element: document.querySelector( '#editor' ),
120
+ * initialData: '<h2>Initial data</h2><p>Foo bar.</p>'
121
+ * }
122
+ * } )
123
+ * .then( editor => {
124
+ * console.log( 'Editor was initialized', editor );
125
+ * } )
126
+ * .catch( err => {
127
+ * console.error( err.stack );
128
+ * } );
129
+ * ```
130
+ *
131
+ * This method can be used to initialize the editor on an existing element with the specified content in case if your integration
132
+ * makes it difficult to set the content of the source element.
133
+ *
134
+ * # Configuring the editor
135
+ *
136
+ * See the {@link module:core/editor/editorconfig~EditorConfig editor configuration documentation} to learn more about
137
+ * customizing plugins, toolbar and more.
138
+ *
139
+ * @param config The editor configuration.
140
+ * @returns A promise resolved once the editor is ready. The promise resolves with the created editor instance.
141
+ */
142
+ static override create(config: EditorConfig): Promise<InlineEditor>;
143
+ /**
144
+ * Creates a new inline editor instance.
145
+ *
146
+ * **Note**: This method signature is deprecated and will be removed in the future release.
147
+ *
148
+ * There are three general ways how the editor can be initialized.
149
+ *
150
+ * # Using an existing DOM element (and loading data from it)
151
+ *
152
+ * You can initialize the editor using an existing DOM element:
153
+ *
154
+ * ```ts
155
+ * InlineEditor
156
+ * .create( document.querySelector( '#editor' ) )
157
+ * .then( editor => {
158
+ * console.log( 'Editor was initialized', editor );
159
+ * } )
160
+ * .catch( err => {
161
+ * console.error( err.stack );
162
+ * } );
163
+ * ```
164
+ *
165
+ * The element's content will be used as the editor data and the element will become the editable element.
166
+ *
167
+ * # Creating a detached editor
168
+ *
169
+ * Alternatively, you can initialize the editor by passing the initial data directly as a `String`.
170
+ * In this case, the editor will render an element that must be inserted into the DOM for the editor to work properly:
171
+ *
172
+ * ```ts
173
+ * InlineEditor
174
+ * .create( '<p>Hello world!</p>' )
175
+ * .then( editor => {
176
+ * console.log( 'Editor was initialized', editor );
177
+ *
178
+ * // Initial data was provided so the editor UI element needs to be added manually to the DOM.
179
+ * document.body.appendChild( editor.ui.element );
180
+ * } )
181
+ * .catch( err => {
182
+ * console.error( err.stack );
183
+ * } );
184
+ * ```
185
+ *
186
+ * This lets you dynamically append the editor to your web page whenever it is convenient for you. You may use this method if your
187
+ * web page content is generated on the client side and the DOM structure is not ready at the moment when you initialize the editor.
188
+ *
189
+ * # Using an existing DOM element (and data provided in `config.root.initialData`)
190
+ *
191
+ * You can also mix these two ways by providing a DOM element to be used and passing the initial data through the configuration:
192
+ *
193
+ * ```ts
194
+ * InlineEditor
195
+ * .create( document.querySelector( '#editor' ), {
196
+ * root: {
197
+ * initialData: '<h2>Initial data</h2><p>Foo bar.</p>'
198
+ * }
199
+ * } )
200
+ * .then( editor => {
201
+ * console.log( 'Editor was initialized', editor );
202
+ * } )
203
+ * .catch( err => {
204
+ * console.error( err.stack );
205
+ * } );
206
+ * ```
207
+ *
208
+ * This method can be used to initialize the editor on an existing element with the specified content in case if your integration
209
+ * makes it difficult to set the content of the source element.
210
+ *
211
+ * Note that an error will be thrown if you pass the initial data both as the first parameter and also in the configuration.
212
+ *
213
+ * # Configuring the editor
214
+ *
215
+ * See the {@link module:core/editor/editorconfig~EditorConfig editor configuration documentation} to learn more about
216
+ * customizing plugins, toolbar and more.
217
+ *
218
+ * @deprecated
219
+ * @param sourceElementOrData The DOM element that will be the source for the created editor
220
+ * or the editor's initial data.
221
+ *
222
+ * If a DOM element is passed, its content will be automatically loaded to the editor upon initialization.
223
+ * The editor data will be set back to the original element once the editor is destroyed only if the
224
+ * {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy updateSourceElementOnDestroy}
225
+ * option is set to `true`.
226
+ *
227
+ * If the initial data is passed, a detached editor will be created. In this case you need to insert it into the DOM manually.
228
+ * It is available under the {@link module:editor-inline/inlineeditorui~InlineEditorUI#element `editor.ui.element`} property.
229
+ *
230
+ * @param config The editor configuration.
231
+ * @returns A promise resolved once the editor is ready. The promise resolves with the created editor instance.
232
+ */
233
+ static override create(sourceElementOrData: HTMLElement | string, config: EditorConfig): Promise<InlineEditor>;
234
234
  }
235
235
  export {};
@@ -1,52 +1,52 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module editor-inline/inlineeditorui
7
- */
8
- import { type Editor } from '@ckeditor/ckeditor5-core';
9
- import { EditorUI } from '@ckeditor/ckeditor5-ui';
10
- import { type InlineEditorUIView } from './inlineeditoruiview.js';
6
+ * @module editor-inline/inlineeditorui
7
+ */
8
+ import { type Editor } from "@ckeditor/ckeditor5-core";
9
+ import { EditorUI } from "@ckeditor/ckeditor5-ui";
10
+ import { type InlineEditorUIView } from "./inlineeditoruiview.js";
11
11
  /**
12
- * The inline editor UI class.
13
- *
14
- * @extends module:ui/editorui/editorui~EditorUI
15
- */
12
+ * The inline editor UI class.
13
+ *
14
+ * @extends module:ui/editorui/editorui~EditorUI
15
+ */
16
16
  export declare class InlineEditorUI extends EditorUI {
17
- /**
18
- * The main (top–most) view of the editor UI.
19
- */
20
- readonly view: InlineEditorUIView;
21
- /**
22
- * A normalized `config.toolbar` object.
23
- */
24
- private readonly _toolbarConfig;
25
- /**
26
- * Creates an instance of the inline editor UI class.
27
- *
28
- * @param editor The editor instance.
29
- * @param view The view of the UI.
30
- */
31
- constructor(editor: Editor, view: InlineEditorUIView);
32
- /**
33
- * @inheritDoc
34
- */
35
- get element(): HTMLElement | null;
36
- /**
37
- * Initializes the UI.
38
- */
39
- init(): void;
40
- /**
41
- * @inheritDoc
42
- */
43
- destroy(): void;
44
- /**
45
- * Initializes the inline editor toolbar and its panel.
46
- */
47
- private _initToolbar;
48
- /**
49
- * Enable the placeholder text on the editing root.
50
- */
51
- private _initPlaceholder;
17
+ /**
18
+ * The main (top–most) view of the editor UI.
19
+ */
20
+ readonly view: InlineEditorUIView;
21
+ /**
22
+ * A normalized `config.toolbar` object.
23
+ */
24
+ private readonly _toolbarConfig;
25
+ /**
26
+ * Creates an instance of the inline editor UI class.
27
+ *
28
+ * @param editor The editor instance.
29
+ * @param view The view of the UI.
30
+ */
31
+ constructor(editor: Editor, view: InlineEditorUIView);
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ override get element(): HTMLElement | null;
36
+ /**
37
+ * Initializes the UI.
38
+ */
39
+ init(): void;
40
+ /**
41
+ * @inheritDoc
42
+ */
43
+ override destroy(): void;
44
+ /**
45
+ * Initializes the inline editor toolbar and its panel.
46
+ */
47
+ private _initToolbar;
48
+ /**
49
+ * Enable the placeholder text on the editing root.
50
+ */
51
+ private _initPlaceholder;
52
52
  }