suneditor 3.1.3 → 3.2.0

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 (219) hide show
  1. package/dist/suneditor-contents.min.css +1 -1
  2. package/dist/suneditor.min.css +28 -1
  3. package/dist/suneditor.min.js +1 -1
  4. package/package.json +2 -1
  5. package/src/assets/design/color.css +12 -0
  6. package/src/assets/design/size.css +9 -2
  7. package/src/assets/icons/defaultIcons.js +96 -47
  8. package/src/assets/suneditor-contents.css +3 -2
  9. package/src/assets/suneditor.css +480 -31
  10. package/src/core/config/contextProvider.js +2 -1
  11. package/src/core/config/eventManager.js +41 -2
  12. package/src/core/config/optionProvider.js +23 -2
  13. package/src/core/editor.js +32 -14
  14. package/src/core/event/actions/index.js +76 -9
  15. package/src/core/event/effects/common.registry.js +2 -1
  16. package/src/core/event/effects/keydown.registry.js +169 -33
  17. package/src/core/event/effects/ruleHelpers.js +20 -6
  18. package/src/core/event/eventOrchestrator.js +136 -23
  19. package/src/core/event/handlers/handler_toolbar.js +4 -2
  20. package/src/core/event/handlers/handler_ww_dragDrop.js +10 -0
  21. package/src/core/event/handlers/handler_ww_input.js +9 -2
  22. package/src/core/event/handlers/handler_ww_key.js +86 -17
  23. package/src/core/event/handlers/handler_ww_mouse.js +45 -8
  24. package/src/core/event/ports.js +23 -5
  25. package/src/core/event/reducers/keydown.reducer.js +15 -2
  26. package/src/core/event/rules/keydown.rule.arrow.js +12 -2
  27. package/src/core/event/rules/keydown.rule.backspace.js +110 -15
  28. package/src/core/event/rules/keydown.rule.delete.js +62 -7
  29. package/src/core/event/rules/keydown.rule.enter.js +62 -31
  30. package/src/core/event/support/defaultLineManager.js +9 -2
  31. package/src/core/event/support/selectionState.js +13 -3
  32. package/src/core/kernel/coreKernel.js +1 -0
  33. package/src/core/logic/dom/char.js +13 -3
  34. package/src/core/logic/dom/format.js +171 -39
  35. package/src/core/logic/dom/html.js +357 -87
  36. package/src/core/logic/dom/inline.js +229 -34
  37. package/src/core/logic/dom/listFormat.js +111 -20
  38. package/src/core/logic/dom/nodeTransform.js +36 -11
  39. package/src/core/logic/dom/offset.js +116 -31
  40. package/src/core/logic/dom/selection.js +147 -29
  41. package/src/core/logic/panel/blockHandle.js +785 -0
  42. package/src/core/logic/panel/blockResolver.js +278 -0
  43. package/src/core/logic/panel/finder.js +16 -6
  44. package/src/core/logic/panel/menu.js +119 -18
  45. package/src/core/logic/panel/toolbar.js +75 -19
  46. package/src/core/logic/panel/viewer.js +76 -20
  47. package/src/core/logic/shell/_commandExecutor.js +44 -9
  48. package/src/core/logic/shell/commandDispatcher.js +46 -4
  49. package/src/core/logic/shell/component.js +102 -25
  50. package/src/core/logic/shell/focusManager.js +13 -3
  51. package/src/core/logic/shell/history.js +21 -6
  52. package/src/core/logic/shell/pluginManager.js +21 -13
  53. package/src/core/logic/shell/shortcuts.js +9 -1
  54. package/src/core/logic/shell/ui.js +139 -37
  55. package/src/core/schema/frameContext.js +34 -3
  56. package/src/core/schema/options.js +61 -19
  57. package/src/core/section/constructor.js +537 -103
  58. package/src/core/section/documentType.js +35 -6
  59. package/src/helper/converter.js +24 -7
  60. package/src/helper/dom/domCheck.js +25 -5
  61. package/src/helper/dom/domQuery.js +2 -1
  62. package/src/helper/dom/domUtils.js +17 -4
  63. package/src/helper/env.js +11 -2
  64. package/src/helper/keyCodeMap.js +6 -2
  65. package/src/helper/markdown.js +24 -5
  66. package/src/helper/msOffice.js +9 -2
  67. package/src/interfaces/plugins.js +1 -1
  68. package/src/langs/ckb.js +0 -1
  69. package/src/langs/cs.js +0 -1
  70. package/src/langs/da.js +0 -1
  71. package/src/langs/de.js +0 -1
  72. package/src/langs/en.js +0 -1
  73. package/src/langs/es.js +0 -1
  74. package/src/langs/fa.js +0 -1
  75. package/src/langs/fr.js +0 -1
  76. package/src/langs/he.js +0 -1
  77. package/src/langs/hu.js +0 -1
  78. package/src/langs/index.js +27 -1
  79. package/src/langs/it.js +0 -1
  80. package/src/langs/ja.js +0 -1
  81. package/src/langs/km.js +0 -1
  82. package/src/langs/ko.js +0 -1
  83. package/src/langs/lv.js +0 -1
  84. package/src/langs/nl.js +0 -1
  85. package/src/langs/pl.js +0 -1
  86. package/src/langs/pt_br.js +0 -1
  87. package/src/langs/ro.js +0 -1
  88. package/src/langs/ru.js +0 -1
  89. package/src/langs/se.js +0 -1
  90. package/src/langs/tr.js +0 -1
  91. package/src/langs/uk.js +0 -1
  92. package/src/langs/ur.js +0 -1
  93. package/src/langs/zh_cn.js +0 -1
  94. package/src/modules/contract/Browser.js +68 -23
  95. package/src/modules/contract/ColorPicker.js +12 -4
  96. package/src/modules/contract/Controller.js +37 -7
  97. package/src/modules/contract/Figure.js +159 -36
  98. package/src/modules/contract/HueSlider.js +27 -4
  99. package/src/modules/contract/Modal.js +62 -11
  100. package/src/modules/manager/FileManager.js +50 -8
  101. package/src/modules/ui/CommandMenu.js +597 -0
  102. package/src/modules/ui/ModalAnchorEditor.js +41 -9
  103. package/src/modules/ui/SelectMenu.js +481 -36
  104. package/src/modules/ui/index.js +1 -0
  105. package/src/plugins/browser/audioGallery.js +8 -1
  106. package/src/plugins/browser/fileBrowser.js +15 -2
  107. package/src/plugins/browser/fileGallery.js +8 -1
  108. package/src/plugins/browser/imageGallery.js +24 -3
  109. package/src/plugins/browser/videoGallery.js +19 -4
  110. package/src/plugins/command/blockquote.js +6 -1
  111. package/src/plugins/command/codeBlock.js +43 -5
  112. package/src/plugins/command/exportPDF.js +20 -4
  113. package/src/plugins/command/fileUpload.js +46 -11
  114. package/src/plugins/command/list_bulleted.js +6 -1
  115. package/src/plugins/command/list_numbered.js +6 -1
  116. package/src/plugins/dropdown/align.js +21 -33
  117. package/src/plugins/dropdown/backgroundColor.js +10 -2
  118. package/src/plugins/dropdown/blockStyle.js +17 -22
  119. package/src/plugins/dropdown/font.js +34 -34
  120. package/src/plugins/dropdown/hr.js +15 -43
  121. package/src/plugins/dropdown/layout.js +10 -27
  122. package/src/plugins/dropdown/lineHeight.js +10 -33
  123. package/src/plugins/dropdown/list.js +19 -25
  124. package/src/plugins/dropdown/paragraphStyle.js +16 -24
  125. package/src/plugins/dropdown/table/index.js +72 -17
  126. package/src/plugins/dropdown/table/render/table.html.js +3 -1
  127. package/src/plugins/dropdown/table/services/table.cell.js +33 -7
  128. package/src/plugins/dropdown/table/services/table.clipboard.js +5 -1
  129. package/src/plugins/dropdown/table/services/table.grid.js +40 -9
  130. package/src/plugins/dropdown/table/services/table.resize.js +55 -11
  131. package/src/plugins/dropdown/table/services/table.selection.js +27 -7
  132. package/src/plugins/dropdown/table/services/table.style.js +120 -20
  133. package/src/plugins/dropdown/template.js +13 -29
  134. package/src/plugins/dropdown/textStyle.js +22 -35
  135. package/src/plugins/field/autocomplete.js +8 -4
  136. package/src/plugins/field/slashCommand.js +297 -0
  137. package/src/plugins/index.js +3 -0
  138. package/src/plugins/input/fontSize.js +37 -8
  139. package/src/plugins/input/pageNavigator.js +7 -1
  140. package/src/plugins/modal/audio.js +71 -17
  141. package/src/plugins/modal/drawing.js +41 -11
  142. package/src/plugins/modal/embed.js +132 -22
  143. package/src/plugins/modal/image/index.js +115 -28
  144. package/src/plugins/modal/image/services/image.size.js +9 -2
  145. package/src/plugins/modal/image/services/image.upload.js +38 -4
  146. package/src/plugins/modal/link.js +9 -2
  147. package/src/plugins/modal/math.js +10 -2
  148. package/src/plugins/modal/video/index.js +112 -26
  149. package/src/plugins/modal/video/render/video.html.js +4 -1
  150. package/src/plugins/modal/video/services/video.size.js +15 -4
  151. package/src/plugins/modal/video/services/video.upload.js +10 -2
  152. package/src/plugins/popup/anchor.js +14 -2
  153. package/src/suneditor.js +8 -2
  154. package/src/themes/cobalt.css +12 -0
  155. package/src/themes/cream.css +12 -0
  156. package/src/themes/dark.css +12 -0
  157. package/src/themes/midnight.css +12 -0
  158. package/src/typedef.js +32 -21
  159. package/types/assets/icons/defaultIcons.d.ts +1 -0
  160. package/types/core/config/contextProvider.d.ts +7 -1
  161. package/types/core/config/eventManager.d.ts +37 -4
  162. package/types/core/config/optionProvider.d.ts +5 -1
  163. package/types/core/event/actions/index.d.ts +44 -6
  164. package/types/core/event/effects/keydown.registry.d.ts +37 -7
  165. package/types/core/event/effects/ruleHelpers.d.ts +6 -1
  166. package/types/core/event/eventOrchestrator.d.ts +6 -1
  167. package/types/core/event/handlers/handler_ww_clipboard.d.ts +15 -3
  168. package/types/core/event/handlers/handler_ww_dragDrop.d.ts +14 -2
  169. package/types/core/event/handlers/handler_ww_input.d.ts +10 -2
  170. package/types/core/event/handlers/handler_ww_key.d.ts +10 -2
  171. package/types/core/event/handlers/handler_ww_mouse.d.ts +25 -5
  172. package/types/core/event/ports.d.ts +7 -2
  173. package/types/core/event/rules/keydown.rule.backspace.d.ts +6 -1
  174. package/types/core/kernel/store.d.ts +4 -1
  175. package/types/core/logic/dom/format.d.ts +32 -14
  176. package/types/core/logic/dom/html.d.ts +11 -3
  177. package/types/core/logic/dom/nodeTransform.d.ts +6 -6
  178. package/types/core/logic/panel/blockHandle.d.ts +64 -0
  179. package/types/core/logic/panel/blockResolver.d.ts +50 -0
  180. package/types/core/logic/panel/menu.d.ts +72 -3
  181. package/types/core/logic/shell/commandDispatcher.d.ts +8 -0
  182. package/types/core/logic/shell/component.d.ts +5 -3
  183. package/types/core/logic/shell/shortcuts.d.ts +10 -1
  184. package/types/core/logic/shell/ui.d.ts +7 -1
  185. package/types/core/schema/context.d.ts +7 -1
  186. package/types/core/schema/frameContext.d.ts +36 -4
  187. package/types/core/schema/options.d.ts +110 -37
  188. package/types/core/section/constructor.d.ts +38 -1
  189. package/types/events.d.ts +208 -32
  190. package/types/helper/converter.d.ts +4 -2
  191. package/types/helper/dom/domCheck.d.ts +12 -2
  192. package/types/helper/dom/domQuery.d.ts +35 -7
  193. package/types/helper/dom/domUtils.d.ts +4 -1
  194. package/types/interfaces/plugins.d.ts +2 -2
  195. package/types/langs/_Lang.d.ts +0 -1
  196. package/types/modules/contract/Browser.d.ts +7 -7
  197. package/types/modules/contract/ColorPicker.d.ts +2 -2
  198. package/types/modules/contract/Controller.d.ts +7 -0
  199. package/types/modules/contract/Figure.d.ts +31 -4
  200. package/types/modules/ui/CommandMenu.d.ts +262 -0
  201. package/types/modules/ui/ModalAnchorEditor.d.ts +6 -1
  202. package/types/modules/ui/SelectMenu.d.ts +56 -3
  203. package/types/modules/ui/index.d.ts +1 -0
  204. package/types/plugins/browser/audioGallery.d.ts +17 -1
  205. package/types/plugins/browser/fileBrowser.d.ts +17 -1
  206. package/types/plugins/browser/fileGallery.d.ts +17 -1
  207. package/types/plugins/browser/imageGallery.d.ts +17 -1
  208. package/types/plugins/browser/videoGallery.d.ts +17 -1
  209. package/types/plugins/dropdown/align.d.ts +1 -1
  210. package/types/plugins/dropdown/blockStyle.d.ts +3 -1
  211. package/types/plugins/dropdown/table/index.d.ts +4 -1
  212. package/types/plugins/dropdown/table/services/table.clipboard.d.ts +5 -1
  213. package/types/plugins/dropdown/table/services/table.grid.d.ts +10 -2
  214. package/types/plugins/field/autocomplete.d.ts +0 -1
  215. package/types/plugins/field/slashCommand.d.ts +165 -0
  216. package/types/plugins/index.d.ts +3 -0
  217. package/types/plugins/modal/embed.d.ts +34 -0
  218. package/types/plugins/modal/link.d.ts +4 -1
  219. package/types/typedef.d.ts +48 -23
@@ -54,16 +54,16 @@ declare class NodeTransform {
54
54
  /**
55
55
  * @description Remove nested tags without other child nodes.
56
56
  * @param {Node} element Element object
57
- * @param {?(((current: Node) => boolean)|string)} [validation] Validation function / String(`tag1|tag2..`) / If `null`, all tags are applicable.
57
+ * @param {?(((current: *) => boolean)|string)} [validation] Validation function / String(`tag1|tag2..`) / If `null`, all tags are applicable.
58
58
  * @example
59
59
  * editor.$.nodeTransform.mergeNestedTags(parentElement, (current) => current.nodeName === 'SPAN');
60
60
  */
61
- mergeNestedTags(element: Node, validation?: (((current: Node) => boolean) | string) | null): void;
61
+ mergeNestedTags(element: Node, validation?: (((current: any) => boolean) | string) | null): void;
62
62
  /**
63
63
  * @description Delete itself and all parent nodes that match the condition.
64
64
  * - Returns an {sc: previousSibling, ec: nextSibling}(the deleted node reference) or `null`.
65
65
  * @param {Node} item Node to be remove
66
- * @param {?(current: Node) => boolean} [validation] Validation function. default(Deleted if it only have `breakLine` and blanks)
66
+ * @param {?(current: *) => boolean} [validation] Validation function. default(Deleted if it only have `breakLine` and blanks)
67
67
  * @param {?Node} [stopParent] Stop when the parent node reaches `stopParent`
68
68
  * @returns {{sc: Node|null, ec: Node|null}|null} {sc: previousSibling, ec: nextSibling} (the deleted node reference) or `null`.
69
69
  * @example
@@ -82,7 +82,7 @@ declare class NodeTransform {
82
82
  */
83
83
  removeAllParents(
84
84
  item: Node,
85
- validation?: ((current: Node) => boolean) | null,
85
+ validation?: ((current: any) => boolean) | null,
86
86
  stopParent?: Node | null,
87
87
  ): {
88
88
  sc: Node | null;
@@ -98,7 +98,7 @@ declare class NodeTransform {
98
98
  /**
99
99
  * @description Creates a nested node structure from the given array of nodes.
100
100
  * @param {SunEditor.NodeCollection} nodeArray An array of nodes to clone. The first node in the array will be the top-level parent.
101
- * @param {?(current: Node) => boolean} [validate] A validate function.
101
+ * @param {?(current: *) => boolean} [validate] A validate function.
102
102
  * @returns {{ parent: Node, inner: Node }} An object containing the top-level parent node and the innermost child node.
103
103
  * @example
104
104
  * // [div, span, em] → <div><span><em></em></span></div> (cloned)
@@ -114,7 +114,7 @@ declare class NodeTransform {
114
114
  */
115
115
  createNestedNode(
116
116
  nodeArray: SunEditor.NodeCollection,
117
- validate?: ((current: Node) => boolean) | null,
117
+ validate?: ((current: any) => boolean) | null,
118
118
  ): {
119
119
  parent: Node;
120
120
  inner: Node;
@@ -0,0 +1,64 @@
1
+ import type {} from '../../../typedef';
2
+ export default BlockHandle;
3
+ /**
4
+ * @class
5
+ * @description Block handle UI — appears in the left gutter on block hover.
6
+ */
7
+ declare class BlockHandle {
8
+ /**
9
+ * @constructor
10
+ * @param {SunEditor.Deps} $ - Kernel dependencies
11
+ * @param {HTMLElement} blockHandleArea - Container (.se-block-handle-area)
12
+ * @param {HTMLElement} blockHandle - Handle group (.se-block-handle)
13
+ * @param {HTMLElement} blockHandlePlus - Plus button
14
+ * @param {HTMLElement} blockHandleDrag - Drag button
15
+ * @param {Array<string | { title: string, icon?: string, action: function(SunEditor.Deps, { block: HTMLElement }): void }>|null} menuConfig
16
+ * Menu entries. Strings resolve via `ResolveButton` (plugin names, built-in commands). Objects
17
+ * define a custom row whose `action` is invoked with the Deps bag and the current block element.
18
+ */
19
+ constructor(
20
+ $: SunEditor.Deps,
21
+ blockHandleArea: HTMLElement,
22
+ blockHandle: HTMLElement,
23
+ blockHandlePlus: HTMLElement,
24
+ blockHandleDrag: HTMLElement,
25
+ menuConfig: Array<
26
+ | string
27
+ | {
28
+ title: string;
29
+ icon?: string;
30
+ action: (
31
+ arg0: SunEditor.Deps,
32
+ arg1: {
33
+ block: HTMLElement;
34
+ },
35
+ ) => void;
36
+ }
37
+ > | null,
38
+ );
39
+ /**
40
+ * @description Position the block handle for the given mouse target. Uses rAF throttle.
41
+ * Called from wysiwyg mousemove.
42
+ * @param {Node} eventTarget - The element under the mouse cursor
43
+ * @param {number} [mouseY] - Mouse clientY for nested list resolution
44
+ */
45
+ positionForTarget(eventTarget: Node, mouseY?: number): void;
46
+ /**
47
+ * @description Schedule hiding the block handle with a short delay.
48
+ * @param {MouseEvent} e - Mouse event
49
+ */
50
+ hide(e: MouseEvent): void;
51
+ /**
52
+ * @description Immediately hide the block handle (no delay).
53
+ */
54
+ hideNow(): void;
55
+ /**
56
+ * @description Sync handle position on editor scroll. Closes menu if open.
57
+ */
58
+ syncScroll(): void;
59
+ /**
60
+ * @description Cleanup — remove listeners, destroy menus, null references.
61
+ */
62
+ destroy(): void;
63
+ #private;
64
+ }
@@ -0,0 +1,50 @@
1
+ import type {} from '../../../typedef';
2
+ /**
3
+ * @description Resolve any DOM node inside the editor to its owning block-level element.
4
+ * @param {Node|null} node - Any DOM node inside the editor
5
+ * @param {FormatAPI} format - Injected format methods (getLine, getBlock, isLine, isBlock)
6
+ * @param {HTMLElement} wysiwygFrame - The wysiwyg root element
7
+ * @param {number} [mouseY] - Mouse clientY for nested list resolution
8
+ * @returns {BlockInfo|null} Block information, or null if node is outside editable area
9
+ */
10
+ export function resolveBlock(
11
+ node: Node | null,
12
+ format: FormatAPI,
13
+ wysiwygFrame: HTMLElement,
14
+ mouseY?: number,
15
+ ): BlockInfo | null;
16
+ export type BlockInfo = {
17
+ /**
18
+ * - The resolved block-level DOM element
19
+ */
20
+ element: HTMLElement;
21
+ /**
22
+ * - Block type: 'p', 'heading', 'list', 'blockquote', 'pre', 'figure', 'table', 'div'
23
+ */
24
+ type: string;
25
+ /**
26
+ * - Nesting level from wysiwyg root (0 = top-level)
27
+ */
28
+ depth: number;
29
+ /**
30
+ * - Parent block element, or null if top-level
31
+ */
32
+ parent: HTMLElement | null;
33
+ /**
34
+ * - Adjacent blocks at same depth
35
+ */
36
+ siblings: {
37
+ prev: HTMLElement | null;
38
+ next: HTMLElement | null;
39
+ };
40
+ /**
41
+ * - getBoundingClientRect() of the element (caller handles scroll/iframe offset)
42
+ */
43
+ rect: DOMRect;
44
+ };
45
+ export type FormatAPI = {
46
+ getLine: (node: Node, validation?: (current: any) => boolean) => HTMLElement | null;
47
+ getBlock: (element: Node, validation?: (current: any) => boolean) => HTMLElement | null;
48
+ isLine: (element: Node) => boolean;
49
+ isBlock: (element: Node) => boolean;
50
+ };
@@ -1,5 +1,62 @@
1
1
  import type {} from '../../../typedef';
2
2
  export default Menu;
3
+ export type DropdownItem = {
4
+ /**
5
+ * - `data-command` attribute value
6
+ */
7
+ command: string;
8
+ /**
9
+ * - `data-value` attribute value
10
+ */
11
+ value?: string;
12
+ /**
13
+ * - Title text (used for `title` and `aria-label`)
14
+ */
15
+ title: string;
16
+ /**
17
+ * - Button inner HTML content
18
+ */
19
+ innerHTML: string;
20
+ /**
21
+ * - Additional CSS class for the `<button>`
22
+ */
23
+ className?: string;
24
+ /**
25
+ * - Extra data attributes (e.g. `{ 'data-class': 'xxx' }`)
26
+ */
27
+ attrs?: {
28
+ [x: string]: string;
29
+ };
30
+ /**
31
+ * - Rendered button element (set by `initDropdownTarget`)
32
+ */
33
+ _element?: HTMLElement;
34
+ };
35
+ /**
36
+ * @typedef {Object} DropdownItem
37
+ * @property {string} command - `data-command` attribute value
38
+ * @property {string} [value] - `data-value` attribute value
39
+ * @property {string} title - Title text (used for `title` and `aria-label`)
40
+ * @property {string} innerHTML - Button inner HTML content
41
+ * @property {string} [className] - Additional CSS class for the `<button>`
42
+ * @property {Object<string, string>} [attrs] - Extra data attributes (e.g. `{ 'data-class': 'xxx' }`)
43
+ * @property {HTMLElement} [_element] - Rendered button element (set by `initDropdownTarget`)
44
+ */
45
+ /**
46
+ * @description Creates a dropdown menu element from standardized item objects.
47
+ * @param {Array<DropdownItem>} items - Menu items
48
+ * @param {Object} [options]
49
+ * @param {string} [options.className] - Additional class for the wrapper `<div>`
50
+ * @param {string} [options.prependHTML] - HTML to prepend inside the `<ul>` (e.g. default value items)
51
+ * @returns {HTMLElement}
52
+ */
53
+ export function CreateDropdownMenu(
54
+ items: Array<DropdownItem>,
55
+ options?: {
56
+ className?: string;
57
+ prependHTML?: string;
58
+ },
59
+ ): HTMLElement;
3
60
  /**
4
61
  * @description Dropdown and container menu management class
5
62
  */
@@ -13,6 +70,10 @@ declare class Menu {
13
70
  targetMap: {
14
71
  [x: string]: HTMLElement;
15
72
  };
73
+ /** @type {Object<string, Array<DropdownItem>>} Structured items keyed by plugin name */
74
+ itemsMap: {
75
+ [x: string]: DropdownItem[];
76
+ };
16
77
  index: number;
17
78
  menus: any[];
18
79
  currentButton: HTMLButtonElement;
@@ -28,7 +89,11 @@ declare class Menu {
28
89
  * @description Method for managing dropdown element.
29
90
  * - You must add the `dropdown` element using this method at custom plugin.
30
91
  * @param {{key: string, type: string}} classObj Class object
31
- * @param {Node} menu Dropdown element
92
+ * @param {Node|Array<DropdownItem>} menuOrItems Dropdown element or array of standardized items
93
+ * @param {Object} [options] Options when passing items array
94
+ * @param {string} [options.className] Additional CSS class for the wrapper element
95
+ * @param {string} [options.prependHTML] HTML to prepend inside the `<ul>` (e.g. default/sub-list items)
96
+ * @returns {HTMLElement} The registered menu element
32
97
  */
33
98
  initDropdownTarget(
34
99
  {
@@ -38,8 +103,12 @@ declare class Menu {
38
103
  key: string;
39
104
  type: string;
40
105
  },
41
- menu: Node,
42
- ): void;
106
+ menuOrItems: Node | Array<DropdownItem>,
107
+ options?: {
108
+ className?: string;
109
+ prependHTML?: string;
110
+ },
111
+ ): HTMLElement;
43
112
  /**
44
113
  * @description Opens the dropdown menu for the specified button.
45
114
  * @param {Node} button Dropdown's button element to call
@@ -50,6 +50,14 @@ export default class CommandDispatcher {
50
50
  * @param {HTMLButtonElement} target - The associated command button.
51
51
  */
52
52
  registerTargets(cmd: string, target: HTMLButtonElement): void;
53
+ /**
54
+ * @description Inverse of {@link registerTargets}. Removes a previously registered target so
55
+ * ephemeral participants (e.g. CommandMenu rows) can opt out of the active-state pass on close.
56
+ * Drops the command entry when its target array empties.
57
+ * @param {string} cmd - The command identifier.
58
+ * @param {HTMLElement} target - The target previously registered.
59
+ */
60
+ unregisterTargets(cmd: string, target: HTMLElement): void;
53
61
  resetTargets(): void;
54
62
  /**
55
63
  * @internal
@@ -25,10 +25,12 @@ declare class Component {
25
25
  */
26
26
  currentTarget: Node | null;
27
27
  /**
28
- * @description Currently selected component plugin instance
29
- * @type {*}
28
+ * @description Currently selected component plugin instance (a full plugin) or a
29
+ * launcher stand-in for non-plugin components (e.g. `pageBreak`). Consumers call the
30
+ * shared component hooks (`componentDestroy`/`componentSelect`/`componentDeselect`) on it.
31
+ * @type {?SunEditor.ComponentLauncher}
30
32
  */
31
- currentPlugin: any;
33
+ currentPlugin: SunEditor.ComponentLauncher | null;
32
34
  /**
33
35
  * @description Currently selected component plugin name
34
36
  * @type {*}
@@ -107,7 +107,16 @@ declare class Shortcuts {
107
107
  * @param {Range} range The current range object
108
108
  * @returns {boolean} Whether to execute shortcuts
109
109
  */
110
- command(event: KeyboardEvent, ctrl: boolean, shift: boolean, keyCode: string, text: string, edge: boolean, line: HTMLElement, range: Range): boolean;
110
+ command(
111
+ event: KeyboardEvent,
112
+ ctrl: boolean,
113
+ shift: boolean,
114
+ keyCode: string,
115
+ text: string,
116
+ edge: boolean,
117
+ line: HTMLElement,
118
+ range: Range,
119
+ ): boolean;
111
120
  /**
112
121
  * @description Disable the shortcut activation.
113
122
  */
@@ -160,7 +160,12 @@ declare class UIManager {
160
160
  /**
161
161
  * @param {SunEditor.FrameContext} rt Root target[key] FrameContext
162
162
  */
163
- reset(rt: SunEditor.FrameContext): void;
163
+ /**
164
+ * @description Block handle instance for external access.
165
+ * @type {BlockHandle}
166
+ */
167
+ get blockHandle(): BlockHandle;
168
+ reset(rt: any): void;
164
169
  /**
165
170
  * @internal
166
171
  * @description Closes all open controllers except those marked as `fixed`.
@@ -259,3 +264,4 @@ declare class UIManager {
259
264
  opendBrowser: any;
260
265
  #private;
261
266
  }
267
+ import BlockHandle from '../panel/blockHandle.js';
@@ -38,7 +38,13 @@ import type {} from '../../typedef';
38
38
  * @param {?Element} statusbarContainer - Status bar container element.
39
39
  * @returns {SunEditor.Context} - A map of key DOM nodes used throughout the editor.
40
40
  */
41
- export function CreateContext(toolbar: Element, toolbarContainer: Element | null, menuTray: Element, subbar: Element | null, statusbarContainer: Element | null): SunEditor.Context;
41
+ export function CreateContext(
42
+ toolbar: Element,
43
+ toolbarContainer: Element | null,
44
+ menuTray: Element,
45
+ subbar: Element | null,
46
+ statusbarContainer: Element | null,
47
+ ): SunEditor.Context;
42
48
  /**
43
49
  * This object stores **global editor-level UI references** for a SunEditor instance.
44
50
  *
@@ -33,6 +33,7 @@ import type {} from '../../typedef';
33
33
  * @property {HTMLTextAreaElement} markdown - Markdown view editing element (a <textarea>).
34
34
  * @property {HTMLTextAreaElement} markdownNumbers - Element displaying line numbers in markdown view mode.
35
35
  * @property {HTMLElement} placeholder - Placeholder element shown when the editor is empty.
36
+ * @property {string} placeholder_line - Per-line placeholder text, rendered via a `::before` on the focused empty line.
36
37
  * @property {HTMLElement} statusbar - Editor status bar element (for resizing, info, etc.).
37
38
  * @property {HTMLElement} navigation - Navigation element (e.g., for outline or bookmarks).
38
39
  * @property {HTMLElement} charWrapper - Wrapper for the character counter element.
@@ -45,6 +46,10 @@ import type {} from '../../typedef';
45
46
  * === UI Utilities & Visual Components ===
46
47
  * @property {HTMLElement} lineBreaker_t - Top floating line-breaker UI element (for line insertion).
47
48
  * @property {HTMLElement} lineBreaker_b - Bottom floating line-breaker UI element (for line insertion).
49
+ * @property {?HTMLElement} blockHandleArea - Gutter container (`.se-block-handle-area`) holding the per-line block handle. `null` when the `blockHandle` option is disabled.
50
+ * @property {?HTMLElement} blockHandle - Block handle group (`.se-block-handle`) containing the plus and drag buttons. `null` when disabled.
51
+ * @property {?HTMLElement} blockHandlePlus - Plus button (`.se-block-handle-plus`) — inserts a new line after the current block. `null` when disabled.
52
+ * @property {?HTMLElement} blockHandleDrag - Drag button (`.se-block-handle-drag`) — opens the action menu / starts drag-to-reorder. `null` when disabled.
48
53
  * @property {HTMLElement} [_stickyDummy] - Placeholder element used for sticky toolbar behavior.
49
54
  * @property {HTMLElement} [_toolbarShadow] - Shadow element below the toolbar for visual effects.
50
55
  * @property {{main: HTMLElement, border: HTMLElement, display: HTMLElement, handles: HTMLElement[]}} [_figure] - Current active figure component (image, table, etc.).
@@ -88,8 +93,11 @@ import type {} from '../../typedef';
88
93
  * @param {HTMLElement} wwFrame Editor wysiwyg frame
89
94
  * @param {HTMLElement} codeWrapper Editor code view wrapper
90
95
  * @param {HTMLElement} codeFrame Editor code view frame
91
- * @param {{inner: HTMLElement, page: HTMLElement, pageMirror: HTMLElement}} documentTypeInner Document type elements
96
+ * @param {?HTMLElement} markdownWrapper Editor markdown view wrapper (only present when the markdown view button is enabled)
97
+ * @param {?HTMLElement} markdownFrame Editor markdown view frame (only present when the markdown view button is enabled)
92
98
  * @param {?HTMLElement} statusbar Editor statusbar
99
+ * @param {{inner: HTMLElement, page: HTMLElement, pageMirror: HTMLElement}} documentTypeInner Document type elements
100
+ * @param {?HTMLElement} blockHandleArea Block handle gutter (`.se-block-handle-area`). `null` when the `blockHandle` option is disabled.
93
101
  * @param {*} key root key
94
102
  * @returns {FrameContexType}
95
103
  */
@@ -103,14 +111,15 @@ export function CreateFrameContext(
103
111
  wwFrame: HTMLElement,
104
112
  codeWrapper: HTMLElement,
105
113
  codeFrame: HTMLElement,
106
- markdownWrapper: any,
107
- markdownFrame: any,
114
+ markdownWrapper: HTMLElement | null,
115
+ markdownFrame: HTMLElement | null,
108
116
  statusbar: HTMLElement | null,
109
117
  documentTypeInner: {
110
118
  inner: HTMLElement;
111
119
  page: HTMLElement;
112
120
  pageMirror: HTMLElement;
113
121
  },
122
+ blockHandleArea: HTMLElement | null,
114
123
  key: any,
115
124
  ): FrameContexType;
116
125
  /**
@@ -118,7 +127,10 @@ export function CreateFrameContext(
118
127
  * @param {HTMLElement} statusbar Statusbar element
119
128
  * @param {FrameContexType|import('../config/contextProvider').FrameContextMap} mapper FrameContext map
120
129
  */
121
- export function UpdateStatusbarContext(statusbar: HTMLElement, mapper: FrameContexType | import('../config/contextProvider').FrameContextMap): void;
130
+ export function UpdateStatusbarContext(
131
+ statusbar: HTMLElement,
132
+ mapper: FrameContexType | import('../config/contextProvider').FrameContextMap,
133
+ ): void;
122
134
  /**
123
135
  * This object stores **all frame-specific states and DOM references** for a SunEditor instance.
124
136
  *
@@ -201,6 +213,10 @@ export type FrameContextStore = {
201
213
  * - Placeholder element shown when the editor is empty.
202
214
  */
203
215
  placeholder: HTMLElement;
216
+ /**
217
+ * - Per-line placeholder text, rendered via a `::before` on the focused empty line.
218
+ */
219
+ placeholder_line: string;
204
220
  /**
205
221
  * - Editor status bar element (for resizing, info, etc.).
206
222
  */
@@ -243,6 +259,22 @@ export type FrameContextStore = {
243
259
  * - Bottom floating line-breaker UI element (for line insertion).
244
260
  */
245
261
  lineBreaker_b: HTMLElement;
262
+ /**
263
+ * - Gutter container (`.se-block-handle-area`) holding the per-line block handle. `null` when the `blockHandle` option is disabled.
264
+ */
265
+ blockHandleArea: HTMLElement | null;
266
+ /**
267
+ * - Block handle group (`.se-block-handle`) containing the plus and drag buttons. `null` when disabled.
268
+ */
269
+ blockHandle: HTMLElement | null;
270
+ /**
271
+ * - Plus button (`.se-block-handle-plus`) — inserts a new line after the current block. `null` when disabled.
272
+ */
273
+ blockHandlePlus: HTMLElement | null;
274
+ /**
275
+ * - Drag button (`.se-block-handle-drag`) — opens the action menu / starts drag-to-reorder. `null` when disabled.
276
+ */
277
+ blockHandleDrag: HTMLElement | null;
246
278
  /**
247
279
  * - Placeholder element used for sticky toolbar behavior.
248
280
  */