@ckeditor/ckeditor5-editor-inline 48.2.0-alpha.7 → 48.3.0-alpha.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/dist/index.css.map +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.js +355 -380
- package/dist/index.js.map +1 -1
- package/dist/inlineeditor.d.ts +230 -230
- package/dist/inlineeditorui.d.ts +47 -47
- package/dist/inlineeditoruiview.d.ts +138 -138
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -2,392 +2,367 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { enableViewPlaceholder } from
|
|
8
|
-
import {
|
|
9
|
-
import { isElement
|
|
5
|
+
import { Editor, ElementApiMixin, attachToForm, normalizeRootsConfig, normalizeSingleRootEditorConstructorParams, registerAndInitializeRootConfigAttributes, rootAcceptsBlocks, secureSourceElement, verifyRootElements } from "@ckeditor/ckeditor5-core";
|
|
6
|
+
import { BalloonPanelView, EditorUI, EditorUIView, InlineEditableUIView, MenuBarView, ToolbarView, normalizeToolbarConfig } from "@ckeditor/ckeditor5-ui";
|
|
7
|
+
import { enableViewPlaceholder } from "@ckeditor/ckeditor5-engine";
|
|
8
|
+
import { Rect, ResizeObserver, toUnit } from "@ckeditor/ckeditor5-utils";
|
|
9
|
+
import { isElement } from "es-toolkit/compat";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const editor = this.editor;
|
|
117
|
-
const editingView = editor.editing.view;
|
|
118
|
-
const editingRoot = editingView.document.getRoot();
|
|
119
|
-
const placeholder = editor.config.get('roots')[editingRoot.rootName].placeholder;
|
|
120
|
-
if (placeholder) {
|
|
121
|
-
editingRoot.placeholder = placeholder;
|
|
122
|
-
}
|
|
123
|
-
enableViewPlaceholder({
|
|
124
|
-
view: editingView,
|
|
125
|
-
element: editingRoot,
|
|
126
|
-
isDirectHost: this.view.editable.isInlineRoot,
|
|
127
|
-
keepOnFocus: true
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
}
|
|
12
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
13
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @module editor-inline/inlineeditorui
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* The inline editor UI class.
|
|
20
|
+
*
|
|
21
|
+
* @extends module:ui/editorui/editorui~EditorUI
|
|
22
|
+
*/
|
|
23
|
+
var InlineEditorUI = class extends EditorUI {
|
|
24
|
+
/**
|
|
25
|
+
* The main (top–most) view of the editor UI.
|
|
26
|
+
*/
|
|
27
|
+
view;
|
|
28
|
+
/**
|
|
29
|
+
* A normalized `config.toolbar` object.
|
|
30
|
+
*/
|
|
31
|
+
_toolbarConfig;
|
|
32
|
+
/**
|
|
33
|
+
* Creates an instance of the inline editor UI class.
|
|
34
|
+
*
|
|
35
|
+
* @param editor The editor instance.
|
|
36
|
+
* @param view The view of the UI.
|
|
37
|
+
*/
|
|
38
|
+
constructor(editor, view) {
|
|
39
|
+
super(editor);
|
|
40
|
+
this.view = view;
|
|
41
|
+
this._toolbarConfig = normalizeToolbarConfig(editor.config.get("toolbar"));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @inheritDoc
|
|
45
|
+
*/
|
|
46
|
+
get element() {
|
|
47
|
+
return this.view.editable.element;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Initializes the UI.
|
|
51
|
+
*/
|
|
52
|
+
init() {
|
|
53
|
+
const editor = this.editor;
|
|
54
|
+
const view = this.view;
|
|
55
|
+
const editingView = editor.editing.view;
|
|
56
|
+
const editable = view.editable;
|
|
57
|
+
const editingRoot = editingView.document.getRoot();
|
|
58
|
+
editable.name = editingRoot.rootName;
|
|
59
|
+
editable.isInlineRoot = !rootAcceptsBlocks(editor, editingRoot.rootName);
|
|
60
|
+
view.render();
|
|
61
|
+
const editableElement = editable.element;
|
|
62
|
+
this.setEditableElement(editable.name, editableElement);
|
|
63
|
+
editable.bind("isFocused").to(this.focusTracker);
|
|
64
|
+
editingView.attachDomRoot(editableElement);
|
|
65
|
+
this._initPlaceholder();
|
|
66
|
+
this._initToolbar();
|
|
67
|
+
if (view.menuBarView) this.initMenuBar(view.menuBarView);
|
|
68
|
+
this.fire("ready");
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @inheritDoc
|
|
72
|
+
*/
|
|
73
|
+
destroy() {
|
|
74
|
+
super.destroy();
|
|
75
|
+
const view = this.view;
|
|
76
|
+
const editingView = this.editor.editing.view;
|
|
77
|
+
if (editingView.getDomRoot(view.editable.name)) editingView.detachDomRoot(view.editable.name);
|
|
78
|
+
view.destroy();
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Initializes the inline editor toolbar and its panel.
|
|
82
|
+
*/
|
|
83
|
+
_initToolbar() {
|
|
84
|
+
const editor = this.editor;
|
|
85
|
+
const view = this.view;
|
|
86
|
+
const editableElement = view.editable.element;
|
|
87
|
+
const toolbar = view.toolbar;
|
|
88
|
+
view.panel.bind("isVisible").to(this.focusTracker, "isFocused");
|
|
89
|
+
view.bind("viewportTopOffset").to(this, "viewportOffset", ({ visualTop }) => visualTop || 0);
|
|
90
|
+
view.listenTo(editor.ui, "update", () => {
|
|
91
|
+
if (view.panel.isVisible) view.panel.pin({
|
|
92
|
+
target: editableElement,
|
|
93
|
+
positions: view.panelPositions
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
toolbar.fillFromConfig(this._toolbarConfig, this.componentFactory);
|
|
97
|
+
this.addToolbar(toolbar);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Enable the placeholder text on the editing root.
|
|
101
|
+
*/
|
|
102
|
+
_initPlaceholder() {
|
|
103
|
+
const editor = this.editor;
|
|
104
|
+
const editingView = editor.editing.view;
|
|
105
|
+
const editingRoot = editingView.document.getRoot();
|
|
106
|
+
const placeholder = editor.config.get("roots")[editingRoot.rootName].placeholder;
|
|
107
|
+
if (placeholder) editingRoot.placeholder = placeholder;
|
|
108
|
+
enableViewPlaceholder({
|
|
109
|
+
view: editingView,
|
|
110
|
+
element: editingRoot,
|
|
111
|
+
isDirectHost: this.view.editable.isInlineRoot,
|
|
112
|
+
keepOnFocus: true
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
};
|
|
131
116
|
|
|
132
|
-
const toPx = /* #__PURE__ */ toUnit('px');
|
|
133
117
|
/**
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
left: editableRect.left + editableRect.width - panelRect.width,
|
|
303
|
-
name: 'toolbar_east',
|
|
304
|
-
config: {
|
|
305
|
-
withArrow: false
|
|
306
|
-
}
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
];
|
|
310
|
-
if (this.locale.uiLanguageDirection === 'ltr') {
|
|
311
|
-
return positions;
|
|
312
|
-
} else {
|
|
313
|
-
return positions.reverse();
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
118
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
119
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
120
|
+
*/
|
|
121
|
+
/**
|
|
122
|
+
* @module editor-inline/inlineeditoruiview
|
|
123
|
+
*/
|
|
124
|
+
const toPx = /* #__PURE__ */ toUnit("px");
|
|
125
|
+
/**
|
|
126
|
+
* Inline editor UI view. Uses an nline editable and a floating toolbar.
|
|
127
|
+
*/
|
|
128
|
+
var InlineEditorUIView = class extends EditorUIView {
|
|
129
|
+
/**
|
|
130
|
+
* A floating toolbar view instance.
|
|
131
|
+
*/
|
|
132
|
+
toolbar;
|
|
133
|
+
/**
|
|
134
|
+
* A balloon panel view instance.
|
|
135
|
+
*/
|
|
136
|
+
panel;
|
|
137
|
+
/**
|
|
138
|
+
* A set of positioning functions used by the {@link #panel} to float around
|
|
139
|
+
* {@link #element editableElement}.
|
|
140
|
+
*
|
|
141
|
+
* The positioning functions are as follows:
|
|
142
|
+
*
|
|
143
|
+
* * West:
|
|
144
|
+
*
|
|
145
|
+
* ```
|
|
146
|
+
* [ Panel ]
|
|
147
|
+
* +------------------+
|
|
148
|
+
* | #editableElement |
|
|
149
|
+
* +------------------+
|
|
150
|
+
*
|
|
151
|
+
* +------------------+
|
|
152
|
+
* | #editableElement |
|
|
153
|
+
* |[ Panel ] |
|
|
154
|
+
* | |
|
|
155
|
+
* +------------------+
|
|
156
|
+
*
|
|
157
|
+
* +------------------+
|
|
158
|
+
* | #editableElement |
|
|
159
|
+
* +------------------+
|
|
160
|
+
* [ Panel ]
|
|
161
|
+
* ```
|
|
162
|
+
*
|
|
163
|
+
* * East:
|
|
164
|
+
*
|
|
165
|
+
* ```
|
|
166
|
+
* [ Panel ]
|
|
167
|
+
* +------------------+
|
|
168
|
+
* | #editableElement |
|
|
169
|
+
* +------------------+
|
|
170
|
+
*
|
|
171
|
+
* +------------------+
|
|
172
|
+
* | #editableElement |
|
|
173
|
+
* | [ Panel ]|
|
|
174
|
+
* | |
|
|
175
|
+
* +------------------+
|
|
176
|
+
*
|
|
177
|
+
* +------------------+
|
|
178
|
+
* | #editableElement |
|
|
179
|
+
* +------------------+
|
|
180
|
+
* [ Panel ]
|
|
181
|
+
* ```
|
|
182
|
+
*
|
|
183
|
+
* See: {@link module:utils/dom/position~DomOptimalPositionOptions#positions}.
|
|
184
|
+
*/
|
|
185
|
+
panelPositions;
|
|
186
|
+
/**
|
|
187
|
+
* Editable UI view.
|
|
188
|
+
*/
|
|
189
|
+
editable;
|
|
190
|
+
/**
|
|
191
|
+
* An instance of the resize observer that helps dynamically determine the geometry of the toolbar
|
|
192
|
+
* and manage items that do not fit into a single row.
|
|
193
|
+
*
|
|
194
|
+
* **Note:** Created in {@link #render}.
|
|
195
|
+
*/
|
|
196
|
+
_resizeObserver;
|
|
197
|
+
/**
|
|
198
|
+
* Creates an instance of the inline editor UI view.
|
|
199
|
+
*
|
|
200
|
+
* @param locale The {@link module:core/editor/editor~Editor#locale} instance.
|
|
201
|
+
* @param editingView The editing view instance this view is related to.
|
|
202
|
+
* @param editableElement The editable element. If not specified, it will be automatically created by
|
|
203
|
+
* {@link module:ui/editableui/editableuiview~EditableUIView}. Otherwise, the given element will be used.
|
|
204
|
+
* @param options Configuration options for the view instance.
|
|
205
|
+
* @param options.shouldToolbarGroupWhenFull When set `true` enables automatic items grouping
|
|
206
|
+
* in the main {@link module:editor-inline/inlineeditoruiview~InlineEditorUIView#toolbar toolbar}.
|
|
207
|
+
* See {@link module:ui/toolbar/toolbarview~ToolbarOptions#shouldGroupWhenFull} to learn more.
|
|
208
|
+
* @param options.label When set, this value will be used as an accessible `aria-label` of the
|
|
209
|
+
* {@link module:ui/editableui/editableuiview~EditableUIView editable view}.
|
|
210
|
+
*/
|
|
211
|
+
constructor(locale, editingView, editableElement, options = {}) {
|
|
212
|
+
super(locale);
|
|
213
|
+
this.toolbar = new ToolbarView(locale, {
|
|
214
|
+
shouldGroupWhenFull: options.shouldToolbarGroupWhenFull,
|
|
215
|
+
isFloating: true
|
|
216
|
+
});
|
|
217
|
+
if (options.useMenuBar) this.menuBarView = new MenuBarView(locale);
|
|
218
|
+
this.set("viewportTopOffset", 0);
|
|
219
|
+
this.panel = new BalloonPanelView(locale);
|
|
220
|
+
this.panelPositions = this._getPanelPositions();
|
|
221
|
+
this.panel.extendTemplate({ attributes: { class: "ck-toolbar-container" } });
|
|
222
|
+
this.editable = new InlineEditableUIView(locale, editingView, editableElement, { label: options.label });
|
|
223
|
+
this._resizeObserver = null;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* @inheritDoc
|
|
227
|
+
*/
|
|
228
|
+
render() {
|
|
229
|
+
super.render();
|
|
230
|
+
this.body.add(this.panel);
|
|
231
|
+
this.registerChild(this.editable);
|
|
232
|
+
if (this.menuBarView) this.panel.content.addMany([this.menuBarView, this.toolbar]);
|
|
233
|
+
else this.panel.content.add(this.toolbar);
|
|
234
|
+
if (this.toolbar.options.shouldGroupWhenFull) {
|
|
235
|
+
const editableElement = this.editable.element;
|
|
236
|
+
this._resizeObserver = new ResizeObserver(editableElement, () => {
|
|
237
|
+
this.toolbar.maxWidth = toPx(new Rect(editableElement).width);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* @inheritDoc
|
|
243
|
+
*/
|
|
244
|
+
destroy() {
|
|
245
|
+
super.destroy();
|
|
246
|
+
if (this._resizeObserver) this._resizeObserver.destroy();
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Determines the panel top position of the {@link #panel} in {@link #panelPositions}.
|
|
250
|
+
*
|
|
251
|
+
* @param editableRect Rect of the {@link #element}.
|
|
252
|
+
* @param panelRect Rect of the {@link #panel}.
|
|
253
|
+
*/
|
|
254
|
+
_getPanelPositionTop(editableRect, panelRect) {
|
|
255
|
+
let top;
|
|
256
|
+
if (editableRect.top > panelRect.height + this.viewportTopOffset) top = editableRect.top - panelRect.height;
|
|
257
|
+
else if (editableRect.bottom > panelRect.height + this.viewportTopOffset + 50) top = this.viewportTopOffset;
|
|
258
|
+
else top = editableRect.bottom;
|
|
259
|
+
return top;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Returns the positions for {@link #panelPositions}.
|
|
263
|
+
*
|
|
264
|
+
* See: {@link module:utils/dom/position~DomOptimalPositionOptions#positions}.
|
|
265
|
+
*/
|
|
266
|
+
_getPanelPositions() {
|
|
267
|
+
const positions = [(editableRect, panelRect) => {
|
|
268
|
+
return {
|
|
269
|
+
top: this._getPanelPositionTop(editableRect, panelRect),
|
|
270
|
+
left: editableRect.left,
|
|
271
|
+
name: "toolbar_west",
|
|
272
|
+
config: { withArrow: false }
|
|
273
|
+
};
|
|
274
|
+
}, (editableRect, panelRect) => {
|
|
275
|
+
return {
|
|
276
|
+
top: this._getPanelPositionTop(editableRect, panelRect),
|
|
277
|
+
left: editableRect.left + editableRect.width - panelRect.width,
|
|
278
|
+
name: "toolbar_east",
|
|
279
|
+
config: { withArrow: false }
|
|
280
|
+
};
|
|
281
|
+
}];
|
|
282
|
+
if (this.locale.uiLanguageDirection === "ltr") return positions;
|
|
283
|
+
else return positions.reverse();
|
|
284
|
+
}
|
|
285
|
+
};
|
|
317
286
|
|
|
318
287
|
/**
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
|
|
288
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
289
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
290
|
+
*/
|
|
291
|
+
/**
|
|
292
|
+
* @module editor-inline/inlineeditor
|
|
293
|
+
*/
|
|
294
|
+
const InlineEditorBase = /* #__PURE__ */ ElementApiMixin(Editor);
|
|
295
|
+
/**
|
|
296
|
+
* The inline editor implementation. It uses an inline editable and a floating toolbar.
|
|
297
|
+
* See the {@glink examples/builds/inline-editor demo}.
|
|
298
|
+
*
|
|
299
|
+
* In order to create a inline editor instance, use the static
|
|
300
|
+
* {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`} method.
|
|
301
|
+
*/
|
|
302
|
+
var InlineEditor = class extends InlineEditorBase {
|
|
303
|
+
/**
|
|
304
|
+
* @inheritDoc
|
|
305
|
+
*/
|
|
306
|
+
static get editorName() {
|
|
307
|
+
return "InlineEditor";
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* @inheritDoc
|
|
311
|
+
*/
|
|
312
|
+
ui;
|
|
313
|
+
constructor(sourceElementOrDataOrConfig, config = {}) {
|
|
314
|
+
const { sourceElementOrData, editorConfig } = normalizeSingleRootEditorConstructorParams(sourceElementOrDataOrConfig, config);
|
|
315
|
+
super(editorConfig);
|
|
316
|
+
normalizeRootsConfig(sourceElementOrData, this.config);
|
|
317
|
+
const editableElement = this.config.get("roots").main.element;
|
|
318
|
+
if (isElement$1(editableElement)) {
|
|
319
|
+
this.sourceElement = editableElement;
|
|
320
|
+
secureSourceElement(this, editableElement);
|
|
321
|
+
}
|
|
322
|
+
this.config.define("menuBar.isVisible", false);
|
|
323
|
+
this.model.document.createRoot(this.config.get("roots").main.modelElement);
|
|
324
|
+
registerAndInitializeRootConfigAttributes(this);
|
|
325
|
+
const shouldToolbarGroupWhenFull = !this.config.get("toolbar.shouldNotGroupWhenFull");
|
|
326
|
+
const menuBarConfig = this.config.get("menuBar");
|
|
327
|
+
const view = new InlineEditorUIView(this.locale, this.editing.view, editableElement, {
|
|
328
|
+
shouldToolbarGroupWhenFull,
|
|
329
|
+
useMenuBar: menuBarConfig.isVisible,
|
|
330
|
+
label: this.config.get("roots").main.label
|
|
331
|
+
});
|
|
332
|
+
this.ui = new InlineEditorUI(this, view);
|
|
333
|
+
attachToForm(this);
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Destroys the editor instance, releasing all resources used by it.
|
|
337
|
+
*
|
|
338
|
+
* Updates the original editor element with the data if the
|
|
339
|
+
* {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy `updateSourceElementOnDestroy`}
|
|
340
|
+
* configuration option is set to `true`.
|
|
341
|
+
*/
|
|
342
|
+
async destroy() {
|
|
343
|
+
const data = this.getData();
|
|
344
|
+
this.ui.destroy();
|
|
345
|
+
await super.destroy();
|
|
346
|
+
if (this.sourceElement) this.updateSourceElement(data);
|
|
347
|
+
}
|
|
348
|
+
static async create(sourceElementOrDataOrConfig, config = {}) {
|
|
349
|
+
const editor = new this(sourceElementOrDataOrConfig, config);
|
|
350
|
+
await editor.initPlugins();
|
|
351
|
+
verifyRootElements(editor);
|
|
352
|
+
await editor.ui.init();
|
|
353
|
+
await editor.data.init(editor.config.get("roots").main.initialData);
|
|
354
|
+
editor.fire("ready");
|
|
355
|
+
return editor;
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
function isElement$1(value) {
|
|
359
|
+
return isElement(value);
|
|
390
360
|
}
|
|
391
361
|
|
|
362
|
+
/**
|
|
363
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
364
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
365
|
+
*/
|
|
366
|
+
|
|
392
367
|
export { InlineEditor, InlineEditorUI, InlineEditorUIView };
|
|
393
|
-
//# sourceMappingURL=index.js.map
|
|
368
|
+
//# sourceMappingURL=index.js.map
|