suneditor 3.0.0-beta.26 → 3.0.0-beta.28
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/suneditor.min.css +1 -1
- package/dist/suneditor.min.js +1 -1
- package/package.json +77 -39
- package/src/core/{section → base}/actives.js +1 -1
- package/src/core/class/component.js +2 -0
- package/src/core/class/format.js +44 -2435
- package/src/core/class/html.js +5 -4
- package/src/core/class/inline.js +1853 -0
- package/src/core/class/listFormat.js +582 -0
- package/src/core/class/nodeTransform.js +1 -3
- package/src/core/class/selection.js +4 -2
- package/src/core/class/ui.js +1 -1
- package/src/core/class/viewer.js +4 -4
- package/src/core/config/options.js +37 -18
- package/src/core/editor.js +43 -29
- package/src/core/event/actions/index.js +229 -0
- package/src/core/event/effects/common.registry.js +60 -0
- package/src/core/event/effects/keydown.registry.js +551 -0
- package/src/core/event/effects/ruleHelpers.js +145 -0
- package/src/core/{base → event}/eventManager.js +8 -124
- package/src/core/event/executor.js +21 -0
- package/src/core/{base/eventHandlers → event/handlers}/handler_toolbar.js +1 -1
- package/src/core/event/handlers/handler_ww_input.js +77 -0
- package/src/core/event/handlers/handler_ww_key.js +228 -0
- package/src/core/{base/eventHandlers → event/handlers}/handler_ww_mouse.js +3 -3
- package/src/core/event/ports.js +211 -0
- package/src/core/event/reducers/keydown.reducer.js +89 -0
- package/src/core/event/rules/keydown.rule.arrow.js +54 -0
- package/src/core/event/rules/keydown.rule.backspace.js +202 -0
- package/src/core/event/rules/keydown.rule.delete.js +126 -0
- package/src/core/event/rules/keydown.rule.enter.js +144 -0
- package/src/core/event/rules/keydown.rule.tab.js +29 -0
- package/src/core/section/constructor.js +57 -23
- package/src/editorInjector/_classes.js +4 -0
- package/src/editorInjector/index.js +4 -0
- package/src/helper/clipboard.js +0 -1
- package/src/helper/converter.js +6 -7
- package/src/helper/dom/domCheck.js +1 -1
- package/src/helper/dom/domQuery.js +1 -1
- package/src/helper/dom/domUtils.js +2 -2
- package/src/helper/dom/index.js +4 -0
- package/src/helper/env.js +1 -6
- package/src/helper/keyCodeMap.js +0 -1
- package/src/langs/ckb.js +1 -1
- package/src/langs/cs.js +1 -1
- package/src/langs/da.js +1 -1
- package/src/langs/de.js +1 -1
- package/src/langs/en.js +1 -1
- package/src/langs/es.js +1 -1
- package/src/langs/fa.js +1 -1
- package/src/langs/fr.js +1 -1
- package/src/langs/he.js +1 -1
- package/src/langs/hu.js +1 -1
- package/src/langs/it.js +1 -1
- package/src/langs/ja.js +1 -1
- package/src/langs/km.js +1 -1
- package/src/langs/ko.js +1 -1
- package/src/langs/lv.js +1 -1
- package/src/langs/nl.js +1 -1
- package/src/langs/pl.js +1 -1
- package/src/langs/pt_br.js +1 -1
- package/src/langs/ro.js +1 -1
- package/src/langs/ru.js +1 -1
- package/src/langs/se.js +1 -1
- package/src/langs/tr.js +1 -1
- package/src/langs/uk.js +1 -1
- package/src/langs/ur.js +1 -1
- package/src/langs/zh_cn.js +1 -1
- package/src/modules/ApiManager.js +5 -0
- package/src/modules/Figure.js +4 -10
- package/src/modules/HueSlider.js +18 -4
- package/src/modules/SelectMenu.js +1 -1
- package/src/plugins/command/fileUpload.js +1 -1
- package/src/plugins/command/list_bulleted.js +1 -1
- package/src/plugins/command/list_numbered.js +1 -1
- package/src/plugins/dropdown/backgroundColor.js +2 -2
- package/src/plugins/dropdown/font.js +2 -2
- package/src/plugins/dropdown/fontColor.js +2 -2
- package/src/plugins/dropdown/list.js +1 -1
- package/src/plugins/dropdown/table.js +1 -3
- package/src/plugins/dropdown/textStyle.js +1 -1
- package/src/plugins/field/mention.js +2 -2
- package/src/plugins/input/fontSize.js +9 -9
- package/src/plugins/modal/audio.js +5 -5
- package/src/plugins/modal/embed.js +5 -5
- package/src/plugins/modal/image.js +7 -7
- package/src/plugins/modal/link.js +23 -8
- package/src/plugins/modal/video.js +5 -5
- package/src/suneditor.js +9 -34
- package/src/typedef.js +15 -9
- package/types/core/class/format.d.ts +2 -352
- package/types/core/class/html.d.ts +2 -2
- package/types/core/class/inline.d.ts +263 -0
- package/types/core/class/listFormat.d.ts +135 -0
- package/types/core/config/options.d.ts +52 -78
- package/types/core/editor.d.ts +22 -12
- package/types/core/event/actions/index.d.ts +47 -0
- package/types/core/event/effects/common.registry.d.ts +50 -0
- package/types/core/event/effects/keydown.registry.d.ts +73 -0
- package/types/core/event/effects/ruleHelpers.d.ts +31 -0
- package/types/core/{base → event}/eventManager.d.ts +0 -42
- package/types/core/event/executor.d.ts +6 -0
- package/types/core/event/handlers/handler_ww_input.d.ts +41 -0
- package/types/core/{base/eventHandlers/handler_ww_key_input.d.ts → event/handlers/handler_ww_key.d.ts} +4 -33
- package/types/core/event/ports.d.ts +255 -0
- package/types/core/event/reducers/keydown.reducer.d.ts +75 -0
- package/types/core/event/rules/keydown.rule.arrow.d.ts +8 -0
- package/types/core/event/rules/keydown.rule.backspace.d.ts +9 -0
- package/types/core/event/rules/keydown.rule.delete.d.ts +9 -0
- package/types/core/event/rules/keydown.rule.enter.d.ts +9 -0
- package/types/core/event/rules/keydown.rule.tab.d.ts +9 -0
- package/types/core/section/constructor.d.ts +165 -39
- package/types/editorInjector/_classes.d.ts +4 -0
- package/types/editorInjector/index.d.ts +4 -0
- package/types/helper/converter.d.ts +4 -20
- package/types/helper/dom/index.d.ts +86 -1
- package/types/index.d.ts +11 -121
- package/types/langs/index.d.ts +2 -2
- package/types/modules/HueSlider.d.ts +12 -0
- package/types/modules/index.d.ts +3 -3
- package/types/plugins/index.d.ts +38 -38
- package/types/plugins/modal/link.d.ts +6 -4
- package/types/suneditor.d.ts +18 -19
- package/types/typedef.d.ts +6 -2
- package/src/core/base/eventHandlers/handler_ww_key_input.js +0 -1267
- package/types/core/section/context.d.ts +0 -67
- package/types/core/section/options.d.ts +0 -1022
- package/types/langs/_Lang.d.ts +0 -194
- /package/src/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.js +0 -0
- /package/src/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.js +0 -0
- /package/types/core/{section → base}/actives.d.ts +0 -0
- /package/types/core/{base/eventHandlers → event/handlers}/handler_toolbar.d.ts +0 -0
- /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.d.ts +0 -0
- /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.d.ts +0 -0
- /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_mouse.d.ts +0 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
export default Inline;
|
|
2
|
+
export type InlineThis = Omit<Inline & Partial<__se__EditorInjector>, 'inline'>;
|
|
3
|
+
export type NodeStyleContainerType = {
|
|
4
|
+
ancestor?: (Node | null) | undefined;
|
|
5
|
+
offset?: (number | null) | undefined;
|
|
6
|
+
container?: (Node | null) | undefined;
|
|
7
|
+
endContainer?: (Node | null) | undefined;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {Omit<Inline & Partial<__se__EditorInjector>, 'inline'>} InlineThis
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {Object} NodeStyleContainerType
|
|
14
|
+
* @property {?Node=} ancestor
|
|
15
|
+
* @property {?number=} offset
|
|
16
|
+
* @property {?Node=} container
|
|
17
|
+
* @property {?Node=} endContainer
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* @constructor
|
|
21
|
+
* @this {InlineThis}
|
|
22
|
+
* @description Classes related to editor inline formats such as style node like strong, span, etc.
|
|
23
|
+
* @param {__se__EditorCore} editor - The root editor instance
|
|
24
|
+
*/
|
|
25
|
+
declare function Inline(this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>, editor: __se__EditorCore): void;
|
|
26
|
+
declare class Inline {
|
|
27
|
+
/**
|
|
28
|
+
* @typedef {Omit<Inline & Partial<__se__EditorInjector>, 'inline'>} InlineThis
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* @typedef {Object} NodeStyleContainerType
|
|
32
|
+
* @property {?Node=} ancestor
|
|
33
|
+
* @property {?number=} offset
|
|
34
|
+
* @property {?Node=} container
|
|
35
|
+
* @property {?Node=} endContainer
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* @constructor
|
|
39
|
+
* @this {InlineThis}
|
|
40
|
+
* @description Classes related to editor inline formats such as style node like strong, span, etc.
|
|
41
|
+
* @param {__se__EditorCore} editor - The root editor instance
|
|
42
|
+
*/
|
|
43
|
+
constructor(editor: __se__EditorCore);
|
|
44
|
+
_listCamel: any;
|
|
45
|
+
_listKebab: any;
|
|
46
|
+
/**
|
|
47
|
+
* @this {InlineThis}
|
|
48
|
+
* @description Adds, updates, or deletes style nodes from selected text (a, span, strong, etc.).
|
|
49
|
+
* @param {?Node} styleNode The element to be added to the selection. If null, only existing nodes are modified or removed.
|
|
50
|
+
* @param {Object} [options] Options
|
|
51
|
+
* @param {Array<string>} [options.stylesToModify=null] Array of style or class names to check and modify.
|
|
52
|
+
* (e.g., ['font-size'], ['.className'], ['font-family', 'color', '.className'])
|
|
53
|
+
* @param {Array<string>} [options.nodesToRemove=null] Array of node names to remove.
|
|
54
|
+
* If empty array or null when styleNode is null, all formats are removed.
|
|
55
|
+
* (e.g., ['span'], ['strong', 'em'])
|
|
56
|
+
* @param {boolean} [options.strictRemove=false] If true, only removes nodes from nodesToRemove if all styles and classes are removed.
|
|
57
|
+
* @returns {HTMLElement} The element that was added to or modified in the selection.
|
|
58
|
+
*
|
|
59
|
+
* @details
|
|
60
|
+
* 1. If styleNode is provided, a node with the same tags and attributes is added to the selected text.
|
|
61
|
+
* 2. If the same tag already exists, only its attributes are updated.
|
|
62
|
+
* 3. If styleNode is null, existing nodes are updated or removed without adding new ones.
|
|
63
|
+
* 4. Styles matching those in stylesToModify are removed. (Use CSS attribute names, e.g., "background-color")
|
|
64
|
+
* 5. Classes matching those in stylesToModify (prefixed with ".") are removed.
|
|
65
|
+
* 6. stylesToModify is used to avoid duplicate property values from styleNode.
|
|
66
|
+
* 7. Nodes with all styles and classes removed are deleted if they match styleNode, are in nodesToRemove, or if styleNode is null.
|
|
67
|
+
* 8. Tags matching names in nodesToRemove are deleted regardless of their style and class.
|
|
68
|
+
* 9. If strictRemove is true, nodes in nodesToRemove are only removed if all their styles and classes are removed.
|
|
69
|
+
* 10. The function won't modify nodes if the parent has the same class and style values.
|
|
70
|
+
* - However, if nodesToRemove has values, it will work and separate text nodes even if there's no node to replace.
|
|
71
|
+
*/
|
|
72
|
+
apply(
|
|
73
|
+
this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>,
|
|
74
|
+
styleNode: Node | null,
|
|
75
|
+
{
|
|
76
|
+
stylesToModify,
|
|
77
|
+
nodesToRemove,
|
|
78
|
+
strictRemove
|
|
79
|
+
}?: {
|
|
80
|
+
stylesToModify?: Array<string>;
|
|
81
|
+
nodesToRemove?: Array<string>;
|
|
82
|
+
strictRemove?: boolean;
|
|
83
|
+
}
|
|
84
|
+
): HTMLElement;
|
|
85
|
+
/**
|
|
86
|
+
* @this {InlineThis}
|
|
87
|
+
* @description Remove format of the currently selected text.
|
|
88
|
+
*/
|
|
89
|
+
remove(this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>): void;
|
|
90
|
+
/**
|
|
91
|
+
* @private
|
|
92
|
+
* @this {InlineThis}
|
|
93
|
+
* @description Nodes that must remain undetached when changing text nodes (A, Label, Code, Span:font-size)
|
|
94
|
+
* @param {Node|string} element Element to check
|
|
95
|
+
* @returns {boolean}
|
|
96
|
+
*/
|
|
97
|
+
_isNonSplitNode(this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>, element: Node | string): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* @private
|
|
100
|
+
* @this {InlineThis}
|
|
101
|
+
* @description Nodes that need to be added without modification when changing text nodes
|
|
102
|
+
* @param {Node} element Element to check
|
|
103
|
+
* @returns {boolean}
|
|
104
|
+
*/
|
|
105
|
+
_isIgnoreNodeChange(this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>, element: Node): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* @private
|
|
108
|
+
* @this {InlineThis}
|
|
109
|
+
* @description wraps text nodes of line selected text.
|
|
110
|
+
* @param {Node} element The node of the line that contains the selected text node.
|
|
111
|
+
* @param {Node} newInnerNode The dom that will wrap the selected text area
|
|
112
|
+
* @param {(current: Node) => Node|null} validation Check if the node should be stripped.
|
|
113
|
+
* @param {Node} startCon The startContainer property of the selection object.
|
|
114
|
+
* @param {number} startOff The startOffset property of the selection object.
|
|
115
|
+
* @param {Node} endCon The endContainer property of the selection object.
|
|
116
|
+
* @param {number} endOff The endOffset property of the selection object.
|
|
117
|
+
* @param {boolean} isRemoveFormat Is the remove all formats command?
|
|
118
|
+
* @param {boolean} isRemoveNode "newInnerNode" is remove node?
|
|
119
|
+
* @param {boolean} collapsed range.collapsed
|
|
120
|
+
* @returns {{ancestor: *, startContainer: *, startOffset: *, endContainer: *, endOffset: *}}
|
|
121
|
+
*/
|
|
122
|
+
_setNode_oneLine(
|
|
123
|
+
this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>,
|
|
124
|
+
element: Node,
|
|
125
|
+
newInnerNode: Node,
|
|
126
|
+
validation: (current: Node) => Node | null,
|
|
127
|
+
startCon: Node,
|
|
128
|
+
startOff: number,
|
|
129
|
+
endCon: Node,
|
|
130
|
+
endOff: number,
|
|
131
|
+
isRemoveFormat: boolean,
|
|
132
|
+
isRemoveNode: boolean,
|
|
133
|
+
collapsed: boolean,
|
|
134
|
+
_removeCheck: any,
|
|
135
|
+
_getMaintainedNode: any,
|
|
136
|
+
_isMaintainedNode: any
|
|
137
|
+
): {
|
|
138
|
+
ancestor: any;
|
|
139
|
+
startContainer: any;
|
|
140
|
+
startOffset: any;
|
|
141
|
+
endContainer: any;
|
|
142
|
+
endOffset: any;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* @private
|
|
146
|
+
* @this {InlineThis}
|
|
147
|
+
* @description wraps first line selected text.
|
|
148
|
+
* @param {Node} element The node of the line that contains the selected text node.
|
|
149
|
+
* @param {Node} newInnerNode The dom that will wrap the selected text area
|
|
150
|
+
* @param {(current: Node) => Node|null} validation Check if the node should be stripped.
|
|
151
|
+
* @param {Node} startCon The startContainer property of the selection object.
|
|
152
|
+
* @param {number} startOff The startOffset property of the selection object.
|
|
153
|
+
* @param {boolean} isRemoveFormat Is the remove all formats command?
|
|
154
|
+
* @param {boolean} isRemoveNode "newInnerNode" is remove node?
|
|
155
|
+
* @returns {NodeStyleContainerType} { ancestor, container, offset, endContainer }
|
|
156
|
+
*/
|
|
157
|
+
_setNode_startLine(
|
|
158
|
+
this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>,
|
|
159
|
+
element: Node,
|
|
160
|
+
newInnerNode: Node,
|
|
161
|
+
validation: (current: Node) => Node | null,
|
|
162
|
+
startCon: Node,
|
|
163
|
+
startOff: number,
|
|
164
|
+
isRemoveFormat: boolean,
|
|
165
|
+
isRemoveNode: boolean,
|
|
166
|
+
_removeCheck: any,
|
|
167
|
+
_getMaintainedNode: any,
|
|
168
|
+
_isMaintainedNode: any,
|
|
169
|
+
_endContainer: any
|
|
170
|
+
): NodeStyleContainerType;
|
|
171
|
+
/**
|
|
172
|
+
* @private
|
|
173
|
+
* @this {InlineThis}
|
|
174
|
+
* @description wraps mid lines selected text.
|
|
175
|
+
* @param {HTMLElement} element The node of the line that contains the selected text node.
|
|
176
|
+
* @param {Node} newInnerNode The dom that will wrap the selected text area
|
|
177
|
+
* @param {(current: Node) => Node|null} validation Check if the node should be stripped.
|
|
178
|
+
* @param {boolean} isRemoveFormat Is the remove all formats command?
|
|
179
|
+
* @param {boolean} isRemoveNode "newInnerNode" is remove node?
|
|
180
|
+
* @param {Node} _endContainer Offset node of last line already modified (end.container)
|
|
181
|
+
* @returns {NodeStyleContainerType} { ancestor, endContainer: "If end container is renewed, returned renewed node" }
|
|
182
|
+
*/
|
|
183
|
+
_setNode_middleLine(
|
|
184
|
+
this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>,
|
|
185
|
+
element: HTMLElement,
|
|
186
|
+
newInnerNode: Node,
|
|
187
|
+
validation: (current: Node) => Node | null,
|
|
188
|
+
isRemoveFormat: boolean,
|
|
189
|
+
isRemoveNode: boolean,
|
|
190
|
+
_removeCheck: any,
|
|
191
|
+
_endContainer: Node
|
|
192
|
+
): NodeStyleContainerType;
|
|
193
|
+
/**
|
|
194
|
+
* @private
|
|
195
|
+
* @this {InlineThis}
|
|
196
|
+
* @description wraps last line selected text.
|
|
197
|
+
* @param {Node} element The node of the line that contains the selected text node.
|
|
198
|
+
* @param {Node} newInnerNode The dom that will wrap the selected text area
|
|
199
|
+
* @param {(current: Node) => Node|null} validation Check if the node should be stripped.
|
|
200
|
+
* @param {Node} endCon The endContainer property of the selection object.
|
|
201
|
+
* @param {number} endOff The endOffset property of the selection object.
|
|
202
|
+
* @param {boolean} isRemoveFormat Is the remove all formats command?
|
|
203
|
+
* @param {boolean} isRemoveNode "newInnerNode" is remove node?
|
|
204
|
+
* @returns {NodeStyleContainerType} { ancestor, container, offset }
|
|
205
|
+
*/
|
|
206
|
+
_setNode_endLine(
|
|
207
|
+
this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>,
|
|
208
|
+
element: Node,
|
|
209
|
+
newInnerNode: Node,
|
|
210
|
+
validation: (current: Node) => Node | null,
|
|
211
|
+
endCon: Node,
|
|
212
|
+
endOff: number,
|
|
213
|
+
isRemoveFormat: boolean,
|
|
214
|
+
isRemoveNode: boolean,
|
|
215
|
+
_removeCheck: any,
|
|
216
|
+
_getMaintainedNode: any,
|
|
217
|
+
_isMaintainedNode: any
|
|
218
|
+
): NodeStyleContainerType;
|
|
219
|
+
/**
|
|
220
|
+
* @private
|
|
221
|
+
* @this {InlineThis}
|
|
222
|
+
* @description Node with font-size style
|
|
223
|
+
* @param {Node} element Element to check
|
|
224
|
+
* @returns {boolean}
|
|
225
|
+
*/
|
|
226
|
+
_sn_isSizeNode(this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>, element: Node): boolean;
|
|
227
|
+
/**
|
|
228
|
+
* @private
|
|
229
|
+
* @this {InlineThis}
|
|
230
|
+
* @description Return the parent maintained tag. (bind and use a util object)
|
|
231
|
+
* @param {boolean} _isRemove is remove anchor
|
|
232
|
+
* @param {boolean} _isSizeNode is size span node
|
|
233
|
+
* @param {Node} element Element
|
|
234
|
+
* @returns {Node|null}
|
|
235
|
+
*/
|
|
236
|
+
_sn_getMaintainedNode(this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>, _isRemove: boolean, _isSizeNode: boolean, element: Node): Node | null;
|
|
237
|
+
/**
|
|
238
|
+
* @private
|
|
239
|
+
* @this {InlineThis}
|
|
240
|
+
* @description Check if element is a tag that should be persisted. (bind and use a util object)
|
|
241
|
+
* @param {boolean} _isRemove is remove anchor
|
|
242
|
+
* @param {boolean} _isSizeNode is size span node
|
|
243
|
+
* @param {Node} element Element
|
|
244
|
+
* @returns {boolean}
|
|
245
|
+
*/
|
|
246
|
+
_sn_isMaintainedNode(this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>, _isRemove: boolean, _isSizeNode: boolean, element: Node): boolean;
|
|
247
|
+
/**
|
|
248
|
+
* @private
|
|
249
|
+
* @this {InlineThis}
|
|
250
|
+
* @description If certain styles are applied to all child nodes of the list cell, the style of the list cell is also changed. (bold, color, size)
|
|
251
|
+
* @param {Node} el List cell element. <li>
|
|
252
|
+
* @param {?Node} child Variable for recursive call. ("null" on the first call)
|
|
253
|
+
*/
|
|
254
|
+
_sn_setCommonListStyle(this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>, el: Node, child: Node | null): void;
|
|
255
|
+
/**
|
|
256
|
+
* @private
|
|
257
|
+
* @this {InlineThis}
|
|
258
|
+
* @description Watch the applied text nodes and adjust the common styles of the list.
|
|
259
|
+
* @param {Node} el "LI" element
|
|
260
|
+
* @param {Array|null} styleArray Refer style array
|
|
261
|
+
*/
|
|
262
|
+
_sn_resetCommonListCell(this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>, el: Node, styleArray: any[] | null): boolean;
|
|
263
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
export default ListFormat;
|
|
2
|
+
export type ListFormatThis = Omit<ListFormat & Partial<__se__EditorInjector>, 'ListFormat'>;
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {Omit<ListFormat & Partial<__se__EditorInjector>, 'ListFormat'>} ListFormatThis
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @constructor
|
|
8
|
+
* @this {ListFormatThis}
|
|
9
|
+
* @description Classes related to editor formats such as "list" (ol, ul, li)
|
|
10
|
+
* - "list" is a special "line", "block" format.
|
|
11
|
+
* @param {__se__EditorCore} editor - The root editor instance
|
|
12
|
+
*/
|
|
13
|
+
declare function ListFormat(this: Omit<ListFormat & Partial<import('../../editorInjector').default>, 'ListFormat'>, editor: __se__EditorCore): void;
|
|
14
|
+
declare class ListFormat {
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {Omit<ListFormat & Partial<__se__EditorInjector>, 'ListFormat'>} ListFormatThis
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* @constructor
|
|
20
|
+
* @this {ListFormatThis}
|
|
21
|
+
* @description Classes related to editor formats such as "list" (ol, ul, li)
|
|
22
|
+
* - "list" is a special "line", "block" format.
|
|
23
|
+
* @param {__se__EditorCore} editor - The root editor instance
|
|
24
|
+
*/
|
|
25
|
+
constructor(editor: __se__EditorCore);
|
|
26
|
+
/**
|
|
27
|
+
* @this {ListFormatThis}
|
|
28
|
+
* @description Append all selected "line" element to the list and insert.
|
|
29
|
+
* @param {string} type List type. (ol | ul):[listStyleType]
|
|
30
|
+
* @param {Array<Node>} selectedCells "line" elements or list cells.
|
|
31
|
+
* @param {boolean} nested If true, indenting existing list cells.
|
|
32
|
+
*/
|
|
33
|
+
apply(
|
|
34
|
+
this: Omit<ListFormat & Partial<import('../../editorInjector').default>, 'ListFormat'>,
|
|
35
|
+
type: string,
|
|
36
|
+
selectedCells: Array<Node>,
|
|
37
|
+
nested: boolean
|
|
38
|
+
): {
|
|
39
|
+
sc: Node;
|
|
40
|
+
so: number;
|
|
41
|
+
ec: Node;
|
|
42
|
+
eo: number;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* @this {ListFormatThis}
|
|
46
|
+
* @description "selectedCells" array are detached from the list element.
|
|
47
|
+
* - The return value is applied when the first and last lines of "selectedFormats" are "LI" respectively.
|
|
48
|
+
* @param {Array<Node>} selectedCells Array of ["line", li] elements(LI, P...) to remove.
|
|
49
|
+
* @param {boolean} shouldDelete If true, It does not just remove the list, it deletes the content.
|
|
50
|
+
* @returns {{sc: Node, ec: Node}} Node information after deletion
|
|
51
|
+
* - sc: Start container node
|
|
52
|
+
* - ec: End container node
|
|
53
|
+
*/
|
|
54
|
+
remove(
|
|
55
|
+
this: Omit<ListFormat & Partial<import('../../editorInjector').default>, 'ListFormat'>,
|
|
56
|
+
selectedCells: Array<Node>,
|
|
57
|
+
shouldDelete: boolean
|
|
58
|
+
): {
|
|
59
|
+
sc: Node;
|
|
60
|
+
ec: Node;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* @this {ListFormatThis}
|
|
64
|
+
* @description Nest list cells or cancel nested cells.
|
|
65
|
+
* @param {Array<HTMLElement>} selectedCells List cells.
|
|
66
|
+
* @param {boolean} nested Nested or cancel nested.
|
|
67
|
+
*/
|
|
68
|
+
applyNested(
|
|
69
|
+
this: Omit<ListFormat & Partial<import('../../editorInjector').default>, 'ListFormat'>,
|
|
70
|
+
selectedCells: Array<HTMLElement>,
|
|
71
|
+
nested: boolean
|
|
72
|
+
): {
|
|
73
|
+
sc: Node;
|
|
74
|
+
so: number;
|
|
75
|
+
ec: Node;
|
|
76
|
+
eo: number;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* @this {ListFormatThis}
|
|
80
|
+
* @description Detach Nested all nested lists under the "baseNode".
|
|
81
|
+
* - Returns a list with nested removed.
|
|
82
|
+
* @param {HTMLElement} baseNode Element on which to base.
|
|
83
|
+
* @param {boolean} all If true, it also detach all nested lists of a returned list.
|
|
84
|
+
* @returns {Node} Result element
|
|
85
|
+
*/
|
|
86
|
+
removeNested(this: Omit<ListFormat & Partial<import('../../editorInjector').default>, 'ListFormat'>, baseNode: HTMLElement, all: boolean): Node;
|
|
87
|
+
/**
|
|
88
|
+
* @private
|
|
89
|
+
* @this {ListFormatThis}
|
|
90
|
+
* @description Attaches a nested list structure by merging adjacent lists if applicable.
|
|
91
|
+
* - Ensures that the nested list is placed correctly in the document structure.
|
|
92
|
+
* @param {Element} originList The original list element where the nested list is inserted.
|
|
93
|
+
* @param {Element} innerList The nested list element.
|
|
94
|
+
* @param {Element} prev The previous sibling element.
|
|
95
|
+
* @param {Element} next The next sibling element.
|
|
96
|
+
* @param {{s: Array<number> | null, e: Array<number> | null, sl: Node | null, el: Node | null}} nodePath Object storing the start and end node paths.
|
|
97
|
+
* - s : Start node path.
|
|
98
|
+
* - e : End node path.
|
|
99
|
+
* - sl : Start node's parent element.
|
|
100
|
+
* - el : End node's parent element.
|
|
101
|
+
* @returns {Node} The attached inner list.
|
|
102
|
+
*/
|
|
103
|
+
_attachNested(
|
|
104
|
+
this: Omit<ListFormat & Partial<import('../../editorInjector').default>, 'ListFormat'>,
|
|
105
|
+
originList: Element,
|
|
106
|
+
innerList: Element,
|
|
107
|
+
prev: Element,
|
|
108
|
+
next: Element,
|
|
109
|
+
nodePath: {
|
|
110
|
+
s: Array<number> | null;
|
|
111
|
+
e: Array<number> | null;
|
|
112
|
+
sl: Node | null;
|
|
113
|
+
el: Node | null;
|
|
114
|
+
}
|
|
115
|
+
): Node;
|
|
116
|
+
/**
|
|
117
|
+
* @private
|
|
118
|
+
* @this {ListFormatThis}
|
|
119
|
+
* @description Detaches a nested list structure by extracting list items from their parent list.
|
|
120
|
+
* - Ensures proper restructuring of the list elements.
|
|
121
|
+
* @param {Array<HTMLElement>} cells The list items to be detached.
|
|
122
|
+
* @returns {{cc: Node, sc: Node, ec: Node}} An object containing reference nodes for repositioning.
|
|
123
|
+
* - cc : The parent node of the first list item.
|
|
124
|
+
* - sc : The first list item.
|
|
125
|
+
* - ec : The last list item.
|
|
126
|
+
*/
|
|
127
|
+
_detachNested(
|
|
128
|
+
this: Omit<ListFormat & Partial<import('../../editorInjector').default>, 'ListFormat'>,
|
|
129
|
+
cells: Array<HTMLElement>
|
|
130
|
+
): {
|
|
131
|
+
cc: Node;
|
|
132
|
+
sc: Node;
|
|
133
|
+
ec: Node;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
/** --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */
|
|
2
2
|
/**
|
|
3
3
|
* ================================================================================================================================
|
|
4
|
-
* === UTILITIES : Manage Option Map
|
|
4
|
+
* === UTILITIES : Manage Option Map ⭐️
|
|
5
5
|
* =================================================================================================================================
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
|
-
* @typedef {Object}
|
|
8
|
+
* @typedef {Object} BaseOptionsMap
|
|
9
|
+
* @description A Map containing all processed editor base options.
|
|
10
|
+
* - This Map contains all keys from {@link AllBaseOptions}, where:
|
|
11
|
+
* - Keys are option names (string)
|
|
12
|
+
* - Values depend on the specific option (see {@link AllBaseOptions} for details)
|
|
13
|
+
*
|
|
14
|
+
* @property {(k: keyof AllBaseOptions) => *} get - Retrieves the value of a specific option.
|
|
15
|
+
* @property {(k: keyof AllBaseOptions, v: *) => void} set - Sets the value of a specific option.
|
|
16
|
+
* @property {(k: keyof AllBaseOptions) => boolean} has - Checks if a specific option exists.
|
|
17
|
+
* @property {() => Object<keyof AllBaseOptions, *>} getAll - Retrieves all options as an object.
|
|
18
|
+
* @property {(options: Object<keyof AllBaseOptions, *>) => void} setMany - Sets multiple options at once.
|
|
19
|
+
* @property {(newMap: Map<string, *>) => void} reset - Replaces all options with a new Map.
|
|
20
|
+
* @property {() => void} clear - Clears all stored options.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* @typedef {Object} FrameOptionsMap
|
|
24
|
+
* @description A Map containing all processed frame-level options.
|
|
25
|
+
* - This Map contains all keys from {@link AllFrameOptions}, where:
|
|
26
|
+
* - Keys are option names (string)
|
|
27
|
+
* - Values depend on the specific option (see {@link AllFrameOptions} for details)
|
|
28
|
+
*
|
|
9
29
|
* @property {(k: keyof AllFrameOptions) => *} get - Retrieves the value of a specific option.
|
|
10
30
|
* @property {(k: keyof AllFrameOptions, v: *) => void} set - Sets the value of a specific option.
|
|
11
31
|
* @property {(k: keyof AllFrameOptions) => boolean} has - Checks if a specific option exists.
|
|
@@ -14,90 +34,24 @@
|
|
|
14
34
|
* @property {(newMap: Map<string, *>) => void} reset - Replaces all options with a new Map.
|
|
15
35
|
* @property {() => void} clear - Clears all stored options.
|
|
16
36
|
*/
|
|
37
|
+
/** ================================================================================================================================= */
|
|
38
|
+
/** ================================================================================================================================= */
|
|
17
39
|
/**
|
|
18
40
|
* @description Creates a utility wrapper for editor frame options.
|
|
19
41
|
* Provides get, set, has, getAll, and setMany methods with internal Map support.
|
|
20
42
|
* @param {*} editor - The editor instance
|
|
21
|
-
* @returns {
|
|
22
|
-
*/
|
|
23
|
-
export function FrameOptionsUtil(editor: any): FrameOptionsUtil;
|
|
24
|
-
export type FrameOptionsUtil = {
|
|
25
|
-
/**
|
|
26
|
-
* - Retrieves the value of a specific option.
|
|
27
|
-
*/
|
|
28
|
-
get: (k: keyof AllFrameOptions) => any;
|
|
29
|
-
/**
|
|
30
|
-
* - Sets the value of a specific option.
|
|
31
|
-
*/
|
|
32
|
-
set: (k: keyof AllFrameOptions, v: any) => void;
|
|
33
|
-
/**
|
|
34
|
-
* - Checks if a specific option exists.
|
|
35
|
-
*/
|
|
36
|
-
has: (k: keyof AllFrameOptions) => boolean;
|
|
37
|
-
/**
|
|
38
|
-
* - Retrieves all options as an object.
|
|
39
|
-
*/
|
|
40
|
-
getAll: () => any;
|
|
41
|
-
/**
|
|
42
|
-
* - Sets multiple options at once.
|
|
43
|
-
*/
|
|
44
|
-
setMany: (options: any) => void;
|
|
45
|
-
/**
|
|
46
|
-
* - Replaces all options with a new Map.
|
|
47
|
-
*/
|
|
48
|
-
reset: (newMap: Map<string, any>) => void;
|
|
49
|
-
/**
|
|
50
|
-
* - Clears all stored options.
|
|
51
|
-
*/
|
|
52
|
-
clear: () => void;
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* @typedef {Object} BaseOptionsUtil
|
|
56
|
-
* @property {(k: keyof AllBaseOptions) => *} get - Retrieves the value of a specific option.
|
|
57
|
-
* @property {(k: keyof AllBaseOptions, v: *) => void} set - Sets the value of a specific option.
|
|
58
|
-
* @property {(k: keyof AllBaseOptions) => boolean} has - Checks if a specific option exists.
|
|
59
|
-
* @property {() => Object<keyof AllBaseOptions, *>} getAll - Retrieves all options as an object.
|
|
60
|
-
* @property {(options: Object<keyof AllBaseOptions, *>) => void} setMany - Sets multiple options at once.
|
|
61
|
-
* @property {(newMap: Map<string, *>) => void} reset - Replaces all options with a new Map.
|
|
62
|
-
* @property {() => void} clear - Clears all stored options.
|
|
43
|
+
* @returns {FrameOptionsMap}
|
|
63
44
|
*/
|
|
45
|
+
export function FrameOptionsMap(editor: any): FrameOptionsMap;
|
|
46
|
+
export type FrameOptionsMap = any;
|
|
64
47
|
/**
|
|
65
48
|
* @description Creates a utility wrapper for editor base options.
|
|
66
49
|
* - Provides get, set, has, getAll, and setMany methods with internal Map support.
|
|
67
50
|
* @param {*} editor - The editor instance
|
|
68
|
-
* @returns {
|
|
51
|
+
* @returns {BaseOptionsMap}
|
|
69
52
|
*/
|
|
70
|
-
export function
|
|
71
|
-
export type
|
|
72
|
-
/**
|
|
73
|
-
* - Retrieves the value of a specific option.
|
|
74
|
-
*/
|
|
75
|
-
get: (k: keyof AllBaseOptions) => any;
|
|
76
|
-
/**
|
|
77
|
-
* - Sets the value of a specific option.
|
|
78
|
-
*/
|
|
79
|
-
set: (k: keyof AllBaseOptions, v: any) => void;
|
|
80
|
-
/**
|
|
81
|
-
* - Checks if a specific option exists.
|
|
82
|
-
*/
|
|
83
|
-
has: (k: keyof AllBaseOptions) => boolean;
|
|
84
|
-
/**
|
|
85
|
-
* - Retrieves all options as an object.
|
|
86
|
-
*/
|
|
87
|
-
getAll: () => any;
|
|
88
|
-
/**
|
|
89
|
-
* - Sets multiple options at once.
|
|
90
|
-
*/
|
|
91
|
-
setMany: (options: any) => void;
|
|
92
|
-
/**
|
|
93
|
-
* - Replaces all options with a new Map.
|
|
94
|
-
*/
|
|
95
|
-
reset: (newMap: Map<string, any>) => void;
|
|
96
|
-
/**
|
|
97
|
-
* - Clears all stored options.
|
|
98
|
-
*/
|
|
99
|
-
clear: () => void;
|
|
100
|
-
};
|
|
53
|
+
export function BaseOptionsMap(editor: any): BaseOptionsMap;
|
|
54
|
+
export type BaseOptionsMap = any;
|
|
101
55
|
export namespace DEFAULTS {
|
|
102
56
|
let BUTTON_LIST: (string | string[])[];
|
|
103
57
|
let REQUIRED_FORMAT_LINE: string;
|
|
@@ -186,11 +140,17 @@ export namespace DEFAULTS {
|
|
|
186
140
|
* @property {Object} [__statusbarEvent] - Status bar event configuration.
|
|
187
141
|
* ================================================================================================================================
|
|
188
142
|
*/
|
|
143
|
+
/**
|
|
144
|
+
* @typedef {Object} OptionStyleResult
|
|
145
|
+
* @property {string} top - Styles applied to the top container (e.g. width, z-index, etc).
|
|
146
|
+
* @property {string} frame - Styles applied to the iframe container (e.g. height, min-height).
|
|
147
|
+
* @property {string} editor - Styles applied to the editable content area.
|
|
148
|
+
*/
|
|
189
149
|
/**
|
|
190
150
|
* ================================================================================================================================
|
|
191
151
|
* @typedef {Object} InternalFrameOptions
|
|
192
152
|
* **Runtime-only frame options (computed internally, cannot be set by users)**
|
|
193
|
-
* @property {
|
|
153
|
+
* @property {OptionStyleResult} [_defaultStyles] - Enables fixed positioning for the editor frame.
|
|
194
154
|
* ================================================================================================================================
|
|
195
155
|
*/
|
|
196
156
|
/**
|
|
@@ -575,6 +535,20 @@ export type EditorFrameOptions = {
|
|
|
575
535
|
*/
|
|
576
536
|
__statusbarEvent?: any;
|
|
577
537
|
};
|
|
538
|
+
export type OptionStyleResult = {
|
|
539
|
+
/**
|
|
540
|
+
* - Styles applied to the top container (e.g. width, z-index, etc).
|
|
541
|
+
*/
|
|
542
|
+
top: string;
|
|
543
|
+
/**
|
|
544
|
+
* - Styles applied to the iframe container (e.g. height, min-height).
|
|
545
|
+
*/
|
|
546
|
+
frame: string;
|
|
547
|
+
/**
|
|
548
|
+
* - Styles applied to the editable content area.
|
|
549
|
+
*/
|
|
550
|
+
editor: string;
|
|
551
|
+
};
|
|
578
552
|
/**
|
|
579
553
|
* **Runtime-only frame options (computed internally, cannot be set by users)**
|
|
580
554
|
*/
|
|
@@ -583,7 +557,7 @@ export type InternalFrameOptions = {
|
|
|
583
557
|
* - Enables fixed positioning for the editor frame.
|
|
584
558
|
* ================================================================================================================================
|
|
585
559
|
*/
|
|
586
|
-
_defaultStyles?:
|
|
560
|
+
_defaultStyles?: OptionStyleResult;
|
|
587
561
|
};
|
|
588
562
|
export type AllFrameOptions = EditorFrameOptions & InternalFrameOptions;
|
|
589
563
|
/**
|
package/types/core/editor.d.ts
CHANGED
|
@@ -104,9 +104,9 @@ declare class Editor {
|
|
|
104
104
|
/**
|
|
105
105
|
* @description Utility object that manages the editor's runtime [frame] options.
|
|
106
106
|
* Provides methods to get, set, and inspect internal [frame] options.
|
|
107
|
-
* @type {
|
|
107
|
+
* @type {FrameOptionsMap}
|
|
108
108
|
*/
|
|
109
|
-
frameOptions:
|
|
109
|
+
frameOptions: FrameOptionsMap;
|
|
110
110
|
/**
|
|
111
111
|
* @description Editor row options
|
|
112
112
|
* @type {Map<string, *>}
|
|
@@ -115,9 +115,9 @@ declare class Editor {
|
|
|
115
115
|
/**
|
|
116
116
|
* @description Utility object that manages the editor's runtime options.
|
|
117
117
|
* Provides methods to get, set, and inspect internal editor options.
|
|
118
|
-
* @type {
|
|
118
|
+
* @type {BaseOptionsMap}
|
|
119
119
|
*/
|
|
120
|
-
options:
|
|
120
|
+
options: BaseOptionsMap;
|
|
121
121
|
/**
|
|
122
122
|
* @description Plugins
|
|
123
123
|
* @type {Object<string, *>}
|
|
@@ -250,8 +250,8 @@ declare class Editor {
|
|
|
250
250
|
selectMenuOn: boolean;
|
|
251
251
|
/** @description History class instance @type {ReturnType<typeof import('./base/history').default>} */
|
|
252
252
|
history: ReturnType<typeof import('./base/history').default>;
|
|
253
|
-
/** @description EventManager class instance @type {import('./
|
|
254
|
-
eventManager: import('./
|
|
253
|
+
/** @description EventManager class instance @type {import('./event/eventManager').default} */
|
|
254
|
+
eventManager: import('./event/eventManager').default;
|
|
255
255
|
/** @description iframe-safe instanceof check utility class @type {import('./util/instanceCheck').default} */
|
|
256
256
|
instanceCheck: import('./util/instanceCheck').default;
|
|
257
257
|
/** @description Toolbar class instance @type {import('./class/toolbar').default} */
|
|
@@ -266,6 +266,10 @@ declare class Editor {
|
|
|
266
266
|
format: import('./class/format').default;
|
|
267
267
|
/** @description HTML class instance @type {import('./class/html').default} */
|
|
268
268
|
html: import('./class/html').default;
|
|
269
|
+
/** @description Inline format class instance @type {import('./class/inline').default} */
|
|
270
|
+
inline: import('./class/inline').default;
|
|
271
|
+
/** @description List format class instance @type {import('./class/listFormat').default} */
|
|
272
|
+
listFormat: import('./class/listFormat').default;
|
|
269
273
|
/** @description Menu class instance @type {import('./class/menu').default} */
|
|
270
274
|
menu: import('./class/menu').default;
|
|
271
275
|
/** @description NodeTransform class instance @type {import('./class/nodeTransform').default} */
|
|
@@ -337,14 +341,20 @@ declare class Editor {
|
|
|
337
341
|
_codeViewDisabledButtons: Array<HTMLButtonElement | HTMLInputElement>;
|
|
338
342
|
/**
|
|
339
343
|
* @description List of buttons to run plugins in the toolbar
|
|
340
|
-
* @type {Array<HTMLElement
|
|
344
|
+
* @type {Object<string, Array<HTMLElement>>}
|
|
341
345
|
*/
|
|
342
|
-
_pluginCallButtons:
|
|
346
|
+
_pluginCallButtons: {
|
|
347
|
+
[x: string]: HTMLElement[];
|
|
348
|
+
};
|
|
343
349
|
/**
|
|
344
350
|
* @description List of buttons to run plugins in the Sub-Toolbar
|
|
345
|
-
* @type {Array<HTMLElement
|
|
351
|
+
* @type {Object<string, Array<HTMLElement>>|[]}
|
|
346
352
|
*/
|
|
347
|
-
_pluginCallButtons_sub:
|
|
353
|
+
_pluginCallButtons_sub:
|
|
354
|
+
| {
|
|
355
|
+
[x: string]: Array<HTMLElement>;
|
|
356
|
+
}
|
|
357
|
+
| [];
|
|
348
358
|
/**
|
|
349
359
|
* @description Responsive Toolbar Button Structure array
|
|
350
360
|
* @type {Array<*>}
|
|
@@ -650,5 +660,5 @@ declare class Editor {
|
|
|
650
660
|
}
|
|
651
661
|
import { ContextUtil } from './config/context';
|
|
652
662
|
import { FrameContextUtil } from './config/frameContext';
|
|
653
|
-
import {
|
|
654
|
-
import {
|
|
663
|
+
import { FrameOptionsMap } from './config/options';
|
|
664
|
+
import { BaseOptionsMap } from './config/options';
|