lakelib 0.3.3 → 0.3.5
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/README.md +30 -24
- package/dist/lake.min.css +15 -15
- package/dist/lake.min.js +22 -22
- package/dist/lake.min.js.map +1 -1
- package/lib/lake.css +267 -39
- package/lib/lake.d.ts +2148 -0
- package/lib/lake.js +1323 -759
- package/lib/lake.js.map +1 -1
- package/package.json +31 -34
- package/lib/config/element-rules.d.ts +0 -1
- package/lib/config/menu-items.d.ts +0 -9
- package/lib/config/tag-names.d.ts +0 -6
- package/lib/config/toolbar-items.d.ts +0 -2
- package/lib/css/index.d.ts +0 -17
- package/lib/editor.d.ts +0 -93
- package/lib/elements/bookmark.d.ts +0 -2
- package/lib/elements/box.d.ts +0 -2
- package/lib/i18n/en-US/index.d.ts +0 -169
- package/lib/i18n/index.d.ts +0 -2
- package/lib/i18n/ja/index.d.ts +0 -169
- package/lib/i18n/ko/index.d.ts +0 -169
- package/lib/i18n/types.d.ts +0 -1233
- package/lib/i18n/zh-CN/index.d.ts +0 -169
- package/lib/icons/index.d.ts +0 -1
- package/lib/index.d.ts +0 -35
- package/lib/managers/box-manager.d.ts +0 -6
- package/lib/managers/command.d.ts +0 -23
- package/lib/managers/history.d.ts +0 -32
- package/lib/managers/keystroke.d.ts +0 -11
- package/lib/managers/plugin.d.ts +0 -7
- package/lib/managers/selection.d.ts +0 -40
- package/lib/models/box.d.ts +0 -25
- package/lib/models/fragment.d.ts +0 -8
- package/lib/models/nodes.d.ts +0 -98
- package/lib/models/range.d.ts +0 -56
- package/lib/operations/add-mark.d.ts +0 -3
- package/lib/operations/delete-contents.d.ts +0 -2
- package/lib/operations/insert-block.d.ts +0 -3
- package/lib/operations/insert-bookmark.d.ts +0 -6
- package/lib/operations/insert-box.d.ts +0 -4
- package/lib/operations/insert-contents.d.ts +0 -4
- package/lib/operations/remove-box.d.ts +0 -3
- package/lib/operations/remove-mark.d.ts +0 -2
- package/lib/operations/set-blocks.d.ts +0 -3
- package/lib/operations/split-block.d.ts +0 -3
- package/lib/operations/split-marks.d.ts +0 -3
- package/lib/operations/to-bookmark.d.ts +0 -6
- package/lib/parsers/html-parser.d.ts +0 -13
- package/lib/parsers/text-parser.d.ts +0 -6
- package/lib/plugins/align.d.ts +0 -3
- package/lib/plugins/arrow-keys.d.ts +0 -3
- package/lib/plugins/backspace-key.d.ts +0 -3
- package/lib/plugins/block-quote.d.ts +0 -3
- package/lib/plugins/bold.d.ts +0 -3
- package/lib/plugins/code-block/code-block-box.d.ts +0 -4
- package/lib/plugins/code-block/index.d.ts +0 -5
- package/lib/plugins/code.d.ts +0 -3
- package/lib/plugins/copy.d.ts +0 -3
- package/lib/plugins/cut.d.ts +0 -3
- package/lib/plugins/delete-key.d.ts +0 -3
- package/lib/plugins/drop.d.ts +0 -3
- package/lib/plugins/emoji/emoji-box.d.ts +0 -4
- package/lib/plugins/emoji/index.d.ts +0 -5
- package/lib/plugins/enter-key.d.ts +0 -3
- package/lib/plugins/equation/equation-box.d.ts +0 -4
- package/lib/plugins/equation/index.d.ts +0 -5
- package/lib/plugins/escape-key.d.ts +0 -3
- package/lib/plugins/file/file-box.d.ts +0 -4
- package/lib/plugins/file/index.d.ts +0 -5
- package/lib/plugins/font-color.d.ts +0 -3
- package/lib/plugins/font-family.d.ts +0 -3
- package/lib/plugins/font-size.d.ts +0 -3
- package/lib/plugins/format-painter.d.ts +0 -3
- package/lib/plugins/heading.d.ts +0 -3
- package/lib/plugins/highlight.d.ts +0 -3
- package/lib/plugins/hr/hr-box.d.ts +0 -4
- package/lib/plugins/hr/index.d.ts +0 -5
- package/lib/plugins/image/image-box.d.ts +0 -5
- package/lib/plugins/image/index.d.ts +0 -5
- package/lib/plugins/indent.d.ts +0 -3
- package/lib/plugins/italic.d.ts +0 -3
- package/lib/plugins/link/index.d.ts +0 -3
- package/lib/plugins/link/insert-link.d.ts +0 -3
- package/lib/plugins/link/link-popup.d.ts +0 -32
- package/lib/plugins/list.d.ts +0 -3
- package/lib/plugins/markdown.d.ts +0 -3
- package/lib/plugins/mention/index.d.ts +0 -5
- package/lib/plugins/mention/mention-box.d.ts +0 -4
- package/lib/plugins/mention/mention-menu.d.ts +0 -15
- package/lib/plugins/mention/types.d.ts +0 -6
- package/lib/plugins/paste.d.ts +0 -3
- package/lib/plugins/redo.d.ts +0 -3
- package/lib/plugins/remove-format.d.ts +0 -3
- package/lib/plugins/select-all.d.ts +0 -3
- package/lib/plugins/shift-enter-key.d.ts +0 -3
- package/lib/plugins/slash/index.d.ts +0 -3
- package/lib/plugins/slash/slash-items.d.ts +0 -2
- package/lib/plugins/slash/slash-menu.d.ts +0 -19
- package/lib/plugins/slash/types.d.ts +0 -20
- package/lib/plugins/special-character.d.ts +0 -3
- package/lib/plugins/strikethrough.d.ts +0 -3
- package/lib/plugins/subscript.d.ts +0 -3
- package/lib/plugins/superscript.d.ts +0 -3
- package/lib/plugins/tab-key.d.ts +0 -3
- package/lib/plugins/table/delete-column.d.ts +0 -2
- package/lib/plugins/table/delete-row.d.ts +0 -2
- package/lib/plugins/table/delete-table.d.ts +0 -2
- package/lib/plugins/table/index.d.ts +0 -4
- package/lib/plugins/table/insert-column.d.ts +0 -4
- package/lib/plugins/table/insert-row.d.ts +0 -4
- package/lib/plugins/table/insert-table.d.ts +0 -3
- package/lib/plugins/table/merge-cells.d.ts +0 -3
- package/lib/plugins/table/split-cell.d.ts +0 -3
- package/lib/plugins/table/utils.d.ts +0 -6
- package/lib/plugins/underline.d.ts +0 -3
- package/lib/plugins/undo.d.ts +0 -3
- package/lib/plugins/unlink.d.ts +0 -3
- package/lib/plugins/video/index.d.ts +0 -5
- package/lib/plugins/video/video-box.d.ts +0 -4
- package/lib/storage/box-instances.d.ts +0 -2
- package/lib/storage/boxes.d.ts +0 -2
- package/lib/storage/editors.d.ts +0 -2
- package/lib/types/box.d.ts +0 -15
- package/lib/types/corner-toolbar.d.ts +0 -7
- package/lib/types/dropdown.d.ts +0 -23
- package/lib/types/native.d.ts +0 -2
- package/lib/types/node.d.ts +0 -13
- package/lib/types/object.d.ts +0 -3
- package/lib/types/plugin.d.ts +0 -3
- package/lib/types/request.d.ts +0 -20
- package/lib/types/selection.d.ts +0 -14
- package/lib/types/toolbar.d.ts +0 -29
- package/lib/ui/button.d.ts +0 -19
- package/lib/ui/corner-toolbar.d.ts +0 -18
- package/lib/ui/dropdown.d.ts +0 -36
- package/lib/ui/floating-toolbar.d.ts +0 -16
- package/lib/ui/menu.d.ts +0 -33
- package/lib/ui/resizer.d.ts +0 -17
- package/lib/ui/toolbar.d.ts +0 -29
- package/lib/utils/append-break.d.ts +0 -2
- package/lib/utils/camel-case.d.ts +0 -1
- package/lib/utils/change-tag-name.d.ts +0 -2
- package/lib/utils/debug.d.ts +0 -1
- package/lib/utils/denormalize-value.d.ts +0 -1
- package/lib/utils/encode.d.ts +0 -1
- package/lib/utils/file-size.d.ts +0 -1
- package/lib/utils/fix-numbered-list.d.ts +0 -2
- package/lib/utils/from-base64.d.ts +0 -1
- package/lib/utils/get-box.d.ts +0 -3
- package/lib/utils/get-css.d.ts +0 -1
- package/lib/utils/get-deep-element.d.ts +0 -2
- package/lib/utils/in-string.d.ts +0 -1
- package/lib/utils/indent-block.d.ts +0 -2
- package/lib/utils/merge-nodes.d.ts +0 -5
- package/lib/utils/modifier-text.d.ts +0 -1
- package/lib/utils/morph.d.ts +0 -56
- package/lib/utils/normalize-value.d.ts +0 -1
- package/lib/utils/parse-style.d.ts +0 -2
- package/lib/utils/query.d.ts +0 -2
- package/lib/utils/remove-break.d.ts +0 -2
- package/lib/utils/remove-empty-marks.d.ts +0 -2
- package/lib/utils/remove-zws.d.ts +0 -2
- package/lib/utils/request.d.ts +0 -27
- package/lib/utils/scroll-to-node.d.ts +0 -2
- package/lib/utils/split-nodes.d.ts +0 -5
- package/lib/utils/template.d.ts +0 -1
- package/lib/utils/to-base64.d.ts +0 -1
- package/lib/utils/to-hex.d.ts +0 -1
- package/lib/utils/to-node-list.d.ts +0 -1
- package/lib/utils/unsafe-template.d.ts +0 -1
- package/lib/utils/upload-file.d.ts +0 -11
- package/lib/utils/visible-info.d.ts +0 -10
- package/lib/utils/wrap-node-list.d.ts +0 -2
package/lib/lake.d.ts
ADDED
|
@@ -0,0 +1,2148 @@
|
|
|
1
|
+
import EventEmitter from 'eventemitter3';
|
|
2
|
+
import { LocalizedString } from 'typesafe-i18n';
|
|
3
|
+
|
|
4
|
+
type KeyValue = Record<string, string>;
|
|
5
|
+
|
|
6
|
+
interface EventItem {
|
|
7
|
+
type: string;
|
|
8
|
+
listener: EventListener;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The Nodes interface represents a collection of the nodes.
|
|
12
|
+
* It is similar to jQuery, but its implementation is much simpler.
|
|
13
|
+
* Its methods can be considered aliases of native DOM interfaces, designed to simplify DOM manipulation.
|
|
14
|
+
*/
|
|
15
|
+
declare class Nodes {
|
|
16
|
+
/**
|
|
17
|
+
* A list of native nodes.
|
|
18
|
+
*/
|
|
19
|
+
private readonly nodeList;
|
|
20
|
+
/**
|
|
21
|
+
* The number of nodes in the Nodes object.
|
|
22
|
+
*/
|
|
23
|
+
readonly length: number;
|
|
24
|
+
constructor(node?: Node | Node[] | null);
|
|
25
|
+
/**
|
|
26
|
+
* The unique ID of the first node.
|
|
27
|
+
*/
|
|
28
|
+
get id(): number;
|
|
29
|
+
/**
|
|
30
|
+
* The name of the first node.
|
|
31
|
+
*/
|
|
32
|
+
get name(): string;
|
|
33
|
+
/**
|
|
34
|
+
* A boolean value indicating whether the first node is an element.
|
|
35
|
+
*/
|
|
36
|
+
get isElement(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* A boolean value indicating whether the first node is a text.
|
|
39
|
+
*/
|
|
40
|
+
get isText(): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* A boolean value indicating whether the first node is a block.
|
|
43
|
+
*/
|
|
44
|
+
get isBlock(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* A boolean value indicating whether the first node is a mark.
|
|
47
|
+
*/
|
|
48
|
+
get isMark(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* A boolean value indicating whether the first node is a void element that cannot have any child nodes.
|
|
51
|
+
*/
|
|
52
|
+
get isVoid(): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* A boolean value indicating whether the first node is a heading.
|
|
55
|
+
*/
|
|
56
|
+
get isHeading(): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* A boolean value indicating whether the first node is a list.
|
|
59
|
+
*/
|
|
60
|
+
get isList(): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* A boolean value indicating whether the first node is a table.
|
|
63
|
+
*/
|
|
64
|
+
get isTable(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* A boolean value indicating whether the first node is a bookmark element.
|
|
67
|
+
*/
|
|
68
|
+
get isBookmark(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* A boolean value indicating whether the first node is a box element.
|
|
71
|
+
*/
|
|
72
|
+
get isBox(): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* A boolean value indicating whether the first node is an inline box element.
|
|
75
|
+
*/
|
|
76
|
+
get isInlineBox(): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* A boolean value indicating whether the first node is a block box element.
|
|
79
|
+
*/
|
|
80
|
+
get isBlockBox(): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* A boolean value indicating whether the first node is a contenteditable element where users can edit the content.
|
|
83
|
+
*/
|
|
84
|
+
get isContainer(): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* A boolean value indicating whether the first node does not have an ancestor element which contenteditable attribute is true.
|
|
87
|
+
*/
|
|
88
|
+
get isOutside(): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* A boolean value indicating whether the first node has an ancestor element which contenteditable attribute is true.
|
|
91
|
+
*/
|
|
92
|
+
get isInside(): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* A boolean value indicating whether the first node's parent element is an element which contenteditable attribute is true.
|
|
95
|
+
*/
|
|
96
|
+
get isTopInside(): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* A boolean value indicating whether the first node is editable.
|
|
99
|
+
*/
|
|
100
|
+
get isContentEditable(): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* A boolean value indicating whether the first node is indivisible.
|
|
103
|
+
*/
|
|
104
|
+
get isIndivisible(): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* A boolean value indicating whether the first node is empty.
|
|
107
|
+
*/
|
|
108
|
+
get isEmpty(): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Returns a native node at the specified index.
|
|
111
|
+
*/
|
|
112
|
+
get(index: number): Node;
|
|
113
|
+
/**
|
|
114
|
+
* Returns all native nodes.
|
|
115
|
+
*/
|
|
116
|
+
getAll(): Node[];
|
|
117
|
+
/**
|
|
118
|
+
* Returns a new Nodes object that includes only the node at the specified index.
|
|
119
|
+
*/
|
|
120
|
+
eq(index: number): Nodes;
|
|
121
|
+
/**
|
|
122
|
+
* Executes a provided function once for each node.
|
|
123
|
+
*/
|
|
124
|
+
each(callback: (node: Node, index: number) => boolean | void): this;
|
|
125
|
+
/**
|
|
126
|
+
* Executes a provided function once for each element.
|
|
127
|
+
*/
|
|
128
|
+
eachElement(callback: (element: Element, index: number) => boolean | void): this;
|
|
129
|
+
/**
|
|
130
|
+
* Returns a new Nodes object with the nodes in reversed order.
|
|
131
|
+
*/
|
|
132
|
+
reverse(): Nodes;
|
|
133
|
+
/**
|
|
134
|
+
* Tests whether the first node would be selected by the specified CSS selector.
|
|
135
|
+
*/
|
|
136
|
+
matches(selector: string): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Returns a boolean value indicating whether the given node is a descendant of the first node,
|
|
139
|
+
* that is the node itself, one of its direct children (childNodes), one of the children's direct children, and so on.
|
|
140
|
+
*/
|
|
141
|
+
contains(otherNode: Nodes): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Returns a boolean value indicating whether the first node and a given node are siblings.
|
|
144
|
+
*/
|
|
145
|
+
isSibling(otherNode: Nodes): boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Returns the descendants of the first node that match the specified CSS selector or node path.
|
|
148
|
+
*/
|
|
149
|
+
find(selector: string | NodePath): Nodes;
|
|
150
|
+
/**
|
|
151
|
+
* Traverses the first node and its parents (heading toward the document root) until it finds an element that matches the specified CSS selector.
|
|
152
|
+
*/
|
|
153
|
+
closest(selector: string): Nodes;
|
|
154
|
+
/**
|
|
155
|
+
* Traverses the first node and its parents until it finds a block element.
|
|
156
|
+
*/
|
|
157
|
+
closestBlock(): Nodes;
|
|
158
|
+
/**
|
|
159
|
+
* Traverses the first node and its parents until it finds an operable block.
|
|
160
|
+
*/
|
|
161
|
+
closestOperableBlock(): Nodes;
|
|
162
|
+
/**
|
|
163
|
+
* Traverses the first node and its parents until it finds a div element which contenteditable attribute is true.
|
|
164
|
+
*/
|
|
165
|
+
closestContainer(): Nodes;
|
|
166
|
+
/**
|
|
167
|
+
* Traverses the first node and its parents until it finds an element which can scroll.
|
|
168
|
+
*/
|
|
169
|
+
closestScroller(): Nodes;
|
|
170
|
+
/**
|
|
171
|
+
* Returns the parent of the first node.
|
|
172
|
+
*/
|
|
173
|
+
parent(): Nodes;
|
|
174
|
+
/**
|
|
175
|
+
* Returns the immediately preceding sibling of the first node.
|
|
176
|
+
*/
|
|
177
|
+
prev(): Nodes;
|
|
178
|
+
/**
|
|
179
|
+
* Returns the immediately following sibling of the first node.
|
|
180
|
+
*/
|
|
181
|
+
next(): Nodes;
|
|
182
|
+
/**
|
|
183
|
+
* Returns the first child of the first node.
|
|
184
|
+
*/
|
|
185
|
+
first(): Nodes;
|
|
186
|
+
/**
|
|
187
|
+
* Returns the last child of the first node.
|
|
188
|
+
*/
|
|
189
|
+
last(): Nodes;
|
|
190
|
+
/**
|
|
191
|
+
* Returns a number indicating the position of the first node relative to its sibling nodes.
|
|
192
|
+
*/
|
|
193
|
+
index(): number;
|
|
194
|
+
/**
|
|
195
|
+
* Returns the path of the first node.
|
|
196
|
+
*/
|
|
197
|
+
path(): NodePath;
|
|
198
|
+
/**
|
|
199
|
+
* Returns a list which contains all of the child nodes of the first node.
|
|
200
|
+
*/
|
|
201
|
+
children(): Nodes[];
|
|
202
|
+
/**
|
|
203
|
+
* Returns a generator that iterates over the descendants of the first node.
|
|
204
|
+
*/
|
|
205
|
+
getWalker(): Generator<Nodes>;
|
|
206
|
+
/**
|
|
207
|
+
* Sets up an event listener for each element.
|
|
208
|
+
*/
|
|
209
|
+
on(type: string, listener: EventListener): this;
|
|
210
|
+
/**
|
|
211
|
+
* Removes event listeners previously registered with on() method.
|
|
212
|
+
*/
|
|
213
|
+
off(type?: string, listener?: EventListener): this;
|
|
214
|
+
/**
|
|
215
|
+
* Executes all event listeners attached to all nodes for the given event type.
|
|
216
|
+
*/
|
|
217
|
+
emit(type: string, event?: Event): this;
|
|
218
|
+
/**
|
|
219
|
+
* Returns all event listeners attached to the node at the specified index.
|
|
220
|
+
*/
|
|
221
|
+
getEventListeners(index: number): EventItem[];
|
|
222
|
+
/**
|
|
223
|
+
* Sets focus on the specified node, if it can be focused.
|
|
224
|
+
*/
|
|
225
|
+
focus(): this;
|
|
226
|
+
/**
|
|
227
|
+
* Removes focus from the specified node.
|
|
228
|
+
*/
|
|
229
|
+
blur(): this;
|
|
230
|
+
/**
|
|
231
|
+
* Returns a copy of the first node. If deep is true, the copy also includes the node's descendants.
|
|
232
|
+
*/
|
|
233
|
+
clone(deep?: boolean): Nodes;
|
|
234
|
+
/**
|
|
235
|
+
* Returns a boolean value indicating whether the first node has the specified attribute or not.
|
|
236
|
+
*/
|
|
237
|
+
hasAttr(attributeName: string): boolean;
|
|
238
|
+
/**
|
|
239
|
+
* Returns the value of the specified attribute from the first node, or sets the values of attributes for all elements.
|
|
240
|
+
*/
|
|
241
|
+
attr(attributeName: string): string;
|
|
242
|
+
attr(attributeName: string, value: string): this;
|
|
243
|
+
attr(attributeName: KeyValue): this;
|
|
244
|
+
/**
|
|
245
|
+
* Removes the attribute with the specified name from every element.
|
|
246
|
+
*/
|
|
247
|
+
removeAttr(attributeName: string): this;
|
|
248
|
+
/**
|
|
249
|
+
* Returns a boolean value indicating whether the first node has the specified class or not.
|
|
250
|
+
*/
|
|
251
|
+
hasClass(className: string): boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Adds the given class to every element.
|
|
254
|
+
*/
|
|
255
|
+
addClass(className: string | string[]): this;
|
|
256
|
+
/**
|
|
257
|
+
* Removes the given class from every element.
|
|
258
|
+
*/
|
|
259
|
+
removeClass(className: string | string[]): this;
|
|
260
|
+
/**
|
|
261
|
+
* Returns the value of the given CSS property of the first node,
|
|
262
|
+
* after applying active stylesheets and resolving any basic computation this value may contain.
|
|
263
|
+
*/
|
|
264
|
+
computedCSS(propertyName: string): string;
|
|
265
|
+
/**
|
|
266
|
+
* Returns the value of the given CSS property of the first node, or sets the values of CSS properties for all elements.
|
|
267
|
+
*/
|
|
268
|
+
css(propertyName: string): string;
|
|
269
|
+
css(propertyName: KeyValue): this;
|
|
270
|
+
css(propertyName: string, value: string): this;
|
|
271
|
+
/**
|
|
272
|
+
* Returns the width of of the first node.
|
|
273
|
+
*/
|
|
274
|
+
width(): number;
|
|
275
|
+
/**
|
|
276
|
+
* Returns the interior width of the first node, which does not include padding.
|
|
277
|
+
*/
|
|
278
|
+
innerWidth(): number;
|
|
279
|
+
/**
|
|
280
|
+
* Returns the height of of the first node.
|
|
281
|
+
*/
|
|
282
|
+
height(): number;
|
|
283
|
+
/**
|
|
284
|
+
* Displays all nodes.
|
|
285
|
+
*/
|
|
286
|
+
show(displayType?: string): this;
|
|
287
|
+
/**
|
|
288
|
+
* Hides all nodes.
|
|
289
|
+
*/
|
|
290
|
+
hide(): this;
|
|
291
|
+
/**
|
|
292
|
+
* Returns the HTML string contained within the first node, or sets the HTML string for all elements.
|
|
293
|
+
*/
|
|
294
|
+
html(): string;
|
|
295
|
+
html(value: string): this;
|
|
296
|
+
/**
|
|
297
|
+
* Returns the rendered text content of the first node, or sets the rendered text content for all elements.
|
|
298
|
+
*/
|
|
299
|
+
text(): string;
|
|
300
|
+
text(value: string): this;
|
|
301
|
+
/**
|
|
302
|
+
* Returns the value of the first node, which must be an input element, or sets the value for all input elements.
|
|
303
|
+
*/
|
|
304
|
+
value(): string;
|
|
305
|
+
value(value: string): this;
|
|
306
|
+
/**
|
|
307
|
+
* Returns the HTML string describing the first node including its descendants.
|
|
308
|
+
*/
|
|
309
|
+
outerHTML(): string;
|
|
310
|
+
/**
|
|
311
|
+
* Removes all child nodes for each element.
|
|
312
|
+
*/
|
|
313
|
+
empty(): this;
|
|
314
|
+
/**
|
|
315
|
+
* Inserts the specified content just inside the first node, before its first child.
|
|
316
|
+
*/
|
|
317
|
+
prepend(content: string | Node | DocumentFragment | Nodes): this;
|
|
318
|
+
/**
|
|
319
|
+
* Inserts the specified content just inside the first node, after its last child.
|
|
320
|
+
*/
|
|
321
|
+
append(content: string | Node | DocumentFragment | Nodes): this;
|
|
322
|
+
/**
|
|
323
|
+
* Inserts the specified content before the first node.
|
|
324
|
+
*/
|
|
325
|
+
before(content: string | Node | DocumentFragment | Nodes): this;
|
|
326
|
+
/**
|
|
327
|
+
* Inserts the specified content after the first node.
|
|
328
|
+
*/
|
|
329
|
+
after(content: string | Node | DocumentFragment | Nodes): this;
|
|
330
|
+
/**
|
|
331
|
+
* Replaces the first node with the given new content.
|
|
332
|
+
*/
|
|
333
|
+
replaceWith(newContent: string | Node | Nodes): this;
|
|
334
|
+
/**
|
|
335
|
+
* Removes all nodes from the DOM.
|
|
336
|
+
*/
|
|
337
|
+
remove(keepChildren?: boolean): this;
|
|
338
|
+
/**
|
|
339
|
+
* Splits the first node, which must be a text node, into two nodes at the specified offset, keeping both as siblings in the tree.
|
|
340
|
+
*/
|
|
341
|
+
splitText(offset: number): Nodes;
|
|
342
|
+
/**
|
|
343
|
+
* Returns information about the first node, which is used for debugging.
|
|
344
|
+
*/
|
|
345
|
+
toString(): string;
|
|
346
|
+
/**
|
|
347
|
+
* Prints information about the first node, which is used for debugging.
|
|
348
|
+
*/
|
|
349
|
+
info(): void;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
interface TwoParts {
|
|
353
|
+
start: Nodes | null;
|
|
354
|
+
end: Nodes | null;
|
|
355
|
+
}
|
|
356
|
+
interface ThreeParts extends TwoParts {
|
|
357
|
+
center: Nodes | null;
|
|
358
|
+
}
|
|
359
|
+
type NodePath = number[];
|
|
360
|
+
|
|
361
|
+
type TranslationFunctions = {
|
|
362
|
+
toolbar: {
|
|
363
|
+
/**
|
|
364
|
+
* Undo (mod+Z)
|
|
365
|
+
*/
|
|
366
|
+
undo: () => LocalizedString;
|
|
367
|
+
/**
|
|
368
|
+
* Redo (mod+Y)
|
|
369
|
+
*/
|
|
370
|
+
redo: () => LocalizedString;
|
|
371
|
+
/**
|
|
372
|
+
* Select all (mod+A)
|
|
373
|
+
*/
|
|
374
|
+
selectAll: () => LocalizedString;
|
|
375
|
+
/**
|
|
376
|
+
* Paragraph
|
|
377
|
+
*/
|
|
378
|
+
paragraph: () => LocalizedString;
|
|
379
|
+
/**
|
|
380
|
+
* Block quotation
|
|
381
|
+
*/
|
|
382
|
+
blockQuote: () => LocalizedString;
|
|
383
|
+
/**
|
|
384
|
+
* Numbered list
|
|
385
|
+
*/
|
|
386
|
+
numberedList: () => LocalizedString;
|
|
387
|
+
/**
|
|
388
|
+
* Bulleted list
|
|
389
|
+
*/
|
|
390
|
+
bulletedList: () => LocalizedString;
|
|
391
|
+
/**
|
|
392
|
+
* Checklist
|
|
393
|
+
*/
|
|
394
|
+
checklist: () => LocalizedString;
|
|
395
|
+
/**
|
|
396
|
+
* Align left
|
|
397
|
+
*/
|
|
398
|
+
alignLeft: () => LocalizedString;
|
|
399
|
+
/**
|
|
400
|
+
* Align center
|
|
401
|
+
*/
|
|
402
|
+
alignCenter: () => LocalizedString;
|
|
403
|
+
/**
|
|
404
|
+
* Align right
|
|
405
|
+
*/
|
|
406
|
+
alignRight: () => LocalizedString;
|
|
407
|
+
/**
|
|
408
|
+
* Justify
|
|
409
|
+
*/
|
|
410
|
+
alignJustify: () => LocalizedString;
|
|
411
|
+
/**
|
|
412
|
+
* Increase indent
|
|
413
|
+
*/
|
|
414
|
+
increaseIndent: () => LocalizedString;
|
|
415
|
+
/**
|
|
416
|
+
* Decrease indent
|
|
417
|
+
*/
|
|
418
|
+
decreaseIndent: () => LocalizedString;
|
|
419
|
+
/**
|
|
420
|
+
* Bold (mod+B)
|
|
421
|
+
*/
|
|
422
|
+
bold: () => LocalizedString;
|
|
423
|
+
/**
|
|
424
|
+
* Italic (mod+I)
|
|
425
|
+
*/
|
|
426
|
+
italic: () => LocalizedString;
|
|
427
|
+
/**
|
|
428
|
+
* Underline (mod+U)
|
|
429
|
+
*/
|
|
430
|
+
underline: () => LocalizedString;
|
|
431
|
+
/**
|
|
432
|
+
* Strikethrough
|
|
433
|
+
*/
|
|
434
|
+
strikethrough: () => LocalizedString;
|
|
435
|
+
/**
|
|
436
|
+
* Superscript
|
|
437
|
+
*/
|
|
438
|
+
superscript: () => LocalizedString;
|
|
439
|
+
/**
|
|
440
|
+
* Subscript
|
|
441
|
+
*/
|
|
442
|
+
subscript: () => LocalizedString;
|
|
443
|
+
/**
|
|
444
|
+
* Inline code
|
|
445
|
+
*/
|
|
446
|
+
code: () => LocalizedString;
|
|
447
|
+
/**
|
|
448
|
+
* Remove format
|
|
449
|
+
*/
|
|
450
|
+
removeFormat: () => LocalizedString;
|
|
451
|
+
/**
|
|
452
|
+
* Format painter
|
|
453
|
+
*/
|
|
454
|
+
formatPainter: () => LocalizedString;
|
|
455
|
+
/**
|
|
456
|
+
* Link
|
|
457
|
+
*/
|
|
458
|
+
link: () => LocalizedString;
|
|
459
|
+
/**
|
|
460
|
+
* Horizontal line
|
|
461
|
+
*/
|
|
462
|
+
hr: () => LocalizedString;
|
|
463
|
+
/**
|
|
464
|
+
* Video
|
|
465
|
+
*/
|
|
466
|
+
video: () => LocalizedString;
|
|
467
|
+
/**
|
|
468
|
+
* Code block
|
|
469
|
+
*/
|
|
470
|
+
codeBlock: () => LocalizedString;
|
|
471
|
+
/**
|
|
472
|
+
* Heading
|
|
473
|
+
*/
|
|
474
|
+
heading: () => LocalizedString;
|
|
475
|
+
/**
|
|
476
|
+
* Heading 1
|
|
477
|
+
*/
|
|
478
|
+
heading1: () => LocalizedString;
|
|
479
|
+
/**
|
|
480
|
+
* Heading 2
|
|
481
|
+
*/
|
|
482
|
+
heading2: () => LocalizedString;
|
|
483
|
+
/**
|
|
484
|
+
* Heading 3
|
|
485
|
+
*/
|
|
486
|
+
heading3: () => LocalizedString;
|
|
487
|
+
/**
|
|
488
|
+
* Heading 4
|
|
489
|
+
*/
|
|
490
|
+
heading4: () => LocalizedString;
|
|
491
|
+
/**
|
|
492
|
+
* Heading 5
|
|
493
|
+
*/
|
|
494
|
+
heading5: () => LocalizedString;
|
|
495
|
+
/**
|
|
496
|
+
* Heading 6
|
|
497
|
+
*/
|
|
498
|
+
heading6: () => LocalizedString;
|
|
499
|
+
/**
|
|
500
|
+
* List
|
|
501
|
+
*/
|
|
502
|
+
list: () => LocalizedString;
|
|
503
|
+
/**
|
|
504
|
+
* Table
|
|
505
|
+
*/
|
|
506
|
+
table: () => LocalizedString;
|
|
507
|
+
/**
|
|
508
|
+
* Alignment
|
|
509
|
+
*/
|
|
510
|
+
align: () => LocalizedString;
|
|
511
|
+
/**
|
|
512
|
+
* Indent
|
|
513
|
+
*/
|
|
514
|
+
indent: () => LocalizedString;
|
|
515
|
+
/**
|
|
516
|
+
* Font family
|
|
517
|
+
*/
|
|
518
|
+
fontFamily: () => LocalizedString;
|
|
519
|
+
/**
|
|
520
|
+
* Font size
|
|
521
|
+
*/
|
|
522
|
+
fontSize: () => LocalizedString;
|
|
523
|
+
/**
|
|
524
|
+
* More style
|
|
525
|
+
*/
|
|
526
|
+
moreStyle: () => LocalizedString;
|
|
527
|
+
/**
|
|
528
|
+
* Font color
|
|
529
|
+
*/
|
|
530
|
+
fontColor: () => LocalizedString;
|
|
531
|
+
/**
|
|
532
|
+
* Highlight
|
|
533
|
+
*/
|
|
534
|
+
highlight: () => LocalizedString;
|
|
535
|
+
/**
|
|
536
|
+
* Image
|
|
537
|
+
*/
|
|
538
|
+
image: () => LocalizedString;
|
|
539
|
+
/**
|
|
540
|
+
* File
|
|
541
|
+
*/
|
|
542
|
+
file: () => LocalizedString;
|
|
543
|
+
/**
|
|
544
|
+
* Emoji
|
|
545
|
+
*/
|
|
546
|
+
emoji: () => LocalizedString;
|
|
547
|
+
/**
|
|
548
|
+
* Mathematical formula
|
|
549
|
+
*/
|
|
550
|
+
equation: () => LocalizedString;
|
|
551
|
+
/**
|
|
552
|
+
* Remove color
|
|
553
|
+
*/
|
|
554
|
+
removeColor: () => LocalizedString;
|
|
555
|
+
};
|
|
556
|
+
slash: {
|
|
557
|
+
/**
|
|
558
|
+
* Heading 1
|
|
559
|
+
*/
|
|
560
|
+
heading1: () => LocalizedString;
|
|
561
|
+
/**
|
|
562
|
+
* Create a heading level 1
|
|
563
|
+
*/
|
|
564
|
+
heading1Desc: () => LocalizedString;
|
|
565
|
+
/**
|
|
566
|
+
* Heading 2
|
|
567
|
+
*/
|
|
568
|
+
heading2: () => LocalizedString;
|
|
569
|
+
/**
|
|
570
|
+
* Create a heading level 2
|
|
571
|
+
*/
|
|
572
|
+
heading2Desc: () => LocalizedString;
|
|
573
|
+
/**
|
|
574
|
+
* Heading 3
|
|
575
|
+
*/
|
|
576
|
+
heading3: () => LocalizedString;
|
|
577
|
+
/**
|
|
578
|
+
* Create a heading level 3
|
|
579
|
+
*/
|
|
580
|
+
heading3Desc: () => LocalizedString;
|
|
581
|
+
/**
|
|
582
|
+
* Heading 4
|
|
583
|
+
*/
|
|
584
|
+
heading4: () => LocalizedString;
|
|
585
|
+
/**
|
|
586
|
+
* Create a heading level 4
|
|
587
|
+
*/
|
|
588
|
+
heading4Desc: () => LocalizedString;
|
|
589
|
+
/**
|
|
590
|
+
* Heading 5
|
|
591
|
+
*/
|
|
592
|
+
heading5: () => LocalizedString;
|
|
593
|
+
/**
|
|
594
|
+
* Create a heading level 5
|
|
595
|
+
*/
|
|
596
|
+
heading5Desc: () => LocalizedString;
|
|
597
|
+
/**
|
|
598
|
+
* Heading 6
|
|
599
|
+
*/
|
|
600
|
+
heading6: () => LocalizedString;
|
|
601
|
+
/**
|
|
602
|
+
* Create a heading level 6
|
|
603
|
+
*/
|
|
604
|
+
heading6Desc: () => LocalizedString;
|
|
605
|
+
/**
|
|
606
|
+
* Paragraph
|
|
607
|
+
*/
|
|
608
|
+
paragraph: () => LocalizedString;
|
|
609
|
+
/**
|
|
610
|
+
* Create a paragraph
|
|
611
|
+
*/
|
|
612
|
+
paragraphDesc: () => LocalizedString;
|
|
613
|
+
/**
|
|
614
|
+
* Block quotation
|
|
615
|
+
*/
|
|
616
|
+
blockQuote: () => LocalizedString;
|
|
617
|
+
/**
|
|
618
|
+
* Create a block quotation
|
|
619
|
+
*/
|
|
620
|
+
blockQuoteDesc: () => LocalizedString;
|
|
621
|
+
/**
|
|
622
|
+
* Numbered list
|
|
623
|
+
*/
|
|
624
|
+
numberedList: () => LocalizedString;
|
|
625
|
+
/**
|
|
626
|
+
* Create a numbered list
|
|
627
|
+
*/
|
|
628
|
+
numberedListDesc: () => LocalizedString;
|
|
629
|
+
/**
|
|
630
|
+
* Bulleted list
|
|
631
|
+
*/
|
|
632
|
+
bulletedList: () => LocalizedString;
|
|
633
|
+
/**
|
|
634
|
+
* Create a bulleted list
|
|
635
|
+
*/
|
|
636
|
+
bulletedListDesc: () => LocalizedString;
|
|
637
|
+
/**
|
|
638
|
+
* Checklist
|
|
639
|
+
*/
|
|
640
|
+
checklist: () => LocalizedString;
|
|
641
|
+
/**
|
|
642
|
+
* Create a checklist
|
|
643
|
+
*/
|
|
644
|
+
checklistDesc: () => LocalizedString;
|
|
645
|
+
/**
|
|
646
|
+
* Table
|
|
647
|
+
*/
|
|
648
|
+
table: () => LocalizedString;
|
|
649
|
+
/**
|
|
650
|
+
* Insert a table
|
|
651
|
+
*/
|
|
652
|
+
tableDesc: () => LocalizedString;
|
|
653
|
+
/**
|
|
654
|
+
* Info alert
|
|
655
|
+
*/
|
|
656
|
+
infoAlert: () => LocalizedString;
|
|
657
|
+
/**
|
|
658
|
+
* Create an info alert
|
|
659
|
+
*/
|
|
660
|
+
infoAlertDesc: () => LocalizedString;
|
|
661
|
+
/**
|
|
662
|
+
* Tip alert
|
|
663
|
+
*/
|
|
664
|
+
tipAlert: () => LocalizedString;
|
|
665
|
+
/**
|
|
666
|
+
* Create a tip alert
|
|
667
|
+
*/
|
|
668
|
+
tipAlertDesc: () => LocalizedString;
|
|
669
|
+
/**
|
|
670
|
+
* Warning alert
|
|
671
|
+
*/
|
|
672
|
+
warningAlert: () => LocalizedString;
|
|
673
|
+
/**
|
|
674
|
+
* Create a warning alert
|
|
675
|
+
*/
|
|
676
|
+
warningAlertDesc: () => LocalizedString;
|
|
677
|
+
/**
|
|
678
|
+
* Danger alert
|
|
679
|
+
*/
|
|
680
|
+
dangerAlert: () => LocalizedString;
|
|
681
|
+
/**
|
|
682
|
+
* Create a danger alert
|
|
683
|
+
*/
|
|
684
|
+
dangerAlertDesc: () => LocalizedString;
|
|
685
|
+
/**
|
|
686
|
+
* Horizontal line
|
|
687
|
+
*/
|
|
688
|
+
hr: () => LocalizedString;
|
|
689
|
+
/**
|
|
690
|
+
* Insert a horizontal line
|
|
691
|
+
*/
|
|
692
|
+
hrDesc: () => LocalizedString;
|
|
693
|
+
/**
|
|
694
|
+
* Code block
|
|
695
|
+
*/
|
|
696
|
+
codeBlock: () => LocalizedString;
|
|
697
|
+
/**
|
|
698
|
+
* Insert a code block
|
|
699
|
+
*/
|
|
700
|
+
codeBlockDesc: () => LocalizedString;
|
|
701
|
+
/**
|
|
702
|
+
* Video
|
|
703
|
+
*/
|
|
704
|
+
video: () => LocalizedString;
|
|
705
|
+
/**
|
|
706
|
+
* Insert a video from YouTube
|
|
707
|
+
*/
|
|
708
|
+
videoDesc: () => LocalizedString;
|
|
709
|
+
/**
|
|
710
|
+
* Mathematical formula
|
|
711
|
+
*/
|
|
712
|
+
equation: () => LocalizedString;
|
|
713
|
+
/**
|
|
714
|
+
* Insert a TeX expression
|
|
715
|
+
*/
|
|
716
|
+
equationDesc: () => LocalizedString;
|
|
717
|
+
/**
|
|
718
|
+
* Image
|
|
719
|
+
*/
|
|
720
|
+
image: () => LocalizedString;
|
|
721
|
+
/**
|
|
722
|
+
* Upload an image
|
|
723
|
+
*/
|
|
724
|
+
imageDesc: () => LocalizedString;
|
|
725
|
+
/**
|
|
726
|
+
* File
|
|
727
|
+
*/
|
|
728
|
+
file: () => LocalizedString;
|
|
729
|
+
/**
|
|
730
|
+
* Upload a file
|
|
731
|
+
*/
|
|
732
|
+
fileDesc: () => LocalizedString;
|
|
733
|
+
};
|
|
734
|
+
link: {
|
|
735
|
+
/**
|
|
736
|
+
* New link
|
|
737
|
+
*/
|
|
738
|
+
newLink: () => LocalizedString;
|
|
739
|
+
/**
|
|
740
|
+
* Link URL
|
|
741
|
+
*/
|
|
742
|
+
url: () => LocalizedString;
|
|
743
|
+
/**
|
|
744
|
+
* Text to display
|
|
745
|
+
*/
|
|
746
|
+
title: () => LocalizedString;
|
|
747
|
+
/**
|
|
748
|
+
* Copy link to clipboard
|
|
749
|
+
*/
|
|
750
|
+
copy: () => LocalizedString;
|
|
751
|
+
/**
|
|
752
|
+
* Open link in new tab
|
|
753
|
+
*/
|
|
754
|
+
open: () => LocalizedString;
|
|
755
|
+
/**
|
|
756
|
+
* Save
|
|
757
|
+
*/
|
|
758
|
+
save: () => LocalizedString;
|
|
759
|
+
/**
|
|
760
|
+
* Remove link
|
|
761
|
+
*/
|
|
762
|
+
unlink: () => LocalizedString;
|
|
763
|
+
};
|
|
764
|
+
table: {
|
|
765
|
+
/**
|
|
766
|
+
* Fit table to page width
|
|
767
|
+
*/
|
|
768
|
+
fitTable: () => LocalizedString;
|
|
769
|
+
/**
|
|
770
|
+
* Cell background color
|
|
771
|
+
*/
|
|
772
|
+
cellBackground: () => LocalizedString;
|
|
773
|
+
/**
|
|
774
|
+
* Column
|
|
775
|
+
*/
|
|
776
|
+
column: () => LocalizedString;
|
|
777
|
+
/**
|
|
778
|
+
* Insert column left
|
|
779
|
+
*/
|
|
780
|
+
insertColumnLeft: () => LocalizedString;
|
|
781
|
+
/**
|
|
782
|
+
* Insert column right
|
|
783
|
+
*/
|
|
784
|
+
insertColumnRight: () => LocalizedString;
|
|
785
|
+
/**
|
|
786
|
+
* Delete column
|
|
787
|
+
*/
|
|
788
|
+
deleteColumn: () => LocalizedString;
|
|
789
|
+
/**
|
|
790
|
+
* Row
|
|
791
|
+
*/
|
|
792
|
+
row: () => LocalizedString;
|
|
793
|
+
/**
|
|
794
|
+
* Insert row above
|
|
795
|
+
*/
|
|
796
|
+
insertRowAbove: () => LocalizedString;
|
|
797
|
+
/**
|
|
798
|
+
* Insert row below
|
|
799
|
+
*/
|
|
800
|
+
insertRowBelow: () => LocalizedString;
|
|
801
|
+
/**
|
|
802
|
+
* Delete row
|
|
803
|
+
*/
|
|
804
|
+
deleteRow: () => LocalizedString;
|
|
805
|
+
/**
|
|
806
|
+
* Merge cells
|
|
807
|
+
*/
|
|
808
|
+
merge: () => LocalizedString;
|
|
809
|
+
/**
|
|
810
|
+
* Merge cell up
|
|
811
|
+
*/
|
|
812
|
+
mergeUp: () => LocalizedString;
|
|
813
|
+
/**
|
|
814
|
+
* Merge cell right
|
|
815
|
+
*/
|
|
816
|
+
mergeRight: () => LocalizedString;
|
|
817
|
+
/**
|
|
818
|
+
* Merge cell down
|
|
819
|
+
*/
|
|
820
|
+
mergeDown: () => LocalizedString;
|
|
821
|
+
/**
|
|
822
|
+
* Merge cell left
|
|
823
|
+
*/
|
|
824
|
+
mergeLeft: () => LocalizedString;
|
|
825
|
+
/**
|
|
826
|
+
* Split cell
|
|
827
|
+
*/
|
|
828
|
+
split: () => LocalizedString;
|
|
829
|
+
/**
|
|
830
|
+
* Split cell left and right
|
|
831
|
+
*/
|
|
832
|
+
splitLeftRight: () => LocalizedString;
|
|
833
|
+
/**
|
|
834
|
+
* Split cell top and bottom
|
|
835
|
+
*/
|
|
836
|
+
splitTopBottom: () => LocalizedString;
|
|
837
|
+
/**
|
|
838
|
+
* Remove table
|
|
839
|
+
*/
|
|
840
|
+
remove: () => LocalizedString;
|
|
841
|
+
};
|
|
842
|
+
image: {
|
|
843
|
+
/**
|
|
844
|
+
* Full screen
|
|
845
|
+
*/
|
|
846
|
+
view: () => LocalizedString;
|
|
847
|
+
/**
|
|
848
|
+
* Delete
|
|
849
|
+
*/
|
|
850
|
+
remove: () => LocalizedString;
|
|
851
|
+
/**
|
|
852
|
+
* Previous
|
|
853
|
+
*/
|
|
854
|
+
previous: () => LocalizedString;
|
|
855
|
+
/**
|
|
856
|
+
* Next
|
|
857
|
+
*/
|
|
858
|
+
next: () => LocalizedString;
|
|
859
|
+
/**
|
|
860
|
+
* Close (Esc)
|
|
861
|
+
*/
|
|
862
|
+
close: () => LocalizedString;
|
|
863
|
+
/**
|
|
864
|
+
* Unable to load image.
|
|
865
|
+
*/
|
|
866
|
+
loadingError: () => LocalizedString;
|
|
867
|
+
/**
|
|
868
|
+
* Zoom out
|
|
869
|
+
*/
|
|
870
|
+
zoomOut: () => LocalizedString;
|
|
871
|
+
/**
|
|
872
|
+
* Zoom in
|
|
873
|
+
*/
|
|
874
|
+
zoomIn: () => LocalizedString;
|
|
875
|
+
/**
|
|
876
|
+
* Alignment
|
|
877
|
+
*/
|
|
878
|
+
align: () => LocalizedString;
|
|
879
|
+
/**
|
|
880
|
+
* Align left
|
|
881
|
+
*/
|
|
882
|
+
alignLeft: () => LocalizedString;
|
|
883
|
+
/**
|
|
884
|
+
* Align center
|
|
885
|
+
*/
|
|
886
|
+
alignCenter: () => LocalizedString;
|
|
887
|
+
/**
|
|
888
|
+
* Align right
|
|
889
|
+
*/
|
|
890
|
+
alignRight: () => LocalizedString;
|
|
891
|
+
/**
|
|
892
|
+
* Resize image
|
|
893
|
+
*/
|
|
894
|
+
resize: () => LocalizedString;
|
|
895
|
+
/**
|
|
896
|
+
* Page width
|
|
897
|
+
*/
|
|
898
|
+
pageWidth: () => LocalizedString;
|
|
899
|
+
/**
|
|
900
|
+
* Original image width
|
|
901
|
+
*/
|
|
902
|
+
originalWidth: () => LocalizedString;
|
|
903
|
+
/**
|
|
904
|
+
* {0} image width
|
|
905
|
+
*/
|
|
906
|
+
imageWidth: (arg0: unknown) => LocalizedString;
|
|
907
|
+
/**
|
|
908
|
+
* Open image in new tab
|
|
909
|
+
*/
|
|
910
|
+
open: () => LocalizedString;
|
|
911
|
+
/**
|
|
912
|
+
* Caption
|
|
913
|
+
*/
|
|
914
|
+
caption: () => LocalizedString;
|
|
915
|
+
/**
|
|
916
|
+
* Write a caption...
|
|
917
|
+
*/
|
|
918
|
+
captionPlaceholder: () => LocalizedString;
|
|
919
|
+
};
|
|
920
|
+
file: {
|
|
921
|
+
/**
|
|
922
|
+
* Download
|
|
923
|
+
*/
|
|
924
|
+
download: () => LocalizedString;
|
|
925
|
+
/**
|
|
926
|
+
* Delete
|
|
927
|
+
*/
|
|
928
|
+
remove: () => LocalizedString;
|
|
929
|
+
};
|
|
930
|
+
video: {
|
|
931
|
+
/**
|
|
932
|
+
* Embed video
|
|
933
|
+
*/
|
|
934
|
+
embed: () => LocalizedString;
|
|
935
|
+
/**
|
|
936
|
+
* Delete
|
|
937
|
+
*/
|
|
938
|
+
remove: () => LocalizedString;
|
|
939
|
+
/**
|
|
940
|
+
* Paste a link to embed a video from YouTube.
|
|
941
|
+
*/
|
|
942
|
+
description: () => LocalizedString;
|
|
943
|
+
/**
|
|
944
|
+
* Link
|
|
945
|
+
*/
|
|
946
|
+
url: () => LocalizedString;
|
|
947
|
+
/**
|
|
948
|
+
* Please enter a valid link.
|
|
949
|
+
*/
|
|
950
|
+
urlError: () => LocalizedString;
|
|
951
|
+
};
|
|
952
|
+
codeBlock: {
|
|
953
|
+
/**
|
|
954
|
+
* Select language
|
|
955
|
+
*/
|
|
956
|
+
langType: () => LocalizedString;
|
|
957
|
+
};
|
|
958
|
+
equation: {
|
|
959
|
+
/**
|
|
960
|
+
* Done
|
|
961
|
+
*/
|
|
962
|
+
save: () => LocalizedString;
|
|
963
|
+
/**
|
|
964
|
+
* Supported functions
|
|
965
|
+
*/
|
|
966
|
+
help: () => LocalizedString;
|
|
967
|
+
/**
|
|
968
|
+
* Type a TeX expression...
|
|
969
|
+
*/
|
|
970
|
+
placeholder: () => LocalizedString;
|
|
971
|
+
};
|
|
972
|
+
};
|
|
973
|
+
|
|
974
|
+
interface ActiveItem {
|
|
975
|
+
node: Nodes;
|
|
976
|
+
name: string;
|
|
977
|
+
attributes: KeyValue;
|
|
978
|
+
styles: KeyValue;
|
|
979
|
+
}
|
|
980
|
+
interface SelectionState {
|
|
981
|
+
activeItems: ActiveItem[];
|
|
982
|
+
disabledNameMap?: Map<string, boolean>;
|
|
983
|
+
selectedNameMap?: Map<string, boolean>;
|
|
984
|
+
selectedValuesMap?: Map<string, string[]>;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
type NativeRange = Range;
|
|
988
|
+
|
|
989
|
+
/**
|
|
990
|
+
* The Range interface represents a fragment of a document that can contain nodes and parts of text nodes.
|
|
991
|
+
* Its interface is similar to the native Range, with some additional properties and methods specifically designed for more efficient manipulation.
|
|
992
|
+
*/
|
|
993
|
+
declare class Range$1 {
|
|
994
|
+
/**
|
|
995
|
+
* A native Range object.
|
|
996
|
+
*/
|
|
997
|
+
private readonly range;
|
|
998
|
+
constructor(range?: NativeRange);
|
|
999
|
+
/**
|
|
1000
|
+
* A node within which the range starts.
|
|
1001
|
+
*/
|
|
1002
|
+
get startNode(): Nodes;
|
|
1003
|
+
/**
|
|
1004
|
+
* A number representing where in the startNode the range starts.
|
|
1005
|
+
*/
|
|
1006
|
+
get startOffset(): number;
|
|
1007
|
+
/**
|
|
1008
|
+
* A node within which the range ends.
|
|
1009
|
+
*/
|
|
1010
|
+
get endNode(): Nodes;
|
|
1011
|
+
/**
|
|
1012
|
+
* A number representing where in the endNode the range ends.
|
|
1013
|
+
*/
|
|
1014
|
+
get endOffset(): number;
|
|
1015
|
+
/**
|
|
1016
|
+
* The deepest — or furthest down the document tree — node that contains both boundary points of the range.
|
|
1017
|
+
*/
|
|
1018
|
+
get commonAncestor(): Nodes;
|
|
1019
|
+
/**
|
|
1020
|
+
* A boolean value indicating whether the range's start and end points are at the same position.
|
|
1021
|
+
*/
|
|
1022
|
+
get isCollapsed(): boolean;
|
|
1023
|
+
/**
|
|
1024
|
+
* A boolean value indicating whether the range's start point is in a box.
|
|
1025
|
+
*/
|
|
1026
|
+
get isBox(): boolean;
|
|
1027
|
+
/**
|
|
1028
|
+
* A boolean value indicating whether the commonAncestor is in the start position of a box.
|
|
1029
|
+
*/
|
|
1030
|
+
get isBoxStart(): boolean;
|
|
1031
|
+
/**
|
|
1032
|
+
* A boolean value indicating whether the commonAncestor is in the center position of a box.
|
|
1033
|
+
*/
|
|
1034
|
+
get isBoxCenter(): boolean;
|
|
1035
|
+
/**
|
|
1036
|
+
* A boolean value indicating whether commonAncestor is in the end position of a box.
|
|
1037
|
+
*/
|
|
1038
|
+
get isBoxEnd(): boolean;
|
|
1039
|
+
/**
|
|
1040
|
+
* A boolean value indicating whether commonAncestor is inside the container of a box.
|
|
1041
|
+
*/
|
|
1042
|
+
get isInsideBox(): boolean;
|
|
1043
|
+
/**
|
|
1044
|
+
* A boolean value indicating whether the range is inoperative.
|
|
1045
|
+
*/
|
|
1046
|
+
get isInoperative(): boolean;
|
|
1047
|
+
/**
|
|
1048
|
+
* Returns a native Range object from the range.
|
|
1049
|
+
*/
|
|
1050
|
+
get(): NativeRange;
|
|
1051
|
+
/**
|
|
1052
|
+
* Returns the size and position of the range.
|
|
1053
|
+
*/
|
|
1054
|
+
getRect(): DOMRect;
|
|
1055
|
+
/**
|
|
1056
|
+
* Returns -1, 0, or 1 depending on whether the specified node is before, the same as, or after the range.
|
|
1057
|
+
* −1 if the point is before the range. 0 if the point is in the range. 1 if the point is after the range.
|
|
1058
|
+
*/
|
|
1059
|
+
comparePoint(node: Nodes, offset: number): number;
|
|
1060
|
+
/**
|
|
1061
|
+
* Returns -1, 0, or 1 depending on whether the beginning of the specified node is before, the same as, or after the range.
|
|
1062
|
+
* −1 if the beginning of the node is before the range. 0 if the beginning of the node is in the range. 1 if the beginning of the node is after the range.
|
|
1063
|
+
*/
|
|
1064
|
+
compareBeforeNode(node: Nodes): number;
|
|
1065
|
+
/**
|
|
1066
|
+
* Returns -1, 0, or 1 depending on whether the end of the specified node is before, the same as, or after the range.
|
|
1067
|
+
* −1 if the end of the node is before the range. 0 if the end of the node is in the range. 1 if the end of the node is after the range.
|
|
1068
|
+
*/
|
|
1069
|
+
compareAfterNode(node: Nodes): number;
|
|
1070
|
+
/**
|
|
1071
|
+
* Returns a boolean value indicating whether the specified node is part of the range or intersects the range.
|
|
1072
|
+
*/
|
|
1073
|
+
intersectsNode(node: Nodes): boolean;
|
|
1074
|
+
/**
|
|
1075
|
+
* Sets the start position of the range.
|
|
1076
|
+
*/
|
|
1077
|
+
setStart(node: Nodes, offset: number): void;
|
|
1078
|
+
/**
|
|
1079
|
+
* Sets the start position of the range to the beginning of the specified node.
|
|
1080
|
+
*/
|
|
1081
|
+
setStartBefore(node: Nodes): void;
|
|
1082
|
+
/**
|
|
1083
|
+
* Sets the start position of the range to the end of the specified node.
|
|
1084
|
+
*/
|
|
1085
|
+
setStartAfter(node: Nodes): void;
|
|
1086
|
+
/**
|
|
1087
|
+
* Sets the end position of the range.
|
|
1088
|
+
*/
|
|
1089
|
+
setEnd(node: Nodes, offset: number): void;
|
|
1090
|
+
/**
|
|
1091
|
+
* Sets the end position of the range to the beginning of the specified node.
|
|
1092
|
+
*/
|
|
1093
|
+
setEndBefore(node: Nodes): void;
|
|
1094
|
+
/**
|
|
1095
|
+
* Sets the end position of the range to the end of the specified node.
|
|
1096
|
+
*/
|
|
1097
|
+
setEndAfter(node: Nodes): void;
|
|
1098
|
+
/**
|
|
1099
|
+
* Collapses the range to its start.
|
|
1100
|
+
*/
|
|
1101
|
+
collapseToStart(): void;
|
|
1102
|
+
/**
|
|
1103
|
+
* Collapses the range to its end.
|
|
1104
|
+
*/
|
|
1105
|
+
collapseToEnd(): void;
|
|
1106
|
+
/**
|
|
1107
|
+
* Sets the range to contain the specified node and its contents.
|
|
1108
|
+
*/
|
|
1109
|
+
selectNode(node: Nodes): void;
|
|
1110
|
+
/**
|
|
1111
|
+
* Sets the range to contain the contents of the specified node.
|
|
1112
|
+
*/
|
|
1113
|
+
selectNodeContents(node: Nodes): void;
|
|
1114
|
+
/**
|
|
1115
|
+
* Collapses the range to the center position of the specified box.
|
|
1116
|
+
*/
|
|
1117
|
+
selectBox(boxNode: Nodes): void;
|
|
1118
|
+
/**
|
|
1119
|
+
* Collapses the range to the start position of the specified box.
|
|
1120
|
+
*/
|
|
1121
|
+
selectBoxStart(boxNode: Nodes): void;
|
|
1122
|
+
/**
|
|
1123
|
+
* Collapses the range to the end position of the specified box.
|
|
1124
|
+
*/
|
|
1125
|
+
selectBoxEnd(boxNode: Nodes): void;
|
|
1126
|
+
/**
|
|
1127
|
+
* Collapses the range to the deepest point at the beginning of the contents of the specified node.
|
|
1128
|
+
*/
|
|
1129
|
+
shrinkBefore(node: Nodes): void;
|
|
1130
|
+
/**
|
|
1131
|
+
* Collapses the range to the deepest point at the end of the contents of the specified node.
|
|
1132
|
+
*/
|
|
1133
|
+
shrinkAfter(node: Nodes): void;
|
|
1134
|
+
/**
|
|
1135
|
+
* Sets the start and end positions of the range to the deepest start position and end position of the contents of the specified node.
|
|
1136
|
+
*/
|
|
1137
|
+
shrink(): void;
|
|
1138
|
+
/**
|
|
1139
|
+
* Relocates the start and end positions of the range for boxes.
|
|
1140
|
+
*/
|
|
1141
|
+
adjustBox(): void;
|
|
1142
|
+
/**
|
|
1143
|
+
* Relocates the start and end positions of the range for tables.
|
|
1144
|
+
*/
|
|
1145
|
+
adjustTable(): void;
|
|
1146
|
+
/**
|
|
1147
|
+
* Relocates the start and end positions of the range for blocks.
|
|
1148
|
+
*/
|
|
1149
|
+
adjustBlock(): void;
|
|
1150
|
+
/**
|
|
1151
|
+
* Relocates the start and end positions of the range for boxes, tables, and blocks.
|
|
1152
|
+
*/
|
|
1153
|
+
adjust(): void;
|
|
1154
|
+
/**
|
|
1155
|
+
* Relocates the start and end positions of the range for <br /> elements.
|
|
1156
|
+
*/
|
|
1157
|
+
adjustBr(): void;
|
|
1158
|
+
/**
|
|
1159
|
+
* Returns the node immediately preceding the start position of the range.
|
|
1160
|
+
*/
|
|
1161
|
+
getPrevNode(): Nodes;
|
|
1162
|
+
/**
|
|
1163
|
+
* Returns the node immediately following the end position of the range.
|
|
1164
|
+
*/
|
|
1165
|
+
getNextNode(): Nodes;
|
|
1166
|
+
/**
|
|
1167
|
+
* Returns the boxes contained within or intersected by the range.
|
|
1168
|
+
*/
|
|
1169
|
+
getBoxes(): Nodes[];
|
|
1170
|
+
/**
|
|
1171
|
+
* Returns the blocks contained within or intersected by the range.
|
|
1172
|
+
*/
|
|
1173
|
+
getBlocks(): Nodes[];
|
|
1174
|
+
/**
|
|
1175
|
+
* Returns the marks and text nodes contained within or intersected by the range.
|
|
1176
|
+
*/
|
|
1177
|
+
getMarks(hasText?: boolean): Nodes[];
|
|
1178
|
+
/**
|
|
1179
|
+
* Returns the text from the start position of the closest block to the start position of the range.
|
|
1180
|
+
*/
|
|
1181
|
+
getStartText(): string;
|
|
1182
|
+
/**
|
|
1183
|
+
* Returns the text from the end position of the range to the end position of the closest block.
|
|
1184
|
+
*/
|
|
1185
|
+
getEndText(): string;
|
|
1186
|
+
/**
|
|
1187
|
+
* Returns a new range from the specified character to the start position of the range.
|
|
1188
|
+
* The specified character must be preceded by a whitespace or be at the beginning of a paragraph,
|
|
1189
|
+
* without being adjacent to other characters. It will return null if not.
|
|
1190
|
+
*/
|
|
1191
|
+
getCharacterRange(character: string): Range$1 | null;
|
|
1192
|
+
/**
|
|
1193
|
+
* Returns a copy of the range.
|
|
1194
|
+
*/
|
|
1195
|
+
clone(): Range$1;
|
|
1196
|
+
/**
|
|
1197
|
+
* Returns a DocumentFragment object copying the nodes included in the range.
|
|
1198
|
+
*/
|
|
1199
|
+
cloneContents(): DocumentFragment;
|
|
1200
|
+
/**
|
|
1201
|
+
* Prints information about the range, which is used for debugging.
|
|
1202
|
+
*/
|
|
1203
|
+
info(): void;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* Inserts a bookmark at the cursor position or a pair of bookmarks at the beginning and end of the range.
|
|
1208
|
+
*/
|
|
1209
|
+
declare function insertBookmark(range: Range$1): {
|
|
1210
|
+
anchor: Nodes;
|
|
1211
|
+
focus: Nodes;
|
|
1212
|
+
};
|
|
1213
|
+
|
|
1214
|
+
/**
|
|
1215
|
+
* Changes the specified range to a range represented by the provided bookmark.
|
|
1216
|
+
*/
|
|
1217
|
+
declare function toBookmark(range: Range$1, bookmark: {
|
|
1218
|
+
anchor: Nodes;
|
|
1219
|
+
focus: Nodes;
|
|
1220
|
+
}): void;
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* The Fragment interface represents a lightweight document object that has no parent.
|
|
1224
|
+
* It is designed for efficient manipulation of document structures without affecting the main DOM.
|
|
1225
|
+
*/
|
|
1226
|
+
declare class Fragment {
|
|
1227
|
+
/**
|
|
1228
|
+
* A native DocumentFragment object.
|
|
1229
|
+
*/
|
|
1230
|
+
private readonly fragment;
|
|
1231
|
+
constructor(fragment?: DocumentFragment);
|
|
1232
|
+
/**
|
|
1233
|
+
* Returns a native DocumentFragment object from the fragment.
|
|
1234
|
+
*/
|
|
1235
|
+
get(): DocumentFragment;
|
|
1236
|
+
/**
|
|
1237
|
+
* Finds and returns descendants of the fragment that match the specified CSS selector.
|
|
1238
|
+
*/
|
|
1239
|
+
find(selector: string): Nodes;
|
|
1240
|
+
/**
|
|
1241
|
+
* Inserts the specified content just inside the fragment, after its last child.
|
|
1242
|
+
*/
|
|
1243
|
+
append(content: string | Node | Nodes): void;
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
/**
|
|
1247
|
+
* Inserts the specified contents into the range.
|
|
1248
|
+
*/
|
|
1249
|
+
declare function insertContents(range: Range$1, contents: string | Node | DocumentFragment | Nodes | Fragment): void;
|
|
1250
|
+
|
|
1251
|
+
/**
|
|
1252
|
+
* Removes the contents of the specified range.
|
|
1253
|
+
*/
|
|
1254
|
+
declare function deleteContents(range: Range$1): void;
|
|
1255
|
+
|
|
1256
|
+
/**
|
|
1257
|
+
* Adds new blocks or changes the target blocks in the specified range.
|
|
1258
|
+
*/
|
|
1259
|
+
declare function setBlocks(range: Range$1, value: string | KeyValue): void;
|
|
1260
|
+
|
|
1261
|
+
/**
|
|
1262
|
+
* Removes the contents of the specified range and then splits the block node at the point of the collapsed range.
|
|
1263
|
+
*/
|
|
1264
|
+
declare function splitBlock(range: Range$1): TwoParts;
|
|
1265
|
+
|
|
1266
|
+
/**
|
|
1267
|
+
* Inserts a block into the specified range.
|
|
1268
|
+
*/
|
|
1269
|
+
declare function insertBlock(range: Range$1, value: string | Nodes): Nodes | null;
|
|
1270
|
+
|
|
1271
|
+
declare function splitMarks(range: Range$1, removeEmptyMark?: boolean): ThreeParts;
|
|
1272
|
+
|
|
1273
|
+
/**
|
|
1274
|
+
* Adds the specified mark to the texts of the range.
|
|
1275
|
+
*/
|
|
1276
|
+
declare function addMark(range: Range$1, value: string | Nodes): void;
|
|
1277
|
+
|
|
1278
|
+
/**
|
|
1279
|
+
* Removes the specified marks in the range.
|
|
1280
|
+
*/
|
|
1281
|
+
declare function removeMark(range: Range$1, value?: string): void;
|
|
1282
|
+
|
|
1283
|
+
/**
|
|
1284
|
+
* Inserts a box into the specified range.
|
|
1285
|
+
*/
|
|
1286
|
+
declare function insertBox(range: Range$1, boxName: string, boxValue?: BoxValue): Box | null;
|
|
1287
|
+
|
|
1288
|
+
/**
|
|
1289
|
+
* Removes a box that contains the specified range.
|
|
1290
|
+
*/
|
|
1291
|
+
declare function removeBox(range: Range$1): Box | null;
|
|
1292
|
+
|
|
1293
|
+
/**
|
|
1294
|
+
* The Selection interface represents the range of content selected by the user or the current cursor position.
|
|
1295
|
+
*/
|
|
1296
|
+
declare class Selection {
|
|
1297
|
+
/**
|
|
1298
|
+
* A native Selection object.
|
|
1299
|
+
*/
|
|
1300
|
+
private readonly selection;
|
|
1301
|
+
/**
|
|
1302
|
+
* A contenteditable element where users can edit the content.
|
|
1303
|
+
*/
|
|
1304
|
+
readonly container: Nodes;
|
|
1305
|
+
/**
|
|
1306
|
+
* A Range object that can be added to the native selection later.
|
|
1307
|
+
*/
|
|
1308
|
+
range: Range$1;
|
|
1309
|
+
constructor(container: Nodes);
|
|
1310
|
+
/**
|
|
1311
|
+
* Returns a Range object that is currently selected.
|
|
1312
|
+
*/
|
|
1313
|
+
getCurrentRange(): Range$1;
|
|
1314
|
+
/**
|
|
1315
|
+
* Adds the selection.range to the native selection.
|
|
1316
|
+
*/
|
|
1317
|
+
sync(): void;
|
|
1318
|
+
/**
|
|
1319
|
+
* Replaces the selection.range with the range of the native selection.
|
|
1320
|
+
*/
|
|
1321
|
+
updateByRange(): void;
|
|
1322
|
+
/**
|
|
1323
|
+
* Replaces the selection.range with the range represented by the bookmark.
|
|
1324
|
+
*/
|
|
1325
|
+
updateByBookmark(): void;
|
|
1326
|
+
/**
|
|
1327
|
+
* Returns a list of items related to the current selection.
|
|
1328
|
+
*/
|
|
1329
|
+
getActiveItems(): ActiveItem[];
|
|
1330
|
+
/**
|
|
1331
|
+
* Inserts a bookmark at the cursor position or a pair of bookmarks at the selection boundaries.
|
|
1332
|
+
*/
|
|
1333
|
+
insertBookmark(): ReturnType<typeof insertBookmark>;
|
|
1334
|
+
/**
|
|
1335
|
+
* Changes selection.range to the range represented by the provided bookmark.
|
|
1336
|
+
*/
|
|
1337
|
+
toBookmark(bookmark: Parameters<typeof toBookmark>[1]): ReturnType<typeof toBookmark>;
|
|
1338
|
+
/**
|
|
1339
|
+
* Inserts the specified content into the selection.
|
|
1340
|
+
*/
|
|
1341
|
+
insertContents(contents: Parameters<typeof insertContents>[1]): ReturnType<typeof insertContents>;
|
|
1342
|
+
/**
|
|
1343
|
+
* Removes the contents of the selection.
|
|
1344
|
+
*/
|
|
1345
|
+
deleteContents(): ReturnType<typeof deleteContents>;
|
|
1346
|
+
/**
|
|
1347
|
+
* Adds new blocks or changes the target blocks in the selection.
|
|
1348
|
+
*/
|
|
1349
|
+
setBlocks(value: Parameters<typeof setBlocks>[1]): ReturnType<typeof setBlocks>;
|
|
1350
|
+
/**
|
|
1351
|
+
* Removes the contents of the selection and splits the block node at the cursor position.
|
|
1352
|
+
*/
|
|
1353
|
+
splitBlock(): ReturnType<typeof splitBlock>;
|
|
1354
|
+
/**
|
|
1355
|
+
* Inserts a block into the selection.
|
|
1356
|
+
*/
|
|
1357
|
+
insertBlock(value: Parameters<typeof insertBlock>[1]): ReturnType<typeof insertBlock>;
|
|
1358
|
+
/**
|
|
1359
|
+
* Splits text nodes or mark nodes.
|
|
1360
|
+
*/
|
|
1361
|
+
splitMarks(removeEmptyMark?: Parameters<typeof splitMarks>[1]): ReturnType<typeof splitMarks>;
|
|
1362
|
+
/**
|
|
1363
|
+
* Adds the specified mark to the selected text.
|
|
1364
|
+
*/
|
|
1365
|
+
addMark(value: Parameters<typeof addMark>[1]): ReturnType<typeof addMark>;
|
|
1366
|
+
/**
|
|
1367
|
+
* Removes specified marks from the selection.
|
|
1368
|
+
*/
|
|
1369
|
+
removeMark(value?: Parameters<typeof removeMark>[1]): ReturnType<typeof removeMark>;
|
|
1370
|
+
/**
|
|
1371
|
+
* Collapses the selection to the center position of the specified box.
|
|
1372
|
+
*/
|
|
1373
|
+
selectBox(box: Box | Nodes): void;
|
|
1374
|
+
/**
|
|
1375
|
+
* Inserts a box into the selection.
|
|
1376
|
+
*/
|
|
1377
|
+
insertBox(boxName: Parameters<typeof insertBox>[1], boxValue?: Parameters<typeof insertBox>[2]): Box;
|
|
1378
|
+
/**
|
|
1379
|
+
* Removes the specified box. If no parameter is given, the selected box is removed.
|
|
1380
|
+
*/
|
|
1381
|
+
removeBox(box?: Box | Nodes | null): ReturnType<typeof removeBox>;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
interface CommandItem {
|
|
1385
|
+
isDisabled?: (activeItems: ActiveItem[]) => boolean;
|
|
1386
|
+
isSelected?: (activeItems: ActiveItem[]) => boolean;
|
|
1387
|
+
selectedValues?: (activeItems: ActiveItem[]) => string[];
|
|
1388
|
+
execute: (...data: any[]) => void;
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
/**
|
|
1392
|
+
* The Command interface manages a collection of commands.
|
|
1393
|
+
*/
|
|
1394
|
+
declare class Command {
|
|
1395
|
+
private readonly selection;
|
|
1396
|
+
private readonly commandMap;
|
|
1397
|
+
constructor(selection: Selection);
|
|
1398
|
+
/**
|
|
1399
|
+
* Adds a new command to the collection.
|
|
1400
|
+
*/
|
|
1401
|
+
add(name: string, commandItem: CommandItem): void;
|
|
1402
|
+
/**
|
|
1403
|
+
* Removes a command from the collection by its name.
|
|
1404
|
+
*/
|
|
1405
|
+
delete(name: string): void;
|
|
1406
|
+
/**
|
|
1407
|
+
* Returns the names of all registered commands.
|
|
1408
|
+
*/
|
|
1409
|
+
getNames(): string[];
|
|
1410
|
+
/**
|
|
1411
|
+
* Checks whether the specified command exists.
|
|
1412
|
+
*/
|
|
1413
|
+
has(name: string): boolean;
|
|
1414
|
+
/**
|
|
1415
|
+
* Returns a command item by its name.
|
|
1416
|
+
*/
|
|
1417
|
+
getItem(name: string): CommandItem;
|
|
1418
|
+
/**
|
|
1419
|
+
* Checks if the specified command is disabled.
|
|
1420
|
+
*/
|
|
1421
|
+
isDisabled(name: string): boolean;
|
|
1422
|
+
/**
|
|
1423
|
+
* Checks if the specified command is selected.
|
|
1424
|
+
*/
|
|
1425
|
+
isSelected(name: string): boolean;
|
|
1426
|
+
/**
|
|
1427
|
+
* Returns the selected values for the specified command.
|
|
1428
|
+
*/
|
|
1429
|
+
selectedValues(name: string): string[];
|
|
1430
|
+
/**
|
|
1431
|
+
* Executes the specified command.
|
|
1432
|
+
*/
|
|
1433
|
+
execute(name: string, ...data: any[]): void;
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
interface SaveOptions {
|
|
1437
|
+
inputType?: string;
|
|
1438
|
+
update?: boolean;
|
|
1439
|
+
emitEvent?: boolean;
|
|
1440
|
+
}
|
|
1441
|
+
/**
|
|
1442
|
+
* The History interface manages undo and redo functionality for a container that holds some editable content.
|
|
1443
|
+
* It emits events when actions like save, undo, or redo are performed.
|
|
1444
|
+
*/
|
|
1445
|
+
declare class History {
|
|
1446
|
+
private readonly selection;
|
|
1447
|
+
private readonly container;
|
|
1448
|
+
private canSave;
|
|
1449
|
+
/**
|
|
1450
|
+
* A list in which the current and previous contents are stored.
|
|
1451
|
+
*/
|
|
1452
|
+
readonly list: Nodes[];
|
|
1453
|
+
/**
|
|
1454
|
+
* An index that always indicates the position at which new content is stored.
|
|
1455
|
+
*/
|
|
1456
|
+
index: number;
|
|
1457
|
+
/**
|
|
1458
|
+
* The maximum length of the history. Once this limit is reached, the earliest item in the list will be removed.
|
|
1459
|
+
*/
|
|
1460
|
+
limit: number;
|
|
1461
|
+
/**
|
|
1462
|
+
* An EventEmitter object used to set up events.
|
|
1463
|
+
*/
|
|
1464
|
+
readonly event: EventEmitter;
|
|
1465
|
+
constructor(selection: Selection);
|
|
1466
|
+
private removeBookmark;
|
|
1467
|
+
private getValue;
|
|
1468
|
+
private addIdToBoxes;
|
|
1469
|
+
private removeIdfromBoxes;
|
|
1470
|
+
private morphContainer;
|
|
1471
|
+
/**
|
|
1472
|
+
* A boolean value indicating whether the history can be undone.
|
|
1473
|
+
*/
|
|
1474
|
+
get canUndo(): boolean;
|
|
1475
|
+
/**
|
|
1476
|
+
* A boolean value indicating whether the history can be redone.
|
|
1477
|
+
*/
|
|
1478
|
+
get canRedo(): boolean;
|
|
1479
|
+
/**
|
|
1480
|
+
* Creates a deep clone of the current container with its content.
|
|
1481
|
+
* If there is a selection within the container, it ensures the selection is also preserved in the cloned container.
|
|
1482
|
+
*/
|
|
1483
|
+
cloneContainer(): Nodes;
|
|
1484
|
+
/**
|
|
1485
|
+
* Undoes to the previous saved content.
|
|
1486
|
+
*/
|
|
1487
|
+
undo(): void;
|
|
1488
|
+
/**
|
|
1489
|
+
* Redoes to the next saved content.
|
|
1490
|
+
*/
|
|
1491
|
+
redo(): void;
|
|
1492
|
+
/**
|
|
1493
|
+
* Resumes the ability to save history.
|
|
1494
|
+
* This method re-enables saving after the pause method has been called.
|
|
1495
|
+
*/
|
|
1496
|
+
continue(): void;
|
|
1497
|
+
/**
|
|
1498
|
+
* Pauses the ability to save history.
|
|
1499
|
+
* This method temporarily disables saving history, which can be resumed later by calling the continue method.
|
|
1500
|
+
*/
|
|
1501
|
+
pause(): void;
|
|
1502
|
+
/**
|
|
1503
|
+
* Saves the current content to the history.
|
|
1504
|
+
* The content is saved only if it is different from the previous content.
|
|
1505
|
+
*/
|
|
1506
|
+
save(options?: SaveOptions): void;
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
/**
|
|
1510
|
+
* The Keystroke interface provides a way to handle keyboard events and define custom shortcuts for a given container.
|
|
1511
|
+
* It allows you to register hotkeys, bind specific actions to them, and handle their execution.
|
|
1512
|
+
*/
|
|
1513
|
+
declare class Keystroke {
|
|
1514
|
+
private readonly container;
|
|
1515
|
+
private readonly keydownEventList;
|
|
1516
|
+
private readonly keyupEventList;
|
|
1517
|
+
constructor(container: Nodes);
|
|
1518
|
+
/**
|
|
1519
|
+
* Registers a keydown event listener for the specified key combination.
|
|
1520
|
+
* The listener will be triggered when the key combination is pressed.
|
|
1521
|
+
*/
|
|
1522
|
+
setKeydown(type: string, listener: EventListener): void;
|
|
1523
|
+
/**
|
|
1524
|
+
* Registers a keyup event listener for the specified key combination.
|
|
1525
|
+
* The listener will be triggered when the key combination is released.
|
|
1526
|
+
*/
|
|
1527
|
+
setKeyup(type: string, listener: EventListener): void;
|
|
1528
|
+
/**
|
|
1529
|
+
* Triggers all keydown event listeners associated with the specified key combination.
|
|
1530
|
+
*/
|
|
1531
|
+
keydown(type: string): void;
|
|
1532
|
+
/**
|
|
1533
|
+
* Triggers all keyup event listeners associated with the specified key combination.
|
|
1534
|
+
*/
|
|
1535
|
+
keyup(type: string): void;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
/**
|
|
1539
|
+
* The BoxManager interface manages a collection of BoxComponent objects.
|
|
1540
|
+
* It allows you to add, remove, and retrieve the names of components.
|
|
1541
|
+
*/
|
|
1542
|
+
declare class BoxManager {
|
|
1543
|
+
/**
|
|
1544
|
+
* Adds a BoxComponent to the collection.
|
|
1545
|
+
*/
|
|
1546
|
+
add(component: BoxComponent): void;
|
|
1547
|
+
/**
|
|
1548
|
+
* Removes a box component from the collection by its name.
|
|
1549
|
+
*/
|
|
1550
|
+
remove(name: string): void;
|
|
1551
|
+
/**
|
|
1552
|
+
* Returns a list of all box component names in the collection.
|
|
1553
|
+
*/
|
|
1554
|
+
getNames(): string[];
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
type UnmountPlugin = () => void;
|
|
1558
|
+
type InitializePlugin = (editor: Editor) => UnmountPlugin | void;
|
|
1559
|
+
|
|
1560
|
+
/**
|
|
1561
|
+
* The Plugin interface manages a collection of plugins.
|
|
1562
|
+
* It allows plugins to be added and loaded into an Editor instance, and it handles the initialization and unmounting of those plugins.
|
|
1563
|
+
*/
|
|
1564
|
+
declare class Plugin {
|
|
1565
|
+
private readonly pluginMap;
|
|
1566
|
+
/**
|
|
1567
|
+
* Registers a plugin using a name as the key.
|
|
1568
|
+
*/
|
|
1569
|
+
add(name: string, plugin: InitializePlugin): void;
|
|
1570
|
+
/**
|
|
1571
|
+
* Loads all registered plugins.
|
|
1572
|
+
*/
|
|
1573
|
+
loadAll(editor: Editor): Map<string, UnmountPlugin>;
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
type DropdownLocation = 'local' | 'global';
|
|
1577
|
+
type DropdownDirection = 'top' | 'bottom' | 'auto';
|
|
1578
|
+
type DropdownMenuType = 'list' | 'icon' | 'character' | 'color';
|
|
1579
|
+
interface DropdownMenuItem {
|
|
1580
|
+
value: string;
|
|
1581
|
+
icon?: string;
|
|
1582
|
+
text: string | ((locale: TranslationFunctions) => string);
|
|
1583
|
+
}
|
|
1584
|
+
interface DropdownItem {
|
|
1585
|
+
name: string;
|
|
1586
|
+
icon?: string;
|
|
1587
|
+
accentIcon?: string;
|
|
1588
|
+
downIcon?: string;
|
|
1589
|
+
defaultValue?: string;
|
|
1590
|
+
tooltip: string | ((locale: TranslationFunctions) => string);
|
|
1591
|
+
width?: string;
|
|
1592
|
+
menuType: DropdownMenuType;
|
|
1593
|
+
menuItems: DropdownMenuItem[];
|
|
1594
|
+
menuWidth?: string;
|
|
1595
|
+
menuHeight?: string;
|
|
1596
|
+
menuCheck?: boolean;
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
interface ToolbarButtonItem {
|
|
1600
|
+
name: string;
|
|
1601
|
+
type: 'button';
|
|
1602
|
+
icon?: string;
|
|
1603
|
+
tooltip: string | ((locale: TranslationFunctions) => string);
|
|
1604
|
+
isSelected?: (activeItems: ActiveItem[]) => boolean;
|
|
1605
|
+
isDisabled?: (activeItems: ActiveItem[]) => boolean;
|
|
1606
|
+
onClick: (editor: Editor, value: string) => void;
|
|
1607
|
+
}
|
|
1608
|
+
interface ToolbarDropdownItem extends DropdownItem {
|
|
1609
|
+
name: string;
|
|
1610
|
+
type: 'dropdown';
|
|
1611
|
+
selectedValues?: (activeItems: ActiveItem[]) => string[];
|
|
1612
|
+
isDisabled?: (activeItems: ActiveItem[]) => boolean;
|
|
1613
|
+
onSelect: (editor: Editor, value: string) => void;
|
|
1614
|
+
}
|
|
1615
|
+
interface ToolbarUploadItem {
|
|
1616
|
+
name: string;
|
|
1617
|
+
type: 'upload';
|
|
1618
|
+
icon?: string;
|
|
1619
|
+
tooltip: string | ((locale: TranslationFunctions) => string);
|
|
1620
|
+
accept?: string;
|
|
1621
|
+
multiple?: boolean;
|
|
1622
|
+
}
|
|
1623
|
+
type ToolbarItem = ToolbarButtonItem | ToolbarDropdownItem | ToolbarUploadItem;
|
|
1624
|
+
|
|
1625
|
+
type ToolbarPlacement = 'top' | 'bottom';
|
|
1626
|
+
interface ToolbarConfig {
|
|
1627
|
+
root?: string | Node | Nodes;
|
|
1628
|
+
items?: (string | ToolbarItem)[];
|
|
1629
|
+
placement?: ToolbarPlacement;
|
|
1630
|
+
}
|
|
1631
|
+
/**
|
|
1632
|
+
* The Toolbar interface provides properties and methods for rendering and manipulating the toolbar.
|
|
1633
|
+
*/
|
|
1634
|
+
declare class Toolbar {
|
|
1635
|
+
private items;
|
|
1636
|
+
private placement;
|
|
1637
|
+
private allMenuMap;
|
|
1638
|
+
private buttonItemList;
|
|
1639
|
+
private dropdownItemList;
|
|
1640
|
+
private dropdownList;
|
|
1641
|
+
/**
|
|
1642
|
+
* The element to which the toolbar is appended.
|
|
1643
|
+
*/
|
|
1644
|
+
root: Nodes;
|
|
1645
|
+
/**
|
|
1646
|
+
* The element where toolbar items are appended.
|
|
1647
|
+
*/
|
|
1648
|
+
container: Nodes;
|
|
1649
|
+
constructor(config: ToolbarConfig);
|
|
1650
|
+
private appendDivider;
|
|
1651
|
+
private appendNormalButton;
|
|
1652
|
+
private appendDropdown;
|
|
1653
|
+
private appendUploadButton;
|
|
1654
|
+
/**
|
|
1655
|
+
* Updates the state of each toolbar item, such as whether it is selected or disabled.
|
|
1656
|
+
*/
|
|
1657
|
+
updateState(state?: SelectionState): void;
|
|
1658
|
+
/**
|
|
1659
|
+
* Renders the toolbar for the specified editor.
|
|
1660
|
+
*/
|
|
1661
|
+
render(editor: Editor): void;
|
|
1662
|
+
/**
|
|
1663
|
+
* Destroys the toolbar instance, removing it from the DOM.
|
|
1664
|
+
*/
|
|
1665
|
+
unmount(): void;
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
type OnMessage = (type: 'success' | 'error' | 'warning', message: string) => void;
|
|
1669
|
+
interface Config {
|
|
1670
|
+
value: string;
|
|
1671
|
+
readonly: boolean;
|
|
1672
|
+
spellcheck: boolean;
|
|
1673
|
+
tabIndex: number;
|
|
1674
|
+
placeholder: string;
|
|
1675
|
+
indentWithTab: boolean;
|
|
1676
|
+
lang: string;
|
|
1677
|
+
minChangeSize: number;
|
|
1678
|
+
historySize: number;
|
|
1679
|
+
onMessage: OnMessage;
|
|
1680
|
+
[name: string]: any;
|
|
1681
|
+
}
|
|
1682
|
+
interface EditorConfig {
|
|
1683
|
+
root: string | Node | Nodes;
|
|
1684
|
+
toolbar?: Toolbar;
|
|
1685
|
+
value?: string;
|
|
1686
|
+
readonly?: boolean;
|
|
1687
|
+
spellcheck?: boolean;
|
|
1688
|
+
tabIndex?: number;
|
|
1689
|
+
placeholder?: string;
|
|
1690
|
+
indentWithTab?: boolean;
|
|
1691
|
+
lang?: string;
|
|
1692
|
+
minChangeSize?: number;
|
|
1693
|
+
onMessage?: OnMessage;
|
|
1694
|
+
[name: string]: any;
|
|
1695
|
+
}
|
|
1696
|
+
/**
|
|
1697
|
+
* The Editor interface provides properties and methods for rendering and manipulating the editor.
|
|
1698
|
+
*/
|
|
1699
|
+
declare class Editor {
|
|
1700
|
+
/**
|
|
1701
|
+
* A string that has not yet been saved to the history.
|
|
1702
|
+
*/
|
|
1703
|
+
private unsavedInputData;
|
|
1704
|
+
/**
|
|
1705
|
+
* The number of input event calls before saving to the history.
|
|
1706
|
+
*/
|
|
1707
|
+
private unsavedInputCount;
|
|
1708
|
+
/**
|
|
1709
|
+
* The state of the current selection.
|
|
1710
|
+
*/
|
|
1711
|
+
private state;
|
|
1712
|
+
/**
|
|
1713
|
+
* The functions for unmounting plugins.
|
|
1714
|
+
*/
|
|
1715
|
+
private unmountPluginMap;
|
|
1716
|
+
/**
|
|
1717
|
+
* The parent element of the container.
|
|
1718
|
+
*/
|
|
1719
|
+
private readonly containerWrapper;
|
|
1720
|
+
/**
|
|
1721
|
+
* The current version of Lake.
|
|
1722
|
+
*/
|
|
1723
|
+
static readonly version: string;
|
|
1724
|
+
/**
|
|
1725
|
+
* A BoxManager object that manages the box components.
|
|
1726
|
+
*/
|
|
1727
|
+
static readonly box: BoxManager;
|
|
1728
|
+
/**
|
|
1729
|
+
* A Plugin object that manages a collection of plugins.
|
|
1730
|
+
*/
|
|
1731
|
+
static readonly plugin: Plugin;
|
|
1732
|
+
/**
|
|
1733
|
+
* An element to which the editor is appended.
|
|
1734
|
+
*/
|
|
1735
|
+
readonly root: Nodes;
|
|
1736
|
+
/**
|
|
1737
|
+
* The toolbar for the editor.
|
|
1738
|
+
*/
|
|
1739
|
+
readonly toolbar: Toolbar | undefined;
|
|
1740
|
+
/**
|
|
1741
|
+
* The configuration for the editor.
|
|
1742
|
+
*/
|
|
1743
|
+
readonly config: Config;
|
|
1744
|
+
/**
|
|
1745
|
+
* A contenteditable element where users can edit the editor's content.
|
|
1746
|
+
*/
|
|
1747
|
+
readonly container: Nodes;
|
|
1748
|
+
/**
|
|
1749
|
+
* An element to which overlays are appended.
|
|
1750
|
+
*/
|
|
1751
|
+
readonly overlayContainer: Nodes;
|
|
1752
|
+
/**
|
|
1753
|
+
* An EventEmitter object used to set up events.
|
|
1754
|
+
*/
|
|
1755
|
+
readonly event: EventEmitter;
|
|
1756
|
+
/**
|
|
1757
|
+
* A Selection object representing the range of content selected by the user or the current position of the cursor.
|
|
1758
|
+
*/
|
|
1759
|
+
readonly selection: Selection;
|
|
1760
|
+
/**
|
|
1761
|
+
* A Command object managing all registered commands.
|
|
1762
|
+
*/
|
|
1763
|
+
readonly command: Command;
|
|
1764
|
+
/**
|
|
1765
|
+
* A History object that manages the undo and redo history.
|
|
1766
|
+
*/
|
|
1767
|
+
readonly history: History;
|
|
1768
|
+
/**
|
|
1769
|
+
* A Keystroke object that manages keyboard shortcuts.
|
|
1770
|
+
*/
|
|
1771
|
+
readonly keystroke: Keystroke;
|
|
1772
|
+
/**
|
|
1773
|
+
* A boolean value indicating whether the editor is in read-only mode.
|
|
1774
|
+
*/
|
|
1775
|
+
readonly readonly: boolean;
|
|
1776
|
+
/**
|
|
1777
|
+
* A boolean value indicating whether a user is entering a character using a text composition system such as an Input Method Editor (IME).
|
|
1778
|
+
*/
|
|
1779
|
+
isComposing: boolean;
|
|
1780
|
+
/**
|
|
1781
|
+
* A pop-up component which is currently displayed, such as LinkPopup, MentionMenu, and SlashMenu.
|
|
1782
|
+
*/
|
|
1783
|
+
popup: any;
|
|
1784
|
+
constructor(config: EditorConfig);
|
|
1785
|
+
private copyListener;
|
|
1786
|
+
private cutListener;
|
|
1787
|
+
private pasteListener;
|
|
1788
|
+
private selectionchangeListener;
|
|
1789
|
+
private clickListener;
|
|
1790
|
+
private updateSelectionRange;
|
|
1791
|
+
/**
|
|
1792
|
+
* Updates the classes of all boxes when the current selection is changed.
|
|
1793
|
+
*/
|
|
1794
|
+
private updateBoxSelectionStyle;
|
|
1795
|
+
/**
|
|
1796
|
+
* Triggers the statechange event when the current selection is changed.
|
|
1797
|
+
*/
|
|
1798
|
+
private emitStateChangeEvent;
|
|
1799
|
+
/**
|
|
1800
|
+
* Adds or Removes a placeholder class.
|
|
1801
|
+
*/
|
|
1802
|
+
private togglePlaceholderClass;
|
|
1803
|
+
/**
|
|
1804
|
+
* Moves the input text from box strip to normal position.
|
|
1805
|
+
*/
|
|
1806
|
+
private moveBoxStripText;
|
|
1807
|
+
/**
|
|
1808
|
+
* Resets the value of "unsavedInputData" property.
|
|
1809
|
+
*/
|
|
1810
|
+
private resetUnsavedInputData;
|
|
1811
|
+
/**
|
|
1812
|
+
* Handles input event.
|
|
1813
|
+
*/
|
|
1814
|
+
private handleInputEvent;
|
|
1815
|
+
/**
|
|
1816
|
+
* Binds events for inputting text.
|
|
1817
|
+
*/
|
|
1818
|
+
private bindInputEvents;
|
|
1819
|
+
/**
|
|
1820
|
+
* Removes all unused box instances.
|
|
1821
|
+
*/
|
|
1822
|
+
private removeBoxGarbage;
|
|
1823
|
+
/**
|
|
1824
|
+
* Binds events for history.
|
|
1825
|
+
*/
|
|
1826
|
+
private bindHistoryEvents;
|
|
1827
|
+
/**
|
|
1828
|
+
* Returns translation functions for the specified language.
|
|
1829
|
+
*/
|
|
1830
|
+
get locale(): TranslationFunctions;
|
|
1831
|
+
/**
|
|
1832
|
+
* Sets the default config for the specified plugin.
|
|
1833
|
+
*/
|
|
1834
|
+
setPluginConfig(name: string, config: Record<string, any>): void;
|
|
1835
|
+
/**
|
|
1836
|
+
* Fixes incorrect content, such as adding paragraphs for void elements or removing empty tags.
|
|
1837
|
+
*/
|
|
1838
|
+
fixContent(): boolean;
|
|
1839
|
+
/**
|
|
1840
|
+
* Renders all boxes that haven't been rendered yet.
|
|
1841
|
+
*/
|
|
1842
|
+
renderBoxes(): void;
|
|
1843
|
+
/**
|
|
1844
|
+
* Scrolls to the cursor.
|
|
1845
|
+
*/
|
|
1846
|
+
scrollToCursor(): void;
|
|
1847
|
+
/**
|
|
1848
|
+
* Checks whether the editor has focus.
|
|
1849
|
+
*/
|
|
1850
|
+
hasFocus(): boolean;
|
|
1851
|
+
/**
|
|
1852
|
+
* Sets focus on the editor.
|
|
1853
|
+
*/
|
|
1854
|
+
focus(): void;
|
|
1855
|
+
/**
|
|
1856
|
+
* Removes focus from the editor.
|
|
1857
|
+
*/
|
|
1858
|
+
blur(): void;
|
|
1859
|
+
/**
|
|
1860
|
+
* Sets the specified content to the editor.
|
|
1861
|
+
*/
|
|
1862
|
+
setValue(value: string): void;
|
|
1863
|
+
/**
|
|
1864
|
+
* Returns the editor's content.
|
|
1865
|
+
*/
|
|
1866
|
+
getValue(): string;
|
|
1867
|
+
/**
|
|
1868
|
+
* Renders an editing area and sets default content to it.
|
|
1869
|
+
*/
|
|
1870
|
+
render(): void;
|
|
1871
|
+
/**
|
|
1872
|
+
* Destroys the editor.
|
|
1873
|
+
*/
|
|
1874
|
+
unmount(): void;
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
interface FloatingToolbarConfig extends ToolbarConfig {
|
|
1878
|
+
target: Nodes | Range$1;
|
|
1879
|
+
}
|
|
1880
|
+
declare class FloatingToolbar extends Toolbar {
|
|
1881
|
+
private range;
|
|
1882
|
+
constructor(config: FloatingToolbarConfig);
|
|
1883
|
+
private scrollListener;
|
|
1884
|
+
private resizeListener;
|
|
1885
|
+
private updatePosition;
|
|
1886
|
+
render(): void;
|
|
1887
|
+
unmount(): void;
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
/**
|
|
1891
|
+
* The Box interface represents an embedded content designed to enhance editing capability.
|
|
1892
|
+
*/
|
|
1893
|
+
declare class Box {
|
|
1894
|
+
/**
|
|
1895
|
+
* The lake-box element to which the contents of the box are appended.
|
|
1896
|
+
*/
|
|
1897
|
+
readonly node: Nodes;
|
|
1898
|
+
/**
|
|
1899
|
+
* An EventEmitter object for handling events. See the Instance events for details.
|
|
1900
|
+
*/
|
|
1901
|
+
readonly event: EventEmitter;
|
|
1902
|
+
/**
|
|
1903
|
+
* A floating toolbar attached to the box.
|
|
1904
|
+
*/
|
|
1905
|
+
toolbar: FloatingToolbar | null;
|
|
1906
|
+
constructor(node: string | Node | Nodes);
|
|
1907
|
+
private initiate;
|
|
1908
|
+
/**
|
|
1909
|
+
* Indicates the type of the box.
|
|
1910
|
+
*/
|
|
1911
|
+
get type(): BoxType;
|
|
1912
|
+
/**
|
|
1913
|
+
* Returns the name of the box.
|
|
1914
|
+
*/
|
|
1915
|
+
get name(): string;
|
|
1916
|
+
/**
|
|
1917
|
+
* Gets or sets the value of the box.
|
|
1918
|
+
*/
|
|
1919
|
+
get value(): BoxValue;
|
|
1920
|
+
set value(value: BoxValue);
|
|
1921
|
+
/**
|
|
1922
|
+
* Updates part of the value of the box.
|
|
1923
|
+
*/
|
|
1924
|
+
updateValue(keyName: string, keyValue: string): void;
|
|
1925
|
+
updateValue(keyName: BoxValue): void;
|
|
1926
|
+
/**
|
|
1927
|
+
* Returns the Editor object that contains the box.
|
|
1928
|
+
*/
|
|
1929
|
+
getEditor(): Editor;
|
|
1930
|
+
/**
|
|
1931
|
+
* Returns the container element of the box.
|
|
1932
|
+
*/
|
|
1933
|
+
getContainer(): Nodes;
|
|
1934
|
+
/**
|
|
1935
|
+
* Returns the HTML content inside the box.
|
|
1936
|
+
*/
|
|
1937
|
+
getHTML(): string;
|
|
1938
|
+
/**
|
|
1939
|
+
* Adds a floating toolbar to the box.
|
|
1940
|
+
*/
|
|
1941
|
+
setToolbar(items: ToolbarItem[]): void;
|
|
1942
|
+
/**
|
|
1943
|
+
* Renders the content inside the box.
|
|
1944
|
+
*/
|
|
1945
|
+
render(): void;
|
|
1946
|
+
/**
|
|
1947
|
+
* Destroys the box instance.
|
|
1948
|
+
*/
|
|
1949
|
+
unmount(): void;
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
type BoxType = 'inline' | 'block';
|
|
1953
|
+
type BoxValue = Record<string, any>;
|
|
1954
|
+
type BoxRender = (box: Box) => Nodes | string | void;
|
|
1955
|
+
type BoxHTML = (box: Box) => string;
|
|
1956
|
+
interface BoxComponent {
|
|
1957
|
+
type: BoxType;
|
|
1958
|
+
name: string;
|
|
1959
|
+
value?: BoxValue;
|
|
1960
|
+
render: BoxRender;
|
|
1961
|
+
html?: BoxHTML;
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
interface MentionItem {
|
|
1965
|
+
id: string;
|
|
1966
|
+
name: string;
|
|
1967
|
+
nickname?: string;
|
|
1968
|
+
avatar?: string;
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
interface SlashButtonItem {
|
|
1972
|
+
name: string;
|
|
1973
|
+
type: 'button';
|
|
1974
|
+
icon?: string;
|
|
1975
|
+
title: string | ((locale: TranslationFunctions) => string);
|
|
1976
|
+
description: string | ((locale: TranslationFunctions) => string);
|
|
1977
|
+
onClick: (editor: Editor, value: string) => void;
|
|
1978
|
+
}
|
|
1979
|
+
interface SlashUploadItem {
|
|
1980
|
+
name: string;
|
|
1981
|
+
type: 'upload';
|
|
1982
|
+
icon?: string;
|
|
1983
|
+
title: string | ((locale: TranslationFunctions) => string);
|
|
1984
|
+
description: string | ((locale: TranslationFunctions) => string);
|
|
1985
|
+
accept?: string;
|
|
1986
|
+
multiple?: boolean;
|
|
1987
|
+
}
|
|
1988
|
+
type SlashItem = SlashButtonItem | SlashUploadItem;
|
|
1989
|
+
|
|
1990
|
+
declare const icons: Map<string, string>;
|
|
1991
|
+
|
|
1992
|
+
/**
|
|
1993
|
+
* Returns a Nodes object representing a collection of the nodes.
|
|
1994
|
+
* This function is similar to jQuery, but its implementation is very simple.
|
|
1995
|
+
* It is designed for simplifying DOM manipulation.
|
|
1996
|
+
*/
|
|
1997
|
+
declare function query(content: string | Node | Nodes): Nodes;
|
|
1998
|
+
|
|
1999
|
+
/**
|
|
2000
|
+
* A tag function that converts all of the reserved characters in the specified string to HTML entities.
|
|
2001
|
+
* It also removes empty spaces at the beginning and end of lines.
|
|
2002
|
+
*/
|
|
2003
|
+
declare function template(strings: TemplateStringsArray, ...keys: any[]): string;
|
|
2004
|
+
|
|
2005
|
+
/**
|
|
2006
|
+
* Converts a color in RGB or RGBA format to hex format.
|
|
2007
|
+
*/
|
|
2008
|
+
declare function toHex(value: string): string;
|
|
2009
|
+
|
|
2010
|
+
/**
|
|
2011
|
+
* Returns an existing Box instance associated with the provided boxNode or generates a new one if none exists.
|
|
2012
|
+
* The function handles the creation and storage of Box instances, storing them either in a temporary or
|
|
2013
|
+
* permanentmap based on whether the boxNode is contained within a container.
|
|
2014
|
+
*/
|
|
2015
|
+
declare function getBox(boxNode: string | Node | Nodes): Box;
|
|
2016
|
+
|
|
2017
|
+
/**
|
|
2018
|
+
* The HTMLParser interface provides the ability to parse an HTML string according to specified rules.
|
|
2019
|
+
*/
|
|
2020
|
+
declare class HTMLParser {
|
|
2021
|
+
private readonly rules;
|
|
2022
|
+
private readonly source;
|
|
2023
|
+
constructor(content: string | Nodes, rules?: any);
|
|
2024
|
+
/**
|
|
2025
|
+
* Parses the given HTML string and returns the body element from the result.
|
|
2026
|
+
*/
|
|
2027
|
+
private parseHTML;
|
|
2028
|
+
/**
|
|
2029
|
+
* Returns a boolean value indicating whether the given value matches the given rule.
|
|
2030
|
+
*/
|
|
2031
|
+
private static matchRule;
|
|
2032
|
+
/**
|
|
2033
|
+
* Returns an open tag string from the specified element.
|
|
2034
|
+
*/
|
|
2035
|
+
private static getOpenTagString;
|
|
2036
|
+
/**
|
|
2037
|
+
* Returns a closed tag string from the specified element.
|
|
2038
|
+
*/
|
|
2039
|
+
private static getClosedTagString;
|
|
2040
|
+
/**
|
|
2041
|
+
* Returns the value of the text node with trimming invisible whitespace.
|
|
2042
|
+
*/
|
|
2043
|
+
private static getTrimmedText;
|
|
2044
|
+
/**
|
|
2045
|
+
* Returns the parsed HTML as a string.
|
|
2046
|
+
*/
|
|
2047
|
+
getHTML(): string;
|
|
2048
|
+
/**
|
|
2049
|
+
* Returns the parsed content as a DocumentFragment object.
|
|
2050
|
+
*/
|
|
2051
|
+
getFragment(): DocumentFragment;
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
/**
|
|
2055
|
+
* The TextParser interface enables parsing of text into structured HTML.
|
|
2056
|
+
*/
|
|
2057
|
+
declare class TextParser {
|
|
2058
|
+
private readonly content;
|
|
2059
|
+
constructor(content: string);
|
|
2060
|
+
/**
|
|
2061
|
+
* Converts the parsed text into an HTML string.
|
|
2062
|
+
*/
|
|
2063
|
+
getHTML(): string;
|
|
2064
|
+
/**
|
|
2065
|
+
* Generates a DocumentFragment object that represents the parsed text.
|
|
2066
|
+
*/
|
|
2067
|
+
getFragment(): DocumentFragment;
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
interface ButtonConfig {
|
|
2071
|
+
root: string | Node | Nodes;
|
|
2072
|
+
name: string;
|
|
2073
|
+
type?: 'primary' | 'default';
|
|
2074
|
+
icon?: string;
|
|
2075
|
+
text?: string;
|
|
2076
|
+
tooltip?: string;
|
|
2077
|
+
tabIndex?: number;
|
|
2078
|
+
onClick: () => void;
|
|
2079
|
+
}
|
|
2080
|
+
/**
|
|
2081
|
+
* The Button interface represents a clickable UI component. When a user clicks the button, a specified action is executed.
|
|
2082
|
+
*/
|
|
2083
|
+
declare class Button {
|
|
2084
|
+
private readonly config;
|
|
2085
|
+
private readonly root;
|
|
2086
|
+
/**
|
|
2087
|
+
* The button element.
|
|
2088
|
+
*/
|
|
2089
|
+
readonly node: Nodes;
|
|
2090
|
+
constructor(config: ButtonConfig);
|
|
2091
|
+
/**
|
|
2092
|
+
* Renders the button to the DOM.
|
|
2093
|
+
*/
|
|
2094
|
+
render(): void;
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
interface DropdownConfig extends DropdownItem {
|
|
2098
|
+
root: string | Node | Nodes;
|
|
2099
|
+
locale?: TranslationFunctions;
|
|
2100
|
+
tabIndex?: number;
|
|
2101
|
+
location?: DropdownLocation;
|
|
2102
|
+
direction?: DropdownDirection;
|
|
2103
|
+
onSelect: (value: string) => void;
|
|
2104
|
+
}
|
|
2105
|
+
/**
|
|
2106
|
+
* The Dropdown component provides a user-friendly menu with selectable options. Use it to allow users to pick from a list of predefined choices.
|
|
2107
|
+
*/
|
|
2108
|
+
declare class Dropdown {
|
|
2109
|
+
private readonly config;
|
|
2110
|
+
private readonly root;
|
|
2111
|
+
private readonly locale;
|
|
2112
|
+
private readonly location;
|
|
2113
|
+
private readonly direction;
|
|
2114
|
+
private readonly menuNode;
|
|
2115
|
+
/**
|
|
2116
|
+
* The DOM element that contains the dropdown's contents.
|
|
2117
|
+
*/
|
|
2118
|
+
readonly node: Nodes;
|
|
2119
|
+
constructor(config: DropdownConfig);
|
|
2120
|
+
/**
|
|
2121
|
+
* Returns the value of the node.
|
|
2122
|
+
*/
|
|
2123
|
+
static getValue(node: Nodes): string[];
|
|
2124
|
+
/**
|
|
2125
|
+
* Updates the value of the node.
|
|
2126
|
+
*/
|
|
2127
|
+
static setValue(node: Nodes, value: string[]): void;
|
|
2128
|
+
static getMenuMap(menuItems: DropdownMenuItem[], locale: TranslationFunctions): Map<string, string>;
|
|
2129
|
+
private updateColorAccent;
|
|
2130
|
+
private apppendMenuItems;
|
|
2131
|
+
private clickListener;
|
|
2132
|
+
private scrollListener;
|
|
2133
|
+
private resizeListener;
|
|
2134
|
+
private appendMenu;
|
|
2135
|
+
private updatePosition;
|
|
2136
|
+
private showMenu;
|
|
2137
|
+
private hideMenu;
|
|
2138
|
+
/**
|
|
2139
|
+
* Renders the dropdown to the DOM.
|
|
2140
|
+
*/
|
|
2141
|
+
render(): void;
|
|
2142
|
+
/**
|
|
2143
|
+
* Removes the dropdown from the DOM and cleans up resources.
|
|
2144
|
+
*/
|
|
2145
|
+
unmount(): void;
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
export { type ActiveItem, Box, type BoxComponent, type BoxValue, Button, type CommandItem, Dropdown, type DropdownItem, type DropdownMenuItem, Editor, Fragment, HTMLParser, type InitializePlugin, type KeyValue, type MentionItem, type NodePath, Nodes, Range$1 as Range, type SelectionState, type SlashButtonItem, type SlashItem, type SlashUploadItem, TextParser, Toolbar, type ToolbarButtonItem, type ToolbarDropdownItem, type ToolbarItem, type ToolbarUploadItem, type UnmountPlugin, addMark, deleteContents, getBox, icons, insertBlock, insertBookmark, insertBox, insertContents, query, removeBox, removeMark, setBlocks, splitBlock, splitMarks, template, toBookmark, toHex };
|