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,512 @@
|
|
|
1
|
+
export default Offset;
|
|
2
|
+
export type OffsetThis = Omit<Offset & Partial<__se__EditorInjector>, 'offset'>;
|
|
3
|
+
/**
|
|
4
|
+
* Bounding rectangle information of the selection range.
|
|
5
|
+
*/
|
|
6
|
+
export type RectsInfo = {
|
|
7
|
+
/**
|
|
8
|
+
* - The left position of the selection.
|
|
9
|
+
*/
|
|
10
|
+
left: number;
|
|
11
|
+
/**
|
|
12
|
+
* - The right position of the selection.
|
|
13
|
+
*/
|
|
14
|
+
right: number;
|
|
15
|
+
/**
|
|
16
|
+
* - The top position of the selection.
|
|
17
|
+
*/
|
|
18
|
+
top: number;
|
|
19
|
+
/**
|
|
20
|
+
* - The bottom position of the selection.
|
|
21
|
+
*/
|
|
22
|
+
bottom: number;
|
|
23
|
+
/**
|
|
24
|
+
* - Whether the selection contains text.
|
|
25
|
+
*/
|
|
26
|
+
noText?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* - The width of the selection.
|
|
29
|
+
*/
|
|
30
|
+
width?: number;
|
|
31
|
+
/**
|
|
32
|
+
* - The height of the selection.
|
|
33
|
+
*/
|
|
34
|
+
height?: number;
|
|
35
|
+
};
|
|
36
|
+
export type OffsetInfo = {
|
|
37
|
+
/**
|
|
38
|
+
* - The vertical position of the node relative to the entire document, including iframe offsets.
|
|
39
|
+
*/
|
|
40
|
+
top: number;
|
|
41
|
+
/**
|
|
42
|
+
* - The horizontal position of the node relative to the entire document, including iframe offsets.
|
|
43
|
+
*/
|
|
44
|
+
left: number;
|
|
45
|
+
};
|
|
46
|
+
export type OffsetLocalInfo = {
|
|
47
|
+
/**
|
|
48
|
+
* - The vertical position of the node relative to the WYSIWYG editor.
|
|
49
|
+
*/
|
|
50
|
+
top: number;
|
|
51
|
+
/**
|
|
52
|
+
* - The horizontal position of the node relative to the WYSIWYG editor.
|
|
53
|
+
*/
|
|
54
|
+
left: number;
|
|
55
|
+
/**
|
|
56
|
+
* - The horizontal scroll offset inside the WYSIWYG editor.
|
|
57
|
+
*/
|
|
58
|
+
scrollX: number;
|
|
59
|
+
/**
|
|
60
|
+
* - The vertical scroll offset inside the WYSIWYG editor.
|
|
61
|
+
*/
|
|
62
|
+
scrollY: number;
|
|
63
|
+
};
|
|
64
|
+
export type OffsetGlobalInfo = {
|
|
65
|
+
/**
|
|
66
|
+
* - The vertical position of the element relative to the entire document.
|
|
67
|
+
*/
|
|
68
|
+
top: number;
|
|
69
|
+
/**
|
|
70
|
+
* - The horizontal position of the element relative to the entire document.
|
|
71
|
+
*/
|
|
72
|
+
left: number;
|
|
73
|
+
/**
|
|
74
|
+
* - The total width of the element, including its content, padding, and border.
|
|
75
|
+
*/
|
|
76
|
+
width: number;
|
|
77
|
+
/**
|
|
78
|
+
* - The total height of the element, including its content, padding, and border.
|
|
79
|
+
*/
|
|
80
|
+
height: number;
|
|
81
|
+
/**
|
|
82
|
+
* - The amount of vertical scrolling applied to the element.
|
|
83
|
+
*/
|
|
84
|
+
scrollTop: number;
|
|
85
|
+
/**
|
|
86
|
+
* - The amount of horizontal scrolling applied to the element.
|
|
87
|
+
*/
|
|
88
|
+
scrollLeft: number;
|
|
89
|
+
};
|
|
90
|
+
export type OffsetGlobalScrollInfo = {
|
|
91
|
+
/**
|
|
92
|
+
* - Total vertical scroll distance
|
|
93
|
+
*/
|
|
94
|
+
top: number;
|
|
95
|
+
/**
|
|
96
|
+
* - Total horizontal scroll distance
|
|
97
|
+
*/
|
|
98
|
+
left: number;
|
|
99
|
+
/**
|
|
100
|
+
* - Total width including scrollable area
|
|
101
|
+
*/
|
|
102
|
+
width: number;
|
|
103
|
+
/**
|
|
104
|
+
* - Total height including scrollable area
|
|
105
|
+
*/
|
|
106
|
+
height: number;
|
|
107
|
+
/**
|
|
108
|
+
* - Horizontal offset from the top reference element
|
|
109
|
+
*/
|
|
110
|
+
x: number;
|
|
111
|
+
/**
|
|
112
|
+
* - Vertical offset from the top reference element
|
|
113
|
+
*/
|
|
114
|
+
y: number;
|
|
115
|
+
/**
|
|
116
|
+
* - Element or window used as the vertical scroll reference
|
|
117
|
+
*/
|
|
118
|
+
ohOffsetEl: HTMLElement | Window | null;
|
|
119
|
+
/**
|
|
120
|
+
* - Element or window used as the horizontal scroll reference
|
|
121
|
+
*/
|
|
122
|
+
owOffsetEl: HTMLElement | Window | null;
|
|
123
|
+
/**
|
|
124
|
+
* - Height of the vertical scrollable area (clientHeight)
|
|
125
|
+
*/
|
|
126
|
+
oh: number;
|
|
127
|
+
/**
|
|
128
|
+
* - Width of the horizontal scrollable area (clientWidth)
|
|
129
|
+
*/
|
|
130
|
+
ow: number;
|
|
131
|
+
/**
|
|
132
|
+
* - Indicates if the vertical scroll reference is the editor area
|
|
133
|
+
*/
|
|
134
|
+
heightEditorRefer: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* - Indicates if the horizontal scroll reference is the editor area
|
|
137
|
+
*/
|
|
138
|
+
widthEditorRefer: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* - Top position of the height offset element relative to the viewport
|
|
141
|
+
*/
|
|
142
|
+
ts: number;
|
|
143
|
+
/**
|
|
144
|
+
* - Left position of the width offset element relative to the viewport
|
|
145
|
+
*/
|
|
146
|
+
ls: number;
|
|
147
|
+
};
|
|
148
|
+
export type OffsetWWScrollInfo = {
|
|
149
|
+
/**
|
|
150
|
+
* - The vertical scroll offset inside the WYSIWYG editor.
|
|
151
|
+
*/
|
|
152
|
+
top: number;
|
|
153
|
+
/**
|
|
154
|
+
* - The horizontal scroll offset inside the WYSIWYG editor.
|
|
155
|
+
*/
|
|
156
|
+
left: number;
|
|
157
|
+
/**
|
|
158
|
+
* - The total width of the WYSIWYG editor's scrollable area.
|
|
159
|
+
*/
|
|
160
|
+
width: number;
|
|
161
|
+
/**
|
|
162
|
+
* - The total height of the WYSIWYG editor's scrollable area.
|
|
163
|
+
*/
|
|
164
|
+
height: number;
|
|
165
|
+
/**
|
|
166
|
+
* - The sum of `top` and `height`, representing the bottom-most scrollable position.
|
|
167
|
+
*/
|
|
168
|
+
bottom: number;
|
|
169
|
+
/**
|
|
170
|
+
* - The bounding rectangle of the editor's visible area.
|
|
171
|
+
*/
|
|
172
|
+
rects: RectsInfo;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* @typedef {Omit<Offset & Partial<__se__EditorInjector>, 'offset'>} OffsetThis
|
|
176
|
+
*/
|
|
177
|
+
/**
|
|
178
|
+
* @typedef {Object} RectsInfo Bounding rectangle information of the selection range.
|
|
179
|
+
* @property {number} rects.left - The left position of the selection.
|
|
180
|
+
* @property {number} rects.right - The right position of the selection.
|
|
181
|
+
* @property {number} rects.top - The top position of the selection.
|
|
182
|
+
* @property {number} rects.bottom - The bottom position of the selection.
|
|
183
|
+
* @property {boolean} [rects.noText] - Whether the selection contains text.
|
|
184
|
+
* @property {number} [rects.width] - The width of the selection.
|
|
185
|
+
* @property {number} [rects.height] - The height of the selection.
|
|
186
|
+
*/
|
|
187
|
+
/**
|
|
188
|
+
* @typedef {Object} OffsetInfo
|
|
189
|
+
* @property {number} top - The vertical position of the node relative to the entire document, including iframe offsets.
|
|
190
|
+
* @property {number} left - The horizontal position of the node relative to the entire document, including iframe offsets.
|
|
191
|
+
*/
|
|
192
|
+
/**
|
|
193
|
+
* @typedef {Object} OffsetLocalInfo
|
|
194
|
+
* @property {number} top - The vertical position of the node relative to the WYSIWYG editor.
|
|
195
|
+
* @property {number} left - The horizontal position of the node relative to the WYSIWYG editor.
|
|
196
|
+
* @property {number} scrollX - The horizontal scroll offset inside the WYSIWYG editor.
|
|
197
|
+
* @property {number} scrollY - The vertical scroll offset inside the WYSIWYG editor.
|
|
198
|
+
*/
|
|
199
|
+
/**
|
|
200
|
+
* @typedef {Object} OffsetGlobalInfo
|
|
201
|
+
* @property {number} top - The vertical position of the element relative to the entire document.
|
|
202
|
+
* @property {number} left - The horizontal position of the element relative to the entire document.
|
|
203
|
+
* @property {number} width - The total width of the element, including its content, padding, and border.
|
|
204
|
+
* @property {number} height - The total height of the element, including its content, padding, and border.
|
|
205
|
+
* @property {number} scrollTop - The amount of vertical scrolling applied to the element.
|
|
206
|
+
* @property {number} scrollLeft - The amount of horizontal scrolling applied to the element.
|
|
207
|
+
*/
|
|
208
|
+
/**
|
|
209
|
+
* @typedef {Object} OffsetGlobalScrollInfo
|
|
210
|
+
* @property {number} top - Total vertical scroll distance
|
|
211
|
+
* @property {number} left - Total horizontal scroll distance
|
|
212
|
+
* @property {number} width - Total width including scrollable area
|
|
213
|
+
* @property {number} height - Total height including scrollable area
|
|
214
|
+
* @property {number} x - Horizontal offset from the top reference element
|
|
215
|
+
* @property {number} y - Vertical offset from the top reference element
|
|
216
|
+
* @property {HTMLElement|Window|null} ohOffsetEl - Element or window used as the vertical scroll reference
|
|
217
|
+
* @property {HTMLElement|Window|null} owOffsetEl - Element or window used as the horizontal scroll reference
|
|
218
|
+
* @property {number} oh - Height of the vertical scrollable area (clientHeight)
|
|
219
|
+
* @property {number} ow - Width of the horizontal scrollable area (clientWidth)
|
|
220
|
+
* @property {boolean} heightEditorRefer - Indicates if the vertical scroll reference is the editor area
|
|
221
|
+
* @property {boolean} widthEditorRefer - Indicates if the horizontal scroll reference is the editor area
|
|
222
|
+
* @property {number} ts - Top position of the height offset element relative to the viewport
|
|
223
|
+
* @property {number} ls - Left position of the width offset element relative to the viewport
|
|
224
|
+
*/
|
|
225
|
+
/**
|
|
226
|
+
* @typedef {Object} OffsetWWScrollInfo
|
|
227
|
+
* @property {number} top - The vertical scroll offset inside the WYSIWYG editor.
|
|
228
|
+
* @property {number} left - The horizontal scroll offset inside the WYSIWYG editor.
|
|
229
|
+
* @property {number} width - The total width of the WYSIWYG editor's scrollable area.
|
|
230
|
+
* @property {number} height - The total height of the WYSIWYG editor's scrollable area.
|
|
231
|
+
* @property {number} bottom - The sum of `top` and `height`, representing the bottom-most scrollable position.
|
|
232
|
+
* @property {RectsInfo} rects - The bounding rectangle of the editor's visible area.
|
|
233
|
+
*/
|
|
234
|
+
/**
|
|
235
|
+
* @constructor
|
|
236
|
+
* @this {OffsetThis}
|
|
237
|
+
* @description Offset class, get the position of the element
|
|
238
|
+
* @param {__se__EditorCore} editor - The root editor instance
|
|
239
|
+
*/
|
|
240
|
+
declare function Offset(this: Omit<Offset & Partial<import('../../editorInjector').default>, 'offset'>, editor: __se__EditorCore): void;
|
|
241
|
+
declare class Offset {
|
|
242
|
+
/**
|
|
243
|
+
* @typedef {Omit<Offset & Partial<__se__EditorInjector>, 'offset'>} OffsetThis
|
|
244
|
+
*/
|
|
245
|
+
/**
|
|
246
|
+
* @typedef {Object} RectsInfo Bounding rectangle information of the selection range.
|
|
247
|
+
* @property {number} rects.left - The left position of the selection.
|
|
248
|
+
* @property {number} rects.right - The right position of the selection.
|
|
249
|
+
* @property {number} rects.top - The top position of the selection.
|
|
250
|
+
* @property {number} rects.bottom - The bottom position of the selection.
|
|
251
|
+
* @property {boolean} [rects.noText] - Whether the selection contains text.
|
|
252
|
+
* @property {number} [rects.width] - The width of the selection.
|
|
253
|
+
* @property {number} [rects.height] - The height of the selection.
|
|
254
|
+
*/
|
|
255
|
+
/**
|
|
256
|
+
* @typedef {Object} OffsetInfo
|
|
257
|
+
* @property {number} top - The vertical position of the node relative to the entire document, including iframe offsets.
|
|
258
|
+
* @property {number} left - The horizontal position of the node relative to the entire document, including iframe offsets.
|
|
259
|
+
*/
|
|
260
|
+
/**
|
|
261
|
+
* @typedef {Object} OffsetLocalInfo
|
|
262
|
+
* @property {number} top - The vertical position of the node relative to the WYSIWYG editor.
|
|
263
|
+
* @property {number} left - The horizontal position of the node relative to the WYSIWYG editor.
|
|
264
|
+
* @property {number} scrollX - The horizontal scroll offset inside the WYSIWYG editor.
|
|
265
|
+
* @property {number} scrollY - The vertical scroll offset inside the WYSIWYG editor.
|
|
266
|
+
*/
|
|
267
|
+
/**
|
|
268
|
+
* @typedef {Object} OffsetGlobalInfo
|
|
269
|
+
* @property {number} top - The vertical position of the element relative to the entire document.
|
|
270
|
+
* @property {number} left - The horizontal position of the element relative to the entire document.
|
|
271
|
+
* @property {number} width - The total width of the element, including its content, padding, and border.
|
|
272
|
+
* @property {number} height - The total height of the element, including its content, padding, and border.
|
|
273
|
+
* @property {number} scrollTop - The amount of vertical scrolling applied to the element.
|
|
274
|
+
* @property {number} scrollLeft - The amount of horizontal scrolling applied to the element.
|
|
275
|
+
*/
|
|
276
|
+
/**
|
|
277
|
+
* @typedef {Object} OffsetGlobalScrollInfo
|
|
278
|
+
* @property {number} top - Total vertical scroll distance
|
|
279
|
+
* @property {number} left - Total horizontal scroll distance
|
|
280
|
+
* @property {number} width - Total width including scrollable area
|
|
281
|
+
* @property {number} height - Total height including scrollable area
|
|
282
|
+
* @property {number} x - Horizontal offset from the top reference element
|
|
283
|
+
* @property {number} y - Vertical offset from the top reference element
|
|
284
|
+
* @property {HTMLElement|Window|null} ohOffsetEl - Element or window used as the vertical scroll reference
|
|
285
|
+
* @property {HTMLElement|Window|null} owOffsetEl - Element or window used as the horizontal scroll reference
|
|
286
|
+
* @property {number} oh - Height of the vertical scrollable area (clientHeight)
|
|
287
|
+
* @property {number} ow - Width of the horizontal scrollable area (clientWidth)
|
|
288
|
+
* @property {boolean} heightEditorRefer - Indicates if the vertical scroll reference is the editor area
|
|
289
|
+
* @property {boolean} widthEditorRefer - Indicates if the horizontal scroll reference is the editor area
|
|
290
|
+
* @property {number} ts - Top position of the height offset element relative to the viewport
|
|
291
|
+
* @property {number} ls - Left position of the width offset element relative to the viewport
|
|
292
|
+
*/
|
|
293
|
+
/**
|
|
294
|
+
* @typedef {Object} OffsetWWScrollInfo
|
|
295
|
+
* @property {number} top - The vertical scroll offset inside the WYSIWYG editor.
|
|
296
|
+
* @property {number} left - The horizontal scroll offset inside the WYSIWYG editor.
|
|
297
|
+
* @property {number} width - The total width of the WYSIWYG editor's scrollable area.
|
|
298
|
+
* @property {number} height - The total height of the WYSIWYG editor's scrollable area.
|
|
299
|
+
* @property {number} bottom - The sum of `top` and `height`, representing the bottom-most scrollable position.
|
|
300
|
+
* @property {RectsInfo} rects - The bounding rectangle of the editor's visible area.
|
|
301
|
+
*/
|
|
302
|
+
/**
|
|
303
|
+
* @constructor
|
|
304
|
+
* @this {OffsetThis}
|
|
305
|
+
* @description Offset class, get the position of the element
|
|
306
|
+
* @param {__se__EditorCore} editor - The root editor instance
|
|
307
|
+
*/
|
|
308
|
+
constructor(editor: __se__EditorCore);
|
|
309
|
+
_scrollEvent: any;
|
|
310
|
+
_elTop: number;
|
|
311
|
+
_scrollY: number;
|
|
312
|
+
_isFixed: boolean;
|
|
313
|
+
/**
|
|
314
|
+
* @this {OffsetThis}
|
|
315
|
+
* @description Gets the position just outside the argument's internal editor (wysiwygFrame).
|
|
316
|
+
* @param {Node} node Target node.
|
|
317
|
+
* @returns {OffsetInfo} Position relative to the editor frame.
|
|
318
|
+
*/
|
|
319
|
+
get(this: Omit<Offset & Partial<import('../../editorInjector').default>, 'offset'>, node: Node): OffsetInfo;
|
|
320
|
+
/**
|
|
321
|
+
* @this {OffsetThis}
|
|
322
|
+
* @description Gets the position inside the internal editor of the argument.
|
|
323
|
+
* @param {Node} node Target node.
|
|
324
|
+
* @returns {OffsetLocalInfo} Position relative to the WYSIWYG editor.
|
|
325
|
+
*/
|
|
326
|
+
getLocal(this: Omit<Offset & Partial<import('../../editorInjector').default>, 'offset'>, node: Node): OffsetLocalInfo;
|
|
327
|
+
/**
|
|
328
|
+
* @this {OffsetThis}
|
|
329
|
+
* @description Returns the position of the argument relative to the global document.
|
|
330
|
+
* @param {?Node=} node Target element.
|
|
331
|
+
* @returns {OffsetGlobalInfo} Global position and scroll values.
|
|
332
|
+
*/
|
|
333
|
+
getGlobal(this: Omit<Offset & Partial<import('../../editorInjector').default>, 'offset'>, node?: (Node | null) | undefined): OffsetGlobalInfo;
|
|
334
|
+
/**
|
|
335
|
+
* @this {OffsetThis}
|
|
336
|
+
* @description Gets the current editor-relative scroll offset.
|
|
337
|
+
* @param {?Node=} node Target element.
|
|
338
|
+
* @returns {OffsetGlobalScrollInfo} Global scroll information.
|
|
339
|
+
*/
|
|
340
|
+
getGlobalScroll(this: Omit<Offset & Partial<import('../../editorInjector').default>, 'offset'>, node?: (Node | null) | undefined): OffsetGlobalScrollInfo;
|
|
341
|
+
/**
|
|
342
|
+
* @this {OffsetThis}
|
|
343
|
+
* @description Get the scroll info of the WYSIWYG area.
|
|
344
|
+
* @returns {OffsetWWScrollInfo} Scroll information within the editor.
|
|
345
|
+
*/
|
|
346
|
+
getWWScroll(this: Omit<Offset & Partial<import('../../editorInjector').default>, 'offset'>): OffsetWWScrollInfo;
|
|
347
|
+
/**
|
|
348
|
+
* @this {OffsetThis}
|
|
349
|
+
* @description Sets the relative position of an element
|
|
350
|
+
* @param {HTMLElement} element Element to position
|
|
351
|
+
* @param {HTMLElement} e_container Element's root container
|
|
352
|
+
* @param {HTMLElement} target Target element to position against
|
|
353
|
+
* @param {HTMLElement} t_container Target's root container
|
|
354
|
+
* @param {boolean} _reload Whether to reload position
|
|
355
|
+
*/
|
|
356
|
+
setRelPosition(this: Omit<Offset & Partial<import('../../editorInjector').default>, 'offset'>, element: HTMLElement, e_container: HTMLElement, target: HTMLElement, t_container: HTMLElement, _reload: boolean): void;
|
|
357
|
+
/**
|
|
358
|
+
* @this {OffsetThis}
|
|
359
|
+
* @description Sets the absolute position of an element
|
|
360
|
+
* @param {HTMLElement} element Element to position
|
|
361
|
+
* @param {HTMLElement} target Target element
|
|
362
|
+
* @param {Object} params Position parameters
|
|
363
|
+
* @param {boolean} [params.isWWTarget=false] Whether the target is within the editor's WYSIWYG area
|
|
364
|
+
* @param {{left:number, top:number}} [params.addOffset={left:0, top:0}] Additional offset
|
|
365
|
+
* @param {"bottom"|"top"} [params.position="bottom"] Position ('bottom'|'top')
|
|
366
|
+
* @param {*} params.inst Instance object of caller
|
|
367
|
+
* @returns {boolean} Success / Failure
|
|
368
|
+
*/
|
|
369
|
+
setAbsPosition(
|
|
370
|
+
this: Omit<Offset & Partial<import('../../editorInjector').default>, 'offset'>,
|
|
371
|
+
element: HTMLElement,
|
|
372
|
+
target: HTMLElement,
|
|
373
|
+
params: {
|
|
374
|
+
isWWTarget?: boolean;
|
|
375
|
+
addOffset?: {
|
|
376
|
+
left: number;
|
|
377
|
+
top: number;
|
|
378
|
+
};
|
|
379
|
+
position?: 'bottom' | 'top';
|
|
380
|
+
inst: any;
|
|
381
|
+
}
|
|
382
|
+
): boolean;
|
|
383
|
+
/**
|
|
384
|
+
* @this {OffsetThis}
|
|
385
|
+
* @description Sets the position of an element relative to a range
|
|
386
|
+
* @param {HTMLElement} element Element to position
|
|
387
|
+
* @param {?Range} range Range to position against.
|
|
388
|
+
* - if null, the current selection range is used
|
|
389
|
+
* @param {Object} [options={}] Position options
|
|
390
|
+
* @param {"bottom"|"top"} [options.position="bottom"] Position ('bottom'|'top')
|
|
391
|
+
* @param {number} [options.addTop=0] Additional top offset
|
|
392
|
+
* @returns {boolean} Success / Failure
|
|
393
|
+
*/
|
|
394
|
+
setRangePosition(
|
|
395
|
+
this: Omit<Offset & Partial<import('../../editorInjector').default>, 'offset'>,
|
|
396
|
+
element: HTMLElement,
|
|
397
|
+
range: Range | null,
|
|
398
|
+
{
|
|
399
|
+
position,
|
|
400
|
+
addTop
|
|
401
|
+
}?: {
|
|
402
|
+
position?: 'bottom' | 'top';
|
|
403
|
+
addTop?: number;
|
|
404
|
+
}
|
|
405
|
+
): boolean;
|
|
406
|
+
/**
|
|
407
|
+
* @private
|
|
408
|
+
* @this {OffsetThis}
|
|
409
|
+
* @description Sets the position of an element relative to the selection range in the editor.
|
|
410
|
+
* - This method calculates the top and left offsets for the element, ensuring it
|
|
411
|
+
* - does not overflow the editor boundaries and adjusts the arrow positioning accordingly.
|
|
412
|
+
* @param {boolean} isDirTop - Determines whether the element should be positioned above (`true`) or below (`false`) the target.
|
|
413
|
+
* @param {RectsInfo} rects - Bounding rectangle information of the selection range.
|
|
414
|
+
* @param {HTMLElement} element - The element to be positioned.
|
|
415
|
+
* @param {number} editorLeft - The left position of the editor.
|
|
416
|
+
* @param {number} editorWidth - The width of the editor.
|
|
417
|
+
* @param {number} scrollLeft - The horizontal scroll offset.
|
|
418
|
+
* @param {number} scrollTop - The vertical scroll offset.
|
|
419
|
+
* @param {number} [addTop=0] - Additional top margin adjustment.
|
|
420
|
+
*/
|
|
421
|
+
_setOffsetOnRange(
|
|
422
|
+
this: Omit<Offset & Partial<import('../../editorInjector').default>, 'offset'>,
|
|
423
|
+
isDirTop: boolean,
|
|
424
|
+
rects: RectsInfo,
|
|
425
|
+
element: HTMLElement,
|
|
426
|
+
editorLeft: number,
|
|
427
|
+
editorWidth: number,
|
|
428
|
+
scrollLeft: number,
|
|
429
|
+
scrollTop: number,
|
|
430
|
+
addTop?: number
|
|
431
|
+
): void;
|
|
432
|
+
/**
|
|
433
|
+
* @private
|
|
434
|
+
* @this {OffsetThis}
|
|
435
|
+
* @description Get available space from page bottom
|
|
436
|
+
* @returns {number} Available space
|
|
437
|
+
*/
|
|
438
|
+
_getPageBottomSpace(this: Omit<Offset & Partial<import('../../editorInjector').default>, 'offset'>): number;
|
|
439
|
+
/**
|
|
440
|
+
* @private
|
|
441
|
+
* @this {OffsetThis}
|
|
442
|
+
* @description Calculates the vertical margin offsets for the target element relative to the editor frame.
|
|
443
|
+
* - This method determines the top and bottom margins based on various conditions such as
|
|
444
|
+
* - fullscreen mode, iframe usage, toolbar height, and scroll positions.
|
|
445
|
+
* @param {number} tmtw Top margin to window
|
|
446
|
+
* @param {number} tmbw Bottom margin to window
|
|
447
|
+
* @param {number} toolbarH Toolbar height
|
|
448
|
+
* @param {{w: number, h: number}} clientSize documentElement.clientWidth, documentElement.clientHeight
|
|
449
|
+
* @param {RectsInfo} targetRect Target rect object
|
|
450
|
+
* @param {boolean} isTargetAbs Is target absolute position
|
|
451
|
+
* @param {OffsetWWScrollInfo} wwScroll WYSIWYG scroll info
|
|
452
|
+
* @returns {{rmt:number, rmb:number, rt:number}} Margin values (rmt: top margin, rmb: bottom margin, rt: Toolbar height offset adjustment)
|
|
453
|
+
*/
|
|
454
|
+
_getVMargin(
|
|
455
|
+
this: Omit<Offset & Partial<import('../../editorInjector').default>, 'offset'>,
|
|
456
|
+
tmtw: number,
|
|
457
|
+
tmbw: number,
|
|
458
|
+
toolbarH: number,
|
|
459
|
+
clientSize: {
|
|
460
|
+
w: number;
|
|
461
|
+
h: number;
|
|
462
|
+
},
|
|
463
|
+
targetRect: RectsInfo,
|
|
464
|
+
isTargetAbs: boolean,
|
|
465
|
+
wwScroll: OffsetWWScrollInfo
|
|
466
|
+
): {
|
|
467
|
+
rmt: number;
|
|
468
|
+
rmb: number;
|
|
469
|
+
rt: number;
|
|
470
|
+
};
|
|
471
|
+
/**
|
|
472
|
+
* @private
|
|
473
|
+
* @this {OffsetThis}
|
|
474
|
+
* @description Sets the visibility and direction of the arrow element.
|
|
475
|
+
* - This method applies the appropriate class (`se-arrow-up` or `se-arrow-down`)
|
|
476
|
+
* - based on the specified direction key and adjusts the visibility of the arrow.
|
|
477
|
+
* @param {HTMLElement} arrow - The arrow element to be updated.
|
|
478
|
+
* @param {string} key - The direction of the arrow. ("up"|"down"|"")
|
|
479
|
+
* - Accepts `'up'` for an upward arrow, `'down'` for a downward arrow,
|
|
480
|
+
* - or any other value to hide the arrow.
|
|
481
|
+
*/
|
|
482
|
+
_setArrow(this: Omit<Offset & Partial<import('../../editorInjector').default>, 'offset'>, arrow: HTMLElement, key: string): void;
|
|
483
|
+
/**
|
|
484
|
+
* @private
|
|
485
|
+
* @this {OffsetThis}
|
|
486
|
+
* @description Retrieves the current window scroll position and viewport size.
|
|
487
|
+
* - Returns an object containing the scroll offsets, viewport dimensions, and boundary rects.
|
|
488
|
+
* @returns {{
|
|
489
|
+
* top: number,
|
|
490
|
+
* left: number,
|
|
491
|
+
* width: number,
|
|
492
|
+
* height: number,
|
|
493
|
+
* bottom: number,
|
|
494
|
+
* rects: RectsInfo
|
|
495
|
+
* }} An object with scroll and viewport information.
|
|
496
|
+
*/
|
|
497
|
+
_getWindowScroll(this: Omit<Offset & Partial<import('../../editorInjector').default>, 'offset'>): {
|
|
498
|
+
top: number;
|
|
499
|
+
left: number;
|
|
500
|
+
width: number;
|
|
501
|
+
height: number;
|
|
502
|
+
bottom: number;
|
|
503
|
+
rects: RectsInfo;
|
|
504
|
+
};
|
|
505
|
+
/**
|
|
506
|
+
* @private
|
|
507
|
+
* @this {OffsetThis}
|
|
508
|
+
* @description Removes the global scroll event listener from the editor.
|
|
509
|
+
* - Resets related scroll tracking properties.
|
|
510
|
+
*/
|
|
511
|
+
__removeGlobalEvent(this: Omit<Offset & Partial<import('../../editorInjector').default>, 'offset'>): void;
|
|
512
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
export default Selection_;
|
|
2
|
+
export type SelectionThis = Omit<Selection_ & Partial<__se__EditorInjector>, 'selection'>;
|
|
3
|
+
export type RectsInfo = import('./offset').RectsInfo;
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {Omit<Selection_ & Partial<__se__EditorInjector>, 'selection'>} SelectionThis
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {import('./offset').RectsInfo} RectsInfo
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* @constructor
|
|
12
|
+
* @this {SelectionThis}
|
|
13
|
+
* @description Selection, Range related class
|
|
14
|
+
* @param {__se__EditorCore} editor - The root editor instance
|
|
15
|
+
*/
|
|
16
|
+
declare function Selection_(this: Omit<Selection_ & Partial<import('../../editorInjector').default>, 'selection'>, editor: __se__EditorCore): void;
|
|
17
|
+
declare class Selection_ {
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {Omit<Selection_ & Partial<__se__EditorInjector>, 'selection'>} SelectionThis
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* @typedef {import('./offset').RectsInfo} RectsInfo
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* @constructor
|
|
26
|
+
* @this {SelectionThis}
|
|
27
|
+
* @description Selection, Range related class
|
|
28
|
+
* @param {__se__EditorCore} editor - The root editor instance
|
|
29
|
+
*/
|
|
30
|
+
constructor(editor: __se__EditorCore);
|
|
31
|
+
/** @type {Range} */
|
|
32
|
+
range: Range;
|
|
33
|
+
/** @type {HTMLElement|Text} */
|
|
34
|
+
selectionNode: HTMLElement | Text;
|
|
35
|
+
__iframeFocus: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* @this {SelectionThis}
|
|
38
|
+
* @description Get window selection obejct
|
|
39
|
+
* @returns {Selection}
|
|
40
|
+
*/
|
|
41
|
+
get(this: Omit<Selection_ & Partial<import('../../editorInjector').default>, 'selection'>): Selection;
|
|
42
|
+
/**
|
|
43
|
+
* @this {SelectionThis}
|
|
44
|
+
* @description Check if the range object is valid
|
|
45
|
+
* @param {*} range Range object
|
|
46
|
+
* @returns {boolean}
|
|
47
|
+
*/
|
|
48
|
+
isRange(this: Omit<Selection_ & Partial<import('../../editorInjector').default>, 'selection'>, range: any): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* @this {SelectionThis}
|
|
51
|
+
* @description Get current editor's range object
|
|
52
|
+
* @returns {Range}
|
|
53
|
+
*/
|
|
54
|
+
getRange(this: Omit<Selection_ & Partial<import('../../editorInjector').default>, 'selection'>): Range;
|
|
55
|
+
/**
|
|
56
|
+
* @this {SelectionThis}
|
|
57
|
+
* @description Set current editor's range object and return.
|
|
58
|
+
* @param {Node|Range} startCon Range object or The startContainer property of the selection object
|
|
59
|
+
* @param {number} [startOff] The startOffset property of the selection object.
|
|
60
|
+
* @param {Node} [endCon] The endContainer property of the selection object.
|
|
61
|
+
* @param {number} [endOff] The endOffset property of the selection object.
|
|
62
|
+
* @returns {Range}
|
|
63
|
+
*/
|
|
64
|
+
setRange(this: Omit<Selection_ & Partial<import('../../editorInjector').default>, 'selection'>, startCon: Node | Range, startOff?: number, endCon?: Node, endOff?: number): Range;
|
|
65
|
+
/**
|
|
66
|
+
* @this {SelectionThis}
|
|
67
|
+
* @description Remove range object and button effect
|
|
68
|
+
*/
|
|
69
|
+
removeRange(this: Omit<Selection_ & Partial<import('../../editorInjector').default>, 'selection'>): void;
|
|
70
|
+
/**
|
|
71
|
+
* @this {SelectionThis}
|
|
72
|
+
* @description Returns the range (container and offset) near the given target node.
|
|
73
|
+
* - If the target node has a next sibling, it returns the next sibling with an offset of 0.
|
|
74
|
+
* - If there is no next sibling but a previous sibling exists, it returns the previous sibling with an offset of 1.
|
|
75
|
+
* @param {Node} target Target node whose neighboring range is to be determined.
|
|
76
|
+
* @returns {{container: Node, offset: number}|null} An object containing the nearest container node and its offset.
|
|
77
|
+
*/
|
|
78
|
+
getNearRange(
|
|
79
|
+
this: Omit<Selection_ & Partial<import('../../editorInjector').default>, 'selection'>,
|
|
80
|
+
target: Node
|
|
81
|
+
): {
|
|
82
|
+
container: Node;
|
|
83
|
+
offset: number;
|
|
84
|
+
} | null;
|
|
85
|
+
/**
|
|
86
|
+
* @this {SelectionThis}
|
|
87
|
+
* @description If the "range" object is a non-editable area, add a line at the top of the editor and update the "range" object.
|
|
88
|
+
* @param {Range} range core.getRange()
|
|
89
|
+
* @param {?Node=} container If there is "container" argument, it creates a line in front of the container.
|
|
90
|
+
* @returns {Range} a new "range" or argument "range".
|
|
91
|
+
*/
|
|
92
|
+
getRangeAndAddLine(this: Omit<Selection_ & Partial<import('../../editorInjector').default>, 'selection'>, range: Range, container?: (Node | null) | undefined): Range;
|
|
93
|
+
/**
|
|
94
|
+
* @this {SelectionThis}
|
|
95
|
+
* @description Get current select node
|
|
96
|
+
* @returns {HTMLElement|Text}
|
|
97
|
+
*/
|
|
98
|
+
getNode(this: Omit<Selection_ & Partial<import('../../editorInjector').default>, 'selection'>): HTMLElement | Text;
|
|
99
|
+
/**
|
|
100
|
+
* @this {SelectionThis}
|
|
101
|
+
* @description Get the Rects object.
|
|
102
|
+
* @param {?Range|Node} target Range | Node | null
|
|
103
|
+
* @param {"start"|"end"} position It is based on the position of the rect object to be returned in case of range selection.
|
|
104
|
+
* @returns {{rects: RectsInfo, position: "start"|"end", scrollLeft: number, scrollTop: number}}
|
|
105
|
+
*/
|
|
106
|
+
getRects(
|
|
107
|
+
this: Omit<Selection_ & Partial<import('../../editorInjector').default>, 'selection'>,
|
|
108
|
+
target: (Range | Node) | null,
|
|
109
|
+
position: 'start' | 'end'
|
|
110
|
+
): {
|
|
111
|
+
rects: RectsInfo;
|
|
112
|
+
position: 'start' | 'end';
|
|
113
|
+
scrollLeft: number;
|
|
114
|
+
scrollTop: number;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* @this {SelectionThis}
|
|
118
|
+
* @description Get the custom range object of the event.
|
|
119
|
+
* @param {DragEvent} e Event object
|
|
120
|
+
* @returns {{sc: Node, so: number, ec: Node, eo: number}} {sc: startContainer, so: startOffset, ec: endContainer, eo: endOffset}
|
|
121
|
+
*/
|
|
122
|
+
getDragEventLocationRange(
|
|
123
|
+
this: Omit<Selection_ & Partial<import('../../editorInjector').default>, 'selection'>,
|
|
124
|
+
e: DragEvent
|
|
125
|
+
): {
|
|
126
|
+
sc: Node;
|
|
127
|
+
so: number;
|
|
128
|
+
ec: Node;
|
|
129
|
+
eo: number;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* @this {SelectionThis}
|
|
133
|
+
* @description Scroll to the corresponding selection or range position.
|
|
134
|
+
* @param {Selection|Range|Node} ref selection or range object
|
|
135
|
+
* @param {?Object<string, *>=} scrollOption option of scrollTo
|
|
136
|
+
*/
|
|
137
|
+
scrollTo(
|
|
138
|
+
this: Omit<Selection_ & Partial<import('../../editorInjector').default>, 'selection'>,
|
|
139
|
+
ref: Selection | Range | Node,
|
|
140
|
+
scrollOption?:
|
|
141
|
+
| ({
|
|
142
|
+
[x: string]: any;
|
|
143
|
+
} | null)
|
|
144
|
+
| undefined
|
|
145
|
+
): void;
|
|
146
|
+
/**
|
|
147
|
+
* @private
|
|
148
|
+
* @this {SelectionThis}
|
|
149
|
+
* @description Returns true if there is no valid selection.
|
|
150
|
+
* @param {Range} range selection.getRange()
|
|
151
|
+
* @returns {boolean}
|
|
152
|
+
*/
|
|
153
|
+
_isNone(this: Omit<Selection_ & Partial<import('../../editorInjector').default>, 'selection'>, range: Range): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* @private
|
|
156
|
+
* @this {SelectionThis}
|
|
157
|
+
* @description Return the range object of editor's first child node
|
|
158
|
+
* @returns {Range}
|
|
159
|
+
*/
|
|
160
|
+
_createDefaultRange(this: Omit<Selection_ & Partial<import('../../editorInjector').default>, 'selection'>): Range;
|
|
161
|
+
/**
|
|
162
|
+
* @private
|
|
163
|
+
* @this {SelectionThis}
|
|
164
|
+
* @description Set "range" and "selection" info.
|
|
165
|
+
* @param {Range} range range object.
|
|
166
|
+
* @param {Selection} selection selection object.
|
|
167
|
+
*/
|
|
168
|
+
_rangeInfo(this: Omit<Selection_ & Partial<import('../../editorInjector').default>, 'selection'>, range: Range, selection: Selection): void;
|
|
169
|
+
/**
|
|
170
|
+
* @private
|
|
171
|
+
* @this {SelectionThis}
|
|
172
|
+
* @description Saving the range object and the currently selected node of editor
|
|
173
|
+
*/
|
|
174
|
+
_init(this: Omit<Selection_ & Partial<import('../../editorInjector').default>, 'selection'>): HTMLInputElement;
|
|
175
|
+
/**
|
|
176
|
+
* @private
|
|
177
|
+
* @this {SelectionThis}
|
|
178
|
+
* @description Focus method
|
|
179
|
+
*/
|
|
180
|
+
__focus(this: Omit<Selection_ & Partial<import('../../editorInjector').default>, 'selection'>): void;
|
|
181
|
+
/**
|
|
182
|
+
* @private
|
|
183
|
+
* @this {SelectionThis}
|
|
184
|
+
* @description Reset range object to text node selected status.
|
|
185
|
+
* @returns {boolean} Returns false if there is no valid selection.
|
|
186
|
+
*/
|
|
187
|
+
_resetRangeToTextNode(this: Omit<Selection_ & Partial<import('../../editorInjector').default>, 'selection'>): boolean;
|
|
188
|
+
}
|