suneditor 3.0.0-beta.3 → 3.0.0-beta.30

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.
Files changed (241) hide show
  1. package/CONTRIBUTING.md +8 -8
  2. package/README.md +44 -49
  3. package/dist/suneditor.min.css +1 -1
  4. package/dist/suneditor.min.js +1 -1
  5. package/package.json +95 -53
  6. package/src/assets/design/color.css +2 -2
  7. package/src/assets/design/size.css +2 -0
  8. package/src/assets/icons/defaultIcons.js +16 -1
  9. package/src/assets/suneditor-contents.css +9 -8
  10. package/src/assets/suneditor.css +29 -26
  11. package/src/core/{section → base}/actives.js +20 -12
  12. package/src/core/base/history.js +4 -4
  13. package/src/core/class/char.js +10 -10
  14. package/src/core/class/component.js +146 -57
  15. package/src/core/class/format.js +94 -2458
  16. package/src/core/class/html.js +187 -129
  17. package/src/core/class/inline.js +1853 -0
  18. package/src/core/class/listFormat.js +582 -0
  19. package/src/core/class/menu.js +14 -3
  20. package/src/core/class/nodeTransform.js +9 -14
  21. package/src/core/class/offset.js +162 -197
  22. package/src/core/class/selection.js +137 -34
  23. package/src/core/class/toolbar.js +73 -52
  24. package/src/core/class/ui.js +11 -11
  25. package/src/core/class/viewer.js +56 -55
  26. package/src/core/config/context.js +122 -0
  27. package/src/core/config/frameContext.js +204 -0
  28. package/src/core/config/options.js +639 -0
  29. package/src/core/editor.js +181 -108
  30. package/src/core/event/actions/index.js +229 -0
  31. package/src/core/event/effects/common.registry.js +60 -0
  32. package/src/core/event/effects/keydown.registry.js +551 -0
  33. package/src/core/event/effects/ruleHelpers.js +145 -0
  34. package/src/core/{base → event}/eventManager.js +119 -201
  35. package/src/core/event/executor.js +21 -0
  36. package/src/core/{base/eventHandlers → event/handlers}/handler_toolbar.js +4 -4
  37. package/src/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.js +2 -2
  38. package/src/core/event/handlers/handler_ww_input.js +77 -0
  39. package/src/core/event/handlers/handler_ww_key.js +228 -0
  40. package/src/core/{base/eventHandlers → event/handlers}/handler_ww_mouse.js +3 -3
  41. package/src/core/event/ports.js +211 -0
  42. package/src/core/event/reducers/keydown.reducer.js +89 -0
  43. package/src/core/event/rules/keydown.rule.arrow.js +54 -0
  44. package/src/core/event/rules/keydown.rule.backspace.js +202 -0
  45. package/src/core/event/rules/keydown.rule.delete.js +126 -0
  46. package/src/core/event/rules/keydown.rule.enter.js +144 -0
  47. package/src/core/event/rules/keydown.rule.tab.js +29 -0
  48. package/src/core/section/constructor.js +79 -388
  49. package/src/core/section/documentType.js +47 -26
  50. package/src/core/util/instanceCheck.js +59 -0
  51. package/src/editorInjector/_classes.js +4 -0
  52. package/src/editorInjector/_core.js +17 -7
  53. package/src/editorInjector/index.js +10 -2
  54. package/src/events.js +6 -0
  55. package/src/helper/clipboard.js +24 -10
  56. package/src/helper/converter.js +17 -12
  57. package/src/helper/dom/domCheck.js +22 -3
  58. package/src/helper/dom/domQuery.js +91 -45
  59. package/src/helper/dom/domUtils.js +93 -19
  60. package/src/helper/dom/index.js +4 -0
  61. package/src/helper/env.js +11 -7
  62. package/src/helper/keyCodeMap.js +4 -3
  63. package/src/langs/ckb.js +1 -1
  64. package/src/langs/cs.js +1 -1
  65. package/src/langs/da.js +1 -1
  66. package/src/langs/de.js +1 -1
  67. package/src/langs/en.js +1 -1
  68. package/src/langs/es.js +1 -1
  69. package/src/langs/fa.js +1 -1
  70. package/src/langs/fr.js +1 -1
  71. package/src/langs/he.js +1 -1
  72. package/src/langs/hu.js +1 -1
  73. package/src/langs/it.js +1 -1
  74. package/src/langs/ja.js +1 -1
  75. package/src/langs/km.js +1 -1
  76. package/src/langs/ko.js +1 -1
  77. package/src/langs/lv.js +1 -1
  78. package/src/langs/nl.js +1 -1
  79. package/src/langs/pl.js +1 -1
  80. package/src/langs/pt_br.js +10 -10
  81. package/src/langs/ro.js +1 -1
  82. package/src/langs/ru.js +1 -1
  83. package/src/langs/se.js +1 -1
  84. package/src/langs/tr.js +1 -1
  85. package/src/langs/uk.js +1 -1
  86. package/src/langs/ur.js +1 -1
  87. package/src/langs/zh_cn.js +1 -1
  88. package/src/modules/ApiManager.js +25 -18
  89. package/src/modules/Browser.js +52 -61
  90. package/src/modules/ColorPicker.js +37 -38
  91. package/src/modules/Controller.js +85 -79
  92. package/src/modules/Figure.js +275 -187
  93. package/src/modules/FileManager.js +86 -92
  94. package/src/modules/HueSlider.js +67 -35
  95. package/src/modules/Modal.js +84 -77
  96. package/src/modules/ModalAnchorEditor.js +62 -79
  97. package/src/modules/SelectMenu.js +89 -86
  98. package/src/plugins/browser/audioGallery.js +9 -5
  99. package/src/plugins/browser/fileBrowser.js +10 -6
  100. package/src/plugins/browser/fileGallery.js +9 -5
  101. package/src/plugins/browser/imageGallery.js +9 -5
  102. package/src/plugins/browser/videoGallery.js +11 -6
  103. package/src/plugins/command/blockquote.js +1 -0
  104. package/src/plugins/command/exportPDF.js +11 -8
  105. package/src/plugins/command/fileUpload.js +41 -29
  106. package/src/plugins/command/list_bulleted.js +2 -1
  107. package/src/plugins/command/list_numbered.js +2 -1
  108. package/src/plugins/dropdown/align.js +8 -2
  109. package/src/plugins/dropdown/backgroundColor.js +19 -11
  110. package/src/plugins/dropdown/font.js +15 -9
  111. package/src/plugins/dropdown/fontColor.js +19 -11
  112. package/src/plugins/dropdown/formatBlock.js +7 -2
  113. package/src/plugins/dropdown/hr.js +7 -3
  114. package/src/plugins/dropdown/layout.js +6 -2
  115. package/src/plugins/dropdown/lineHeight.js +8 -3
  116. package/src/plugins/dropdown/list.js +2 -1
  117. package/src/plugins/dropdown/paragraphStyle.js +15 -11
  118. package/src/plugins/dropdown/{table.js → table/index.js} +514 -362
  119. package/src/plugins/dropdown/template.js +6 -2
  120. package/src/plugins/dropdown/textStyle.js +7 -3
  121. package/src/plugins/field/mention.js +33 -27
  122. package/src/plugins/input/fontSize.js +44 -37
  123. package/src/plugins/input/pageNavigator.js +3 -2
  124. package/src/plugins/modal/audio.js +90 -85
  125. package/src/plugins/modal/drawing.js +58 -66
  126. package/src/plugins/modal/embed.js +193 -180
  127. package/src/plugins/modal/image.js +441 -439
  128. package/src/plugins/modal/link.js +31 -8
  129. package/src/plugins/modal/math.js +23 -22
  130. package/src/plugins/modal/video.js +233 -230
  131. package/src/plugins/popup/anchor.js +24 -18
  132. package/src/suneditor.js +69 -24
  133. package/src/typedef.js +42 -19
  134. package/types/assets/icons/defaultIcons.d.ts +8 -0
  135. package/types/core/class/char.d.ts +1 -1
  136. package/types/core/class/component.d.ts +29 -7
  137. package/types/core/class/format.d.ts +4 -354
  138. package/types/core/class/html.d.ts +13 -4
  139. package/types/core/class/inline.d.ts +263 -0
  140. package/types/core/class/listFormat.d.ts +135 -0
  141. package/types/core/class/menu.d.ts +10 -2
  142. package/types/core/class/offset.d.ts +24 -26
  143. package/types/core/class/selection.d.ts +2 -0
  144. package/types/core/class/toolbar.d.ts +24 -11
  145. package/types/core/class/ui.d.ts +1 -1
  146. package/types/core/class/viewer.d.ts +1 -1
  147. package/types/core/config/context.d.ts +157 -0
  148. package/types/core/config/frameContext.d.ts +367 -0
  149. package/types/core/config/options.d.ts +1119 -0
  150. package/types/core/editor.d.ts +101 -66
  151. package/types/core/event/actions/index.d.ts +47 -0
  152. package/types/core/event/effects/common.registry.d.ts +50 -0
  153. package/types/core/event/effects/keydown.registry.d.ts +73 -0
  154. package/types/core/event/effects/ruleHelpers.d.ts +31 -0
  155. package/types/core/{base → event}/eventManager.d.ts +15 -46
  156. package/types/core/event/executor.d.ts +6 -0
  157. package/types/core/event/handlers/handler_ww_input.d.ts +41 -0
  158. package/types/core/{base/eventHandlers/handler_ww_key_input.d.ts → event/handlers/handler_ww_key.d.ts} +4 -6
  159. package/types/core/event/ports.d.ts +255 -0
  160. package/types/core/event/reducers/keydown.reducer.d.ts +75 -0
  161. package/types/core/event/rules/keydown.rule.arrow.d.ts +8 -0
  162. package/types/core/event/rules/keydown.rule.backspace.d.ts +9 -0
  163. package/types/core/event/rules/keydown.rule.delete.d.ts +9 -0
  164. package/types/core/event/rules/keydown.rule.enter.d.ts +9 -0
  165. package/types/core/event/rules/keydown.rule.tab.d.ts +9 -0
  166. package/types/core/section/constructor.d.ts +101 -631
  167. package/types/core/section/documentType.d.ts +14 -4
  168. package/types/core/util/instanceCheck.d.ts +50 -0
  169. package/types/editorInjector/_classes.d.ts +4 -0
  170. package/types/editorInjector/_core.d.ts +17 -7
  171. package/types/editorInjector/index.d.ts +10 -2
  172. package/types/events.d.ts +1 -0
  173. package/types/helper/clipboard.d.ts +2 -2
  174. package/types/helper/converter.d.ts +6 -9
  175. package/types/helper/dom/domCheck.d.ts +7 -0
  176. package/types/helper/dom/domQuery.d.ts +19 -8
  177. package/types/helper/dom/domUtils.d.ts +24 -2
  178. package/types/helper/dom/index.d.ts +86 -1
  179. package/types/helper/env.d.ts +6 -1
  180. package/types/helper/index.d.ts +7 -1
  181. package/types/helper/keyCodeMap.d.ts +3 -3
  182. package/types/index.d.ts +23 -117
  183. package/types/langs/index.d.ts +2 -2
  184. package/types/modules/ApiManager.d.ts +1 -8
  185. package/types/modules/Browser.d.ts +4 -62
  186. package/types/modules/ColorPicker.d.ts +4 -21
  187. package/types/modules/Controller.d.ts +8 -64
  188. package/types/modules/Figure.d.ts +54 -50
  189. package/types/modules/FileManager.d.ts +1 -13
  190. package/types/modules/HueSlider.d.ts +13 -3
  191. package/types/modules/Modal.d.ts +0 -43
  192. package/types/modules/ModalAnchorEditor.d.ts +0 -73
  193. package/types/modules/SelectMenu.d.ts +0 -85
  194. package/types/modules/index.d.ts +3 -3
  195. package/types/plugins/browser/audioGallery.d.ts +29 -18
  196. package/types/plugins/browser/fileBrowser.d.ts +38 -27
  197. package/types/plugins/browser/fileGallery.d.ts +29 -18
  198. package/types/plugins/browser/imageGallery.d.ts +24 -16
  199. package/types/plugins/browser/videoGallery.d.ts +29 -18
  200. package/types/plugins/command/blockquote.d.ts +1 -0
  201. package/types/plugins/command/exportPDF.d.ts +18 -18
  202. package/types/plugins/command/fileUpload.d.ts +65 -45
  203. package/types/plugins/command/list_bulleted.d.ts +1 -0
  204. package/types/plugins/command/list_numbered.d.ts +1 -0
  205. package/types/plugins/dropdown/align.d.ts +13 -8
  206. package/types/plugins/dropdown/backgroundColor.d.ts +30 -19
  207. package/types/plugins/dropdown/font.d.ts +13 -12
  208. package/types/plugins/dropdown/fontColor.d.ts +30 -19
  209. package/types/plugins/dropdown/formatBlock.d.ts +13 -8
  210. package/types/plugins/dropdown/hr.d.ts +15 -11
  211. package/types/plugins/dropdown/layout.d.ts +15 -11
  212. package/types/plugins/dropdown/lineHeight.d.ts +16 -11
  213. package/types/plugins/dropdown/list.d.ts +1 -0
  214. package/types/plugins/dropdown/paragraphStyle.d.ts +31 -27
  215. package/types/plugins/dropdown/table/index.d.ts +582 -0
  216. package/types/plugins/dropdown/table.d.ts +41 -86
  217. package/types/plugins/dropdown/template.d.ts +15 -11
  218. package/types/plugins/dropdown/textStyle.d.ts +19 -11
  219. package/types/plugins/field/mention.d.ts +58 -56
  220. package/types/plugins/index.d.ts +38 -38
  221. package/types/plugins/input/fontSize.d.ts +46 -50
  222. package/types/plugins/modal/audio.d.ts +26 -56
  223. package/types/plugins/modal/drawing.d.ts +0 -85
  224. package/types/plugins/modal/embed.d.ts +15 -79
  225. package/types/plugins/modal/image.d.ts +24 -136
  226. package/types/plugins/modal/link.d.ts +34 -15
  227. package/types/plugins/modal/math.d.ts +0 -16
  228. package/types/plugins/modal/video.d.ts +17 -86
  229. package/types/plugins/popup/anchor.d.ts +1 -8
  230. package/types/suneditor.d.ts +70 -19
  231. package/types/typedef.d.ts +60 -46
  232. package/src/core/base/eventHandlers/handler_ww_key_input.js +0 -1200
  233. package/src/core/section/context.js +0 -102
  234. package/types/core/section/context.d.ts +0 -45
  235. package/types/langs/_Lang.d.ts +0 -194
  236. /package/src/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.js +0 -0
  237. /package/types/core/{section → base}/actives.d.ts +0 -0
  238. /package/types/core/{base/eventHandlers → event/handlers}/handler_toolbar.d.ts +0 -0
  239. /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.d.ts +0 -0
  240. /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.d.ts +0 -0
  241. /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_mouse.d.ts +0 -0
@@ -0,0 +1,263 @@
1
+ export default Inline;
2
+ export type InlineThis = Omit<Inline & Partial<__se__EditorInjector>, 'inline'>;
3
+ export type NodeStyleContainerType = {
4
+ ancestor?: (Node | null) | undefined;
5
+ offset?: (number | null) | undefined;
6
+ container?: (Node | null) | undefined;
7
+ endContainer?: (Node | null) | undefined;
8
+ };
9
+ /**
10
+ * @typedef {Omit<Inline & Partial<__se__EditorInjector>, 'inline'>} InlineThis
11
+ */
12
+ /**
13
+ * @typedef {Object} NodeStyleContainerType
14
+ * @property {?Node=} ancestor
15
+ * @property {?number=} offset
16
+ * @property {?Node=} container
17
+ * @property {?Node=} endContainer
18
+ */
19
+ /**
20
+ * @constructor
21
+ * @this {InlineThis}
22
+ * @description Classes related to editor inline formats such as style node like strong, span, etc.
23
+ * @param {__se__EditorCore} editor - The root editor instance
24
+ */
25
+ declare function Inline(this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>, editor: __se__EditorCore): void;
26
+ declare class Inline {
27
+ /**
28
+ * @typedef {Omit<Inline & Partial<__se__EditorInjector>, 'inline'>} InlineThis
29
+ */
30
+ /**
31
+ * @typedef {Object} NodeStyleContainerType
32
+ * @property {?Node=} ancestor
33
+ * @property {?number=} offset
34
+ * @property {?Node=} container
35
+ * @property {?Node=} endContainer
36
+ */
37
+ /**
38
+ * @constructor
39
+ * @this {InlineThis}
40
+ * @description Classes related to editor inline formats such as style node like strong, span, etc.
41
+ * @param {__se__EditorCore} editor - The root editor instance
42
+ */
43
+ constructor(editor: __se__EditorCore);
44
+ _listCamel: any;
45
+ _listKebab: any;
46
+ /**
47
+ * @this {InlineThis}
48
+ * @description Adds, updates, or deletes style nodes from selected text (a, span, strong, etc.).
49
+ * @param {?Node} styleNode The element to be added to the selection. If null, only existing nodes are modified or removed.
50
+ * @param {Object} [options] Options
51
+ * @param {Array<string>} [options.stylesToModify=null] Array of style or class names to check and modify.
52
+ * (e.g., ['font-size'], ['.className'], ['font-family', 'color', '.className'])
53
+ * @param {Array<string>} [options.nodesToRemove=null] Array of node names to remove.
54
+ * If empty array or null when styleNode is null, all formats are removed.
55
+ * (e.g., ['span'], ['strong', 'em'])
56
+ * @param {boolean} [options.strictRemove=false] If true, only removes nodes from nodesToRemove if all styles and classes are removed.
57
+ * @returns {HTMLElement} The element that was added to or modified in the selection.
58
+ *
59
+ * @details
60
+ * 1. If styleNode is provided, a node with the same tags and attributes is added to the selected text.
61
+ * 2. If the same tag already exists, only its attributes are updated.
62
+ * 3. If styleNode is null, existing nodes are updated or removed without adding new ones.
63
+ * 4. Styles matching those in stylesToModify are removed. (Use CSS attribute names, e.g., "background-color")
64
+ * 5. Classes matching those in stylesToModify (prefixed with ".") are removed.
65
+ * 6. stylesToModify is used to avoid duplicate property values from styleNode.
66
+ * 7. Nodes with all styles and classes removed are deleted if they match styleNode, are in nodesToRemove, or if styleNode is null.
67
+ * 8. Tags matching names in nodesToRemove are deleted regardless of their style and class.
68
+ * 9. If strictRemove is true, nodes in nodesToRemove are only removed if all their styles and classes are removed.
69
+ * 10. The function won't modify nodes if the parent has the same class and style values.
70
+ * - However, if nodesToRemove has values, it will work and separate text nodes even if there's no node to replace.
71
+ */
72
+ apply(
73
+ this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>,
74
+ styleNode: Node | null,
75
+ {
76
+ stylesToModify,
77
+ nodesToRemove,
78
+ strictRemove
79
+ }?: {
80
+ stylesToModify?: Array<string>;
81
+ nodesToRemove?: Array<string>;
82
+ strictRemove?: boolean;
83
+ }
84
+ ): HTMLElement;
85
+ /**
86
+ * @this {InlineThis}
87
+ * @description Remove format of the currently selected text.
88
+ */
89
+ remove(this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>): void;
90
+ /**
91
+ * @private
92
+ * @this {InlineThis}
93
+ * @description Nodes that must remain undetached when changing text nodes (A, Label, Code, Span:font-size)
94
+ * @param {Node|string} element Element to check
95
+ * @returns {boolean}
96
+ */
97
+ _isNonSplitNode(this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>, element: Node | string): boolean;
98
+ /**
99
+ * @private
100
+ * @this {InlineThis}
101
+ * @description Nodes that need to be added without modification when changing text nodes
102
+ * @param {Node} element Element to check
103
+ * @returns {boolean}
104
+ */
105
+ _isIgnoreNodeChange(this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>, element: Node): boolean;
106
+ /**
107
+ * @private
108
+ * @this {InlineThis}
109
+ * @description wraps text nodes of line selected text.
110
+ * @param {Node} element The node of the line that contains the selected text node.
111
+ * @param {Node} newInnerNode The dom that will wrap the selected text area
112
+ * @param {(current: Node) => Node|null} validation Check if the node should be stripped.
113
+ * @param {Node} startCon The startContainer property of the selection object.
114
+ * @param {number} startOff The startOffset property of the selection object.
115
+ * @param {Node} endCon The endContainer property of the selection object.
116
+ * @param {number} endOff The endOffset property of the selection object.
117
+ * @param {boolean} isRemoveFormat Is the remove all formats command?
118
+ * @param {boolean} isRemoveNode "newInnerNode" is remove node?
119
+ * @param {boolean} collapsed range.collapsed
120
+ * @returns {{ancestor: *, startContainer: *, startOffset: *, endContainer: *, endOffset: *}}
121
+ */
122
+ _setNode_oneLine(
123
+ this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>,
124
+ element: Node,
125
+ newInnerNode: Node,
126
+ validation: (current: Node) => Node | null,
127
+ startCon: Node,
128
+ startOff: number,
129
+ endCon: Node,
130
+ endOff: number,
131
+ isRemoveFormat: boolean,
132
+ isRemoveNode: boolean,
133
+ collapsed: boolean,
134
+ _removeCheck: any,
135
+ _getMaintainedNode: any,
136
+ _isMaintainedNode: any
137
+ ): {
138
+ ancestor: any;
139
+ startContainer: any;
140
+ startOffset: any;
141
+ endContainer: any;
142
+ endOffset: any;
143
+ };
144
+ /**
145
+ * @private
146
+ * @this {InlineThis}
147
+ * @description wraps first line selected text.
148
+ * @param {Node} element The node of the line that contains the selected text node.
149
+ * @param {Node} newInnerNode The dom that will wrap the selected text area
150
+ * @param {(current: Node) => Node|null} validation Check if the node should be stripped.
151
+ * @param {Node} startCon The startContainer property of the selection object.
152
+ * @param {number} startOff The startOffset property of the selection object.
153
+ * @param {boolean} isRemoveFormat Is the remove all formats command?
154
+ * @param {boolean} isRemoveNode "newInnerNode" is remove node?
155
+ * @returns {NodeStyleContainerType} { ancestor, container, offset, endContainer }
156
+ */
157
+ _setNode_startLine(
158
+ this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>,
159
+ element: Node,
160
+ newInnerNode: Node,
161
+ validation: (current: Node) => Node | null,
162
+ startCon: Node,
163
+ startOff: number,
164
+ isRemoveFormat: boolean,
165
+ isRemoveNode: boolean,
166
+ _removeCheck: any,
167
+ _getMaintainedNode: any,
168
+ _isMaintainedNode: any,
169
+ _endContainer: any
170
+ ): NodeStyleContainerType;
171
+ /**
172
+ * @private
173
+ * @this {InlineThis}
174
+ * @description wraps mid lines selected text.
175
+ * @param {HTMLElement} element The node of the line that contains the selected text node.
176
+ * @param {Node} newInnerNode The dom that will wrap the selected text area
177
+ * @param {(current: Node) => Node|null} validation Check if the node should be stripped.
178
+ * @param {boolean} isRemoveFormat Is the remove all formats command?
179
+ * @param {boolean} isRemoveNode "newInnerNode" is remove node?
180
+ * @param {Node} _endContainer Offset node of last line already modified (end.container)
181
+ * @returns {NodeStyleContainerType} { ancestor, endContainer: "If end container is renewed, returned renewed node" }
182
+ */
183
+ _setNode_middleLine(
184
+ this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>,
185
+ element: HTMLElement,
186
+ newInnerNode: Node,
187
+ validation: (current: Node) => Node | null,
188
+ isRemoveFormat: boolean,
189
+ isRemoveNode: boolean,
190
+ _removeCheck: any,
191
+ _endContainer: Node
192
+ ): NodeStyleContainerType;
193
+ /**
194
+ * @private
195
+ * @this {InlineThis}
196
+ * @description wraps last line selected text.
197
+ * @param {Node} element The node of the line that contains the selected text node.
198
+ * @param {Node} newInnerNode The dom that will wrap the selected text area
199
+ * @param {(current: Node) => Node|null} validation Check if the node should be stripped.
200
+ * @param {Node} endCon The endContainer property of the selection object.
201
+ * @param {number} endOff The endOffset property of the selection object.
202
+ * @param {boolean} isRemoveFormat Is the remove all formats command?
203
+ * @param {boolean} isRemoveNode "newInnerNode" is remove node?
204
+ * @returns {NodeStyleContainerType} { ancestor, container, offset }
205
+ */
206
+ _setNode_endLine(
207
+ this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>,
208
+ element: Node,
209
+ newInnerNode: Node,
210
+ validation: (current: Node) => Node | null,
211
+ endCon: Node,
212
+ endOff: number,
213
+ isRemoveFormat: boolean,
214
+ isRemoveNode: boolean,
215
+ _removeCheck: any,
216
+ _getMaintainedNode: any,
217
+ _isMaintainedNode: any
218
+ ): NodeStyleContainerType;
219
+ /**
220
+ * @private
221
+ * @this {InlineThis}
222
+ * @description Node with font-size style
223
+ * @param {Node} element Element to check
224
+ * @returns {boolean}
225
+ */
226
+ _sn_isSizeNode(this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>, element: Node): boolean;
227
+ /**
228
+ * @private
229
+ * @this {InlineThis}
230
+ * @description Return the parent maintained tag. (bind and use a util object)
231
+ * @param {boolean} _isRemove is remove anchor
232
+ * @param {boolean} _isSizeNode is size span node
233
+ * @param {Node} element Element
234
+ * @returns {Node|null}
235
+ */
236
+ _sn_getMaintainedNode(this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>, _isRemove: boolean, _isSizeNode: boolean, element: Node): Node | null;
237
+ /**
238
+ * @private
239
+ * @this {InlineThis}
240
+ * @description Check if element is a tag that should be persisted. (bind and use a util object)
241
+ * @param {boolean} _isRemove is remove anchor
242
+ * @param {boolean} _isSizeNode is size span node
243
+ * @param {Node} element Element
244
+ * @returns {boolean}
245
+ */
246
+ _sn_isMaintainedNode(this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>, _isRemove: boolean, _isSizeNode: boolean, element: Node): boolean;
247
+ /**
248
+ * @private
249
+ * @this {InlineThis}
250
+ * @description If certain styles are applied to all child nodes of the list cell, the style of the list cell is also changed. (bold, color, size)
251
+ * @param {Node} el List cell element. <li>
252
+ * @param {?Node} child Variable for recursive call. ("null" on the first call)
253
+ */
254
+ _sn_setCommonListStyle(this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>, el: Node, child: Node | null): void;
255
+ /**
256
+ * @private
257
+ * @this {InlineThis}
258
+ * @description Watch the applied text nodes and adjust the common styles of the list.
259
+ * @param {Node} el "LI" element
260
+ * @param {Array|null} styleArray Refer style array
261
+ */
262
+ _sn_resetCommonListCell(this: Omit<Inline & Partial<import('../../editorInjector').default>, 'inline'>, el: Node, styleArray: any[] | null): boolean;
263
+ }
@@ -0,0 +1,135 @@
1
+ export default ListFormat;
2
+ export type ListFormatThis = Omit<ListFormat & Partial<__se__EditorInjector>, 'ListFormat'>;
3
+ /**
4
+ * @typedef {Omit<ListFormat & Partial<__se__EditorInjector>, 'ListFormat'>} ListFormatThis
5
+ */
6
+ /**
7
+ * @constructor
8
+ * @this {ListFormatThis}
9
+ * @description Classes related to editor formats such as "list" (ol, ul, li)
10
+ * - "list" is a special "line", "block" format.
11
+ * @param {__se__EditorCore} editor - The root editor instance
12
+ */
13
+ declare function ListFormat(this: Omit<ListFormat & Partial<import('../../editorInjector').default>, 'ListFormat'>, editor: __se__EditorCore): void;
14
+ declare class ListFormat {
15
+ /**
16
+ * @typedef {Omit<ListFormat & Partial<__se__EditorInjector>, 'ListFormat'>} ListFormatThis
17
+ */
18
+ /**
19
+ * @constructor
20
+ * @this {ListFormatThis}
21
+ * @description Classes related to editor formats such as "list" (ol, ul, li)
22
+ * - "list" is a special "line", "block" format.
23
+ * @param {__se__EditorCore} editor - The root editor instance
24
+ */
25
+ constructor(editor: __se__EditorCore);
26
+ /**
27
+ * @this {ListFormatThis}
28
+ * @description Append all selected "line" element to the list and insert.
29
+ * @param {string} type List type. (ol | ul):[listStyleType]
30
+ * @param {Array<Node>} selectedCells "line" elements or list cells.
31
+ * @param {boolean} nested If true, indenting existing list cells.
32
+ */
33
+ apply(
34
+ this: Omit<ListFormat & Partial<import('../../editorInjector').default>, 'ListFormat'>,
35
+ type: string,
36
+ selectedCells: Array<Node>,
37
+ nested: boolean
38
+ ): {
39
+ sc: Node;
40
+ so: number;
41
+ ec: Node;
42
+ eo: number;
43
+ };
44
+ /**
45
+ * @this {ListFormatThis}
46
+ * @description "selectedCells" array are detached from the list element.
47
+ * - The return value is applied when the first and last lines of "selectedFormats" are "LI" respectively.
48
+ * @param {Array<Node>} selectedCells Array of ["line", li] elements(LI, P...) to remove.
49
+ * @param {boolean} shouldDelete If true, It does not just remove the list, it deletes the content.
50
+ * @returns {{sc: Node, ec: Node}} Node information after deletion
51
+ * - sc: Start container node
52
+ * - ec: End container node
53
+ */
54
+ remove(
55
+ this: Omit<ListFormat & Partial<import('../../editorInjector').default>, 'ListFormat'>,
56
+ selectedCells: Array<Node>,
57
+ shouldDelete: boolean
58
+ ): {
59
+ sc: Node;
60
+ ec: Node;
61
+ };
62
+ /**
63
+ * @this {ListFormatThis}
64
+ * @description Nest list cells or cancel nested cells.
65
+ * @param {Array<HTMLElement>} selectedCells List cells.
66
+ * @param {boolean} nested Nested or cancel nested.
67
+ */
68
+ applyNested(
69
+ this: Omit<ListFormat & Partial<import('../../editorInjector').default>, 'ListFormat'>,
70
+ selectedCells: Array<HTMLElement>,
71
+ nested: boolean
72
+ ): {
73
+ sc: Node;
74
+ so: number;
75
+ ec: Node;
76
+ eo: number;
77
+ };
78
+ /**
79
+ * @this {ListFormatThis}
80
+ * @description Detach Nested all nested lists under the "baseNode".
81
+ * - Returns a list with nested removed.
82
+ * @param {HTMLElement} baseNode Element on which to base.
83
+ * @param {boolean} all If true, it also detach all nested lists of a returned list.
84
+ * @returns {Node} Result element
85
+ */
86
+ removeNested(this: Omit<ListFormat & Partial<import('../../editorInjector').default>, 'ListFormat'>, baseNode: HTMLElement, all: boolean): Node;
87
+ /**
88
+ * @private
89
+ * @this {ListFormatThis}
90
+ * @description Attaches a nested list structure by merging adjacent lists if applicable.
91
+ * - Ensures that the nested list is placed correctly in the document structure.
92
+ * @param {Element} originList The original list element where the nested list is inserted.
93
+ * @param {Element} innerList The nested list element.
94
+ * @param {Element} prev The previous sibling element.
95
+ * @param {Element} next The next sibling element.
96
+ * @param {{s: Array<number> | null, e: Array<number> | null, sl: Node | null, el: Node | null}} nodePath Object storing the start and end node paths.
97
+ * - s : Start node path.
98
+ * - e : End node path.
99
+ * - sl : Start node's parent element.
100
+ * - el : End node's parent element.
101
+ * @returns {Node} The attached inner list.
102
+ */
103
+ _attachNested(
104
+ this: Omit<ListFormat & Partial<import('../../editorInjector').default>, 'ListFormat'>,
105
+ originList: Element,
106
+ innerList: Element,
107
+ prev: Element,
108
+ next: Element,
109
+ nodePath: {
110
+ s: Array<number> | null;
111
+ e: Array<number> | null;
112
+ sl: Node | null;
113
+ el: Node | null;
114
+ }
115
+ ): Node;
116
+ /**
117
+ * @private
118
+ * @this {ListFormatThis}
119
+ * @description Detaches a nested list structure by extracting list items from their parent list.
120
+ * - Ensures proper restructuring of the list elements.
121
+ * @param {Array<HTMLElement>} cells The list items to be detached.
122
+ * @returns {{cc: Node, sc: Node, ec: Node}} An object containing reference nodes for repositioning.
123
+ * - cc : The parent node of the first list item.
124
+ * - sc : The first list item.
125
+ * - ec : The last list item.
126
+ */
127
+ _detachNested(
128
+ this: Omit<ListFormat & Partial<import('../../editorInjector').default>, 'ListFormat'>,
129
+ cells: Array<HTMLElement>
130
+ ): {
131
+ cc: Node;
132
+ sc: Node;
133
+ ec: Node;
134
+ };
135
+ }
@@ -42,9 +42,9 @@ declare class Menu {
42
42
  mousemove: any;
43
43
  mouseout: any;
44
44
  };
45
- _bindClose_dropdown_mouse: any;
45
+ _bindClose_dropdown_mouse: __se__GlobalEventInfo;
46
46
  _bindClose_dropdown_key: any;
47
- _bindClose_cons_mouse: any;
47
+ _bindClose_cons_mouse: __se__GlobalEventInfo;
48
48
  currentDropdownPlugin: any;
49
49
  __menuBtn: Node;
50
50
  __menuContainer: HTMLElement;
@@ -96,6 +96,14 @@ declare class Menu {
96
96
  * @param {HTMLElement} menu Menu element
97
97
  */
98
98
  _setMenuPosition(this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>, element: Node, menu: HTMLElement): void;
99
+ /**
100
+ * @private
101
+ * @this {MenuThis}
102
+ * @description Reset the menu position.
103
+ * @param {Node} element Button element
104
+ * @param {HTMLElement} menu Menu element
105
+ */
106
+ _resetMenuPosition(this: Omit<Menu & Partial<import('../../editorInjector').default>, 'menu'>, element: Node, menu: HTMLElement): void;
99
107
  /**
100
108
  * @private
101
109
  * @this {MenuThis}
@@ -75,21 +75,21 @@ export type OffsetGlobalInfo = {
75
75
  */
76
76
  left: number;
77
77
  /**
78
- * - The total width of the element, including its content, padding, and border.
78
+ * - The top position within the current viewport, without taking scrolling into account.
79
79
  */
80
- width: number;
80
+ fixedTop: number;
81
81
  /**
82
- * - The total height of the element, including its content, padding, and border.
82
+ * - The left position within the current viewport, without taking scrolling into account.
83
83
  */
84
- height: number;
84
+ fixedLeft: number;
85
85
  /**
86
- * - The amount of vertical scrolling applied to the element.
86
+ * - The total width of the element, including its content, padding, and border.
87
87
  */
88
- scrollTop: number;
88
+ width: number;
89
89
  /**
90
- * - The amount of horizontal scrolling applied to the element.
90
+ * - The total height of the element, including its content, padding, and border.
91
91
  */
92
- scrollLeft: number;
92
+ height: number;
93
93
  };
94
94
  export type OffsetGlobalScrollInfo = {
95
95
  /**
@@ -205,10 +205,10 @@ export type OffsetWWScrollInfo = {
205
205
  * @typedef {Object} OffsetGlobalInfo
206
206
  * @property {number} top - The top position of the element relative to the entire document.
207
207
  * @property {number} left - The left position of the element relative to the entire document.
208
+ * @property {number} fixedTop - The top position within the current viewport, without taking scrolling into account.
209
+ * @property {number} fixedLeft - The left position within the current viewport, without taking scrolling into account.
208
210
  * @property {number} width - The total width of the element, including its content, padding, and border.
209
211
  * @property {number} height - The total height of the element, including its content, padding, and border.
210
- * @property {number} scrollTop - The amount of vertical scrolling applied to the element.
211
- * @property {number} scrollLeft - The amount of horizontal scrolling applied to the element.
212
212
  */
213
213
  /**
214
214
  * @typedef {Object} OffsetGlobalScrollInfo
@@ -274,10 +274,10 @@ declare class Offset {
274
274
  * @typedef {Object} OffsetGlobalInfo
275
275
  * @property {number} top - The top position of the element relative to the entire document.
276
276
  * @property {number} left - The left position of the element relative to the entire document.
277
+ * @property {number} fixedTop - The top position within the current viewport, without taking scrolling into account.
278
+ * @property {number} fixedLeft - The left position within the current viewport, without taking scrolling into account.
277
279
  * @property {number} width - The total width of the element, including its content, padding, and border.
278
280
  * @property {number} height - The total height of the element, including its content, padding, and border.
279
- * @property {number} scrollTop - The amount of vertical scrolling applied to the element.
280
- * @property {number} scrollLeft - The amount of horizontal scrolling applied to the element.
281
281
  */
282
282
  /**
283
283
  * @typedef {Object} OffsetGlobalScrollInfo
@@ -312,10 +312,6 @@ declare class Offset {
312
312
  * @param {__se__EditorCore} editor - The root editor instance
313
313
  */
314
314
  constructor(editor: __se__EditorCore);
315
- _scrollEvent: any;
316
- _elTop: number;
317
- _scrollY: number;
318
- _isFixed: boolean;
319
315
  /**
320
316
  * @this {OffsetThis}
321
317
  * @description Gets the position just outside the argument's internal editor (wysiwygFrame).
@@ -333,6 +329,7 @@ declare class Offset {
333
329
  /**
334
330
  * @this {OffsetThis}
335
331
  * @description Returns the position of the argument relative to the global document.
332
+ * This is a refactored version using getBoundingClientRect for better performance and accuracy.
336
333
  * @param {?Node=} node Target element.
337
334
  * @returns {OffsetGlobalInfo} Global position and scroll values.
338
335
  */
@@ -357,9 +354,8 @@ declare class Offset {
357
354
  * @param {HTMLElement} e_container Element's root container
358
355
  * @param {HTMLElement} target Target element to position against
359
356
  * @param {HTMLElement} t_container Target's root container
360
- * @param {boolean} _reload Whether to reload position
361
357
  */
362
- setRelPosition(this: Omit<Offset & Partial<import('../../editorInjector').default>, 'offset'>, element: HTMLElement, e_container: HTMLElement, target: HTMLElement, t_container: HTMLElement, _reload: boolean): void;
358
+ setRelPosition(this: Omit<Offset & Partial<import('../../editorInjector').default>, 'offset'>, element: HTMLElement, e_container: HTMLElement, target: HTMLElement, t_container: HTMLElement): void;
363
359
  /**
364
360
  * @this {OffsetThis}
365
361
  * @description Sets the absolute position of an element
@@ -370,6 +366,7 @@ declare class Offset {
370
366
  * @param {{left:number, top:number}} [params.addOffset={left:0, top:0}] Additional offset
371
367
  * @param {"bottom"|"top"} [params.position="bottom"] Position ('bottom'|'top')
372
368
  * @param {*} params.inst Instance object of caller
369
+ * @param {HTMLElement} [params.sibling] The sibling controller element
373
370
  * @returns {{position: "top" | "bottom"} | undefined} Success -> {position: current position}
374
371
  */
375
372
  setAbsPosition(
@@ -384,6 +381,7 @@ declare class Offset {
384
381
  };
385
382
  position?: 'bottom' | 'top';
386
383
  inst: any;
384
+ sibling?: HTMLElement;
387
385
  }
388
386
  ):
389
387
  | {
@@ -459,7 +457,12 @@ declare class Offset {
459
457
  * @param {RectsInfo} targetRect Target rect object
460
458
  * @param {boolean} isTargetAbs Is target absolute position
461
459
  * @param {OffsetWWScrollInfo} wwScroll WYSIWYG scroll info
462
- * @returns {{rmt:number, rmb:number, rt:number}} Margin values (rmt: top margin, rmb: bottom margin, rt: Toolbar height offset adjustment)
460
+ * @returns {{rmt:number, rmb:number, rt:number, tMargin:number, bMargin:number}} Margin values
461
+ * - rmt: top margin to frame
462
+ * - rmb: bottom margin to frame
463
+ * - rt: Toolbar height offset adjustment
464
+ * - tMargin: top margin
465
+ * - bMargin: bottom margin
463
466
  */
464
467
  _getVMargin(
465
468
  this: Omit<Offset & Partial<import('../../editorInjector').default>, 'offset'>,
@@ -477,6 +480,8 @@ declare class Offset {
477
480
  rmt: number;
478
481
  rmb: number;
479
482
  rt: number;
483
+ tMargin: number;
484
+ bMargin: number;
480
485
  };
481
486
  /**
482
487
  * @private
@@ -512,11 +517,4 @@ declare class Offset {
512
517
  bottom: number;
513
518
  rects: RectsInfo;
514
519
  };
515
- /**
516
- * @private
517
- * @this {OffsetThis}
518
- * @description Removes the global scroll event listener from the editor.
519
- * - Resets related scroll tracking properties.
520
- */
521
- __removeGlobalEvent(this: Omit<Offset & Partial<import('../../editorInjector').default>, 'offset'>): void;
522
520
  }
@@ -33,6 +33,8 @@ declare class Selection_ {
33
33
  /** @type {HTMLElement|Text} */
34
34
  selectionNode: HTMLElement | Text;
35
35
  __iframeFocus: boolean;
36
+ __hasScrollParents: boolean;
37
+ _scrollMargin: number;
36
38
  /**
37
39
  * @this {SelectionThis}
38
40
  * @description Get window selection obejct
@@ -9,10 +9,10 @@ export type ToolbarThis = Omit<Toolbar & Partial<__se__EditorInjector>, 'toolbar
9
9
  * @description Toolbar class
10
10
  * @param {__se__EditorCore} editor - The root editor instance
11
11
  * @param {Object} options - toolbar options
12
- * @param {String} options.keyName - toolbar key name
13
- * @param {Boolean} options.balloon - balloon toolbar
14
- * @param {Boolean} options.inline - inline toolbar
15
- * @param {Boolean} options.balloonAlways - balloon toolbar always show
12
+ * @param {"toolbar"|"toolbar_sub"} options.keyName - toolbar key name
13
+ * @param {boolean} options.balloon - balloon toolbar
14
+ * @param {boolean} options.inline - inline toolbar
15
+ * @param {boolean} options.balloonAlways - balloon toolbar always show
16
16
  * @param {Array<Node>} options.res - responsive toolbar button list
17
17
  */
18
18
  declare function Toolbar(
@@ -25,7 +25,7 @@ declare function Toolbar(
25
25
  balloonAlways,
26
26
  res
27
27
  }: {
28
- keyName: string;
28
+ keyName: 'toolbar' | 'toolbar_sub';
29
29
  balloon: boolean;
30
30
  inline: boolean;
31
31
  balloonAlways: boolean;
@@ -42,10 +42,10 @@ declare class Toolbar {
42
42
  * @description Toolbar class
43
43
  * @param {__se__EditorCore} editor - The root editor instance
44
44
  * @param {Object} options - toolbar options
45
- * @param {String} options.keyName - toolbar key name
46
- * @param {Boolean} options.balloon - balloon toolbar
47
- * @param {Boolean} options.inline - inline toolbar
48
- * @param {Boolean} options.balloonAlways - balloon toolbar always show
45
+ * @param {"toolbar"|"toolbar_sub"} options.keyName - toolbar key name
46
+ * @param {boolean} options.balloon - balloon toolbar
47
+ * @param {boolean} options.inline - inline toolbar
48
+ * @param {boolean} options.balloonAlways - balloon toolbar always show
49
49
  * @param {Array<Node>} options.res - responsive toolbar button list
50
50
  */
51
51
  constructor(
@@ -57,15 +57,22 @@ declare class Toolbar {
57
57
  balloonAlways,
58
58
  res
59
59
  }: {
60
- keyName: string;
60
+ keyName: 'toolbar' | 'toolbar_sub';
61
61
  balloon: boolean;
62
62
  inline: boolean;
63
63
  balloonAlways: boolean;
64
64
  res: Array<Node>;
65
65
  }
66
66
  );
67
- keyName: string;
68
67
  isSub: boolean;
68
+ /**
69
+ * @type {Object}
70
+ * @description Key names for the toolbar elements.
71
+ * @property {"toolbar_sub_main"|"toolbar_main"} main - Main toolbar key name
72
+ * @property {"toolbar_sub_buttonTray"|"toolbar_buttonTray"} buttonTray - Button tray key name
73
+ * @property {"toolbar_sub_width"|"toolbar_width"} width - Toolbar width key name
74
+ */
75
+ keyName: any;
69
76
  currentMoreLayerActiveButton: HTMLButtonElement;
70
77
  _isBalloon: boolean;
71
78
  _isInline: boolean;
@@ -120,6 +127,12 @@ declare class Toolbar {
120
127
  * @param {Array} buttonList Button list
121
128
  */
122
129
  setButtons(this: Omit<Toolbar & Partial<import('../../editorInjector').default>, 'toolbar' | 'subToolbar'>, buttonList: any[]): void;
130
+ /**
131
+ * @private
132
+ * @this {ToolbarThis}
133
+ * @description Reset the common buttons info.
134
+ */
135
+ _resetButtonInfo(this: Omit<Toolbar & Partial<import('../../editorInjector').default>, 'toolbar' | 'subToolbar'>): void;
123
136
  /**
124
137
  * @private
125
138
  * @this {ToolbarThis}
@@ -30,7 +30,7 @@ declare class UI {
30
30
  _alertInner: HTMLElement;
31
31
  _closeListener: any[];
32
32
  _closeSignal: boolean;
33
- _bindClose: any;
33
+ _bindClose: __se__GlobalEventInfo;
34
34
  _backWrapper: HTMLElement;
35
35
  toastPopup: HTMLElement;
36
36
  toastContainer: Element;
@@ -33,7 +33,7 @@ declare class Viewer {
33
33
  fullScreenSticky: boolean;
34
34
  fullScreenBalloon: boolean;
35
35
  fullScreenInline: boolean;
36
- toolbarParent: any;
36
+ toolbarParent: HTMLElement;
37
37
  /**
38
38
  * @this {ViewerThis}
39
39
  * @description Changes to code view or wysiwyg view