@ckeditor/ckeditor5-editor-balloon 48.2.0 → 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/ballooneditor.d.ts +243 -243
- package/dist/ballooneditorui.d.ts +37 -37
- package/dist/ballooneditoruiview.d.ts +34 -34
- package/dist/index-content.css +1 -0
- package/dist/index-editor.css +1 -0
- package/dist/index.css +0 -2
- package/dist/index.d.ts +8 -8
- package/dist/index.js +203 -200
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/dist/index.css.map +0 -1
package/dist/index-content.css
CHANGED
package/dist/index-editor.css
CHANGED
package/dist/index.css
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
export { BalloonEditor } from
|
|
9
|
-
export { BalloonEditorUI } from
|
|
10
|
-
export { BalloonEditorUIView } from
|
|
6
|
+
* @module editor-balloon
|
|
7
|
+
*/
|
|
8
|
+
export { BalloonEditor } from "./ballooneditor.js";
|
|
9
|
+
export { BalloonEditorUI } from "./ballooneditorui.js";
|
|
10
|
+
export { BalloonEditorUIView } from "./ballooneditoruiview.js";
|
package/dist/index.js
CHANGED
|
@@ -2,212 +2,215 @@
|
|
|
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 { EditorUI, EditorUIView, InlineEditableUIView, MenuBarView
|
|
7
|
-
import { enableViewPlaceholder } from
|
|
8
|
-
import { isElement
|
|
5
|
+
import { Editor, ElementApiMixin, attachToForm, normalizeRootsConfig, normalizeSingleRootEditorConstructorParams, registerAndInitializeRootConfigAttributes, rootAcceptsBlocks, secureSourceElement, verifyRootElements } from "@ckeditor/ckeditor5-core";
|
|
6
|
+
import { BalloonToolbar, EditorUI, EditorUIView, InlineEditableUIView, MenuBarView } from "@ckeditor/ckeditor5-ui";
|
|
7
|
+
import { enableViewPlaceholder } from "@ckeditor/ckeditor5-engine";
|
|
8
|
+
import { isElement } from "es-toolkit/compat";
|
|
9
9
|
|
|
10
10
|
/**
|
|
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
|
-
enableViewPlaceholder({
|
|
89
|
-
view: editingView,
|
|
90
|
-
element: editingRoot,
|
|
91
|
-
isDirectHost: this.view.editable.isInlineRoot,
|
|
92
|
-
keepOnFocus: true
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
11
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
12
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* @module editor-balloon/ballooneditorui
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* The balloon editor UI class.
|
|
19
|
+
*/
|
|
20
|
+
var BalloonEditorUI = class extends EditorUI {
|
|
21
|
+
/**
|
|
22
|
+
* The main (top–most) view of the editor UI.
|
|
23
|
+
*/
|
|
24
|
+
view;
|
|
25
|
+
/**
|
|
26
|
+
* Creates an instance of the balloon editor UI class.
|
|
27
|
+
*
|
|
28
|
+
* @param editor The editor instance.
|
|
29
|
+
* @param view The view of the UI.
|
|
30
|
+
*/
|
|
31
|
+
constructor(editor, view) {
|
|
32
|
+
super(editor);
|
|
33
|
+
this.view = view;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @inheritDoc
|
|
37
|
+
*/
|
|
38
|
+
get element() {
|
|
39
|
+
return this.view.editable.element;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Initializes the UI.
|
|
43
|
+
*/
|
|
44
|
+
init() {
|
|
45
|
+
const editor = this.editor;
|
|
46
|
+
const view = this.view;
|
|
47
|
+
const editingView = editor.editing.view;
|
|
48
|
+
const editable = view.editable;
|
|
49
|
+
const editingRoot = editingView.document.getRoot();
|
|
50
|
+
editable.name = editingRoot.rootName;
|
|
51
|
+
editable.isInlineRoot = !rootAcceptsBlocks(editor, editingRoot.rootName);
|
|
52
|
+
view.render();
|
|
53
|
+
const editableElement = editable.element;
|
|
54
|
+
this.setEditableElement(editable.name, editableElement);
|
|
55
|
+
editable.bind("isFocused").to(this.focusTracker);
|
|
56
|
+
editingView.attachDomRoot(editableElement);
|
|
57
|
+
this._initPlaceholder();
|
|
58
|
+
this.initMenuBar(this.view.menuBarView);
|
|
59
|
+
this.fire("ready");
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @inheritDoc
|
|
63
|
+
*/
|
|
64
|
+
destroy() {
|
|
65
|
+
super.destroy();
|
|
66
|
+
const view = this.view;
|
|
67
|
+
const editingView = this.editor.editing.view;
|
|
68
|
+
if (editingView.getDomRoot(view.editable.name)) editingView.detachDomRoot(view.editable.name);
|
|
69
|
+
view.destroy();
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Enable the placeholder text on the editing root.
|
|
73
|
+
*/
|
|
74
|
+
_initPlaceholder() {
|
|
75
|
+
const editor = this.editor;
|
|
76
|
+
const editingView = editor.editing.view;
|
|
77
|
+
const editingRoot = editingView.document.getRoot();
|
|
78
|
+
const placeholder = editor.config.get("roots")[editingRoot.rootName].placeholder;
|
|
79
|
+
if (placeholder) editingRoot.placeholder = placeholder;
|
|
80
|
+
enableViewPlaceholder({
|
|
81
|
+
view: editingView,
|
|
82
|
+
element: editingRoot,
|
|
83
|
+
isDirectHost: this.view.editable.isInlineRoot,
|
|
84
|
+
keepOnFocus: true
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
};
|
|
96
88
|
|
|
97
89
|
/**
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
90
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
91
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
92
|
+
*/
|
|
93
|
+
/**
|
|
94
|
+
* @module editor-balloon/ballooneditoruiview
|
|
95
|
+
*/
|
|
96
|
+
/**
|
|
97
|
+
* Contextual editor UI view. Uses the {@link module:ui/editableui/inline/inlineeditableuiview~InlineEditableUIView}.
|
|
98
|
+
*/
|
|
99
|
+
var BalloonEditorUIView = class extends EditorUIView {
|
|
100
|
+
/**
|
|
101
|
+
* Editable UI view.
|
|
102
|
+
*/
|
|
103
|
+
editable;
|
|
104
|
+
/**
|
|
105
|
+
* Menu bar view instance.
|
|
106
|
+
*/
|
|
107
|
+
menuBarView;
|
|
108
|
+
/**
|
|
109
|
+
* Creates an instance of the balloon editor UI view.
|
|
110
|
+
*
|
|
111
|
+
* @param locale The {@link module:core/editor/editor~Editor#locale} instance.
|
|
112
|
+
* @param editingView The editing view instance this view is related to.
|
|
113
|
+
* @param editableElement The editable element. If not specified, it will be automatically created by
|
|
114
|
+
* {@link module:ui/editableui/editableuiview~EditableUIView}. Otherwise, the given element will be used.
|
|
115
|
+
* @param label When set, this value will be used as an accessible `aria-label` of the
|
|
116
|
+
* {@link module:ui/editableui/editableuiview~EditableUIView editable view}.
|
|
117
|
+
*/
|
|
118
|
+
constructor(locale, editingView, editableElement, label) {
|
|
119
|
+
super(locale);
|
|
120
|
+
this.editable = new InlineEditableUIView(locale, editingView, editableElement, { label });
|
|
121
|
+
this.menuBarView = new MenuBarView(locale);
|
|
122
|
+
this.menuBarView.extendTemplate({ attributes: {
|
|
123
|
+
class: ["ck-reset_all", "ck-rounded-corners"],
|
|
124
|
+
dir: locale.uiLanguageDirection
|
|
125
|
+
} });
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* @inheritDoc
|
|
129
|
+
*/
|
|
130
|
+
render() {
|
|
131
|
+
super.render();
|
|
132
|
+
this.registerChild(this.editable);
|
|
133
|
+
this.registerChild(this.menuBarView);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
139
136
|
|
|
140
137
|
/**
|
|
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
|
-
|
|
138
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
139
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
140
|
+
*/
|
|
141
|
+
/**
|
|
142
|
+
* @module editor-balloon/ballooneditor
|
|
143
|
+
*/
|
|
144
|
+
const BalloonEditorBase = /* #__PURE__ */ ElementApiMixin(Editor);
|
|
145
|
+
/**
|
|
146
|
+
* The balloon editor implementation (Medium-like editor).
|
|
147
|
+
* It uses an inline editable and a toolbar based on the {@link module:ui/toolbar/balloon/balloontoolbar~BalloonToolbar}.
|
|
148
|
+
* See the {@glink examples/builds/balloon-editor demo}.
|
|
149
|
+
*
|
|
150
|
+
* In order to create a balloon editor instance, use the static
|
|
151
|
+
* {@link module:editor-balloon/ballooneditor~BalloonEditor.create `BalloonEditor.create()`} method.
|
|
152
|
+
*/
|
|
153
|
+
var BalloonEditor = class extends BalloonEditorBase {
|
|
154
|
+
/**
|
|
155
|
+
* @inheritDoc
|
|
156
|
+
*/
|
|
157
|
+
static get editorName() {
|
|
158
|
+
return "BalloonEditor";
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* @inheritDoc
|
|
162
|
+
*/
|
|
163
|
+
ui;
|
|
164
|
+
constructor(sourceElementOrDataOrConfig, config = {}) {
|
|
165
|
+
const { sourceElementOrData, editorConfig } = normalizeSingleRootEditorConstructorParams(sourceElementOrDataOrConfig, config);
|
|
166
|
+
super(editorConfig);
|
|
167
|
+
normalizeRootsConfig(sourceElementOrData, this.config);
|
|
168
|
+
const editableElement = this.config.get("roots").main.element;
|
|
169
|
+
if (isElement$1(editableElement)) {
|
|
170
|
+
this.sourceElement = editableElement;
|
|
171
|
+
secureSourceElement(this, editableElement);
|
|
172
|
+
}
|
|
173
|
+
const plugins = this.config.get("plugins");
|
|
174
|
+
plugins.push(BalloonToolbar);
|
|
175
|
+
this.config.set("plugins", plugins);
|
|
176
|
+
this.config.define("balloonToolbar", this.config.get("toolbar"));
|
|
177
|
+
this.model.document.createRoot(this.config.get("roots").main.modelElement);
|
|
178
|
+
registerAndInitializeRootConfigAttributes(this);
|
|
179
|
+
const view = new BalloonEditorUIView(this.locale, this.editing.view, editableElement, this.config.get("roots").main.label);
|
|
180
|
+
this.ui = new BalloonEditorUI(this, view);
|
|
181
|
+
attachToForm(this);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Destroys the editor instance, releasing all resources used by it.
|
|
185
|
+
*
|
|
186
|
+
* Updates the original editor element with the data if the
|
|
187
|
+
* {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy `updateSourceElementOnDestroy`}
|
|
188
|
+
* configuration option is set to `true`.
|
|
189
|
+
*/
|
|
190
|
+
async destroy() {
|
|
191
|
+
const data = this.getData();
|
|
192
|
+
this.ui.destroy();
|
|
193
|
+
await super.destroy();
|
|
194
|
+
if (this.sourceElement) this.updateSourceElement(data);
|
|
195
|
+
}
|
|
196
|
+
static async create(sourceElementOrDataOrConfig, config = {}) {
|
|
197
|
+
const editor = new this(sourceElementOrDataOrConfig, config);
|
|
198
|
+
await editor.initPlugins();
|
|
199
|
+
verifyRootElements(editor);
|
|
200
|
+
await editor.ui.init();
|
|
201
|
+
await editor.data.init(editor.config.get("roots").main.initialData);
|
|
202
|
+
editor.fire("ready");
|
|
203
|
+
return editor;
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
function isElement$1(value) {
|
|
207
|
+
return isElement(value);
|
|
210
208
|
}
|
|
211
209
|
|
|
210
|
+
/**
|
|
211
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
212
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
213
|
+
*/
|
|
214
|
+
|
|
212
215
|
export { BalloonEditor, BalloonEditorUI, BalloonEditorUIView };
|
|
213
|
-
//# sourceMappingURL=index.js.map
|
|
216
|
+
//# sourceMappingURL=index.js.map
|