suneditor 3.0.0-alpha.2 → 3.0.0-alpha.20
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/.eslintrc.json +4 -3
- package/CONTRIBUTING.md +4 -2
- package/README.md +19 -11
- package/README_V3_TEMP.md +705 -0
- package/dist/suneditor.min.css +1 -0
- package/dist/suneditor.min.js +1 -0
- package/example.md +587 -0
- package/package.json +15 -9
- package/src/assets/icons/_default.js +166 -131
- package/src/assets/{suneditor-content.css → suneditor-contents.css} +182 -45
- package/src/assets/suneditor.css +1195 -556
- package/src/assets/variables.css +138 -0
- package/src/core/base/eventHandlers/handler_toolbar.js +35 -14
- package/src/core/base/eventHandlers/handler_ww_clipboard.js +29 -4
- package/src/core/base/eventHandlers/handler_ww_dragDrop.js +59 -15
- package/src/core/base/eventHandlers/handler_ww_key_input.js +426 -212
- package/src/core/base/eventHandlers/handler_ww_mouse.js +108 -32
- package/src/core/base/eventManager.js +540 -209
- package/src/core/base/events.js +616 -320
- package/src/core/base/history.js +93 -39
- package/src/core/class/char.js +29 -13
- package/src/core/class/component.js +332 -145
- package/src/core/class/format.js +671 -509
- package/src/core/class/html.js +504 -290
- package/src/core/class/menu.js +114 -47
- package/src/core/class/nodeTransform.js +111 -66
- package/src/core/class/offset.js +409 -105
- package/src/core/class/selection.js +220 -108
- package/src/core/class/shortcuts.js +68 -8
- package/src/core/class/toolbar.js +106 -116
- package/src/core/class/ui.js +330 -0
- package/src/core/class/viewer.js +178 -74
- package/src/core/editor.js +489 -384
- package/src/core/section/actives.js +118 -22
- package/src/core/section/constructor.js +504 -170
- package/src/core/section/context.js +28 -23
- package/src/core/section/documentType.js +561 -0
- package/src/editorInjector/_classes.js +19 -5
- package/src/editorInjector/_core.js +71 -7
- package/src/editorInjector/index.js +63 -1
- package/src/helper/converter.js +137 -19
- package/src/helper/dom/domCheck.js +294 -0
- package/src/helper/dom/domQuery.js +609 -0
- package/src/helper/dom/domUtils.js +533 -0
- package/src/helper/dom/index.js +12 -0
- package/src/helper/env.js +42 -19
- package/src/helper/index.js +7 -4
- package/src/helper/keyCodeMap.js +183 -0
- package/src/helper/numbers.js +8 -8
- package/src/helper/unicode.js +5 -5
- package/src/langs/ckb.js +69 -3
- package/src/langs/cs.js +67 -1
- package/src/langs/da.js +68 -2
- package/src/langs/de.js +68 -3
- package/src/langs/en.js +29 -1
- package/src/langs/es.js +68 -3
- package/src/langs/fa.js +70 -2
- package/src/langs/fr.js +68 -2
- package/src/langs/he.js +68 -3
- package/src/langs/hu.js +226 -0
- package/src/langs/index.js +3 -2
- package/src/langs/it.js +65 -0
- package/src/langs/ja.js +68 -3
- package/src/langs/ko.js +66 -1
- package/src/langs/lv.js +68 -3
- package/src/langs/nl.js +68 -3
- package/src/langs/pl.js +68 -3
- package/src/langs/pt_br.js +65 -0
- package/src/langs/ro.js +69 -4
- package/src/langs/ru.js +68 -3
- package/src/langs/se.js +68 -3
- package/src/langs/tr.js +68 -0
- package/src/langs/ua.js +68 -3
- package/src/langs/ur.js +71 -6
- package/src/langs/zh_cn.js +69 -4
- package/src/modules/ApiManager.js +77 -54
- package/src/modules/Browser.js +667 -0
- package/src/modules/ColorPicker.js +162 -102
- package/src/modules/Controller.js +233 -136
- package/src/modules/Figure.js +913 -489
- package/src/modules/FileManager.js +141 -72
- package/src/modules/HueSlider.js +113 -61
- package/src/modules/Modal.js +292 -113
- package/src/modules/ModalAnchorEditor.js +380 -230
- package/src/modules/SelectMenu.js +270 -168
- package/src/modules/_DragHandle.js +2 -1
- package/src/modules/index.js +3 -3
- package/src/plugins/browser/audioGallery.js +83 -0
- package/src/plugins/browser/fileBrowser.js +103 -0
- package/src/plugins/browser/fileGallery.js +83 -0
- package/src/plugins/browser/imageGallery.js +81 -0
- package/src/plugins/browser/videoGallery.js +103 -0
- package/src/plugins/command/blockquote.js +40 -27
- package/src/plugins/command/exportPDF.js +134 -0
- package/src/plugins/command/fileUpload.js +226 -158
- package/src/plugins/command/list_bulleted.js +93 -47
- package/src/plugins/command/list_numbered.js +93 -47
- package/src/plugins/dropdown/align.js +66 -54
- package/src/plugins/dropdown/backgroundColor.js +76 -45
- package/src/plugins/dropdown/font.js +71 -47
- package/src/plugins/dropdown/fontColor.js +78 -46
- package/src/plugins/dropdown/formatBlock.js +74 -33
- package/src/plugins/dropdown/hr.js +102 -51
- package/src/plugins/dropdown/layout.js +37 -26
- package/src/plugins/dropdown/lineHeight.js +54 -38
- package/src/plugins/dropdown/list.js +60 -45
- package/src/plugins/dropdown/paragraphStyle.js +51 -30
- package/src/plugins/dropdown/table.js +1269 -777
- package/src/plugins/dropdown/template.js +38 -26
- package/src/plugins/dropdown/textStyle.js +43 -31
- package/src/plugins/field/mention.js +144 -82
- package/src/plugins/index.js +32 -6
- package/src/plugins/input/fontSize.js +161 -108
- package/src/plugins/input/pageNavigator.js +70 -0
- package/src/plugins/modal/audio.js +341 -169
- package/src/plugins/modal/drawing.js +530 -0
- package/src/plugins/modal/embed.js +886 -0
- package/src/plugins/modal/image.js +673 -358
- package/src/plugins/modal/link.js +100 -71
- package/src/plugins/modal/math.js +384 -168
- package/src/plugins/modal/video.js +693 -336
- package/src/plugins/popup/anchor.js +222 -0
- package/src/suneditor.js +54 -12
- package/src/themes/dark.css +85 -0
- package/src/typedef.js +86 -0
- package/types/assets/icons/_default.d.ts +152 -0
- package/types/core/base/eventHandlers/handler_toolbar.d.ts +41 -0
- package/types/core/base/eventHandlers/handler_ww_clipboard.d.ts +40 -0
- package/types/core/base/eventHandlers/handler_ww_dragDrop.d.ts +35 -0
- package/types/core/base/eventHandlers/handler_ww_key_input.d.ts +45 -0
- package/types/core/base/eventHandlers/handler_ww_mouse.d.ts +39 -0
- package/types/core/base/eventManager.d.ts +377 -0
- package/types/core/base/events.d.ts +297 -0
- package/types/core/base/history.d.ts +81 -0
- package/types/core/class/char.d.ts +60 -0
- package/types/core/class/component.d.ts +259 -0
- package/types/core/class/format.d.ts +615 -0
- package/types/core/class/html.d.ts +377 -0
- package/types/core/class/menu.d.ts +118 -0
- package/types/core/class/nodeTransform.d.ts +93 -0
- package/types/core/class/offset.d.ts +512 -0
- package/types/core/class/selection.d.ts +188 -0
- package/types/core/class/shortcuts.d.ts +142 -0
- package/types/core/class/toolbar.d.ts +189 -0
- package/types/core/class/ui.d.ts +144 -0
- package/types/core/class/viewer.d.ts +140 -0
- package/types/core/editor.d.ts +606 -0
- package/types/core/section/actives.d.ts +46 -0
- package/types/core/section/constructor.d.ts +748 -0
- package/types/core/section/context.d.ts +45 -0
- package/types/core/section/documentType.d.ts +178 -0
- package/types/editorInjector/_classes.d.ts +41 -0
- package/types/editorInjector/_core.d.ts +92 -0
- package/types/editorInjector/index.d.ts +71 -0
- package/types/helper/converter.d.ts +150 -0
- package/types/helper/dom/domCheck.d.ts +182 -0
- package/types/helper/dom/domQuery.d.ts +214 -0
- package/types/helper/dom/domUtils.d.ts +211 -0
- package/types/helper/dom/index.d.ts +9 -0
- package/types/helper/env.d.ts +149 -0
- package/types/helper/index.d.ts +163 -0
- package/types/helper/keyCodeMap.d.ts +110 -0
- package/types/helper/numbers.d.ts +43 -0
- package/types/helper/unicode.d.ts +28 -0
- package/types/index.d.ts +0 -0
- package/{typings/Lang.d.ts → types/langs/_Lang.d.ts} +170 -103
- package/types/langs/ckb.d.ts +384 -0
- package/types/langs/cs.d.ts +384 -0
- package/types/langs/da.d.ts +384 -0
- package/types/langs/de.d.ts +384 -0
- package/types/langs/en.d.ts +384 -0
- package/types/langs/es.d.ts +384 -0
- package/types/langs/fa.d.ts +384 -0
- package/types/langs/fr.d.ts +384 -0
- package/types/langs/he.d.ts +384 -0
- package/types/langs/hu.d.ts +384 -0
- package/types/langs/index.d.ts +48 -0
- package/types/langs/it.d.ts +384 -0
- package/types/langs/ja.d.ts +384 -0
- package/types/langs/ko.d.ts +384 -0
- package/types/langs/lv.d.ts +384 -0
- package/types/langs/nl.d.ts +384 -0
- package/types/langs/pl.d.ts +384 -0
- package/types/langs/pt_br.d.ts +384 -0
- package/types/langs/ro.d.ts +384 -0
- package/types/langs/ru.d.ts +384 -0
- package/types/langs/se.d.ts +384 -0
- package/types/langs/tr.d.ts +384 -0
- package/types/langs/ua.d.ts +384 -0
- package/types/langs/ur.d.ts +384 -0
- package/types/langs/zh_cn.d.ts +384 -0
- package/types/modules/ApiManager.d.ts +125 -0
- package/types/modules/Browser.d.ts +326 -0
- package/types/modules/ColorPicker.d.ts +131 -0
- package/types/modules/Controller.d.ts +231 -0
- package/types/modules/Figure.d.ts +504 -0
- package/types/modules/FileManager.d.ts +202 -0
- package/types/modules/HueSlider.d.ts +136 -0
- package/types/modules/Modal.d.ts +117 -0
- package/types/modules/ModalAnchorEditor.d.ts +236 -0
- package/types/modules/SelectMenu.d.ts +194 -0
- package/types/modules/_DragHandle.d.ts +7 -0
- package/types/modules/index.d.ts +26 -0
- package/types/plugins/browser/audioGallery.d.ts +55 -0
- package/types/plugins/browser/fileBrowser.d.ts +64 -0
- package/types/plugins/browser/fileGallery.d.ts +55 -0
- package/types/plugins/browser/imageGallery.d.ts +51 -0
- package/types/plugins/browser/videoGallery.d.ts +57 -0
- package/types/plugins/command/blockquote.d.ts +28 -0
- package/types/plugins/command/exportPDF.d.ts +46 -0
- package/types/plugins/command/fileUpload.d.ts +156 -0
- package/types/plugins/command/list_bulleted.d.ts +56 -0
- package/types/plugins/command/list_numbered.d.ts +56 -0
- package/types/plugins/dropdown/align.d.ts +60 -0
- package/types/plugins/dropdown/backgroundColor.d.ts +63 -0
- package/types/plugins/dropdown/font.d.ts +54 -0
- package/types/plugins/dropdown/fontColor.d.ts +63 -0
- package/types/plugins/dropdown/formatBlock.d.ts +58 -0
- package/types/plugins/dropdown/hr.d.ts +81 -0
- package/types/plugins/dropdown/layout.d.ts +40 -0
- package/types/plugins/dropdown/lineHeight.d.ts +50 -0
- package/types/plugins/dropdown/list.d.ts +39 -0
- package/types/plugins/dropdown/paragraphStyle.d.ts +54 -0
- package/types/plugins/dropdown/table.d.ts +579 -0
- package/types/plugins/dropdown/template.d.ts +40 -0
- package/types/plugins/dropdown/textStyle.d.ts +41 -0
- package/types/plugins/field/mention.d.ts +102 -0
- package/types/plugins/index.d.ts +107 -0
- package/types/plugins/input/fontSize.d.ts +170 -0
- package/types/plugins/input/pageNavigator.d.ts +28 -0
- package/types/plugins/modal/audio.d.ts +269 -0
- package/types/plugins/modal/drawing.d.ts +246 -0
- package/types/plugins/modal/embed.d.ts +387 -0
- package/types/plugins/modal/image.d.ts +451 -0
- package/types/plugins/modal/link.d.ts +128 -0
- package/types/plugins/modal/math.d.ts +193 -0
- package/types/plugins/modal/video.d.ts +485 -0
- package/types/plugins/popup/anchor.d.ts +56 -0
- package/types/suneditor.d.ts +51 -0
- package/types/typedef-global.d.ts +144 -0
- package/src/core/class/notice.js +0 -42
- package/src/helper/domUtils.js +0 -1177
- package/src/modules/FileBrowser.js +0 -271
- package/src/plugins/command/exportPdf.js +0 -168
- package/src/plugins/fileBrowser/imageGallery.js +0 -81
- package/src/themes/test.css +0 -61
- package/typings/CommandPlugin.d.ts +0 -8
- package/typings/DialogPlugin.d.ts +0 -20
- package/typings/FileBrowserPlugin.d.ts +0 -30
- package/typings/Module.d.ts +0 -15
- package/typings/Plugin.d.ts +0 -42
- package/typings/SubmenuPlugin.d.ts +0 -8
- package/typings/_classes.d.ts +0 -17
- package/typings/_colorPicker.d.ts +0 -60
- package/typings/_core.d.ts +0 -55
- package/typings/align.d.ts +0 -5
- package/typings/audio.d.ts +0 -5
- package/typings/backgroundColor.d.ts +0 -5
- package/typings/blockquote.d.ts +0 -5
- package/typings/char.d.ts +0 -39
- package/typings/component.d.ts +0 -38
- package/typings/context.d.ts +0 -39
- package/typings/converter.d.ts +0 -33
- package/typings/dialog.d.ts +0 -28
- package/typings/domUtils.d.ts +0 -361
- package/typings/editor.d.ts +0 -7
- package/typings/editor.ts +0 -542
- package/typings/env.d.ts +0 -70
- package/typings/eventManager.d.ts +0 -37
- package/typings/events.d.ts +0 -262
- package/typings/fileBrowser.d.ts +0 -42
- package/typings/fileManager.d.ts +0 -67
- package/typings/font.d.ts +0 -5
- package/typings/fontColor.d.ts +0 -5
- package/typings/fontSize.d.ts +0 -5
- package/typings/format.d.ts +0 -191
- package/typings/formatBlock.d.ts +0 -5
- package/typings/history.d.ts +0 -48
- package/typings/horizontalRule.d.ts +0 -5
- package/typings/image.d.ts +0 -5
- package/typings/imageGallery.d.ts +0 -5
- package/typings/index.d.ts +0 -21
- package/typings/index.modules.d.ts +0 -11
- package/typings/index.plugins.d.ts +0 -58
- package/typings/lineHeight.d.ts +0 -5
- package/typings/link.d.ts +0 -5
- package/typings/list.d.ts +0 -5
- package/typings/math.d.ts +0 -5
- package/typings/mediaContainer.d.ts +0 -25
- package/typings/mention.d.ts +0 -5
- package/typings/node.d.ts +0 -57
- package/typings/notice.d.ts +0 -16
- package/typings/numbers.d.ts +0 -29
- package/typings/offset.d.ts +0 -24
- package/typings/options.d.ts +0 -589
- package/typings/paragraphStyle.d.ts +0 -5
- package/typings/resizing.d.ts +0 -141
- package/typings/selection.d.ts +0 -94
- package/typings/shortcuts.d.ts +0 -13
- package/typings/suneditor.d.ts +0 -9
- package/typings/table.d.ts +0 -5
- package/typings/template.d.ts +0 -5
- package/typings/textStyle.d.ts +0 -5
- package/typings/toolbar.d.ts +0 -32
- package/typings/unicode.d.ts +0 -25
- package/typings/video.d.ts +0 -5
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
export default HTML;
|
|
2
|
+
export type HTMLThis = Omit<HTML & Partial<__se__EditorInjector>, 'html'>;
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {Omit<HTML & Partial<__se__EditorInjector>, 'html'>} HTMLThis
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @constructor
|
|
8
|
+
* @this {HTMLThis}
|
|
9
|
+
* @description All HTML related classes involved in the editing area
|
|
10
|
+
* @param {__se__EditorCore} editor - The root editor instance
|
|
11
|
+
*/
|
|
12
|
+
declare function HTML(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, editor: __se__EditorCore): void;
|
|
13
|
+
declare class HTML {
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {Omit<HTML & Partial<__se__EditorInjector>, 'html'>} HTMLThis
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* @constructor
|
|
19
|
+
* @this {HTMLThis}
|
|
20
|
+
* @description All HTML related classes involved in the editing area
|
|
21
|
+
* @param {__se__EditorCore} editor - The root editor instance
|
|
22
|
+
*/
|
|
23
|
+
constructor(editor: __se__EditorCore);
|
|
24
|
+
fontSizeUnitRegExp: RegExp;
|
|
25
|
+
_isAllowedClassName: any;
|
|
26
|
+
_allowHTMLComment: any;
|
|
27
|
+
_disallowedStyleNodesRegExp: RegExp;
|
|
28
|
+
_htmlCheckWhitelistRegExp: RegExp;
|
|
29
|
+
_htmlCheckBlacklistRegExp: RegExp;
|
|
30
|
+
_elementWhitelistRegExp: RegExp;
|
|
31
|
+
_elementBlacklistRegExp: RegExp;
|
|
32
|
+
/** @type {Object<string, RegExp>} */
|
|
33
|
+
_attributeWhitelist: {
|
|
34
|
+
[x: string]: RegExp;
|
|
35
|
+
};
|
|
36
|
+
/** @type {Object<string, RegExp>} */
|
|
37
|
+
_attributeBlacklist: {
|
|
38
|
+
[x: string]: RegExp;
|
|
39
|
+
};
|
|
40
|
+
_attributeWhitelistRegExp: RegExp;
|
|
41
|
+
_attributeBlacklistRegExp: RegExp;
|
|
42
|
+
_cleanStyleTagKeyRegExp: RegExp;
|
|
43
|
+
_cleanStyleRegExpMap: Map<any, any>;
|
|
44
|
+
_textStyleTags: any;
|
|
45
|
+
/** @type {Object<string, *>} */
|
|
46
|
+
_autoStyleify: {
|
|
47
|
+
[x: string]: any;
|
|
48
|
+
};
|
|
49
|
+
__disallowedTagsRegExp: RegExp;
|
|
50
|
+
__disallowedTagNameRegExp: RegExp;
|
|
51
|
+
__allowedTagNameRegExp: RegExp;
|
|
52
|
+
/**
|
|
53
|
+
* @this {HTMLThis}
|
|
54
|
+
* @description Filters an HTML string based on allowed and disallowed tags, with optional custom validation.
|
|
55
|
+
* - Removes blacklisted tags and keeps only whitelisted tags.
|
|
56
|
+
* - Allows custom validation functions to replace, modify, or remove elements.
|
|
57
|
+
* @param {string} html - The HTML string to be filtered.
|
|
58
|
+
* @param {Object} params - Filtering parameters.
|
|
59
|
+
* @param {string} [params.tagWhitelist] - Allowed tags, specified as a string with tags separated by '|'. (e.g. "div|p|span").
|
|
60
|
+
* @param {string} [params.tagBlacklist] - Disallowed tags, specified as a string with tags separated by '|'. (e.g. "script|iframe").
|
|
61
|
+
* @param {(node: Node) => Node | string | null} [params.validate] - Function to validate and modify individual nodes.
|
|
62
|
+
* - Return `null` to remove the node.
|
|
63
|
+
* - Return a `Node` to replace the current node.
|
|
64
|
+
* - Return a `string` to replace the node's outerHTML.
|
|
65
|
+
* @param {boolean} [params.validateAll] - Whether to apply validation to all nodes.
|
|
66
|
+
* @returns {string} - The filtered HTML string.
|
|
67
|
+
*/
|
|
68
|
+
filter(
|
|
69
|
+
this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>,
|
|
70
|
+
html: string,
|
|
71
|
+
{
|
|
72
|
+
tagWhitelist,
|
|
73
|
+
tagBlacklist,
|
|
74
|
+
validate,
|
|
75
|
+
validateAll
|
|
76
|
+
}: {
|
|
77
|
+
tagWhitelist?: string;
|
|
78
|
+
tagBlacklist?: string;
|
|
79
|
+
validate?: (node: Node) => Node | string | null;
|
|
80
|
+
validateAll?: boolean;
|
|
81
|
+
}
|
|
82
|
+
): string;
|
|
83
|
+
/**
|
|
84
|
+
* @this {HTMLThis}
|
|
85
|
+
* @description Cleans and compresses HTML code to suit the editor format.
|
|
86
|
+
* @param {string} html HTML string to clean and compress
|
|
87
|
+
* @param {Object} [options] Cleaning options
|
|
88
|
+
* @param {boolean} [options.forceFormat=false] If true, wraps text nodes without a format node in the format tag.
|
|
89
|
+
* @param {string|RegExp|null} [options.whitelist=null] Regular expression of allowed tags.
|
|
90
|
+
* Create RegExp object using helper.converter.createElementWhitelist method.
|
|
91
|
+
* @param {string|RegExp|null} [options.blacklist=null] Regular expression of disallowed tags.
|
|
92
|
+
* Create RegExp object using helper.converter.createElementBlacklist method.
|
|
93
|
+
* @param {boolean} [options._freeCodeViewMode=false] If true, the free code view mode is enabled.
|
|
94
|
+
* @returns {string} Cleaned and compressed HTML string
|
|
95
|
+
*/
|
|
96
|
+
clean(
|
|
97
|
+
this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>,
|
|
98
|
+
html: string,
|
|
99
|
+
{
|
|
100
|
+
forceFormat,
|
|
101
|
+
whitelist,
|
|
102
|
+
blacklist,
|
|
103
|
+
_freeCodeViewMode
|
|
104
|
+
}?: {
|
|
105
|
+
forceFormat?: boolean;
|
|
106
|
+
whitelist?: string | RegExp | null;
|
|
107
|
+
blacklist?: string | RegExp | null;
|
|
108
|
+
_freeCodeViewMode?: boolean;
|
|
109
|
+
}
|
|
110
|
+
): string;
|
|
111
|
+
/**
|
|
112
|
+
* @this {HTMLThis}
|
|
113
|
+
* @description Inserts an (HTML element / HTML string / plain string) at the selection range.
|
|
114
|
+
* - If "frameOptions.get('charCounter_max')" is exceeded when "html" is added, null is returned without addition.
|
|
115
|
+
* @param {Node|string} html HTML Element or HTML string or plain string
|
|
116
|
+
* @param {Object} [options] Options
|
|
117
|
+
* @param {boolean} [options.selectInserted=false] If true, selects the range of the inserted node.
|
|
118
|
+
* @param {boolean} [options.skipCharCount=false] If true, inserts even if "frameOptions.get('charCounter_max')" is exceeded.
|
|
119
|
+
* @param {boolean} [options.skipCleaning=false] If true, inserts the HTML string without refining it with html.clean.
|
|
120
|
+
* @returns {HTMLElement|null} The inserted element or null if insertion failed
|
|
121
|
+
*/
|
|
122
|
+
insert(
|
|
123
|
+
this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>,
|
|
124
|
+
html: Node | string,
|
|
125
|
+
{
|
|
126
|
+
selectInserted,
|
|
127
|
+
skipCharCount,
|
|
128
|
+
skipCleaning
|
|
129
|
+
}?: {
|
|
130
|
+
selectInserted?: boolean;
|
|
131
|
+
skipCharCount?: boolean;
|
|
132
|
+
skipCleaning?: boolean;
|
|
133
|
+
}
|
|
134
|
+
): HTMLElement | null;
|
|
135
|
+
/**
|
|
136
|
+
* @this {HTMLThis}
|
|
137
|
+
* @description Delete selected node and insert argument value node and return.
|
|
138
|
+
* - If the "afterNode" exists, it is inserted after the "afterNode"
|
|
139
|
+
* - Inserting a text node merges with both text nodes on both sides and returns a new "{ container, startOffset, endOffset }".
|
|
140
|
+
* @param {Node} oNode Node to be inserted
|
|
141
|
+
* @param {Object} [options] Options
|
|
142
|
+
* @param {Node} [options.afterNode=null] If the node exists, it is inserted after the node
|
|
143
|
+
* @param {boolean} [options.skipCharCount=null] If true, it will be inserted even if "frameOptions.get('charCounter_max')" is exceeded.
|
|
144
|
+
* @returns {Object|Node|null}
|
|
145
|
+
*/
|
|
146
|
+
insertNode(
|
|
147
|
+
this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>,
|
|
148
|
+
oNode: Node,
|
|
149
|
+
{
|
|
150
|
+
afterNode,
|
|
151
|
+
skipCharCount
|
|
152
|
+
}?: {
|
|
153
|
+
afterNode?: Node;
|
|
154
|
+
skipCharCount?: boolean;
|
|
155
|
+
}
|
|
156
|
+
): any | Node | null;
|
|
157
|
+
/**
|
|
158
|
+
* @this {HTMLThis}
|
|
159
|
+
* @description Delete the selected range.
|
|
160
|
+
* @returns {{container: Node, offset: number, commonCon?: Node|null, prevContainer?: Node|null}}
|
|
161
|
+
* - container: "the last element after deletion"
|
|
162
|
+
* - offset: "offset"
|
|
163
|
+
* - commonCon: "commonAncestorContainer"
|
|
164
|
+
* - prevContainer: "previousElementSibling Of the deleted area"
|
|
165
|
+
*/
|
|
166
|
+
remove(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>): {
|
|
167
|
+
container: Node;
|
|
168
|
+
offset: number;
|
|
169
|
+
commonCon?: Node | null;
|
|
170
|
+
prevContainer?: Node | null;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* @this {HTMLThis}
|
|
174
|
+
* @description Gets the current content
|
|
175
|
+
* @param {Object} [options] Options
|
|
176
|
+
* @param {boolean} [options.withFrame=false] Gets the current content with containing parent div.sun-editor-editable (<div class="sun-editor-editable">{content}</div>).
|
|
177
|
+
* Ignored for targetOptions.get('iframe_fullPage') is true.
|
|
178
|
+
* @param {boolean} [options.includeFullPage=false] Return only the content of the body without headers when the "iframe_fullPage" option is true
|
|
179
|
+
* @param {number|Array<number>} [options.rootKey=null] Root index
|
|
180
|
+
* @returns {string|Object<*, string>}
|
|
181
|
+
*/
|
|
182
|
+
get(
|
|
183
|
+
this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>,
|
|
184
|
+
{
|
|
185
|
+
withFrame,
|
|
186
|
+
includeFullPage,
|
|
187
|
+
rootKey
|
|
188
|
+
}?: {
|
|
189
|
+
withFrame?: boolean;
|
|
190
|
+
includeFullPage?: boolean;
|
|
191
|
+
rootKey?: number | Array<number>;
|
|
192
|
+
}
|
|
193
|
+
): string | any;
|
|
194
|
+
/**
|
|
195
|
+
* @this {HTMLThis}
|
|
196
|
+
* @description Sets the HTML string
|
|
197
|
+
* @param {string} html HTML string
|
|
198
|
+
* @param {Object} [options] Options
|
|
199
|
+
* @param {number|Array<number>} [options.rootKey=null] Root index
|
|
200
|
+
*/
|
|
201
|
+
set(
|
|
202
|
+
this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>,
|
|
203
|
+
html: string,
|
|
204
|
+
{
|
|
205
|
+
rootKey
|
|
206
|
+
}?: {
|
|
207
|
+
rootKey?: number | Array<number>;
|
|
208
|
+
}
|
|
209
|
+
): void;
|
|
210
|
+
/**
|
|
211
|
+
* @this {HTMLThis}
|
|
212
|
+
* @description Add content to the end of content.
|
|
213
|
+
* @param {string} html Content to Input
|
|
214
|
+
* @param {Object} [options] Options
|
|
215
|
+
* @param {number|Array<number>} [options.rootKey=null] Root index
|
|
216
|
+
*/
|
|
217
|
+
add(
|
|
218
|
+
this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>,
|
|
219
|
+
html: string,
|
|
220
|
+
{
|
|
221
|
+
rootKey
|
|
222
|
+
}?: {
|
|
223
|
+
rootKey?: number | Array<number>;
|
|
224
|
+
}
|
|
225
|
+
): void;
|
|
226
|
+
/**
|
|
227
|
+
* @this {HTMLThis}
|
|
228
|
+
* @description Sets the content of the iframe's head tag and body tag when using the "iframe" or "iframe_fullPage" option.
|
|
229
|
+
* @param {{head: string, body: string}} ctx { head: HTML string, body: HTML string}
|
|
230
|
+
* @param {Object} [options] Options
|
|
231
|
+
* @param {number|Array<number>} [options.rootKey=null] Root index
|
|
232
|
+
*/
|
|
233
|
+
setFullPage(
|
|
234
|
+
this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>,
|
|
235
|
+
ctx: {
|
|
236
|
+
head: string;
|
|
237
|
+
body: string;
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
rootKey
|
|
241
|
+
}?: {
|
|
242
|
+
rootKey?: number | Array<number>;
|
|
243
|
+
}
|
|
244
|
+
): boolean;
|
|
245
|
+
/**
|
|
246
|
+
* @this {HTMLThis}
|
|
247
|
+
* @description HTML code compression
|
|
248
|
+
* @param {string} html HTML string
|
|
249
|
+
* @returns {string} HTML string
|
|
250
|
+
*/
|
|
251
|
+
compress(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, html: string): string;
|
|
252
|
+
/**
|
|
253
|
+
* @private
|
|
254
|
+
* @this {HTMLThis}
|
|
255
|
+
* @description construct wysiwyg area element to html string
|
|
256
|
+
* @param {Node|string} html WYSIWYG element (this.editor.frameContext.get('wysiwyg')) or HTML string.
|
|
257
|
+
* @param {boolean} comp If true, does not line break and indentation of tags.
|
|
258
|
+
* @returns {string}
|
|
259
|
+
*/
|
|
260
|
+
_convertToCode(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, html: Node | string, comp: boolean): string;
|
|
261
|
+
/**
|
|
262
|
+
* @private
|
|
263
|
+
* @this {HTMLThis}
|
|
264
|
+
* @description Checks whether the given list item node should be removed and handles necessary clean-up.
|
|
265
|
+
* @param {Node} item The list item node to be checked.
|
|
266
|
+
*/
|
|
267
|
+
_nodeRemoveListItem(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, item: Node): void;
|
|
268
|
+
/**
|
|
269
|
+
* @private
|
|
270
|
+
* @this {HTMLThis}
|
|
271
|
+
* @description Recursive function when used to place a node in "BrLine" in "html.insertNode"
|
|
272
|
+
* @param {Node} oNode Node to be inserted
|
|
273
|
+
* @returns {Node} "oNode"
|
|
274
|
+
*/
|
|
275
|
+
_setIntoFreeFormat(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, oNode: Node): Node;
|
|
276
|
+
/**
|
|
277
|
+
* @private
|
|
278
|
+
* @this {HTMLThis}
|
|
279
|
+
* @description Returns HTML string according to tag type and configurati isExcludeFormat.
|
|
280
|
+
* @param {Node} node Node
|
|
281
|
+
* @param {boolean} forceFormat If true, text nodes that do not have a format node is wrapped with the format tag.
|
|
282
|
+
*/
|
|
283
|
+
_makeLine(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, node: Node, forceFormat: boolean): string;
|
|
284
|
+
/**
|
|
285
|
+
* @private
|
|
286
|
+
* @this {HTMLThis}
|
|
287
|
+
* @description Fix tags that do not fit the editor format.
|
|
288
|
+
* @param {DocumentFragment} documentFragment Document fragment "DOCUMENT_FRAGMENT_NODE" (nodeType === 11)
|
|
289
|
+
* @param {RegExp} htmlCheckWhitelistRegExp Editor tags whitelist
|
|
290
|
+
* @param {RegExp} htmlCheckBlacklistRegExp Editor tags blacklist
|
|
291
|
+
* @param {boolean} tagFilter Tag filter option
|
|
292
|
+
* @param {boolean} formatFilter Format filter option
|
|
293
|
+
* @param {boolean} classFilter Class name filter option
|
|
294
|
+
* @param {boolean} _freeCodeViewMode Enforces strict HTML validation based on the editor`s policy
|
|
295
|
+
*/
|
|
296
|
+
_consistencyCheckOfHTML(
|
|
297
|
+
this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>,
|
|
298
|
+
documentFragment: DocumentFragment,
|
|
299
|
+
htmlCheckWhitelistRegExp: RegExp,
|
|
300
|
+
htmlCheckBlacklistRegExp: RegExp,
|
|
301
|
+
tagFilter: boolean,
|
|
302
|
+
formatFilter: boolean,
|
|
303
|
+
classFilter: boolean,
|
|
304
|
+
_freeCodeViewMode: boolean
|
|
305
|
+
): void;
|
|
306
|
+
/**
|
|
307
|
+
* @private
|
|
308
|
+
* @this {HTMLThis}
|
|
309
|
+
* @description Removes attribute values such as style and converts tags that do not conform to the "html5" standard.
|
|
310
|
+
* @param {string} html HTML string
|
|
311
|
+
* @returns {string} HTML string
|
|
312
|
+
*/
|
|
313
|
+
_styleNodeConvertor(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, html: string): string;
|
|
314
|
+
/**
|
|
315
|
+
* @private
|
|
316
|
+
* @this {HTMLThis}
|
|
317
|
+
* @description Determines if formatting is required and returns a domTree
|
|
318
|
+
* @param {DocumentFragment} domFrag documentFragment
|
|
319
|
+
* @returns {DocumentFragment}
|
|
320
|
+
*/
|
|
321
|
+
_editFormat(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, domFrag: DocumentFragment): DocumentFragment;
|
|
322
|
+
/**
|
|
323
|
+
* @private
|
|
324
|
+
* @this {HTMLThis}
|
|
325
|
+
* @description Converts a list of DOM nodes into an HTML list structure.
|
|
326
|
+
* - If the node is already a list, its innerHTML is used. If it is a block element,
|
|
327
|
+
* - the function is called recursively.
|
|
328
|
+
* @param {__se__NodeCollection} domTree List of DOM nodes to be converted.
|
|
329
|
+
* @returns {string} The generated HTML list.
|
|
330
|
+
*/
|
|
331
|
+
_convertListCell(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, domTree: __se__NodeCollection): string;
|
|
332
|
+
/**
|
|
333
|
+
* @private
|
|
334
|
+
* @this {HTMLThis}
|
|
335
|
+
* @description Checks whether the provided DOM nodes require formatting.
|
|
336
|
+
* @param {NodeList} domTree List of DOM nodes to check.
|
|
337
|
+
* @returns {boolean} True if formatting is required, otherwise false.
|
|
338
|
+
*/
|
|
339
|
+
_isFormatData(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, domTree: NodeList): boolean;
|
|
340
|
+
/**
|
|
341
|
+
* @private
|
|
342
|
+
* @this {HTMLThis}
|
|
343
|
+
* @description Cleans the inline style attributes of an HTML element.
|
|
344
|
+
* - Extracts allowed styles and removes disallowed ones based on editor settings.
|
|
345
|
+
* @param {string} m The full matched string from a regular expression.
|
|
346
|
+
* @param {Array|null} v The list of allowed attributes.
|
|
347
|
+
* @param {string} name The tag name of the element being cleaned.
|
|
348
|
+
* @returns {Array} The updated list of allowed attributes including cleaned styles.
|
|
349
|
+
*/
|
|
350
|
+
_cleanStyle(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, m: string, v: any[] | null, name: string): any[];
|
|
351
|
+
/**
|
|
352
|
+
* @private
|
|
353
|
+
* @this {HTMLThis}
|
|
354
|
+
* @description Delete disallowed tags
|
|
355
|
+
* @param {string} html HTML string
|
|
356
|
+
* @returns {string}
|
|
357
|
+
*/
|
|
358
|
+
_deleteDisallowedTags(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, html: string, whitelistRegExp: any, blacklistRegExp: any): string;
|
|
359
|
+
/**
|
|
360
|
+
* @private
|
|
361
|
+
* @this {HTMLThis}
|
|
362
|
+
* @description Recursively checks for duplicate text style nodes within a given parent node.
|
|
363
|
+
* @param {Node} oNode The node to check for duplicate styles.
|
|
364
|
+
* @param {Node} parentNode The parent node where the duplicate check occurs.
|
|
365
|
+
*/
|
|
366
|
+
_checkDuplicateNode(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, oNode: Node, parentNode: Node): void;
|
|
367
|
+
/**
|
|
368
|
+
* @private
|
|
369
|
+
* @this {HTMLThis}
|
|
370
|
+
* @description Recursively checks for duplicate text style nodes within a given parent node.
|
|
371
|
+
* - If duplicate styles are found, redundant attributes are removed.
|
|
372
|
+
* @param {Node} oNode The node to check for duplicate styles.
|
|
373
|
+
* @param {Node} parentNode The parent node where the duplicate check occurs.
|
|
374
|
+
* @returns {Node} The cleaned node with redundant styles removed.
|
|
375
|
+
*/
|
|
376
|
+
_dupleCheck(this: Omit<HTML & Partial<import('../../editorInjector').default>, 'html'>, oNode: Node, parentNode: Node): Node;
|
|
377
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
export default Menu;
|
|
2
|
+
export type MenuThis = Omit<Menu & Partial<__se__EditorInjector>, 'menu'>;
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {Omit<Menu & Partial<__se__EditorInjector>, 'menu'>} MenuThis
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @constructor
|
|
8
|
+
* @this {MenuThis}
|
|
9
|
+
* @description Dropdown and container menu management class
|
|
10
|
+
* @param {__se__EditorCore} editor - The root editor instance
|
|
11
|
+
*/
|
|
12
|
+
declare function Menu(this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>, editor: __se__EditorCore): void;
|
|
13
|
+
declare class Menu {
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {Omit<Menu & Partial<__se__EditorInjector>, 'menu'>} MenuThis
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* @constructor
|
|
19
|
+
* @this {MenuThis}
|
|
20
|
+
* @description Dropdown and container menu management class
|
|
21
|
+
* @param {__se__EditorCore} editor - The root editor instance
|
|
22
|
+
*/
|
|
23
|
+
constructor(editor: __se__EditorCore);
|
|
24
|
+
/** @type {Object<string, HTMLElement>} */
|
|
25
|
+
targetMap: {
|
|
26
|
+
[x: string]: HTMLElement;
|
|
27
|
+
};
|
|
28
|
+
index: number;
|
|
29
|
+
menus: any[];
|
|
30
|
+
currentDropdown: HTMLElement;
|
|
31
|
+
currentDropdownActiveButton: HTMLButtonElement;
|
|
32
|
+
currentDropdownName: string;
|
|
33
|
+
currentDropdownType: string;
|
|
34
|
+
currentContainer: HTMLElement;
|
|
35
|
+
currentContainerActiveButton: HTMLButtonElement;
|
|
36
|
+
currentContainerName: string;
|
|
37
|
+
_dropdownCommands: any[];
|
|
38
|
+
__globalEventHandler: {
|
|
39
|
+
mousedown: any;
|
|
40
|
+
containerDown: any;
|
|
41
|
+
keydown: any;
|
|
42
|
+
mousemove: any;
|
|
43
|
+
mouseout: any;
|
|
44
|
+
};
|
|
45
|
+
_bindClose_dropdown_mouse: any;
|
|
46
|
+
_bindClose_dropdown_key: any;
|
|
47
|
+
_bindClose_cons_mouse: any;
|
|
48
|
+
currentDropdownPlugin: any;
|
|
49
|
+
/**
|
|
50
|
+
* @this {MenuThis}
|
|
51
|
+
* @description Method for managing dropdown element.
|
|
52
|
+
* - You must add the "dropdown" element using the this method at custom plugin.
|
|
53
|
+
* @param {{key: string, type: string}} classObj Class object
|
|
54
|
+
* @param {Node} menu Dropdown element
|
|
55
|
+
*/
|
|
56
|
+
initDropdownTarget(
|
|
57
|
+
this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>,
|
|
58
|
+
{
|
|
59
|
+
key,
|
|
60
|
+
type
|
|
61
|
+
}: {
|
|
62
|
+
key: string;
|
|
63
|
+
type: string;
|
|
64
|
+
},
|
|
65
|
+
menu: Node
|
|
66
|
+
): void;
|
|
67
|
+
/**
|
|
68
|
+
* @this {MenuThis}
|
|
69
|
+
* @description On dropdown
|
|
70
|
+
* @param {Node} button Dropdown's button element to call
|
|
71
|
+
*/
|
|
72
|
+
dropdownOn(this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>, button: Node): void;
|
|
73
|
+
/**
|
|
74
|
+
* @this {MenuThis}
|
|
75
|
+
* @description Off dropdown
|
|
76
|
+
*/
|
|
77
|
+
dropdownOff(this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>): void;
|
|
78
|
+
/**
|
|
79
|
+
* @this {MenuThis}
|
|
80
|
+
* @description On menu container
|
|
81
|
+
* @param {Node} button Container's button element to call
|
|
82
|
+
*/
|
|
83
|
+
containerOn(this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>, button: Node): void;
|
|
84
|
+
/**
|
|
85
|
+
* @this {MenuThis}
|
|
86
|
+
* @description Off menu container
|
|
87
|
+
*/
|
|
88
|
+
containerOff(this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>): void;
|
|
89
|
+
/**
|
|
90
|
+
* @private
|
|
91
|
+
* @this {MenuThis}
|
|
92
|
+
* @description Set the menu position.
|
|
93
|
+
* @param {Node} element Button element
|
|
94
|
+
* @param {HTMLElement} menu Menu element
|
|
95
|
+
*/
|
|
96
|
+
_setMenuPosition(this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>, element: Node, menu: HTMLElement): void;
|
|
97
|
+
/**
|
|
98
|
+
* @private
|
|
99
|
+
* @this {MenuThis}
|
|
100
|
+
* @description Check if the element is part of a more layer
|
|
101
|
+
* @param {Node} element The element to check
|
|
102
|
+
* @returns {HTMLElement|null} The more layer element or null
|
|
103
|
+
*/
|
|
104
|
+
_checkMoreLayer(this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>, element: Node): HTMLElement | null;
|
|
105
|
+
/**
|
|
106
|
+
* @private
|
|
107
|
+
* @this {MenuThis}
|
|
108
|
+
* @description Move the selected item in the dropdown menu
|
|
109
|
+
* @param {number} num Direction and amount to move (-1 for up, 1 for down)
|
|
110
|
+
*/
|
|
111
|
+
_moveItem(this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>, num: number): void;
|
|
112
|
+
/**
|
|
113
|
+
* @private
|
|
114
|
+
* @this {MenuThis}
|
|
115
|
+
* @description Remove global event listeners
|
|
116
|
+
*/
|
|
117
|
+
__removeGlobalEvent(this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>): void;
|
|
118
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export default NodeTransform;
|
|
2
|
+
export type NodeTransformThis = Omit<NodeTransform & Partial<__se__EditorInjector>, 'nodeTransform'>;
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {Omit<NodeTransform & Partial<__se__EditorInjector>, 'nodeTransform'>} NodeTransformThis
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @constructor
|
|
8
|
+
* @this {NodeTransformThis}
|
|
9
|
+
* @description Node utility class. split, merge, etc.
|
|
10
|
+
* @param {__se__EditorCore} editor - The root editor instance
|
|
11
|
+
*/
|
|
12
|
+
declare function NodeTransform(this: Omit<NodeTransform & Partial<import('../../editorInjector').default>, 'nodeTransform'>, editor: __se__EditorCore): void;
|
|
13
|
+
declare class NodeTransform {
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {Omit<NodeTransform & Partial<__se__EditorInjector>, 'nodeTransform'>} NodeTransformThis
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* @constructor
|
|
19
|
+
* @this {NodeTransformThis}
|
|
20
|
+
* @description Node utility class. split, merge, etc.
|
|
21
|
+
* @param {__se__EditorCore} editor - The root editor instance
|
|
22
|
+
*/
|
|
23
|
+
constructor(editor: __se__EditorCore);
|
|
24
|
+
/**
|
|
25
|
+
* @this {NodeTransformThis}
|
|
26
|
+
* @template {HTMLElement} T
|
|
27
|
+
* @description Split all tags based on "baseNode"
|
|
28
|
+
* @param {Node} baseNode Element or text node on which to base
|
|
29
|
+
* @param {?number|Node} offset Text offset of "baseNode" (Only valid when "baseNode" is a text node)
|
|
30
|
+
* @param {number} [depth=0] The nesting depth of the element being split. (default: 0)
|
|
31
|
+
* @returns {T} The last element of the splited tag.
|
|
32
|
+
*/
|
|
33
|
+
split<T extends HTMLElement>(this: Omit<NodeTransform & Partial<import('../../editorInjector').default>, 'nodeTransform'>, baseNode: Node, offset: (number | Node) | null, depth?: number): T;
|
|
34
|
+
/**
|
|
35
|
+
* @this {NodeTransformThis}
|
|
36
|
+
* @description Use with "npdePath (dom-query-GetNodePath)" to merge the same attributes and tags if they are present and modify the nodepath.
|
|
37
|
+
* - If "offset" has been changed, it will return as much "offset" as it has been modified.
|
|
38
|
+
* - An array containing change offsets is returned in the order of the "nodePathArray" array.
|
|
39
|
+
* @param {Node} element Element
|
|
40
|
+
* @param {?number[][]=} nodePathArray Array of NodePath object ([dom-query-GetNodePath(), ..])
|
|
41
|
+
* @param {?boolean=} onlyText If true, non-text nodes like 'span', 'strong'.. are ignored.
|
|
42
|
+
* @returns {Array<number>} [offset, ..]
|
|
43
|
+
*/
|
|
44
|
+
mergeSameTags(this: Omit<NodeTransform & Partial<import('../../editorInjector').default>, 'nodeTransform'>, element: Node, nodePathArray?: (number[][] | null) | undefined, onlyText?: (boolean | null) | undefined): Array<number>;
|
|
45
|
+
/**
|
|
46
|
+
* @this {NodeTransformThis}
|
|
47
|
+
* @description Remove nested tags without other child nodes.
|
|
48
|
+
* @param {Node} element Element object
|
|
49
|
+
* @param {?(current: Node) => boolean|string=} validation Validation function / String("tag1|tag2..") / If null, all tags are applicable.
|
|
50
|
+
*/
|
|
51
|
+
mergeNestedTags(this: Omit<NodeTransform & Partial<import('../../editorInjector').default>, 'nodeTransform'>, element: Node, validation?: (((current: Node) => boolean | string) | null) | undefined): void;
|
|
52
|
+
/**
|
|
53
|
+
* @this {NodeTransformThis}
|
|
54
|
+
* @description Delete itself and all parent nodes that match the condition.
|
|
55
|
+
* - Returns an {sc: previousSibling, ec: nextSibling}(the deleted node reference) or null.
|
|
56
|
+
* @param {Node} item Node to be remove
|
|
57
|
+
* @param {?(current: Node) => boolean=} validation Validation function. default(Deleted if it only have breakLine and blanks)
|
|
58
|
+
* @param {?Node=} stopParent Stop when the parent node reaches stopParent
|
|
59
|
+
* @returns {{sc: Node|null, ec: Node|null}|null} {sc: previousSibling, ec: nextSibling} (the deleted node reference) or null.
|
|
60
|
+
*/
|
|
61
|
+
removeAllParents(
|
|
62
|
+
this: Omit<NodeTransform & Partial<import('../../editorInjector').default>, 'nodeTransform'>,
|
|
63
|
+
item: Node,
|
|
64
|
+
validation?: (((current: Node) => boolean) | null) | undefined,
|
|
65
|
+
stopParent?: (Node | null) | undefined
|
|
66
|
+
): {
|
|
67
|
+
sc: Node | null;
|
|
68
|
+
ec: Node | null;
|
|
69
|
+
} | null;
|
|
70
|
+
/**
|
|
71
|
+
* @this {NodeTransformThis}
|
|
72
|
+
* @description Delete a empty child node of argument element
|
|
73
|
+
* @param {Node} element Element node
|
|
74
|
+
* @param {?Node} notRemoveNode Do not remove node
|
|
75
|
+
* @param {boolean} forceDelete When all child nodes are deleted, the parent node is also deleted.
|
|
76
|
+
*/
|
|
77
|
+
removeEmptyNode(this: Omit<NodeTransform & Partial<import('../../editorInjector').default>, 'nodeTransform'>, element: Node, notRemoveNode: Node | null, forceDelete: boolean): void;
|
|
78
|
+
/**
|
|
79
|
+
* @this {NodeTransformThis}
|
|
80
|
+
* @description Creates a nested node structure from the given array of nodes.
|
|
81
|
+
* @param {__se__NodeCollection} nodeArray An array of nodes to clone. The first node in the array will be the top-level parent.
|
|
82
|
+
* @param {?(current: Node) => boolean=} validate A validate function.
|
|
83
|
+
* @returns {{ parent: Node, inner: Node }} An object containing the top-level parent node and the innermost child node.
|
|
84
|
+
*/
|
|
85
|
+
createNestedNode(
|
|
86
|
+
this: Omit<NodeTransform & Partial<import('../../editorInjector').default>, 'nodeTransform'>,
|
|
87
|
+
nodeArray: __se__NodeCollection,
|
|
88
|
+
validate?: (((current: Node) => boolean) | null) | undefined
|
|
89
|
+
): {
|
|
90
|
+
parent: Node;
|
|
91
|
+
inner: Node;
|
|
92
|
+
};
|
|
93
|
+
}
|