suneditor 3.0.0-alpha.9 → 3.0.0-beta.2
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/CONTRIBUTING.md +170 -22
- package/{LICENSE.txt → LICENSE} +9 -9
- package/README.md +168 -30
- package/dist/suneditor.min.css +1 -1
- package/dist/suneditor.min.js +1 -1
- package/package.json +47 -21
- package/src/assets/design/color.css +121 -0
- package/src/assets/design/index.css +3 -0
- package/src/assets/design/size.css +35 -0
- package/src/assets/design/typography.css +37 -0
- package/src/assets/icons/defaultIcons.js +232 -0
- package/src/assets/suneditor-contents.css +181 -46
- package/src/assets/suneditor.css +1403 -650
- package/src/core/base/eventHandlers/handler_toolbar.js +35 -14
- package/src/core/base/eventHandlers/handler_ww_clipboard.js +23 -4
- package/src/core/base/eventHandlers/handler_ww_dragDrop.js +49 -10
- package/src/core/base/eventHandlers/handler_ww_key_input.js +422 -224
- package/src/core/base/eventHandlers/handler_ww_mouse.js +83 -36
- package/src/core/base/eventManager.js +520 -179
- package/src/core/base/history.js +95 -41
- package/src/core/class/char.js +26 -11
- package/src/core/class/component.js +345 -137
- package/src/core/class/format.js +683 -519
- package/src/core/class/html.js +485 -305
- package/src/core/class/menu.js +133 -47
- package/src/core/class/nodeTransform.js +90 -71
- package/src/core/class/offset.js +408 -92
- package/src/core/class/selection.js +216 -106
- package/src/core/class/shortcuts.js +68 -8
- package/src/core/class/toolbar.js +106 -116
- package/src/core/class/ui.js +422 -0
- package/src/core/class/viewer.js +178 -74
- package/src/core/editor.js +496 -389
- package/src/core/section/actives.js +123 -27
- package/src/core/section/constructor.js +615 -206
- 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/events.js +622 -0
- package/src/helper/clipboard.js +59 -0
- package/src/helper/converter.js +202 -26
- package/src/helper/dom/domCheck.js +304 -0
- package/src/helper/dom/domQuery.js +669 -0
- package/src/helper/dom/domUtils.js +557 -0
- package/src/helper/dom/index.js +12 -0
- package/src/helper/env.js +46 -56
- package/src/helper/index.js +10 -4
- package/src/helper/keyCodeMap.js +183 -0
- package/src/helper/numbers.js +12 -8
- package/src/helper/unicode.js +9 -5
- package/src/langs/ckb.js +74 -4
- package/src/langs/cs.js +72 -2
- package/src/langs/da.js +73 -3
- package/src/langs/de.js +73 -4
- package/src/langs/en.js +23 -3
- package/src/langs/es.js +73 -4
- package/src/langs/fa.js +75 -3
- package/src/langs/fr.js +73 -3
- package/src/langs/he.js +73 -4
- package/src/langs/hu.js +230 -0
- package/src/langs/index.js +7 -3
- package/src/langs/it.js +70 -1
- package/src/langs/ja.js +72 -4
- package/src/langs/km.js +230 -0
- package/src/langs/ko.js +22 -2
- package/src/langs/lv.js +74 -5
- package/src/langs/nl.js +73 -4
- package/src/langs/pl.js +73 -4
- package/src/langs/pt_br.js +70 -1
- package/src/langs/ro.js +74 -5
- package/src/langs/ru.js +73 -4
- package/src/langs/se.js +73 -4
- package/src/langs/tr.js +73 -1
- package/src/langs/{ua.js → uk.js} +75 -6
- package/src/langs/ur.js +77 -8
- package/src/langs/zh_cn.js +74 -5
- 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 +273 -142
- package/src/modules/Figure.js +925 -484
- package/src/modules/FileManager.js +121 -69
- package/src/modules/HueSlider.js +113 -61
- package/src/modules/Modal.js +291 -122
- package/src/modules/ModalAnchorEditor.js +383 -234
- 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 +229 -162
- package/src/plugins/command/list_bulleted.js +83 -47
- package/src/plugins/command/list_numbered.js +83 -47
- package/src/plugins/dropdown/align.js +66 -54
- package/src/plugins/dropdown/backgroundColor.js +63 -49
- package/src/plugins/dropdown/font.js +71 -47
- package/src/plugins/dropdown/fontColor.js +63 -48
- package/src/plugins/dropdown/formatBlock.js +70 -33
- package/src/plugins/dropdown/hr.js +92 -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 +2003 -813
- package/src/plugins/dropdown/template.js +38 -26
- package/src/plugins/dropdown/textStyle.js +43 -31
- package/src/plugins/field/mention.js +147 -86
- 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 +358 -173
- package/src/plugins/modal/drawing.js +531 -0
- package/src/plugins/modal/embed.js +886 -0
- package/src/plugins/modal/image.js +674 -362
- package/src/plugins/modal/link.js +100 -71
- package/src/plugins/modal/math.js +367 -167
- package/src/plugins/modal/video.js +691 -335
- package/src/plugins/popup/anchor.js +222 -0
- package/src/suneditor.js +50 -13
- package/src/themes/dark.css +122 -0
- package/src/typedef.js +130 -0
- package/types/assets/icons/defaultIcons.d.ts +153 -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 +385 -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 +212 -0
- package/types/core/class/format.d.ts +616 -0
- package/types/core/class/html.d.ts +422 -0
- package/types/core/class/menu.d.ts +126 -0
- package/types/core/class/nodeTransform.d.ts +93 -0
- package/types/core/class/offset.d.ts +522 -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 +164 -0
- package/types/core/class/viewer.d.ts +140 -0
- package/types/core/editor.d.ts +610 -0
- package/types/core/section/actives.d.ts +46 -0
- package/types/core/section/constructor.d.ts +777 -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/events.d.ts +273 -0
- package/types/helper/clipboard.d.ts +12 -0
- package/types/helper/converter.d.ts +197 -0
- package/types/helper/dom/domCheck.d.ts +189 -0
- package/types/helper/dom/domQuery.d.ts +223 -0
- package/types/helper/dom/domUtils.d.ts +226 -0
- package/types/helper/dom/index.d.ts +9 -0
- package/types/helper/env.d.ts +132 -0
- package/types/helper/index.d.ts +174 -0
- package/types/helper/keyCodeMap.d.ts +110 -0
- package/types/helper/numbers.d.ts +46 -0
- package/types/helper/unicode.d.ts +28 -0
- package/types/index.d.ts +120 -0
- package/{typings/Lang.d.ts → types/langs/_Lang.d.ts} +173 -103
- package/types/langs/ckb.d.ts +3 -0
- package/types/langs/cs.d.ts +3 -0
- package/types/langs/da.d.ts +3 -0
- package/types/langs/de.d.ts +3 -0
- package/types/langs/en.d.ts +3 -0
- package/types/langs/es.d.ts +3 -0
- package/types/langs/fa.d.ts +3 -0
- package/types/langs/fr.d.ts +3 -0
- package/types/langs/he.d.ts +3 -0
- package/types/langs/hu.d.ts +3 -0
- package/types/langs/index.d.ts +54 -0
- package/types/langs/it.d.ts +3 -0
- package/types/langs/ja.d.ts +3 -0
- package/types/langs/km.d.ts +3 -0
- package/types/langs/ko.d.ts +3 -0
- package/types/langs/lv.d.ts +3 -0
- package/types/langs/nl.d.ts +3 -0
- package/types/langs/pl.d.ts +3 -0
- package/types/langs/pt_br.d.ts +3 -0
- package/types/langs/ro.d.ts +3 -0
- package/types/langs/ru.d.ts +3 -0
- package/types/langs/se.d.ts +3 -0
- package/types/langs/tr.d.ts +3 -0
- package/types/langs/uk.d.ts +3 -0
- package/types/langs/ur.d.ts +3 -0
- package/types/langs/zh_cn.d.ts +3 -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 +251 -0
- package/types/modules/Figure.d.ts +517 -0
- package/types/modules/FileManager.d.ts +202 -0
- package/types/modules/HueSlider.d.ts +136 -0
- package/types/modules/Modal.d.ts +111 -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 +46 -0
- package/types/plugins/command/list_numbered.d.ts +46 -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 +54 -0
- package/types/plugins/dropdown/hr.d.ts +71 -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 +627 -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.d.ts +233 -0
- package/.eslintignore +0 -7
- package/.eslintrc.json +0 -64
- package/src/assets/icons/_default.js +0 -194
- package/src/core/base/events.js +0 -320
- 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,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Write the content to the clipboard
|
|
3
|
+
* - Iframe is replaced with a placeholder : <div data-se-iframe-holder-src="iframe.src">[iframe: iframe.src]</div>
|
|
4
|
+
* - "iframe placeholder" is re-rendered in html.clean when pasted into the editor.
|
|
5
|
+
* @param {Element|Text|string} content Content to be copied to the clipboard
|
|
6
|
+
* @returns {Promise<void>}
|
|
7
|
+
*/
|
|
8
|
+
export function write(content: Element | Text | string): Promise<void>;
|
|
9
|
+
declare namespace _default {
|
|
10
|
+
export { write };
|
|
11
|
+
}
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Parses an HTML string into a DOM tree, then recursively traverses the nodes to convert them into a structured JSON representation.
|
|
3
|
+
* -Each element includes its tag name, attributes, and children.
|
|
4
|
+
* -Text nodes are represented as { type: 'text', content: '...' }.
|
|
5
|
+
* @param {string} content HTML string
|
|
6
|
+
* @returns {Object<string, *>} JSON data
|
|
7
|
+
*/
|
|
8
|
+
export function htmlToJson(content: string): {
|
|
9
|
+
[x: string]: any;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* @description Takes a JSON structure representing HTML elements and recursively serializes it into a valid HTML string.
|
|
13
|
+
* -It rebuilds each tag with attributes and inner content.
|
|
14
|
+
* Text content and attributes are safely escaped to prevent parsing issues or XSS.
|
|
15
|
+
* Useful for restoring dynamic HTML from a data format.
|
|
16
|
+
* @param {Object<string, *>} jsonData
|
|
17
|
+
* @returns {string} HTML string
|
|
18
|
+
*/
|
|
19
|
+
export function jsonToHtml(jsonData: { [x: string]: any }): string;
|
|
20
|
+
/**
|
|
21
|
+
* @description Convert HTML string to HTML Entity
|
|
22
|
+
* @param {string} content
|
|
23
|
+
* @returns {string} Content string
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
export function htmlToEntity(content: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* @description Convert HTML Entity to HTML string
|
|
29
|
+
* @param {string} content Content string
|
|
30
|
+
* @returns {string}
|
|
31
|
+
*/
|
|
32
|
+
export function entityToHTML(content: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* @description Debounce function
|
|
35
|
+
* @param {(...args: *) => void} func function
|
|
36
|
+
* @param {number} wait delay ms
|
|
37
|
+
* @returns {*} executedFunction
|
|
38
|
+
*/
|
|
39
|
+
export function debounce(func: (...args: any) => void, wait: number): any;
|
|
40
|
+
/**
|
|
41
|
+
* @description Synchronizes two Map objects by updating the first Map with the values from the second,
|
|
42
|
+
* - and deleting any keys in the first Map that are not present in the second.
|
|
43
|
+
* @param {Map<*, *>} targetMap The Map to update (target).
|
|
44
|
+
* @param {Map<*, *>} referenceMap The Map providing the reference values (source).
|
|
45
|
+
*/
|
|
46
|
+
export function syncMaps(targetMap: Map<any, any>, referenceMap: Map<any, any>): void;
|
|
47
|
+
/**
|
|
48
|
+
* @description Object.values
|
|
49
|
+
* @param {Object<*, *>} obj Object parameter.
|
|
50
|
+
* @returns {Array<*>}
|
|
51
|
+
*/
|
|
52
|
+
export function getValues(obj: any): Array<any>;
|
|
53
|
+
/**
|
|
54
|
+
* @description Convert the CamelCase To the KebabCase.
|
|
55
|
+
* @param {string|Array<string>} param [Camel string]
|
|
56
|
+
*/
|
|
57
|
+
export function camelToKebabCase(param: string | Array<string>): any;
|
|
58
|
+
/**
|
|
59
|
+
* @overload
|
|
60
|
+
* @param {string} param - Kebab-case string.
|
|
61
|
+
* @returns {string} CamelCase string.
|
|
62
|
+
*/
|
|
63
|
+
export function kebabToCamelCase(param: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* @overload
|
|
66
|
+
* @param {Array<string>} param - Array of Kebab-case strings.
|
|
67
|
+
* @returns {Array<string>} Array of CamelCase strings.
|
|
68
|
+
*/
|
|
69
|
+
export function kebabToCamelCase(param: Array<string>): Array<string>;
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* @param {"em"|"rem"|"%"|"pt"|"px"} to Size units to be converted
|
|
73
|
+
* @param {string} size siSize to convert with units (ex: "15rem")
|
|
74
|
+
* @returns {string}
|
|
75
|
+
*/
|
|
76
|
+
export function toFontUnit(to: 'em' | 'rem' | '%' | 'pt' | 'px', size: string): string;
|
|
77
|
+
/**
|
|
78
|
+
* @description Convert the node list to an array. If not, returns an empty array.
|
|
79
|
+
* @param {?__se__NodeCollection} nodeList
|
|
80
|
+
* @returns Array
|
|
81
|
+
*/
|
|
82
|
+
export function nodeListToArray(nodeList: __se__NodeCollection | null): any;
|
|
83
|
+
/**
|
|
84
|
+
* @description Returns a new object with keys and values swapped.
|
|
85
|
+
* @param {Object<*, *>} obj object
|
|
86
|
+
* @returns {Object<*, *>}
|
|
87
|
+
*/
|
|
88
|
+
export function swapKeyValue(obj: any): any;
|
|
89
|
+
/**
|
|
90
|
+
* @description Create whitelist RegExp object.
|
|
91
|
+
* @param {string} list Tags list ("br|p|div|pre...")
|
|
92
|
+
* @returns {RegExp} Return RegExp format: new RegExp("<\\/?\\b(?!" + list + ")\\b[^>^<]*+>", "gi")
|
|
93
|
+
*/
|
|
94
|
+
export function createElementWhitelist(list: string): RegExp;
|
|
95
|
+
/**
|
|
96
|
+
* @description Create blacklist RegExp object.
|
|
97
|
+
* @param {string} list Tags list ("br|p|div|pre...")
|
|
98
|
+
* @returns {RegExp} Return RegExp format: new RegExp("<\\/?\\b(?:" + list + ")\\b[^>^<]*+>", "gi")
|
|
99
|
+
*/
|
|
100
|
+
export function createElementBlacklist(list: string): RegExp;
|
|
101
|
+
/**
|
|
102
|
+
* @description Function to check hex format color
|
|
103
|
+
* @param {string} str Color value
|
|
104
|
+
*/
|
|
105
|
+
export function isHexColor(str: string): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* @description Function to convert hex format to a rgb color
|
|
108
|
+
* @param {string} rgba RGBA color format
|
|
109
|
+
* @returns {string}
|
|
110
|
+
*/
|
|
111
|
+
export function rgb2hex(rgba: string): string;
|
|
112
|
+
/**
|
|
113
|
+
* @description Computes the width as a percentage of the parent's width, and returns this value rounded to two decimal places.
|
|
114
|
+
* @param {HTMLElement} target The target element for which to calculate the width percentage.
|
|
115
|
+
* @param {?HTMLElement=} parentTarget The parent element to use as the reference for the width calculation. If not provided, the target's parent element is used.
|
|
116
|
+
* @returns {number}
|
|
117
|
+
*/
|
|
118
|
+
export function getWidthInPercentage(target: HTMLElement, parentTarget?: (HTMLElement | null) | undefined): number;
|
|
119
|
+
/**
|
|
120
|
+
* @description Convert url pattern text node to anchor node
|
|
121
|
+
* @param {Node} node Text node
|
|
122
|
+
* @returns {boolean} Return true if the text node is converted to an anchor node
|
|
123
|
+
*/
|
|
124
|
+
export function textToAnchor(node: Node): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Converts styles within a <span> tag to corresponding HTML tags (e.g., <strong>, <em>, <u>, <s>).
|
|
127
|
+
* Maintains the original <span> tag and wraps its content with the new tags.
|
|
128
|
+
* @param {{ regex: RegExp, tag: string }} styleToTag An object mapping style properties to HTML tags. ex) {bold: { regex: /font-weight\s*:\s*bold/i, tag: 'strong' },}
|
|
129
|
+
* @param {Node} node Node
|
|
130
|
+
*/
|
|
131
|
+
export function spanToStyleNode(
|
|
132
|
+
styleToTag: {
|
|
133
|
+
regex: RegExp;
|
|
134
|
+
tag: string;
|
|
135
|
+
},
|
|
136
|
+
node: Node
|
|
137
|
+
): void;
|
|
138
|
+
/**
|
|
139
|
+
* Adds a query string to a URL. If the URL already contains a query string, the new query is appended to the existing one.
|
|
140
|
+
* @param {string} url The original URL to which the query string will be added.
|
|
141
|
+
* @param {string} query The query string to be added to the URL.
|
|
142
|
+
* @returns {string} The updated URL with the query string appended.
|
|
143
|
+
*/
|
|
144
|
+
export function addUrlQuery(url: string, query: string): string;
|
|
145
|
+
/**
|
|
146
|
+
* @description Converts options-related styles and returns them for each frame.
|
|
147
|
+
* @param {Map<string, *>} fo editor.frameOptions
|
|
148
|
+
* @param {string} cssText Style string
|
|
149
|
+
* @returns {{top: string, frame: string, editor: string}}
|
|
150
|
+
* @private
|
|
151
|
+
*/
|
|
152
|
+
export function _setDefaultOptionStyle(
|
|
153
|
+
fo: Map<string, any>,
|
|
154
|
+
cssText: string
|
|
155
|
+
): {
|
|
156
|
+
top: string;
|
|
157
|
+
frame: string;
|
|
158
|
+
editor: string;
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* @description Set default style tag of the iframe
|
|
162
|
+
* @param {Array<string>} linkNames link names array of CSS files
|
|
163
|
+
* @returns {string} "<link rel="stylesheet" href=".." />.."
|
|
164
|
+
*/
|
|
165
|
+
export function _setIframeStyleLinks(linkNames: Array<string>): string;
|
|
166
|
+
/**
|
|
167
|
+
* @description When iframe height options is "auto" return "<style>" tag that required.
|
|
168
|
+
* @param {string} frameHeight height
|
|
169
|
+
* @returns {string} "<style>...</style>"
|
|
170
|
+
*/
|
|
171
|
+
export function _setAutoHeightStyle(frameHeight: string): string;
|
|
172
|
+
export default converter;
|
|
173
|
+
declare namespace converter {
|
|
174
|
+
export { htmlToJson };
|
|
175
|
+
export { jsonToHtml };
|
|
176
|
+
export { htmlToEntity };
|
|
177
|
+
export { entityToHTML };
|
|
178
|
+
export { debounce };
|
|
179
|
+
export { syncMaps };
|
|
180
|
+
export { getValues };
|
|
181
|
+
export { camelToKebabCase };
|
|
182
|
+
export { kebabToCamelCase };
|
|
183
|
+
export { toFontUnit };
|
|
184
|
+
export { nodeListToArray };
|
|
185
|
+
export { swapKeyValue };
|
|
186
|
+
export { createElementWhitelist };
|
|
187
|
+
export { createElementBlacklist };
|
|
188
|
+
export { isHexColor };
|
|
189
|
+
export { rgb2hex };
|
|
190
|
+
export { getWidthInPercentage };
|
|
191
|
+
export { textToAnchor };
|
|
192
|
+
export { spanToStyleNode };
|
|
193
|
+
export { addUrlQuery };
|
|
194
|
+
export { _setDefaultOptionStyle };
|
|
195
|
+
export { _setIframeStyleLinks };
|
|
196
|
+
export { _setAutoHeightStyle };
|
|
197
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description A method that checks If the text is blank or to see if it contains 'ZERO WIDTH SPACE' or empty (unicode.zeroWidthSpace)
|
|
3
|
+
* @param {string|Node} text String value or Node
|
|
4
|
+
* @returns {boolean}
|
|
5
|
+
*/
|
|
6
|
+
export function isZeroWidth(text: string | Node): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* @description Determine if this offset is the edge offset of container
|
|
9
|
+
* @param {Node} container The node of the selection object. (range.startContainer..)
|
|
10
|
+
* @param {number} offset The offset of the selection object. (core.getRange().startOffset...)
|
|
11
|
+
* @param {?"front"|"end"=} dir Select check point - Both edge, Front edge or End edge. ("front": Front edge, "end": End edge, undefined: Both edge)
|
|
12
|
+
* @returns {boolean}
|
|
13
|
+
*/
|
|
14
|
+
export function isEdgePoint(container: Node, offset: number, dir?: (('front' | 'end') | null) | undefined): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* @description Check the node is a text node.
|
|
17
|
+
* @param {?Node} node The node to check
|
|
18
|
+
* @returns {node is Text}
|
|
19
|
+
*/
|
|
20
|
+
export function isText(node: Node | null): node is Text;
|
|
21
|
+
/**
|
|
22
|
+
* @description Check the node is an HTMLElement node.
|
|
23
|
+
* @param {?Node} node The node to check
|
|
24
|
+
* @returns {node is HTMLElement}
|
|
25
|
+
*/
|
|
26
|
+
export function isElement(node: Node | null): node is HTMLElement;
|
|
27
|
+
/**
|
|
28
|
+
* @description It is judged whether it is the input element (INPUT, TEXTAREA)
|
|
29
|
+
* @param {?Node} node The node to check
|
|
30
|
+
* @returns {node is HTMLInputElement}
|
|
31
|
+
*/
|
|
32
|
+
export function isInputElement(node: Node | null): node is HTMLInputElement;
|
|
33
|
+
/**
|
|
34
|
+
* @description It is judged whether it is the button element
|
|
35
|
+
* @param {?Node} node The node to check
|
|
36
|
+
* @returns {node is HTMLButtonElement}
|
|
37
|
+
*/
|
|
38
|
+
export function isButtonElement(node: Node | null): node is HTMLButtonElement;
|
|
39
|
+
/**
|
|
40
|
+
* @description Check the node is a list (ol, ul)
|
|
41
|
+
* @param {?Node|string} node The element or element name to check
|
|
42
|
+
* @returns {node is HTMLOListElement|HTMLUListElement}
|
|
43
|
+
*/
|
|
44
|
+
export function isList(node: (Node | string) | null): node is HTMLOListElement | HTMLUListElement;
|
|
45
|
+
/**
|
|
46
|
+
* @description Check the node is a list cell (li)
|
|
47
|
+
* @param {?Node|string} node The element or element name to check
|
|
48
|
+
* @returns {node is HTMLLIElement}
|
|
49
|
+
*/
|
|
50
|
+
export function isListCell(node: (Node | string) | null): node is HTMLLIElement;
|
|
51
|
+
/**
|
|
52
|
+
* @description Check the node is a table
|
|
53
|
+
* @param {?Node|string} node The element or element name to check
|
|
54
|
+
* @returns {node is HTMLTableElement}
|
|
55
|
+
*/
|
|
56
|
+
export function isTable(node: (Node | string) | null): node is HTMLTableElement;
|
|
57
|
+
/**
|
|
58
|
+
* @description Check the node is a table elements. (table, thead, tbody, tr, th, td)
|
|
59
|
+
* @param {?Node|string} node The element or element name to check
|
|
60
|
+
* @returns {node is HTMLTableElement|HTMLTableSectionElement|HTMLTableRowElement|HTMLTableCellElement|HTMLTableColElement|HTMLTableColElement}
|
|
61
|
+
*/
|
|
62
|
+
export function isTableElements(node: (Node | string) | null): node is HTMLTableElement | HTMLTableSectionElement | HTMLTableRowElement | HTMLTableCellElement | HTMLTableColElement | HTMLTableColElement;
|
|
63
|
+
/**
|
|
64
|
+
* @description Check the node is a table cell (td, th)
|
|
65
|
+
* @param {?Node|string} node The element or element name to check
|
|
66
|
+
* @returns {node is HTMLTableCellElement|HTMLTableColElement}
|
|
67
|
+
*/
|
|
68
|
+
export function isTableCell(node: (Node | string) | null): node is HTMLTableCellElement | HTMLTableColElement;
|
|
69
|
+
/**
|
|
70
|
+
* @description Check the node is a table row (tr)
|
|
71
|
+
* @param {?Node|string} node The element or element name to check
|
|
72
|
+
* @returns {node is HTMLTableRowElement}
|
|
73
|
+
*/
|
|
74
|
+
export function isTableRow(node: (Node | string) | null): node is HTMLTableRowElement;
|
|
75
|
+
/**
|
|
76
|
+
* @description Check the node is a break node (BR)
|
|
77
|
+
* @param {?Node|string} node The element or element name to check
|
|
78
|
+
* @returns {node is HTMLBRElement}
|
|
79
|
+
*/
|
|
80
|
+
export function isBreak(node: (Node | string) | null): node is HTMLBRElement;
|
|
81
|
+
/**
|
|
82
|
+
* @description Check the node is a anchor node (A)
|
|
83
|
+
* @param {?Node|string} node The element or element name to check
|
|
84
|
+
* @returns {node is HTMLAnchorElement}
|
|
85
|
+
*/
|
|
86
|
+
export function isAnchor(node: (Node | string) | null): node is HTMLAnchorElement;
|
|
87
|
+
/**
|
|
88
|
+
* @description Check the node is a media node (img, iframe, audio, video, canvas)
|
|
89
|
+
* @param {?Node|string} node The element or element name to check
|
|
90
|
+
* @returns {node is HTMLImageElement|HTMLIFrameElement|HTMLAudioElement|HTMLVideoElement|HTMLCanvasElement}
|
|
91
|
+
*/
|
|
92
|
+
export function isMedia(node: (Node | string) | null): node is HTMLImageElement | HTMLIFrameElement | HTMLAudioElement | HTMLVideoElement | HTMLCanvasElement;
|
|
93
|
+
/**
|
|
94
|
+
* @description Check the node is a iframe tag
|
|
95
|
+
* @param {?Node|string} node The element or element name to check
|
|
96
|
+
* @returns {node is HTMLIFrameElement}
|
|
97
|
+
*/
|
|
98
|
+
export function isIFrame(node: (Node | string) | null): node is HTMLIFrameElement;
|
|
99
|
+
/**
|
|
100
|
+
* @description Check the node is a figure tag
|
|
101
|
+
* @param {?Node|string} node The element or element name to check
|
|
102
|
+
* @returns {boolean}
|
|
103
|
+
*/
|
|
104
|
+
export function isFigure(node: (Node | string) | null): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* @description Checks whether the given node is a content-less (void) HTML tag
|
|
107
|
+
* @param {?Node|string} node The element or element name to check
|
|
108
|
+
* @returns {boolean}
|
|
109
|
+
*/
|
|
110
|
+
export function isContentLess(node: (Node | string) | null): boolean;
|
|
111
|
+
/**
|
|
112
|
+
* @description Check the line element is empty.
|
|
113
|
+
* @param {Node} node "line" element node
|
|
114
|
+
* @returns {boolean}
|
|
115
|
+
*/
|
|
116
|
+
export function isEmptyLine(node: Node): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* @description It is judged whether it is the edit region top div element or iframe's body tag.
|
|
119
|
+
* @param {?Node} node The node to check
|
|
120
|
+
* @returns {node is HTMLElement}
|
|
121
|
+
*/
|
|
122
|
+
export function isWysiwygFrame(node: Node | null): node is HTMLElement;
|
|
123
|
+
/**
|
|
124
|
+
* @description It is judged whether it is the contenteditable property is false.
|
|
125
|
+
* @param {?Node} node The node to check
|
|
126
|
+
* @returns {node is HTMLElement}
|
|
127
|
+
*/
|
|
128
|
+
export function isNonEditable(node: Node | null): node is HTMLElement;
|
|
129
|
+
/**
|
|
130
|
+
* @description Check the span's attributes are empty.
|
|
131
|
+
* @param {?Node} node Element node
|
|
132
|
+
* @returns {boolean}
|
|
133
|
+
*/
|
|
134
|
+
export function isSpanWithoutAttr(node: Node | null): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* @description Compares the style and class for equal values.
|
|
137
|
+
* @param {Node} a Node to compare
|
|
138
|
+
* @param {Node} b Node to compare
|
|
139
|
+
* @returns {boolean} Returns true if both are text nodes.
|
|
140
|
+
*/
|
|
141
|
+
export function isSameAttributes(a: Node, b: Node): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* @description It is judged whether it is the not checking node. (class="katex", "MathJax", "se-exclude-format")
|
|
144
|
+
* @param {Node} node The node to check
|
|
145
|
+
* @returns {node is HTMLElement}
|
|
146
|
+
*/
|
|
147
|
+
export function isExcludeFormat(node: Node): node is HTMLElement;
|
|
148
|
+
/**
|
|
149
|
+
* @description Checks for "__se__uneditable" in the class list.
|
|
150
|
+
* - Components with class "__se__uneditable" cannot be modified.
|
|
151
|
+
* @param {Node} node The element to check
|
|
152
|
+
* @returns {boolean}
|
|
153
|
+
*/
|
|
154
|
+
export function isUneditable(node: Node): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* @description Checks if element can't be easily enabled
|
|
157
|
+
* @param {Node} node Element to check for
|
|
158
|
+
* @returns {boolean}
|
|
159
|
+
*/
|
|
160
|
+
export function isImportantDisabled(node: Node): boolean;
|
|
161
|
+
export default check;
|
|
162
|
+
declare namespace check {
|
|
163
|
+
export { isZeroWidth };
|
|
164
|
+
export { isEdgePoint };
|
|
165
|
+
export { isText };
|
|
166
|
+
export { isElement };
|
|
167
|
+
export { isInputElement };
|
|
168
|
+
export { isButtonElement };
|
|
169
|
+
export { isList };
|
|
170
|
+
export { isListCell };
|
|
171
|
+
export { isTable };
|
|
172
|
+
export { isTableElements };
|
|
173
|
+
export { isTableCell };
|
|
174
|
+
export { isTableRow };
|
|
175
|
+
export { isBreak };
|
|
176
|
+
export { isAnchor };
|
|
177
|
+
export { isMedia };
|
|
178
|
+
export { isIFrame };
|
|
179
|
+
export { isFigure };
|
|
180
|
+
export { isContentLess };
|
|
181
|
+
export { isEmptyLine };
|
|
182
|
+
export { isWysiwygFrame };
|
|
183
|
+
export { isNonEditable };
|
|
184
|
+
export { isSpanWithoutAttr };
|
|
185
|
+
export { isSameAttributes };
|
|
186
|
+
export { isExcludeFormat };
|
|
187
|
+
export { isUneditable };
|
|
188
|
+
export { isImportantDisabled };
|
|
189
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Returns the index compared to other sibling nodes.
|
|
3
|
+
* @param {Node} node The Node to find index
|
|
4
|
+
* @returns {number}
|
|
5
|
+
*/
|
|
6
|
+
export function getPositionIndex(node: Node): number;
|
|
7
|
+
/**
|
|
8
|
+
* @description Returns the position of the "node" in the "parentNode" in a numerical array.
|
|
9
|
+
* - e.g.) <p><span>aa</span><span>bb</span></p> : getNodePath(node: "bb", parentNode: "<P>") -> [1, 0]
|
|
10
|
+
* @param {Node} node The Node to find position path
|
|
11
|
+
* @param {?Node} parentNode Parent node. If null, wysiwyg div area
|
|
12
|
+
* @param {?{s: number, e: number}=} _newOffsets If you send an object of the form "{s: 0, e: 0}", the text nodes that are attached together are merged into one, centered on the "node" argument.
|
|
13
|
+
* "_newOffsets.s" stores the length of the combined characters after "node" and "_newOffsets.e" stores the length of the combined characters before "node".
|
|
14
|
+
* Do not use unless absolutely necessary.
|
|
15
|
+
* @returns {Array<number>}
|
|
16
|
+
*/
|
|
17
|
+
export function getNodePath(
|
|
18
|
+
node: Node,
|
|
19
|
+
parentNode: Node | null,
|
|
20
|
+
_newOffsets?:
|
|
21
|
+
| ({
|
|
22
|
+
s: number;
|
|
23
|
+
e: number;
|
|
24
|
+
} | null)
|
|
25
|
+
| undefined
|
|
26
|
+
): Array<number>;
|
|
27
|
+
/**
|
|
28
|
+
* @template {Node} T
|
|
29
|
+
* @description Returns the node in the location of the path array obtained from "helper.dom.getNodePath".
|
|
30
|
+
* @param {Array<number>} offsets Position array, array obtained from "helper.dom.getNodePath"
|
|
31
|
+
* @param {Node} parentNode Base parent element
|
|
32
|
+
* @returns {T}
|
|
33
|
+
*/
|
|
34
|
+
export function getNodeFromPath<T extends Node>(offsets: Array<number>, parentNode: Node): T;
|
|
35
|
+
/**
|
|
36
|
+
* @template {HTMLElement} T
|
|
37
|
+
* @description Get all "children" of the argument value element (Without text nodes)
|
|
38
|
+
* @param {Node} element element to get child node
|
|
39
|
+
* @param {?(current: *) => boolean} validation Conditional function
|
|
40
|
+
* @returns {Array<T>}
|
|
41
|
+
*/
|
|
42
|
+
export function getListChildren<T extends HTMLElement>(element: Node, validation: ((current: any) => boolean) | null): Array<T>;
|
|
43
|
+
/**
|
|
44
|
+
* @template {Node} T
|
|
45
|
+
* @description Get all "childNodes" of the argument value element (Include text nodes)
|
|
46
|
+
* @param {Node} element element to get child node
|
|
47
|
+
* @param {?(current: *) => boolean} validation Conditional function
|
|
48
|
+
* @returns {Array<T>}
|
|
49
|
+
*/
|
|
50
|
+
export function getListChildNodes<T extends Node>(element: Node, validation: ((current: any) => boolean) | null): Array<T>;
|
|
51
|
+
/**
|
|
52
|
+
* @description Returns the number of parents nodes.
|
|
53
|
+
* - "0" when the parent node is the WYSIWYG area.
|
|
54
|
+
* - '-1' when the element argument is the WYSIWYG area.
|
|
55
|
+
* @param {Node} node The element to check
|
|
56
|
+
* @returns {number}
|
|
57
|
+
*/
|
|
58
|
+
export function getNodeDepth(node: Node): number;
|
|
59
|
+
/**
|
|
60
|
+
* @description Sort a node array by depth of element.
|
|
61
|
+
* @param {Array<Node>} array Node array
|
|
62
|
+
* @param {boolean} des true: descending order / false: ascending order
|
|
63
|
+
*/
|
|
64
|
+
export function sortNodeByDepth(array: Array<Node>, des: boolean): void;
|
|
65
|
+
/**
|
|
66
|
+
* @description Compares two elements to find a common ancestor, and returns the order of the two elements.
|
|
67
|
+
* @param {Node} a Node to compare.
|
|
68
|
+
* @param {Node} b Node to compare.
|
|
69
|
+
* @returns {{ancestor: HTMLElement|null, a: Node, b: Node, result: number}} { ancesstor, a, b, result: (a > b ? 1 : a < b ? -1 : 0) };
|
|
70
|
+
*/
|
|
71
|
+
export function compareElements(
|
|
72
|
+
a: Node,
|
|
73
|
+
b: Node
|
|
74
|
+
): {
|
|
75
|
+
ancestor: HTMLElement | null;
|
|
76
|
+
a: Node;
|
|
77
|
+
b: Node;
|
|
78
|
+
result: number;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* @template {HTMLElement} T
|
|
82
|
+
* @description Get the parent element of the argument value.
|
|
83
|
+
* - A tag that satisfies the query condition is imported.
|
|
84
|
+
* @param {Node} element Reference element
|
|
85
|
+
* @param {string|((current: *) => boolean)|Node} query Query String (nodeName, .className, #ID, :name) or validation function.
|
|
86
|
+
* - Not use it like jquery.
|
|
87
|
+
* - Only one condition can be entered at a time.
|
|
88
|
+
* @param {?number=} depth Number of parent levels to depth.
|
|
89
|
+
* @returns {T|null} Not found: null
|
|
90
|
+
*/
|
|
91
|
+
export function getParentElement<T extends HTMLElement>(element: Node, query: string | ((current: any) => boolean) | Node, depth?: (number | null) | undefined): T | null;
|
|
92
|
+
/**
|
|
93
|
+
* @template {HTMLElement} T
|
|
94
|
+
* @description Gets all ancestors of the argument value.
|
|
95
|
+
* - Get all tags that satisfy the query condition.
|
|
96
|
+
* @param {Node} element Reference element
|
|
97
|
+
* @param {string|((current: *) => boolean)|Node} query Query String (nodeName, .className, #ID, :name) or validation function.
|
|
98
|
+
* Not use it like jquery.
|
|
99
|
+
* Only one condition can be entered at a time.
|
|
100
|
+
* @param {?number=} depth Number of parent levels to depth.
|
|
101
|
+
* @returns {Array<T>} Returned in an array in order.
|
|
102
|
+
*/
|
|
103
|
+
export function getParentElements<T extends HTMLElement>(element: Node, query: string | ((current: any) => boolean) | Node, depth?: (number | null) | undefined): Array<T>;
|
|
104
|
+
/**
|
|
105
|
+
* @template {HTMLElement} T
|
|
106
|
+
* @description Gets the element with "data-command" attribute among the parent elements.
|
|
107
|
+
* @param {Node} target Target element
|
|
108
|
+
* @returns {T|null}
|
|
109
|
+
*/
|
|
110
|
+
export function getCommandTarget<T extends HTMLElement>(target: Node): T | null;
|
|
111
|
+
/**
|
|
112
|
+
* @template {HTMLElement} T
|
|
113
|
+
* @description Get the event.target element.
|
|
114
|
+
* @param {Event} event Event object
|
|
115
|
+
* @returns {T|null}
|
|
116
|
+
*/
|
|
117
|
+
export function getEventTarget<T extends HTMLElement>(event: Event): T | null;
|
|
118
|
+
/**
|
|
119
|
+
* @template {Node} T
|
|
120
|
+
* @description Get the child element of the argument value.
|
|
121
|
+
* - A tag that satisfies the query condition is imported.
|
|
122
|
+
* @param {Node} node Reference element
|
|
123
|
+
* @param {string|((current: *) => boolean)|Node} query Query String (nodeName, .className, #ID, :name) or validation function.
|
|
124
|
+
* @param {boolean} last If true returns the last node among the found child nodes. (default: first node)
|
|
125
|
+
* Not use it like jquery.
|
|
126
|
+
* Only one condition can be entered at a time.
|
|
127
|
+
* @returns {T|null} Not found: null
|
|
128
|
+
*/
|
|
129
|
+
export function getEdgeChild<T extends Node>(node: Node, query: string | ((current: any) => boolean) | Node, last: boolean): T | null;
|
|
130
|
+
/**
|
|
131
|
+
* @description Get edge child nodes of the argument value.
|
|
132
|
+
* - 1. The first node of all the child nodes of the "first" element is returned.
|
|
133
|
+
* - 2. The last node of all the child nodes of the "last" element is returned.
|
|
134
|
+
* - 3. When there is no "last" element, the first and last nodes of all the children of the "first" element are returned.
|
|
135
|
+
* @param {Node} first First element
|
|
136
|
+
* @param {Node|null} last Last element
|
|
137
|
+
* @returns {{sc: Node, ec: Node}} { sc: "first", ec: "last" }
|
|
138
|
+
*/
|
|
139
|
+
export function getEdgeChildNodes(
|
|
140
|
+
first: Node,
|
|
141
|
+
last: Node | null
|
|
142
|
+
): {
|
|
143
|
+
sc: Node;
|
|
144
|
+
ec: Node;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* @template {Node} T
|
|
148
|
+
* @description Gets the previous sibling last child. If there is no sibling, then it'll take it from the closest ancestor with child
|
|
149
|
+
* @param {Node} node Reference element
|
|
150
|
+
* @param {?Node=} ceiling Highest boundary allowed
|
|
151
|
+
* @returns {T|null} Not found: null
|
|
152
|
+
*/
|
|
153
|
+
export function getPreviousDeepestNode<T extends Node>(node: Node, ceiling?: (Node | null) | undefined): T | null;
|
|
154
|
+
/**
|
|
155
|
+
* @template {Node} T
|
|
156
|
+
* @description Gets the next sibling first child. If there is no sibling, then it'll take it from the closest ancestor with child
|
|
157
|
+
* @param {Node} node Reference element
|
|
158
|
+
* @param {?Node=} ceiling Highest boundary allowed
|
|
159
|
+
* @returns {T|null} Not found: null
|
|
160
|
+
*/
|
|
161
|
+
export function getNextDeepestNode<T extends Node>(node: Node, ceiling?: (Node | null) | undefined): T | null;
|
|
162
|
+
/**
|
|
163
|
+
* @description Find the index of the text node in the line element.
|
|
164
|
+
* @param {Node} line Line element (p, div, etc.)
|
|
165
|
+
* @param {Node} offsetContainer Base node to start searching
|
|
166
|
+
* @param {number} offset Base offset to start searching
|
|
167
|
+
* @param {?(current: *) => boolean=} validate Validation function
|
|
168
|
+
* @returns {number}
|
|
169
|
+
*/
|
|
170
|
+
export function findTextIndexOnLine(line: Node, offsetContainer: Node, offset: number, validate?: (((current: any) => boolean) | null) | undefined): number;
|
|
171
|
+
/**
|
|
172
|
+
* @description Find the end index of a sequence of at least minTabSize consecutive non-breaking spaces or spaces
|
|
173
|
+
* - which are interpreted as a tab key, occurring after a given base index in a text string.
|
|
174
|
+
* @param {Node} line Line element (p, div, etc.)
|
|
175
|
+
* @param {number} baseIndex Base index to start searching
|
|
176
|
+
* @param {number} minTabSize Minimum number of consecutive spaces to consider as a tab
|
|
177
|
+
* @returns {number} The adjusted index within the line element accounting for non-space characters
|
|
178
|
+
*/
|
|
179
|
+
export function findTabEndIndex(line: Node, baseIndex: number, minTabSize: number): number;
|
|
180
|
+
/**
|
|
181
|
+
* @description Finds the table cell that appears visually at the bottom-right position,
|
|
182
|
+
* considering both rowSpan and colSpan, even if smaller cells are placed after large merged cells.
|
|
183
|
+
*
|
|
184
|
+
* @param {HTMLTableCellElement[]} cells
|
|
185
|
+
* @returns {HTMLTableCellElement|null}
|
|
186
|
+
*/
|
|
187
|
+
export function findVisualLastCell(cells: HTMLTableCellElement[]): HTMLTableCellElement | null;
|
|
188
|
+
/**
|
|
189
|
+
* @description Get nearest scrollable parent
|
|
190
|
+
* @param {Node} element Element
|
|
191
|
+
* @returns {HTMLElement|null}
|
|
192
|
+
*/
|
|
193
|
+
export function getScrollParent(element: Node): HTMLElement | null;
|
|
194
|
+
/**
|
|
195
|
+
* @description Get the argument iframe's document object if use the "iframe" or "fullPage" options
|
|
196
|
+
* @param {HTMLIFrameElement} iframe Iframe element (this.editor.frameContext.get('wysiwygFrame'))
|
|
197
|
+
* @returns {Document}
|
|
198
|
+
*/
|
|
199
|
+
export function getIframeDocument(iframe: HTMLIFrameElement): Document;
|
|
200
|
+
export default query;
|
|
201
|
+
declare namespace query {
|
|
202
|
+
export { getPositionIndex };
|
|
203
|
+
export { getNodePath };
|
|
204
|
+
export { getNodeFromPath };
|
|
205
|
+
export { getListChildren };
|
|
206
|
+
export { getListChildNodes };
|
|
207
|
+
export { getNodeDepth };
|
|
208
|
+
export { sortNodeByDepth };
|
|
209
|
+
export { compareElements };
|
|
210
|
+
export { getParentElement };
|
|
211
|
+
export { getParentElements };
|
|
212
|
+
export { getCommandTarget };
|
|
213
|
+
export { getEventTarget };
|
|
214
|
+
export { getEdgeChild };
|
|
215
|
+
export { getEdgeChildNodes };
|
|
216
|
+
export { getPreviousDeepestNode };
|
|
217
|
+
export { getNextDeepestNode };
|
|
218
|
+
export { findTextIndexOnLine };
|
|
219
|
+
export { findTabEndIndex };
|
|
220
|
+
export { findVisualLastCell };
|
|
221
|
+
export { getScrollParent };
|
|
222
|
+
export { getIframeDocument };
|
|
223
|
+
}
|