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
package/src/suneditor.js
CHANGED
|
@@ -1,47 +1,22 @@
|
|
|
1
1
|
import Editor from './core/editor';
|
|
2
2
|
|
|
3
|
-
import editorInjector from './editorInjector';
|
|
4
3
|
import plugins from './plugins';
|
|
5
|
-
import langs from './langs';
|
|
6
4
|
import modules from './modules';
|
|
7
5
|
import helper from './helper';
|
|
6
|
+
import langs from './langs';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* @module SunEditorExports
|
|
11
10
|
*/
|
|
11
|
+
export { plugins, modules, helper, langs };
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* @typedef {import('./core/config/options').EditorFrameOptions}
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @typedef {import('./core/config/options').EditorInitOptions} EditorInitOptions_suneditor
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Editor Injector module, Inject "editor" and basic frequently used objects by calling it with "call(this, editor)".
|
|
23
|
-
*/
|
|
24
|
-
export { editorInjector };
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Available editor plugins
|
|
28
|
-
*/
|
|
29
|
-
export { plugins };
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Editor modules
|
|
33
|
-
*/
|
|
34
|
-
export { modules };
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Language packs for the editor
|
|
14
|
+
* @typedef {import('./core/config/options').EditorFrameOptions} SunEditorFrameOptionsType
|
|
38
15
|
*/
|
|
39
|
-
export { langs };
|
|
40
16
|
|
|
41
17
|
/**
|
|
42
|
-
*
|
|
18
|
+
* @typedef {import('./core/config/options').EditorInitOptions} SunEditorOptionsType
|
|
43
19
|
*/
|
|
44
|
-
export { helper };
|
|
45
20
|
|
|
46
21
|
/**
|
|
47
22
|
* SunEditor Factory Object
|
|
@@ -51,8 +26,8 @@ export default {
|
|
|
51
26
|
/**
|
|
52
27
|
* Returns the create function with preset options.
|
|
53
28
|
* If the options overlap, the options of the 'create' function take precedence.
|
|
54
|
-
* @param {
|
|
55
|
-
* @returns {{create: (targets: Element|Object<string, {target: Element, options:
|
|
29
|
+
* @param {SunEditorOptionsType} init_options - Initialization options
|
|
30
|
+
* @returns {{create: (targets: Element|Object<string, {target: Element, options: SunEditorFrameOptionsType}>, options: SunEditorOptionsType) => Editor}}}
|
|
56
31
|
*/
|
|
57
32
|
init(init_options) {
|
|
58
33
|
return {
|
|
@@ -62,12 +37,12 @@ export default {
|
|
|
62
37
|
|
|
63
38
|
/**
|
|
64
39
|
* Creates a new instance of the SunEditor
|
|
65
|
-
* @param {Element|string|Object<string, {target: Element, options:
|
|
40
|
+
* @param {Element|string|Object<string, {target: Element, options: SunEditorFrameOptionsType}>} target
|
|
66
41
|
* - Element: The direct DOM element to initialize the editor on.
|
|
67
42
|
* - string: A CSS selector string. The corresponding element is selected using `document.querySelector`.
|
|
68
43
|
* - Object: For multi-root setup. Each key maps to a config with `{target, options}`.
|
|
69
|
-
* @param {
|
|
70
|
-
* @param {
|
|
44
|
+
* @param {SunEditorOptionsType} options - Initialization options
|
|
45
|
+
* @param {SunEditorOptionsType} [_init_options] - Optional preset initialization options
|
|
71
46
|
* @returns {Editor} - Instance of the SunEditor
|
|
72
47
|
* @throws {Error} If the target element is not provided or is invalid
|
|
73
48
|
*/
|
package/src/typedef.js
CHANGED
|
@@ -14,9 +14,6 @@
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @typedef {import('./editorInjector').default} __se__EditorInjector
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
17
|
* @typedef {import('./editorInjector/_core').default} __se__CoreInjector
|
|
21
18
|
*/
|
|
22
19
|
|
|
@@ -45,7 +42,7 @@
|
|
|
45
42
|
* @property {number} currentViewportHeight Current visual viewport height size
|
|
46
43
|
* @property {number} initViewportHeight Height of the initial visual viewport height size
|
|
47
44
|
* @property {boolean} onSelected Boolean value of whether component is selected
|
|
48
|
-
* @property {
|
|
45
|
+
* @property {*} rootKey Current root key
|
|
49
46
|
* @property {Range} _range Current range object
|
|
50
47
|
* @property {boolean} _onMousedown Mouse down event status
|
|
51
48
|
*/
|
|
@@ -124,16 +121,15 @@
|
|
|
124
121
|
* @property {__se__ComponentInfo} info Component information
|
|
125
122
|
*/
|
|
126
123
|
|
|
127
|
-
// --------------------------------------------------------- [
|
|
124
|
+
// --------------------------------------------------------- [Options] ---------------------------------------------------------------------------------------------------
|
|
128
125
|
/**
|
|
129
|
-
* @typedef {
|
|
126
|
+
* @typedef {import('./core/config/options').FrameOptionsMap} __se__FrameOptions
|
|
127
|
+
* @typedef {import('./core/config/options').BaseOptionsMap} __se__BaseOptions
|
|
130
128
|
*/
|
|
131
129
|
|
|
130
|
+
// --------------------------------------------------------- [Context] ---------------------------------------------------------------------------------------------------
|
|
132
131
|
/**
|
|
133
132
|
* @typedef {import('./core/config/frameContext').FrameContextUtil} __se__FrameContext
|
|
134
|
-
*/
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
133
|
* @typedef {Map<keyof import('./core/config/context').ContextUtil, *>} __se__Context
|
|
138
134
|
*/
|
|
139
135
|
|
|
@@ -141,3 +137,13 @@
|
|
|
141
137
|
/**
|
|
142
138
|
* @typedef {import('./core/class/offset').OffsetGlobalInfo} __se__Class_OffsetGlobalInfo
|
|
143
139
|
*/
|
|
140
|
+
|
|
141
|
+
// --------------------------------------------------------- [event.reducer/action] ------------------------------------------------------------------------------------------
|
|
142
|
+
/**
|
|
143
|
+
* @typedef {import('./core/event/reducers/keydown.reducer').KeydownReducerCtx} __se__EventKeydownCtx
|
|
144
|
+
*/
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @typedef {import('./core/event/actions').Action[]} __se__EventActions
|
|
148
|
+
* @typedef {import('./core/event/ports').EventReducerPorts} __se__EventPorts
|
|
149
|
+
*/
|
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
export default Format;
|
|
2
2
|
export type FormatThis = Omit<Format & Partial<__se__EditorInjector>, 'format'>;
|
|
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
3
|
/**
|
|
10
4
|
* @typedef {Omit<Format & Partial<__se__EditorInjector>, 'format'>} FormatThis
|
|
11
5
|
*/
|
|
12
|
-
/**
|
|
13
|
-
* @typedef {Object} NodeStyleContainerType
|
|
14
|
-
* @property {?Node=} ancestor
|
|
15
|
-
* @property {?number=} offset
|
|
16
|
-
* @property {?Node=} container
|
|
17
|
-
* @property {?Node=} endContainer
|
|
18
|
-
*/
|
|
19
6
|
/**
|
|
20
7
|
* @constructor
|
|
21
8
|
* @this {FormatThis}
|
|
22
|
-
* @description Classes related to editor formats such as line
|
|
9
|
+
* @description Classes related to editor formats such as "line" and "block".
|
|
23
10
|
* @param {__se__EditorCore} editor - The root editor instance
|
|
24
11
|
*/
|
|
25
12
|
declare function Format(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, editor: __se__EditorCore): void;
|
|
@@ -27,22 +14,13 @@ declare class Format {
|
|
|
27
14
|
/**
|
|
28
15
|
* @typedef {Omit<Format & Partial<__se__EditorInjector>, 'format'>} FormatThis
|
|
29
16
|
*/
|
|
30
|
-
/**
|
|
31
|
-
* @typedef {Object} NodeStyleContainerType
|
|
32
|
-
* @property {?Node=} ancestor
|
|
33
|
-
* @property {?number=} offset
|
|
34
|
-
* @property {?Node=} container
|
|
35
|
-
* @property {?Node=} endContainer
|
|
36
|
-
*/
|
|
37
17
|
/**
|
|
38
18
|
* @constructor
|
|
39
19
|
* @this {FormatThis}
|
|
40
|
-
* @description Classes related to editor formats such as line
|
|
20
|
+
* @description Classes related to editor formats such as "line" and "block".
|
|
41
21
|
* @param {__se__EditorCore} editor - The root editor instance
|
|
42
22
|
*/
|
|
43
23
|
constructor(editor: __se__EditorCore);
|
|
44
|
-
_listCamel: any;
|
|
45
|
-
_listKebab: any;
|
|
46
24
|
_formatLineCheck: any;
|
|
47
25
|
_formatBrLineCheck: any;
|
|
48
26
|
_formatBlockCheck: any;
|
|
@@ -143,42 +121,6 @@ declare class Format {
|
|
|
143
121
|
eo: number;
|
|
144
122
|
removeArray: Array<Node> | null;
|
|
145
123
|
};
|
|
146
|
-
/**
|
|
147
|
-
* @this {FormatThis}
|
|
148
|
-
* @description Append all selected "line" element to the list and insert.
|
|
149
|
-
* @param {string} type List type. (ol | ul):[listStyleType]
|
|
150
|
-
* @param {Array<Node>} selectedCells "line" elements or list cells.
|
|
151
|
-
* @param {boolean} nested If true, indenting existing list cells.
|
|
152
|
-
*/
|
|
153
|
-
applyList(
|
|
154
|
-
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
155
|
-
type: string,
|
|
156
|
-
selectedCells: Array<Node>,
|
|
157
|
-
nested: boolean
|
|
158
|
-
): {
|
|
159
|
-
sc: Node;
|
|
160
|
-
so: number;
|
|
161
|
-
ec: Node;
|
|
162
|
-
eo: number;
|
|
163
|
-
};
|
|
164
|
-
/**
|
|
165
|
-
* @this {FormatThis}
|
|
166
|
-
* @description "selectedCells" array are detached from the list element.
|
|
167
|
-
* - The return value is applied when the first and last lines of "selectedFormats" are "LI" respectively.
|
|
168
|
-
* @param {Array<Node>} selectedCells Array of ["line", li] elements(LI, P...) to remove.
|
|
169
|
-
* @param {boolean} shouldDelete If true, It does not just remove the list, it deletes the content.
|
|
170
|
-
* @returns {{sc: Node, ec: Node}} Node information after deletion
|
|
171
|
-
* - sc: Start container node
|
|
172
|
-
* - ec: End container node
|
|
173
|
-
*/
|
|
174
|
-
removeList(
|
|
175
|
-
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
176
|
-
selectedCells: Array<Node>,
|
|
177
|
-
shouldDelete: boolean
|
|
178
|
-
): {
|
|
179
|
-
sc: Node;
|
|
180
|
-
ec: Node;
|
|
181
|
-
};
|
|
182
124
|
/**
|
|
183
125
|
* @this {FormatThis}
|
|
184
126
|
* @description Indent more the selected lines.
|
|
@@ -191,50 +133,6 @@ declare class Format {
|
|
|
191
133
|
* - margin size - "status.indentSize"px
|
|
192
134
|
*/
|
|
193
135
|
outdent(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>): void;
|
|
194
|
-
/**
|
|
195
|
-
* @this {FormatThis}
|
|
196
|
-
* @description Adds, updates, or deletes style nodes from selected text (a, span, strong, etc.).
|
|
197
|
-
* @param {?Node} styleNode The element to be added to the selection. If null, only existing nodes are modified or removed.
|
|
198
|
-
* @param {Object} [options] Options
|
|
199
|
-
* @param {Array<string>} [options.stylesToModify=null] Array of style or class names to check and modify.
|
|
200
|
-
* (e.g., ['font-size'], ['.className'], ['font-family', 'color', '.className'])
|
|
201
|
-
* @param {Array<string>} [options.nodesToRemove=null] Array of node names to remove.
|
|
202
|
-
* If empty array or null when styleNode is null, all formats are removed.
|
|
203
|
-
* (e.g., ['span'], ['strong', 'em'])
|
|
204
|
-
* @param {boolean} [options.strictRemove=false] If true, only removes nodes from nodesToRemove if all styles and classes are removed.
|
|
205
|
-
* @returns {HTMLElement} The element that was added to or modified in the selection.
|
|
206
|
-
*
|
|
207
|
-
* @details
|
|
208
|
-
* 1. If styleNode is provided, a node with the same tags and attributes is added to the selected text.
|
|
209
|
-
* 2. If the same tag already exists, only its attributes are updated.
|
|
210
|
-
* 3. If styleNode is null, existing nodes are updated or removed without adding new ones.
|
|
211
|
-
* 4. Styles matching those in stylesToModify are removed. (Use CSS attribute names, e.g., "background-color")
|
|
212
|
-
* 5. Classes matching those in stylesToModify (prefixed with ".") are removed.
|
|
213
|
-
* 6. stylesToModify is used to avoid duplicate property values from styleNode.
|
|
214
|
-
* 7. Nodes with all styles and classes removed are deleted if they match styleNode, are in nodesToRemove, or if styleNode is null.
|
|
215
|
-
* 8. Tags matching names in nodesToRemove are deleted regardless of their style and class.
|
|
216
|
-
* 9. If strictRemove is true, nodes in nodesToRemove are only removed if all their styles and classes are removed.
|
|
217
|
-
* 10. The function won't modify nodes if the parent has the same class and style values.
|
|
218
|
-
* - However, if nodesToRemove has values, it will work and separate text nodes even if there's no node to replace.
|
|
219
|
-
*/
|
|
220
|
-
applyInlineElement(
|
|
221
|
-
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
222
|
-
styleNode: Node | null,
|
|
223
|
-
{
|
|
224
|
-
stylesToModify,
|
|
225
|
-
nodesToRemove,
|
|
226
|
-
strictRemove
|
|
227
|
-
}?: {
|
|
228
|
-
stylesToModify?: Array<string>;
|
|
229
|
-
nodesToRemove?: Array<string>;
|
|
230
|
-
strictRemove?: boolean;
|
|
231
|
-
}
|
|
232
|
-
): HTMLElement;
|
|
233
|
-
/**
|
|
234
|
-
* @this {FormatThis}
|
|
235
|
-
* @description Remove format of the currently selected text.
|
|
236
|
-
*/
|
|
237
|
-
removeInlineElement(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>): void;
|
|
238
136
|
/**
|
|
239
137
|
* @this {FormatThis}
|
|
240
138
|
* @description Check if the container and offset values are the edges of the "line"
|
|
@@ -342,14 +240,6 @@ declare class Format {
|
|
|
342
240
|
* @returns {boolean}
|
|
343
241
|
*/
|
|
344
242
|
_nonFormat(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node): boolean;
|
|
345
|
-
/**
|
|
346
|
-
* @private
|
|
347
|
-
* @this {FormatThis}
|
|
348
|
-
* @description Nodes that must remain undetached when changing text nodes (A, Label, Code, Span:font-size)
|
|
349
|
-
* @param {Node|string} element Element to check
|
|
350
|
-
* @returns {boolean}
|
|
351
|
-
*/
|
|
352
|
-
_isNonSplitNode(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node | string): boolean;
|
|
353
243
|
/**
|
|
354
244
|
* @private
|
|
355
245
|
* @this {FormatThis}
|
|
@@ -358,14 +248,6 @@ declare class Format {
|
|
|
358
248
|
* @returns {boolean}
|
|
359
249
|
*/
|
|
360
250
|
_notTextNode(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node | string): boolean;
|
|
361
|
-
/**
|
|
362
|
-
* @private
|
|
363
|
-
* @this {FormatThis}
|
|
364
|
-
* @description Nodes that need to be added without modification when changing text nodes
|
|
365
|
-
* @param {Node} element Element to check
|
|
366
|
-
* @returns {boolean}
|
|
367
|
-
*/
|
|
368
|
-
_isIgnoreNodeChange(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node): boolean;
|
|
369
251
|
/**
|
|
370
252
|
* @private
|
|
371
253
|
* @this {FormatThis}
|
|
@@ -381,238 +263,6 @@ declare class Format {
|
|
|
381
263
|
startOffset: number;
|
|
382
264
|
endOffset: number;
|
|
383
265
|
};
|
|
384
|
-
/**
|
|
385
|
-
* @private
|
|
386
|
-
* @this {FormatThis}
|
|
387
|
-
* @description Attaches a nested list structure by merging adjacent lists if applicable.
|
|
388
|
-
* - Ensures that the nested list is placed correctly in the document structure.
|
|
389
|
-
* @param {Element} originList The original list element where the nested list is inserted.
|
|
390
|
-
* @param {Element} innerList The nested list element.
|
|
391
|
-
* @param {Element} prev The previous sibling element.
|
|
392
|
-
* @param {Element} next The next sibling element.
|
|
393
|
-
* @param {{s: Array<number> | null, e: Array<number> | null, sl: Node | null, el: Node | null}} nodePath Object storing the start and end node paths.
|
|
394
|
-
* - s : Start node path.
|
|
395
|
-
* - e : End node path.
|
|
396
|
-
* - sl : Start node's parent element.
|
|
397
|
-
* - el : End node's parent element.
|
|
398
|
-
* @returns {Node} The attached inner list.
|
|
399
|
-
*/
|
|
400
|
-
_attachNested(
|
|
401
|
-
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
402
|
-
originList: Element,
|
|
403
|
-
innerList: Element,
|
|
404
|
-
prev: Element,
|
|
405
|
-
next: Element,
|
|
406
|
-
nodePath: {
|
|
407
|
-
s: Array<number> | null;
|
|
408
|
-
e: Array<number> | null;
|
|
409
|
-
sl: Node | null;
|
|
410
|
-
el: Node | null;
|
|
411
|
-
}
|
|
412
|
-
): Node;
|
|
413
|
-
/**
|
|
414
|
-
* @private
|
|
415
|
-
* @this {FormatThis}
|
|
416
|
-
* @description Detaches a nested list structure by extracting list items from their parent list.
|
|
417
|
-
* - Ensures proper restructuring of the list elements.
|
|
418
|
-
* @param {Array<HTMLElement>} cells The list items to be detached.
|
|
419
|
-
* @returns {{cc: Node, sc: Node, ec: Node}} An object containing reference nodes for repositioning.
|
|
420
|
-
* - cc : The parent node of the first list item.
|
|
421
|
-
* - sc : The first list item.
|
|
422
|
-
* - ec : The last list item.
|
|
423
|
-
*/
|
|
424
|
-
_detachNested(
|
|
425
|
-
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
426
|
-
cells: Array<HTMLElement>
|
|
427
|
-
): {
|
|
428
|
-
cc: Node;
|
|
429
|
-
sc: Node;
|
|
430
|
-
ec: Node;
|
|
431
|
-
};
|
|
432
|
-
/**
|
|
433
|
-
* @private
|
|
434
|
-
* @this {FormatThis}
|
|
435
|
-
* @description Nest list cells or cancel nested cells.
|
|
436
|
-
* @param {Array<HTMLElement>} selectedCells List cells.
|
|
437
|
-
* @param {boolean} nested Nested or cancel nested.
|
|
438
|
-
*/
|
|
439
|
-
_applyNestedList(
|
|
440
|
-
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
441
|
-
selectedCells: Array<HTMLElement>,
|
|
442
|
-
nested: boolean
|
|
443
|
-
): {
|
|
444
|
-
sc: Node;
|
|
445
|
-
so: number;
|
|
446
|
-
ec: Node;
|
|
447
|
-
eo: number;
|
|
448
|
-
};
|
|
449
|
-
/**
|
|
450
|
-
* @private
|
|
451
|
-
* @this {FormatThis}
|
|
452
|
-
* @description Detach Nested all nested lists under the "baseNode".
|
|
453
|
-
* - Returns a list with nested removed.
|
|
454
|
-
* @param {HTMLElement} baseNode Element on which to base.
|
|
455
|
-
* @param {boolean} all If true, it also detach all nested lists of a returned list.
|
|
456
|
-
* @returns {Node} Result element
|
|
457
|
-
*/
|
|
458
|
-
_removeNestedList(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, baseNode: HTMLElement, all: boolean): Node;
|
|
459
|
-
/**
|
|
460
|
-
* @private
|
|
461
|
-
* @this {FormatThis}
|
|
462
|
-
* @description wraps text nodes of line selected text.
|
|
463
|
-
* @param {Node} element The node of the line that contains the selected text node.
|
|
464
|
-
* @param {Node} newInnerNode The dom that will wrap the selected text area
|
|
465
|
-
* @param {(current: Node) => Node|null} validation Check if the node should be stripped.
|
|
466
|
-
* @param {Node} startCon The startContainer property of the selection object.
|
|
467
|
-
* @param {number} startOff The startOffset property of the selection object.
|
|
468
|
-
* @param {Node} endCon The endContainer property of the selection object.
|
|
469
|
-
* @param {number} endOff The endOffset property of the selection object.
|
|
470
|
-
* @param {boolean} isRemoveFormat Is the remove all formats command?
|
|
471
|
-
* @param {boolean} isRemoveNode "newInnerNode" is remove node?
|
|
472
|
-
* @param {boolean} collapsed range.collapsed
|
|
473
|
-
* @returns {{ancestor: *, startContainer: *, startOffset: *, endContainer: *, endOffset: *}}
|
|
474
|
-
*/
|
|
475
|
-
_setNode_oneLine(
|
|
476
|
-
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
477
|
-
element: Node,
|
|
478
|
-
newInnerNode: Node,
|
|
479
|
-
validation: (current: Node) => Node | null,
|
|
480
|
-
startCon: Node,
|
|
481
|
-
startOff: number,
|
|
482
|
-
endCon: Node,
|
|
483
|
-
endOff: number,
|
|
484
|
-
isRemoveFormat: boolean,
|
|
485
|
-
isRemoveNode: boolean,
|
|
486
|
-
collapsed: boolean,
|
|
487
|
-
_removeCheck: any,
|
|
488
|
-
_getMaintainedNode: any,
|
|
489
|
-
_isMaintainedNode: any
|
|
490
|
-
): {
|
|
491
|
-
ancestor: any;
|
|
492
|
-
startContainer: any;
|
|
493
|
-
startOffset: any;
|
|
494
|
-
endContainer: any;
|
|
495
|
-
endOffset: any;
|
|
496
|
-
};
|
|
497
|
-
/**
|
|
498
|
-
* @private
|
|
499
|
-
* @this {FormatThis}
|
|
500
|
-
* @description wraps first line selected text.
|
|
501
|
-
* @param {Node} element The node of the line that contains the selected text node.
|
|
502
|
-
* @param {Node} newInnerNode The dom that will wrap the selected text area
|
|
503
|
-
* @param {(current: Node) => Node|null} validation Check if the node should be stripped.
|
|
504
|
-
* @param {Node} startCon The startContainer property of the selection object.
|
|
505
|
-
* @param {number} startOff The startOffset property of the selection object.
|
|
506
|
-
* @param {boolean} isRemoveFormat Is the remove all formats command?
|
|
507
|
-
* @param {boolean} isRemoveNode "newInnerNode" is remove node?
|
|
508
|
-
* @returns {NodeStyleContainerType} { ancestor, container, offset, endContainer }
|
|
509
|
-
*/
|
|
510
|
-
_setNode_startLine(
|
|
511
|
-
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
512
|
-
element: Node,
|
|
513
|
-
newInnerNode: Node,
|
|
514
|
-
validation: (current: Node) => Node | null,
|
|
515
|
-
startCon: Node,
|
|
516
|
-
startOff: number,
|
|
517
|
-
isRemoveFormat: boolean,
|
|
518
|
-
isRemoveNode: boolean,
|
|
519
|
-
_removeCheck: any,
|
|
520
|
-
_getMaintainedNode: any,
|
|
521
|
-
_isMaintainedNode: any,
|
|
522
|
-
_endContainer: any
|
|
523
|
-
): NodeStyleContainerType;
|
|
524
|
-
/**
|
|
525
|
-
* @private
|
|
526
|
-
* @this {FormatThis}
|
|
527
|
-
* @description wraps mid lines selected text.
|
|
528
|
-
* @param {HTMLElement} element The node of the line that contains the selected text node.
|
|
529
|
-
* @param {Node} newInnerNode The dom that will wrap the selected text area
|
|
530
|
-
* @param {(current: Node) => Node|null} validation Check if the node should be stripped.
|
|
531
|
-
* @param {boolean} isRemoveFormat Is the remove all formats command?
|
|
532
|
-
* @param {boolean} isRemoveNode "newInnerNode" is remove node?
|
|
533
|
-
* @param {Node} _endContainer Offset node of last line already modified (end.container)
|
|
534
|
-
* @returns {NodeStyleContainerType} { ancestor, endContainer: "If end container is renewed, returned renewed node" }
|
|
535
|
-
*/
|
|
536
|
-
_setNode_middleLine(
|
|
537
|
-
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
538
|
-
element: HTMLElement,
|
|
539
|
-
newInnerNode: Node,
|
|
540
|
-
validation: (current: Node) => Node | null,
|
|
541
|
-
isRemoveFormat: boolean,
|
|
542
|
-
isRemoveNode: boolean,
|
|
543
|
-
_removeCheck: any,
|
|
544
|
-
_endContainer: Node
|
|
545
|
-
): NodeStyleContainerType;
|
|
546
|
-
/**
|
|
547
|
-
* @private
|
|
548
|
-
* @this {FormatThis}
|
|
549
|
-
* @description wraps last line selected text.
|
|
550
|
-
* @param {Node} element The node of the line that contains the selected text node.
|
|
551
|
-
* @param {Node} newInnerNode The dom that will wrap the selected text area
|
|
552
|
-
* @param {(current: Node) => Node|null} validation Check if the node should be stripped.
|
|
553
|
-
* @param {Node} endCon The endContainer property of the selection object.
|
|
554
|
-
* @param {number} endOff The endOffset property of the selection object.
|
|
555
|
-
* @param {boolean} isRemoveFormat Is the remove all formats command?
|
|
556
|
-
* @param {boolean} isRemoveNode "newInnerNode" is remove node?
|
|
557
|
-
* @returns {NodeStyleContainerType} { ancestor, container, offset }
|
|
558
|
-
*/
|
|
559
|
-
_setNode_endLine(
|
|
560
|
-
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
561
|
-
element: Node,
|
|
562
|
-
newInnerNode: Node,
|
|
563
|
-
validation: (current: Node) => Node | null,
|
|
564
|
-
endCon: Node,
|
|
565
|
-
endOff: number,
|
|
566
|
-
isRemoveFormat: boolean,
|
|
567
|
-
isRemoveNode: boolean,
|
|
568
|
-
_removeCheck: any,
|
|
569
|
-
_getMaintainedNode: any,
|
|
570
|
-
_isMaintainedNode: any
|
|
571
|
-
): NodeStyleContainerType;
|
|
572
|
-
/**
|
|
573
|
-
* @private
|
|
574
|
-
* @this {FormatThis}
|
|
575
|
-
* @description Node with font-size style
|
|
576
|
-
* @param {Node} element Element to check
|
|
577
|
-
* @returns {boolean}
|
|
578
|
-
*/
|
|
579
|
-
_sn_isSizeNode(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node): boolean;
|
|
580
|
-
/**
|
|
581
|
-
* @private
|
|
582
|
-
* @this {FormatThis}
|
|
583
|
-
* @description Return the parent maintained tag. (bind and use a util object)
|
|
584
|
-
* @param {boolean} _isRemove is remove anchor
|
|
585
|
-
* @param {boolean} _isSizeNode is size span node
|
|
586
|
-
* @param {Node} element Element
|
|
587
|
-
* @returns {Node|null}
|
|
588
|
-
*/
|
|
589
|
-
_sn_getMaintainedNode(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, _isRemove: boolean, _isSizeNode: boolean, element: Node): Node | null;
|
|
590
|
-
/**
|
|
591
|
-
* @private
|
|
592
|
-
* @this {FormatThis}
|
|
593
|
-
* @description Check if element is a tag that should be persisted. (bind and use a util object)
|
|
594
|
-
* @param {boolean} _isRemove is remove anchor
|
|
595
|
-
* @param {boolean} _isSizeNode is size span node
|
|
596
|
-
* @param {Node} element Element
|
|
597
|
-
* @returns {boolean}
|
|
598
|
-
*/
|
|
599
|
-
_sn_isMaintainedNode(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, _isRemove: boolean, _isSizeNode: boolean, element: Node): boolean;
|
|
600
|
-
/**
|
|
601
|
-
* @private
|
|
602
|
-
* @this {FormatThis}
|
|
603
|
-
* @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)
|
|
604
|
-
* @param {Node} el List cell element. <li>
|
|
605
|
-
* @param {?Node} child Variable for recursive call. ("null" on the first call)
|
|
606
|
-
*/
|
|
607
|
-
_sn_setCommonListStyle(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, el: Node, child: Node | null): void;
|
|
608
|
-
/**
|
|
609
|
-
* @private
|
|
610
|
-
* @this {FormatThis}
|
|
611
|
-
* @description Watch the applied text nodes and adjust the common styles of the list.
|
|
612
|
-
* @param {Node} el "LI" element
|
|
613
|
-
* @param {Array|null} styleArray Refer style array
|
|
614
|
-
*/
|
|
615
|
-
_sn_resetCommonListCell(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, el: Node, styleArray: any[] | null): boolean;
|
|
616
266
|
/**
|
|
617
267
|
* @private
|
|
618
268
|
* @this {FormatThis}
|
|
@@ -264,10 +264,10 @@ declare class HTML {
|
|
|
264
264
|
/**
|
|
265
265
|
* @this {HTMLThis}
|
|
266
266
|
* @description Call "clipboard.write" to copy the contents and display a success/failure toast message.
|
|
267
|
-
* @param {Element|Text|string} content Content to be copied to the clipboard
|
|
267
|
+
* @param {Node|Element|Text|string} content Content to be copied to the clipboard
|
|
268
268
|
* @returns {Promise<boolean>} Success or failure
|
|
269
269
|
*/
|
|
270
|
-
copy(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, content: Element | Text | string): Promise<boolean>;
|
|
270
|
+
copy(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, content: Node | Element | Text | string): Promise<boolean>;
|
|
271
271
|
/**
|
|
272
272
|
* @this {HTMLThis}
|
|
273
273
|
* @description Sets the content of the iframe's head tag and body tag when using the "iframe" or "iframe_fullPage" option.
|