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,182 @@
|
|
|
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 Check the line element is empty.
|
|
107
|
+
* @param {Node} node "line" element node
|
|
108
|
+
* @returns {boolean}
|
|
109
|
+
*/
|
|
110
|
+
export function isEmptyLine(node: Node): boolean;
|
|
111
|
+
/**
|
|
112
|
+
* @description It is judged whether it is the edit region top div element or iframe's body tag.
|
|
113
|
+
* @param {?Node} node The node to check
|
|
114
|
+
* @returns {node is HTMLElement}
|
|
115
|
+
*/
|
|
116
|
+
export function isWysiwygFrame(node: Node | null): node is HTMLElement;
|
|
117
|
+
/**
|
|
118
|
+
* @description It is judged whether it is the contenteditable property is false.
|
|
119
|
+
* @param {?Node} node The node to check
|
|
120
|
+
* @returns {node is HTMLElement}
|
|
121
|
+
*/
|
|
122
|
+
export function isNonEditable(node: Node | null): node is HTMLElement;
|
|
123
|
+
/**
|
|
124
|
+
* @description Check the span's attributes are empty.
|
|
125
|
+
* @param {?Node} node Element node
|
|
126
|
+
* @returns {boolean}
|
|
127
|
+
*/
|
|
128
|
+
export function isSpanWithoutAttr(node: Node | null): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* @description Compares the style and class for equal values.
|
|
131
|
+
* @param {Node} a Node to compare
|
|
132
|
+
* @param {Node} b Node to compare
|
|
133
|
+
* @returns {boolean} Returns true if both are text nodes.
|
|
134
|
+
*/
|
|
135
|
+
export function isSameAttributes(a: Node, b: Node): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* @description It is judged whether it is the not checking node. (class="katex", "MathJax", "se-exclude-format")
|
|
138
|
+
* @param {Node} node The node to check
|
|
139
|
+
* @returns {node is HTMLElement}
|
|
140
|
+
*/
|
|
141
|
+
export function isExcludeFormat(node: Node): node is HTMLElement;
|
|
142
|
+
/**
|
|
143
|
+
* @description Checks for "__se__uneditable" in the class list.
|
|
144
|
+
* - Components with class "__se__uneditable" cannot be modified.
|
|
145
|
+
* @param {Node} node The element to check
|
|
146
|
+
* @returns {boolean}
|
|
147
|
+
*/
|
|
148
|
+
export function isUneditable(node: Node): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* @description Checks if element can't be easily enabled
|
|
151
|
+
* @param {Node} node Element to check for
|
|
152
|
+
* @returns {boolean}
|
|
153
|
+
*/
|
|
154
|
+
export function isImportantDisabled(node: Node): boolean;
|
|
155
|
+
export default check;
|
|
156
|
+
declare namespace check {
|
|
157
|
+
export { isZeroWidth };
|
|
158
|
+
export { isEdgePoint };
|
|
159
|
+
export { isText };
|
|
160
|
+
export { isElement };
|
|
161
|
+
export { isInputElement };
|
|
162
|
+
export { isButtonElement };
|
|
163
|
+
export { isList };
|
|
164
|
+
export { isListCell };
|
|
165
|
+
export { isTable };
|
|
166
|
+
export { isTableElements };
|
|
167
|
+
export { isTableCell };
|
|
168
|
+
export { isTableRow };
|
|
169
|
+
export { isBreak };
|
|
170
|
+
export { isAnchor };
|
|
171
|
+
export { isMedia };
|
|
172
|
+
export { isIFrame };
|
|
173
|
+
export { isFigure };
|
|
174
|
+
export { isEmptyLine };
|
|
175
|
+
export { isWysiwygFrame };
|
|
176
|
+
export { isNonEditable };
|
|
177
|
+
export { isSpanWithoutAttr };
|
|
178
|
+
export { isSameAttributes };
|
|
179
|
+
export { isExcludeFormat };
|
|
180
|
+
export { isUneditable };
|
|
181
|
+
export { isImportantDisabled };
|
|
182
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
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 Get nearest scrollable parent
|
|
182
|
+
* @param {Node} element Element
|
|
183
|
+
* @returns {HTMLElement|null}
|
|
184
|
+
*/
|
|
185
|
+
export function getScrollParent(element: Node): HTMLElement | null;
|
|
186
|
+
/**
|
|
187
|
+
* @description Get the argument iframe's document object if use the "iframe" or "fullPage" options
|
|
188
|
+
* @param {HTMLIFrameElement} iframe Iframe element (this.editor.frameContext.get('wysiwygFrame'))
|
|
189
|
+
* @returns {Document}
|
|
190
|
+
*/
|
|
191
|
+
export function getIframeDocument(iframe: HTMLIFrameElement): Document;
|
|
192
|
+
export default query;
|
|
193
|
+
declare namespace query {
|
|
194
|
+
export { getPositionIndex };
|
|
195
|
+
export { getNodePath };
|
|
196
|
+
export { getNodeFromPath };
|
|
197
|
+
export { getListChildren };
|
|
198
|
+
export { getListChildNodes };
|
|
199
|
+
export { getNodeDepth };
|
|
200
|
+
export { sortNodeByDepth };
|
|
201
|
+
export { compareElements };
|
|
202
|
+
export { getParentElement };
|
|
203
|
+
export { getParentElements };
|
|
204
|
+
export { getCommandTarget };
|
|
205
|
+
export { getEventTarget };
|
|
206
|
+
export { getEdgeChild };
|
|
207
|
+
export { getEdgeChildNodes };
|
|
208
|
+
export { getPreviousDeepestNode };
|
|
209
|
+
export { getNextDeepestNode };
|
|
210
|
+
export { findTextIndexOnLine };
|
|
211
|
+
export { findTabEndIndex };
|
|
212
|
+
export { getScrollParent };
|
|
213
|
+
export { getIframeDocument };
|
|
214
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @template {HTMLElement} T
|
|
3
|
+
* @description Create Element node
|
|
4
|
+
* @param {string} elementName Element name
|
|
5
|
+
* @param {?Object<string, string>=} attributes The attributes of the tag. {style: 'font-size:12px;..', class: 'el_class',..}
|
|
6
|
+
* @param {?string|Node=} inner A innerHTML string or inner node.
|
|
7
|
+
* @returns {T}
|
|
8
|
+
*/
|
|
9
|
+
export function createElement<T extends HTMLElement>(
|
|
10
|
+
elementName: string,
|
|
11
|
+
attributes?:
|
|
12
|
+
| ({
|
|
13
|
+
[x: string]: string;
|
|
14
|
+
} | null)
|
|
15
|
+
| undefined,
|
|
16
|
+
inner?: ((string | Node) | null) | undefined
|
|
17
|
+
): T;
|
|
18
|
+
/**
|
|
19
|
+
* @description Create text node
|
|
20
|
+
* @param {string} text text content
|
|
21
|
+
* @returns {Text}
|
|
22
|
+
*/
|
|
23
|
+
export function createTextNode(text: string): Text;
|
|
24
|
+
/**
|
|
25
|
+
* @description Get attributes of argument element to string ('class="---" name="---" ')
|
|
26
|
+
* @param {Node} element Element object
|
|
27
|
+
* @param {Array<string>|null} exceptAttrs Array of attribute names to exclude from the result
|
|
28
|
+
* @returns {string}
|
|
29
|
+
*/
|
|
30
|
+
export function getAttributesToString(element: Node, exceptAttrs: Array<string> | null): string;
|
|
31
|
+
/**
|
|
32
|
+
* @description Get the items array from the array that matches the condition.
|
|
33
|
+
* @param {__se__NodeCollection} array Array to get item
|
|
34
|
+
* @param {?(current: *) => boolean} validation Conditional function
|
|
35
|
+
* @returns {Array<Node>|null}
|
|
36
|
+
*/
|
|
37
|
+
export function arrayFilter(array: __se__NodeCollection, validation: ((current: any) => boolean) | null): Array<Node> | null;
|
|
38
|
+
/**
|
|
39
|
+
* @description Get the item from the array that matches the condition.
|
|
40
|
+
* @param {__se__NodeCollection} array Array to get item
|
|
41
|
+
* @param {?(current: *) => boolean} validation Conditional function
|
|
42
|
+
* @returns {Node|null}
|
|
43
|
+
*/
|
|
44
|
+
export function arrayFind(array: __se__NodeCollection, validation: ((current: any) => boolean) | null): Node | null;
|
|
45
|
+
/**
|
|
46
|
+
* @description Check if an array contains an element
|
|
47
|
+
* @param {__se__NodeCollection} array element array
|
|
48
|
+
* @param {Node} node The node to check for
|
|
49
|
+
* @returns {boolean}
|
|
50
|
+
*/
|
|
51
|
+
export function arrayIncludes(array: __se__NodeCollection, node: Node): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* @description Get the index of the argument value in the element array
|
|
54
|
+
* @param {__se__NodeCollection} array element array
|
|
55
|
+
* @param {Node} node The element to find index
|
|
56
|
+
* @returns {number}
|
|
57
|
+
*/
|
|
58
|
+
export function getArrayIndex(array: __se__NodeCollection, node: Node): number;
|
|
59
|
+
/**
|
|
60
|
+
* @description Get the next index of the argument value in the element array
|
|
61
|
+
* @param {__se__NodeCollection} array element array
|
|
62
|
+
* @param {Node} item The element to find index
|
|
63
|
+
* @returns {number}
|
|
64
|
+
*/
|
|
65
|
+
export function nextIndex(array: __se__NodeCollection, item: Node): number;
|
|
66
|
+
/**
|
|
67
|
+
* @description Get the previous index of the argument value in the element array
|
|
68
|
+
* @param {__se__NodeCollection} array Element array
|
|
69
|
+
* @param {Node} item The element to find index
|
|
70
|
+
* @returns {number}
|
|
71
|
+
*/
|
|
72
|
+
export function prevIndex(array: __se__NodeCollection, item: Node): number;
|
|
73
|
+
/**
|
|
74
|
+
* @description Add style and className of copyEl to originEl
|
|
75
|
+
* @param {Node} originEl Origin element
|
|
76
|
+
* @param {Node} copyEl Element to copy
|
|
77
|
+
* @param {?Array<string>=} blacklist Blacklist array(LowerCase)
|
|
78
|
+
*/
|
|
79
|
+
export function copyTagAttributes(originEl: Node, copyEl: Node, blacklist?: (Array<string> | null) | undefined): void;
|
|
80
|
+
/**
|
|
81
|
+
* @description Copy and apply attributes of format tag that should be maintained. (style, class) Ignore "__se__format__" class
|
|
82
|
+
* @param {Node} originEl Origin element
|
|
83
|
+
* @param {Node} copyEl Element to copy
|
|
84
|
+
*/
|
|
85
|
+
export function copyFormatAttributes(originEl: Node, copyEl: Node): void;
|
|
86
|
+
/**
|
|
87
|
+
* @description Delete argumenu value element
|
|
88
|
+
* @param {Node} item Node to be remove
|
|
89
|
+
*/
|
|
90
|
+
export function removeItem(item: Node): void;
|
|
91
|
+
/**
|
|
92
|
+
* @description Replace element
|
|
93
|
+
* @param {Node} element Target element
|
|
94
|
+
* @param {string|Node} newElement String or element of the new element to apply
|
|
95
|
+
*/
|
|
96
|
+
export function changeElement(element: Node, newElement: string | Node): void;
|
|
97
|
+
/**
|
|
98
|
+
* @description Set the text content value of the argument value element
|
|
99
|
+
* @param {Node} node Element to replace text content
|
|
100
|
+
* @param {string} txt Text to be applied
|
|
101
|
+
*/
|
|
102
|
+
export function changeTxt(node: Node, txt: string): void;
|
|
103
|
+
/**
|
|
104
|
+
* @description Set style, if all styles are deleted, the style properties are deleted.
|
|
105
|
+
* @param {Node|Node[]} elements Element to set style
|
|
106
|
+
* @param {string} styleName Style attribute name (marginLeft, textAlign...)
|
|
107
|
+
* @param {string|number} value Style value
|
|
108
|
+
*/
|
|
109
|
+
export function setStyle(elements: Node | Node[], styleName: string, value: string | number): void;
|
|
110
|
+
/**
|
|
111
|
+
* @description In the predefined code view mode, the buttons except the executable button are changed to the 'disabled' state.
|
|
112
|
+
* @param {Array<HTMLButtonElement|HTMLInputElement>} buttonList (Button | Input) Element array
|
|
113
|
+
* @param {boolean} disabled Disabled value
|
|
114
|
+
* @param {boolean} [important=false] If priveleged mode should be used (Necessary to switch importantDisabled buttons)
|
|
115
|
+
*/
|
|
116
|
+
export function setDisabled(buttonList: Array<HTMLButtonElement | HTMLInputElement>, disabled: boolean, important?: boolean): void;
|
|
117
|
+
/**
|
|
118
|
+
* @description Determine whether any of the matched elements are assigned the given class
|
|
119
|
+
* @param {?Node} element Elements to search class name
|
|
120
|
+
* @param {string} className Class name to search for
|
|
121
|
+
* @returns {boolean}
|
|
122
|
+
*/
|
|
123
|
+
export function hasClass(element: Node | null, className: string): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* @description Append the className value of the argument value element
|
|
126
|
+
* @param {Node|__se__NodeCollection} element Elements to add class name
|
|
127
|
+
* @param {string} className Class name to be add
|
|
128
|
+
*/
|
|
129
|
+
export function addClass(element: Node | __se__NodeCollection, className: string): void;
|
|
130
|
+
/**
|
|
131
|
+
* @description Delete the className value of the argument value element
|
|
132
|
+
* @param {Node|__se__NodeCollection} element Elements to remove class name
|
|
133
|
+
* @param {string} className Class name to be remove
|
|
134
|
+
*/
|
|
135
|
+
export function removeClass(element: Node | __se__NodeCollection, className: string): void;
|
|
136
|
+
/**
|
|
137
|
+
* @description Argument value If there is no class name, insert it and delete the class name if it exists
|
|
138
|
+
* @param {Node} element Element to replace class name
|
|
139
|
+
* @param {string} className Class name to be change
|
|
140
|
+
* @returns {boolean|undefined}
|
|
141
|
+
*/
|
|
142
|
+
export function toggleClass(element: Node, className: string): boolean | undefined;
|
|
143
|
+
/**
|
|
144
|
+
* @description Gets the size of the documentElement client size.
|
|
145
|
+
* @param {Document} doc Document object
|
|
146
|
+
* @returns {{w: number, h: number}} documentElement.clientWidth, documentElement.clientHeight
|
|
147
|
+
*/
|
|
148
|
+
export function getClientSize(doc?: Document): {
|
|
149
|
+
w: number;
|
|
150
|
+
h: number;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* @description Gets the size of the window visualViewport size
|
|
154
|
+
* @returns {{top: number, left: number, scale: number}}
|
|
155
|
+
*/
|
|
156
|
+
export function getViewportSize(): {
|
|
157
|
+
top: number;
|
|
158
|
+
left: number;
|
|
159
|
+
scale: number;
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* @description Copies the "wwTarget" element and returns it with inline all styles applied.
|
|
163
|
+
* @param {Node} wwTarget Target element to copy(.sun-editor.sun-editor-editable)
|
|
164
|
+
* @param {boolean} includeWW Include the "wwTarget" element in the copy
|
|
165
|
+
* @param {Array<string>} styles Style list - kamel case
|
|
166
|
+
* @returns
|
|
167
|
+
*/
|
|
168
|
+
export function applyInlineStylesAll(wwTarget: Node, includeWW: boolean, styles: Array<string>): HTMLElement;
|
|
169
|
+
export default utils;
|
|
170
|
+
declare namespace utils {
|
|
171
|
+
export { clone };
|
|
172
|
+
export { createElement };
|
|
173
|
+
export { createTextNode };
|
|
174
|
+
export { getAttributesToString };
|
|
175
|
+
export { arrayFilter };
|
|
176
|
+
export { arrayFind };
|
|
177
|
+
export { arrayIncludes };
|
|
178
|
+
export { getArrayIndex };
|
|
179
|
+
export { nextIndex };
|
|
180
|
+
export { prevIndex };
|
|
181
|
+
export { copyTagAttributes };
|
|
182
|
+
export { copyFormatAttributes };
|
|
183
|
+
export { removeItem };
|
|
184
|
+
export { changeElement };
|
|
185
|
+
export { changeTxt };
|
|
186
|
+
export { setStyle };
|
|
187
|
+
export { setDisabled };
|
|
188
|
+
export { hasClass };
|
|
189
|
+
export { addClass };
|
|
190
|
+
export { removeClass };
|
|
191
|
+
export { toggleClass };
|
|
192
|
+
export { getClientSize };
|
|
193
|
+
export { getViewportSize };
|
|
194
|
+
export { applyInlineStylesAll };
|
|
195
|
+
export { waitForMediaLoad };
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* @template {Node} T
|
|
199
|
+
* @description Clones a node while preserving its type.
|
|
200
|
+
* @param {T} node - The node to clone.
|
|
201
|
+
* @param {boolean} [deep=false] - Whether to perform a deep clone.
|
|
202
|
+
* @returns {T} - The cloned node.
|
|
203
|
+
*/
|
|
204
|
+
declare function clone<T extends Node>(node: T, deep?: boolean): T;
|
|
205
|
+
/**
|
|
206
|
+
* @description Wait for media elements to load
|
|
207
|
+
* @param {Node} target Target element
|
|
208
|
+
* @param {number} timeout Timeout milliseconds
|
|
209
|
+
* @returns {Promise<void>}
|
|
210
|
+
*/
|
|
211
|
+
declare function waitForMediaLoad(target: Node, timeout?: number): Promise<void>;
|