suneditor 3.1.4 → 3.2.1

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 (217) 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 +481 -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 +162 -30
  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 +84 -2
  22. package/src/core/event/handlers/handler_ww_key.js +82 -21
  23. package/src/core/event/handlers/handler_ww_mouse.js +45 -8
  24. package/src/core/event/ports.js +27 -13
  25. package/src/core/event/reducers/keydown.reducer.js +33 -5
  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 +350 -72
  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 +46 -4
  57. package/src/core/section/constructor.js +537 -106
  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 +58 -14
  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 +156 -36
  98. package/src/modules/contract/HueSlider.js +27 -4
  99. package/src/modules/contract/Modal.js +50 -10
  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 +33 -6
  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 +2 -1
  106. package/src/plugins/browser/fileBrowser.js +9 -2
  107. package/src/plugins/browser/fileGallery.js +2 -1
  108. package/src/plugins/browser/imageGallery.js +18 -3
  109. package/src/plugins/browser/videoGallery.js +13 -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 +92 -22
  143. package/src/plugins/modal/image/index.js +114 -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 +13 -3
  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 +11 -4
  173. package/types/core/event/reducers/keydown.reducer.d.ts +12 -3
  174. package/types/core/event/rules/keydown.rule.backspace.d.ts +6 -1
  175. package/types/core/kernel/store.d.ts +4 -1
  176. package/types/core/logic/dom/format.d.ts +32 -14
  177. package/types/core/logic/dom/html.d.ts +11 -3
  178. package/types/core/logic/dom/nodeTransform.d.ts +6 -6
  179. package/types/core/logic/panel/blockHandle.d.ts +64 -0
  180. package/types/core/logic/panel/blockResolver.d.ts +50 -0
  181. package/types/core/logic/panel/menu.d.ts +72 -3
  182. package/types/core/logic/shell/commandDispatcher.d.ts +8 -0
  183. package/types/core/logic/shell/component.d.ts +5 -3
  184. package/types/core/logic/shell/shortcuts.d.ts +10 -1
  185. package/types/core/logic/shell/ui.d.ts +7 -1
  186. package/types/core/schema/context.d.ts +7 -1
  187. package/types/core/schema/frameContext.d.ts +36 -4
  188. package/types/core/schema/options.d.ts +83 -2
  189. package/types/core/section/constructor.d.ts +38 -1
  190. package/types/events.d.ts +208 -32
  191. package/types/helper/converter.d.ts +4 -2
  192. package/types/helper/dom/domCheck.d.ts +12 -2
  193. package/types/helper/dom/domQuery.d.ts +35 -7
  194. package/types/helper/dom/domUtils.d.ts +4 -1
  195. package/types/interfaces/plugins.d.ts +2 -2
  196. package/types/langs/_Lang.d.ts +0 -1
  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/SelectMenu.d.ts +56 -3
  202. package/types/modules/ui/index.d.ts +1 -0
  203. package/types/plugins/browser/audioGallery.d.ts +1 -1
  204. package/types/plugins/browser/fileBrowser.d.ts +1 -1
  205. package/types/plugins/browser/fileGallery.d.ts +1 -1
  206. package/types/plugins/browser/imageGallery.d.ts +1 -1
  207. package/types/plugins/browser/videoGallery.d.ts +1 -1
  208. package/types/plugins/dropdown/align.d.ts +1 -1
  209. package/types/plugins/dropdown/blockStyle.d.ts +3 -1
  210. package/types/plugins/dropdown/table/index.d.ts +4 -1
  211. package/types/plugins/dropdown/table/services/table.clipboard.d.ts +5 -1
  212. package/types/plugins/dropdown/table/services/table.grid.d.ts +10 -2
  213. package/types/plugins/field/autocomplete.d.ts +0 -1
  214. package/types/plugins/field/slashCommand.d.ts +165 -0
  215. package/types/plugins/index.d.ts +3 -0
  216. package/types/plugins/modal/link.d.ts +4 -1
  217. package/types/typedef.d.ts +48 -23
@@ -54,7 +54,9 @@ export namespace DEFAULTS {
54
54
  *
55
55
  * === Content & Editing ===
56
56
  * @property {string} [value=""] - Initial value for the editor.
57
- * @property {string} [placeholder=""] - Placeholder text.
57
+ * @property {string} [placeholder=""] - Placeholder text shown when the whole editor is empty.
58
+ * @property {string} [placeholder_line=""] - per-line placeholder shown on the focused
59
+ * line when that line is empty. Takes priority over `placeholder` while a line is focused.
58
60
  * @property {Object<string, string>} [editableFrameAttributes={spellcheck: "false"}] - Attributes for the editable frame[.sun-editor-editable].
59
61
  * ```js
60
62
  * { editableFrameAttributes: { spellcheck: 'true', autocomplete: 'on' } }
@@ -65,6 +67,13 @@ export namespace DEFAULTS {
65
67
  * @property {string|number} [width="100%"] - Width for the editor.
66
68
  * @property {string|number} [minWidth=""] - Min width for the editor.
67
69
  * @property {string|number} [maxWidth=""] - Max width for the editor.
70
+ * @property {string} [innerWidth=""] - Optional max-width for the editor body (`.se-wrapper`).
71
+ * - **CSS length** (`"740px"`, `"60ch"`): editor body's content is clamped to this width and centered horizontally; scroll container stays full width (scrollbar at the outer edge, wheel/touch active over the whole area).
72
+ * - **`"auto"`** or **empty string** (default): no constraint — natural full-width layout with default content padding.
73
+ * - In `blockHandle` mode, the gutter handle tracks the centered text band.
74
+ * ```js
75
+ * { innerWidth: '740px' }
76
+ * ```
68
77
  * @property {string|number} [height="auto"] - Height for the editor.
69
78
  * @property {string|number} [minHeight=""] - Min height for the editor.
70
79
  * @property {string|number} [maxHeight=""] - Max height for the editor.
@@ -233,6 +242,22 @@ export namespace DEFAULTS {
233
242
  * === Modes & Themes ===
234
243
  * @property {boolean} [v2Migration=false] - Enables migration mode for SunEditor v2.
235
244
  * @property {"classic"|"inline"|"balloon"|"balloon-always"|"classic:bottom"|"inline:bottom"} [mode="classic"] - Toolbar mode: `classic`, `inline`, `balloon`, `balloon-always`. Append `:bottom` to place toolbar at the bottom (e.g. `classic:bottom`, `inline:bottom`).
245
+ * @property {Object} [blockHandle] - Block handle configuration. When provided, a per-line block handle UI is shown. Works independently of `mode`.
246
+ * @property {Array<string | { title: string, icon?: string, action: (deps: SunEditor.Deps, ctx: { block: HTMLElement }) => void }>} [blockHandle.menu] - Menu entries.
247
+ * - **String entries** — resolved via `ResolveButton`. Accepts the same values as toolbar `buttonList`:
248
+ * - **Block format keys**: `p`, `h1`-`h6`, `heading` (H1-H6 submenu), `ul`, `ol`, `list` (UL/OL submenu), `blockquote`, `pre`.
249
+ * - **Plugin names**: Any registered plugin name (e.g. `blockStyle`, `align`, `image`, `link`). Dropdown plugins display their items as a submenu. Modal plugins open the modal on click.
250
+ * - **Built-in commands**: `bold`, `italic`, `underline`, `strike`, `undo`, `redo`, etc.
251
+ * - **Custom item objects** — `{ title, icon?, action }`. `icon` is an icon key from `$.icons` or a raw `<svg>` HTML string; `action` is invoked with `($, { block })`.
252
+ * - Defaults to `['p', 'heading', 'list', 'blockquote', 'pre']`.
253
+ * ```js
254
+ * blockHandle: {
255
+ * menu: [
256
+ * 'p', 'heading', 'blockStyle',
257
+ * { title: 'Duplicate', icon: 'copy', action: ($, { block }) => block.after(block.cloneNode(true)) },
258
+ * ],
259
+ * }
260
+ * ```
236
261
  * @property {string} [type=""] - Editor type. Use `"document"` for a document-style layout, with optional sub-types after `:`.
237
262
  * ```js
238
263
  * // type
@@ -416,6 +441,15 @@ export namespace DEFAULTS {
416
441
  * @property {boolean} [syncTabIndent=true] - Synchronizes tab indent with spaces.
417
442
  * @property {boolean} [tabDisable=false] - Disables tab key input.
418
443
  * @property {string} [toolbar_width="auto"] - Toolbar width.
444
+ * @property {string} [toolbar_innerWidth=""] - Center the toolbar's button row (`.se-btn-tray`) horizontally.
445
+ * - **CSS length** (e.g. `"500px"`, `"740px"`, `"60ch"`): toolbar background spans full width while the button row is capped at that width and centered. If buttons fit, the row stays on a single line; if they exceed the cap, they wrap inside it.
446
+ * - **`"auto"`**: no cap — the row is sized to its content and simply centered.
447
+ * - **Empty string** (default): no constraint.
448
+ * - **Note on `responsiveButtonList`**: thresholds compare against the toolbar's full width, not the band. When this option is set, calibrate `responsiveButtonList` keys around the toolbar size you actually want each button set to kick in at.
449
+ * ```js
450
+ * { toolbar_innerWidth: '740px' }
451
+ * { toolbar_innerWidth: 'auto' }
452
+ * ```
419
453
  * @property {?HTMLElement} [toolbar_container] - Container element for the toolbar.
420
454
  * @property {number|{top: number, offset: number}} [toolbar_sticky=0] - Enables sticky toolbar.
421
455
  * - `number`: Sets the sticky top position (px). Use `-1` to disable sticky.
@@ -550,6 +584,7 @@ export namespace DEFAULTS {
550
584
  * @property {import('../../plugins/modal/link.js').LinkPluginOptions} [link]
551
585
  * @property {import('../../plugins/modal/math.js').MathPluginOptions} [math]
552
586
  * @property {import('../../plugins/dropdown/paragraphStyle.js').ParagraphStylePluginOptions} [paragraphStyle]
587
+ * @property {import('../../plugins/field/slashCommand.js').SlashCommandPluginOptions} [slashCommand]
553
588
  * @property {import('../../plugins/dropdown/table/index.js').TablePluginOptions} [table]
554
589
  * @property {import('../../plugins/dropdown/template.js').TemplatePluginOptions} [template]
555
590
  * @property {import('../../plugins/dropdown/textStyle.js').TextStylePluginOptions} [textStyle]
@@ -626,9 +661,14 @@ export type EditorFrameOptions = {
626
661
  */
627
662
  value?: string;
628
663
  /**
629
- * - Placeholder text.
664
+ * - Placeholder text shown when the whole editor is empty.
630
665
  */
631
666
  placeholder?: string;
667
+ /**
668
+ * - per-line placeholder shown on the focused
669
+ * line when that line is empty. Takes priority over `placeholder` while a line is focused.
670
+ */
671
+ placeholder_line?: string;
632
672
  /**
633
673
  * - Attributes for the editable frame[.sun-editor-editable].
634
674
  * ```js
@@ -653,6 +693,16 @@ export type EditorFrameOptions = {
653
693
  * - Max width for the editor.
654
694
  */
655
695
  maxWidth?: string | number;
696
+ /**
697
+ * - Optional max-width for the editor body (`.se-wrapper`).
698
+ * - **CSS length** (`"740px"`, `"60ch"`): editor body's content is clamped to this width and centered horizontally; scroll container stays full width (scrollbar at the outer edge, wheel/touch active over the whole area).
699
+ * - **`"auto"`** or **empty string** (default): no constraint — natural full-width layout with default content padding.
700
+ * - In `blockHandle` mode, the gutter handle tracks the centered text band.
701
+ * ```js
702
+ * { innerWidth: '740px' }
703
+ * ```
704
+ */
705
+ innerWidth?: string;
656
706
  /**
657
707
  * - Height for the editor.
658
708
  */
@@ -941,6 +991,24 @@ export type EditorBaseOptions = {
941
991
  * - Toolbar mode: `classic`, `inline`, `balloon`, `balloon-always`. Append `:bottom` to place toolbar at the bottom (e.g. `classic:bottom`, `inline:bottom`).
942
992
  */
943
993
  mode?: 'classic' | 'inline' | 'balloon' | 'balloon-always' | 'classic:bottom' | 'inline:bottom';
994
+ /**
995
+ * - Block handle configuration. When provided, a per-line block handle UI is shown. Works independently of `mode`.
996
+ */
997
+ blockHandle?: {
998
+ menu?: Array<
999
+ | string
1000
+ | {
1001
+ title: string;
1002
+ icon?: string;
1003
+ action: (
1004
+ deps: SunEditor.Deps,
1005
+ ctx: {
1006
+ block: HTMLElement;
1007
+ },
1008
+ ) => void;
1009
+ }
1010
+ >;
1011
+ };
944
1012
  /**
945
1013
  * - Editor type. Use `"document"` for a document-style layout, with optional sub-types after `:`.
946
1014
  * ```js
@@ -1231,6 +1299,18 @@ export type EditorBaseOptions = {
1231
1299
  * - Toolbar width.
1232
1300
  */
1233
1301
  toolbar_width?: string;
1302
+ /**
1303
+ * - Center the toolbar's button row (`.se-btn-tray`) horizontally.
1304
+ * - **CSS length** (e.g. `"500px"`, `"740px"`, `"60ch"`): toolbar background spans full width while the button row is capped at that width and centered. If buttons fit, the row stays on a single line; if they exceed the cap, they wrap inside it.
1305
+ * - **`"auto"`**: no cap — the row is sized to its content and simply centered.
1306
+ * - **Empty string** (default): no constraint.
1307
+ * - **Note on `responsiveButtonList`**: thresholds compare against the toolbar's full width, not the band. When this option is set, calibrate `responsiveButtonList` keys around the toolbar size you actually want each button set to kick in at.
1308
+ * ```js
1309
+ * { toolbar_innerWidth: '740px' }
1310
+ * { toolbar_innerWidth: 'auto' }
1311
+ * ```
1312
+ */
1313
+ toolbar_innerWidth?: string;
1234
1314
  /**
1235
1315
  * - Container element for the toolbar.
1236
1316
  */
@@ -1450,6 +1530,7 @@ export type EditorBaseOptions = {
1450
1530
  link?: import('../../plugins/modal/link.js').LinkPluginOptions;
1451
1531
  math?: import('../../plugins/modal/math.js').MathPluginOptions;
1452
1532
  paragraphStyle?: import('../../plugins/dropdown/paragraphStyle.js').ParagraphStylePluginOptions;
1533
+ slashCommand?: import('../../plugins/field/slashCommand.js').SlashCommandPluginOptions;
1453
1534
  table?: import('../../plugins/dropdown/table/index.js').TablePluginOptions;
1454
1535
  template?: import('../../plugins/dropdown/template.js').TemplatePluginOptions;
1455
1536
  textStyle?: import('../../plugins/dropdown/textStyle.js').TextStylePluginOptions;
@@ -8,7 +8,14 @@ import type {} from '../../typedef';
8
8
  * @param {Array} rc `_reverseCommandArray` option
9
9
  * @param {Set} reverseKeys Reverse key array
10
10
  */
11
- export function CreateShortcuts(command: string, button: Element | null, values: Array<string>, keyMap: Map<string, any>, rc: any[], reverseKeys: Set<any>): void;
11
+ export function CreateShortcuts(
12
+ command: string,
13
+ button: Element | null,
14
+ values: Array<string>,
15
+ keyMap: Map<string, any>,
16
+ rc: any[],
17
+ reverseKeys: Set<any>,
18
+ ): void;
12
19
  /**
13
20
  * @typedef {Object} InitOptionsReturnType
14
21
  * @property {Map<string, *>} o - Processed base options (`Map` containing {@link AllBaseOptions_constructor} keys)
@@ -55,6 +62,36 @@ export function CreateStatusbar(
55
62
  wordWrapper: HTMLElement;
56
63
  wordCounter: HTMLElement;
57
64
  };
65
+ /**
66
+ * @description Resolves a button key to its toolbar metadata.
67
+ * Checks plugins first, then falls back to the default button list.
68
+ * Same resolution logic as `CreateToolBar`.
69
+ * @param {string} key Button name
70
+ * @param {?Object<string, *>} plugins Plugin instances
71
+ * @param {SunEditor.Options} options Options map
72
+ * @param {Object<string, string>} icons Icons
73
+ * @param {Object<string, string>} lang Language object
74
+ * @returns {{className: string, title: string, command: string, type: string, icon: string}|null}
75
+ */
76
+ export function ResolveButton(
77
+ key: string,
78
+ plugins: {
79
+ [x: string]: any;
80
+ } | null,
81
+ options: SunEditor.Options,
82
+ icons: {
83
+ [x: string]: string;
84
+ },
85
+ lang: {
86
+ [x: string]: string;
87
+ },
88
+ ): {
89
+ className: string;
90
+ title: string;
91
+ command: string;
92
+ type: string;
93
+ icon: string;
94
+ } | null;
58
95
  /**
59
96
  * @description Update a button state, attributes, and icons
60
97
  * @param {?HTMLElement} element Button element
package/types/events.d.ts CHANGED
@@ -484,7 +484,12 @@ declare function onNativeBlur(params: BaseEvent): void;
484
484
  * @param {Event} params.event - event object
485
485
  * @param {Event} params.clipboardData - `clipboardData`
486
486
  */
487
- declare function onCopy(params: { $: SunEditor.Deps; frameContext: SunEditor.FrameContext; event: Event; clipboardData: Event }): void;
487
+ declare function onCopy(params: {
488
+ $: SunEditor.Deps;
489
+ frameContext: SunEditor.FrameContext;
490
+ event: Event;
491
+ clipboardData: Event;
492
+ }): void;
488
493
  /**
489
494
  * @callback
490
495
  * @description Fired when the user attempts to cut content from the editor.
@@ -496,7 +501,12 @@ declare function onCopy(params: { $: SunEditor.Deps; frameContext: SunEditor.Fra
496
501
  * @param {Event} params.event - event object
497
502
  * @param {Event} params.clipboardData - `clipboardData`
498
503
  */
499
- declare function onCut(params: { $: SunEditor.Deps; frameContext: SunEditor.FrameContext; event: Event; clipboardData: Event }): void;
504
+ declare function onCut(params: {
505
+ $: SunEditor.Deps;
506
+ frameContext: SunEditor.FrameContext;
507
+ event: Event;
508
+ clipboardData: Event;
509
+ }): void;
500
510
  /**
501
511
  * @callback
502
512
  * @description Fired when the editor content has changed.
@@ -520,7 +530,12 @@ declare function onChange(params: { $: SunEditor.Deps; frameContext: SunEditor.F
520
530
  * @param {string} params.mode - Toolbar mode
521
531
  * @param {SunEditor.FrameContext} params.frameContext - frame context
522
532
  */
523
- declare function onShowToolbar(params: { $: SunEditor.Deps; toolbar: HTMLElement; mode: string; frameContext: SunEditor.FrameContext }): void;
533
+ declare function onShowToolbar(params: {
534
+ $: SunEditor.Deps;
535
+ toolbar: HTMLElement;
536
+ mode: string;
537
+ frameContext: SunEditor.FrameContext;
538
+ }): void;
524
539
  /**
525
540
  * @callback
526
541
  * @description Fired after a component controller (floating toolbar) is displayed.
@@ -532,7 +547,12 @@ declare function onShowToolbar(params: { $: SunEditor.Deps; toolbar: HTMLElement
532
547
  * @param {string} params.caller - caller plugin name
533
548
  * @param {SunEditor.Module.Controller.Info} params.info - info object
534
549
  */
535
- declare function onShowController(params: { $: SunEditor.Deps; frameContext: SunEditor.FrameContext; caller: string; info: SunEditor.Module.Controller.Info }): void;
550
+ declare function onShowController(params: {
551
+ $: SunEditor.Deps;
552
+ frameContext: SunEditor.FrameContext;
553
+ caller: string;
554
+ info: SunEditor.Module.Controller.Info;
555
+ }): void;
536
556
  /**
537
557
  * @callback
538
558
  * @description Fired before a component controller (floating toolbar) is displayed.
@@ -544,7 +564,12 @@ declare function onShowController(params: { $: SunEditor.Deps; frameContext: Sun
544
564
  * @param {string} params.caller - caller plugin name
545
565
  * @param {SunEditor.Module.Controller.Info} params.info - info object
546
566
  */
547
- declare function onBeforeShowController(params: { $: SunEditor.Deps; frameContext: SunEditor.FrameContext; caller: string; info: SunEditor.Module.Controller.Info }): void;
567
+ declare function onBeforeShowController(params: {
568
+ $: SunEditor.Deps;
569
+ frameContext: SunEditor.FrameContext;
570
+ caller: string;
571
+ info: SunEditor.Module.Controller.Info;
572
+ }): void;
548
573
  /**
549
574
  * @callback
550
575
  * @description Fired when the editor switches between WYSIWYG view and code view.
@@ -554,7 +579,11 @@ declare function onBeforeShowController(params: { $: SunEditor.Deps; frameContex
554
579
  * @param {SunEditor.FrameContext} params.frameContext - frame context
555
580
  * @param {boolean} params.is - code view status
556
581
  */
557
- declare function onToggleCodeView(params: { $: SunEditor.Deps; frameContext: SunEditor.FrameContext; is: boolean }): void;
582
+ declare function onToggleCodeView(params: {
583
+ $: SunEditor.Deps;
584
+ frameContext: SunEditor.FrameContext;
585
+ is: boolean;
586
+ }): void;
558
587
  /**
559
588
  * @callback
560
589
  * @description Fired when the editor switches between WYSIWYG view and markdown view.
@@ -564,7 +593,11 @@ declare function onToggleCodeView(params: { $: SunEditor.Deps; frameContext: Sun
564
593
  * @param {SunEditor.FrameContext} params.frameContext - frame context
565
594
  * @param {boolean} params.is - markdown view status
566
595
  */
567
- declare function onToggleMarkdownView(params: { $: SunEditor.Deps; frameContext: SunEditor.FrameContext; is: boolean }): void;
596
+ declare function onToggleMarkdownView(params: {
597
+ $: SunEditor.Deps;
598
+ frameContext: SunEditor.FrameContext;
599
+ is: boolean;
600
+ }): void;
568
601
  /**
569
602
  * @callback
570
603
  * @description Fired when the editor enters or exits fullscreen mode.
@@ -574,7 +607,11 @@ declare function onToggleMarkdownView(params: { $: SunEditor.Deps; frameContext:
574
607
  * @param {SunEditor.FrameContext} params.frameContext - frame context
575
608
  * @param {boolean} params.is - full screen status
576
609
  */
577
- declare function onToggleFullScreen(params: { $: SunEditor.Deps; frameContext: SunEditor.FrameContext; is: boolean }): void;
610
+ declare function onToggleFullScreen(params: {
611
+ $: SunEditor.Deps;
612
+ frameContext: SunEditor.FrameContext;
613
+ is: boolean;
614
+ }): void;
578
615
  /**
579
616
  * @callback
580
617
  * @description Fired when the editor's wysiwyg area height changes.
@@ -588,7 +625,13 @@ declare function onToggleFullScreen(params: { $: SunEditor.Deps; frameContext: S
588
625
  * @param {boolean} params.prevHeight - wysiwyg area previous height
589
626
  * @param {ResizeObserverEntry} params.observerEntry - ResizeObserverEntry
590
627
  */
591
- declare function onResizeEditor(params: { $: SunEditor.Deps; frameContext: SunEditor.FrameContext; height: number; prevHeight: boolean; observerEntry: ResizeObserverEntry }): void;
628
+ declare function onResizeEditor(params: {
629
+ $: SunEditor.Deps;
630
+ frameContext: SunEditor.FrameContext;
631
+ height: number;
632
+ prevHeight: boolean;
633
+ observerEntry: ResizeObserverEntry;
634
+ }): void;
592
635
  /**
593
636
  * @callback
594
637
  * @description Fired after toolbar buttons are created and rendered.
@@ -599,7 +642,11 @@ declare function onResizeEditor(params: { $: SunEditor.Deps; frameContext: SunEd
599
642
  * @param {SunEditor.FrameContext} params.frameContext - frame context
600
643
  * @param {HTMLElement} params.buttonTray - button tray element
601
644
  */
602
- declare function onSetToolbarButtons(params: { $: SunEditor.Deps; frameContext: SunEditor.FrameContext; buttonTray: HTMLElement }): void;
645
+ declare function onSetToolbarButtons(params: {
646
+ $: SunEditor.Deps;
647
+ frameContext: SunEditor.FrameContext;
648
+ buttonTray: HTMLElement;
649
+ }): void;
603
650
  /**
604
651
  * @callback
605
652
  * @description Fired when the save command is executed (Ctrl+S or save button).
@@ -611,7 +658,11 @@ declare function onSetToolbarButtons(params: { $: SunEditor.Deps; frameContext:
611
658
  * @param {Event} params.data - editor data
612
659
  * @returns {PromiseLike<boolean>}
613
660
  */
614
- declare function onSave(params: { $: SunEditor.Deps; frameContext: SunEditor.FrameContext; data: Event }): PromiseLike<boolean>;
661
+ declare function onSave(params: {
662
+ $: SunEditor.Deps;
663
+ frameContext: SunEditor.FrameContext;
664
+ data: Event;
665
+ }): PromiseLike<boolean>;
615
666
  /**
616
667
  * @callback
617
668
  * @description Fired when toolbar button states are reset.
@@ -663,7 +714,11 @@ declare function onPaste(params: ClipboardEvent): PromiseLike<boolean | string |
663
714
  * @param {ImageInfo} params.info - info object
664
715
  * @returns {PromiseLike<boolean | void>}
665
716
  */
666
- declare function imageUploadHandler(params: { $: SunEditor.Deps; xmlHttp: XMLHttpRequest; info: ImageInfo }): PromiseLike<boolean | void>;
717
+ declare function imageUploadHandler(params: {
718
+ $: SunEditor.Deps;
719
+ xmlHttp: XMLHttpRequest;
720
+ info: ImageInfo;
721
+ }): PromiseLike<boolean | void>;
667
722
  /**
668
723
  * @callback
669
724
  * @description Fired before an image is uploaded to the server.
@@ -676,7 +731,11 @@ declare function imageUploadHandler(params: { $: SunEditor.Deps; xmlHttp: XMLHtt
676
731
  * @param {(newInfo?: ImageInfo | null) => void} params.handler - handler function
677
732
  * @returns {PromiseLike<boolean | ImageInfo | void>}
678
733
  */
679
- declare function onImageUploadBefore(params: { $: SunEditor.Deps; info: ImageInfo; handler: (newInfo?: ImageInfo | null) => void }): PromiseLike<boolean | ImageInfo | void>;
734
+ declare function onImageUploadBefore(params: {
735
+ $: SunEditor.Deps;
736
+ info: ImageInfo;
737
+ handler: (newInfo?: ImageInfo | null) => void;
738
+ }): PromiseLike<boolean | ImageInfo | void>;
680
739
  /**
681
740
  * @callback
682
741
  * @description Fired after images are successfully loaded into the editor.
@@ -701,7 +760,15 @@ declare function onImageLoad(params: { $: SunEditor.Deps; infoList: Array<FileMa
701
760
  * @param {number} params.remainingFilesCount - remaining files count
702
761
  * @param {string} params.pluginName - plugin name
703
762
  */
704
- declare function onImageAction(params: { $: SunEditor.Deps; info: FileManagementInfo; element: HTMLElement | null; state: 'create' | 'update' | 'delete'; index: number; remainingFilesCount: number; pluginName: string }): void;
763
+ declare function onImageAction(params: {
764
+ $: SunEditor.Deps;
765
+ info: FileManagementInfo;
766
+ element: HTMLElement | null;
767
+ state: 'create' | 'update' | 'delete';
768
+ index: number;
769
+ remainingFilesCount: number;
770
+ pluginName: string;
771
+ }): void;
705
772
  /**
706
773
  * @callback
707
774
  * @description Fired when an image upload fails due to size limits, server errors, or other issues.
@@ -716,7 +783,14 @@ declare function onImageAction(params: { $: SunEditor.Deps; info: FileManagement
716
783
  * @param {File} [params.file] - File object
717
784
  * @returns {PromiseLike<string | void>}
718
785
  */
719
- declare function onImageUploadError(params: { $: SunEditor.Deps; error: string; limitSize?: number; uploadSize?: number; currentSize?: number; file?: File }): PromiseLike<string | void>;
786
+ declare function onImageUploadError(params: {
787
+ $: SunEditor.Deps;
788
+ error: string;
789
+ limitSize?: number;
790
+ uploadSize?: number;
791
+ currentSize?: number;
792
+ file?: File;
793
+ }): PromiseLike<string | void>;
720
794
  /**
721
795
  * @callback
722
796
  * @description Fired before an image is deleted from the editor.
@@ -731,7 +805,14 @@ declare function onImageUploadError(params: { $: SunEditor.Deps; error: string;
731
805
  * @param {?string} params.url - Anchor url, if it exists
732
806
  * @returns {PromiseLike<boolean>}
733
807
  */
734
- declare function onImageDeleteBefore(params: { $: SunEditor.Deps; element: HTMLElement; container: HTMLElement; align: string; alt: string; url: string | null }): PromiseLike<boolean>;
808
+ declare function onImageDeleteBefore(params: {
809
+ $: SunEditor.Deps;
810
+ element: HTMLElement;
811
+ container: HTMLElement;
812
+ align: string;
813
+ alt: string;
814
+ url: string | null;
815
+ }): PromiseLike<boolean>;
735
816
  /**
736
817
  * @callback
737
818
  * @description Custom handler for video upload requests.
@@ -745,7 +826,11 @@ declare function onImageDeleteBefore(params: { $: SunEditor.Deps; element: HTMLE
745
826
  * @param {VideoInfo} params.info - info object
746
827
  * @returns {PromiseLike<boolean>}
747
828
  */
748
- declare function videoUploadHandler(params: { $: SunEditor.Deps; xmlHttp: XMLHttpRequest; info: VideoInfo }): PromiseLike<boolean>;
829
+ declare function videoUploadHandler(params: {
830
+ $: SunEditor.Deps;
831
+ xmlHttp: XMLHttpRequest;
832
+ info: VideoInfo;
833
+ }): PromiseLike<boolean>;
749
834
  /**
750
835
  * @callback
751
836
  * @description Fired before a video is uploaded to the server.
@@ -758,7 +843,11 @@ declare function videoUploadHandler(params: { $: SunEditor.Deps; xmlHttp: XMLHtt
758
843
  * @param {(newInfo?: VideoInfo | null) => void} params.handler - handler function
759
844
  * @returns {PromiseLike<boolean | VideoInfo | void>}
760
845
  */
761
- declare function onVideoUploadBefore(params: { $: SunEditor.Deps; info: VideoInfo; handler: (newInfo?: VideoInfo | null) => void }): PromiseLike<boolean | VideoInfo | void>;
846
+ declare function onVideoUploadBefore(params: {
847
+ $: SunEditor.Deps;
848
+ info: VideoInfo;
849
+ handler: (newInfo?: VideoInfo | null) => void;
850
+ }): PromiseLike<boolean | VideoInfo | void>;
762
851
  /**
763
852
  * @callback
764
853
  * @description Fired after videos are successfully loaded into the editor.
@@ -783,7 +872,15 @@ declare function onVideoLoad(params: { $: SunEditor.Deps; infoList: Array<FileMa
783
872
  * @param {number} params.remainingFilesCount - remaining files count
784
873
  * @param {string} params.pluginName - plugin name
785
874
  */
786
- declare function onVideoAction(params: { $: SunEditor.Deps; info: FileManagementInfo; element: HTMLElement | null; state: 'create' | 'update' | 'delete'; index: number; remainingFilesCount: number; pluginName: string }): void;
875
+ declare function onVideoAction(params: {
876
+ $: SunEditor.Deps;
877
+ info: FileManagementInfo;
878
+ element: HTMLElement | null;
879
+ state: 'create' | 'update' | 'delete';
880
+ index: number;
881
+ remainingFilesCount: number;
882
+ pluginName: string;
883
+ }): void;
787
884
  /**
788
885
  * @callback
789
886
  * @description Fired when a video upload fails due to size limits, server errors, or other issues.
@@ -798,7 +895,14 @@ declare function onVideoAction(params: { $: SunEditor.Deps; info: FileManagement
798
895
  * @param {File} [params.file] - File object
799
896
  * @returns {PromiseLike<string | void>}
800
897
  */
801
- declare function onVideoUploadError(params: { $: SunEditor.Deps; error: string; limitSize?: number; uploadSize?: number; currentSize?: number; file?: File }): PromiseLike<string | void>;
898
+ declare function onVideoUploadError(params: {
899
+ $: SunEditor.Deps;
900
+ error: string;
901
+ limitSize?: number;
902
+ uploadSize?: number;
903
+ currentSize?: number;
904
+ file?: File;
905
+ }): PromiseLike<string | void>;
802
906
  /**
803
907
  * @callback
804
908
  * @description Fired before a video is deleted from the editor.
@@ -812,7 +916,13 @@ declare function onVideoUploadError(params: { $: SunEditor.Deps; error: string;
812
916
  * @param {string} params.url - video url
813
917
  * @returns {PromiseLike<boolean>}
814
918
  */
815
- declare function onVideoDeleteBefore(params: { $: SunEditor.Deps; element: HTMLElement; container: HTMLElement; align: string; url: string }): PromiseLike<boolean>;
919
+ declare function onVideoDeleteBefore(params: {
920
+ $: SunEditor.Deps;
921
+ element: HTMLElement;
922
+ container: HTMLElement;
923
+ align: string;
924
+ url: string;
925
+ }): PromiseLike<boolean>;
816
926
  /**
817
927
  * @callback
818
928
  * @description Custom handler for audio upload requests.
@@ -826,7 +936,11 @@ declare function onVideoDeleteBefore(params: { $: SunEditor.Deps; element: HTMLE
826
936
  * @param {AudioInfo} params.info - info object
827
937
  * @returns {PromiseLike<boolean>}
828
938
  */
829
- declare function audioUploadHandler(params: { $: SunEditor.Deps; xmlHttp: XMLHttpRequest; info: AudioInfo }): PromiseLike<boolean>;
939
+ declare function audioUploadHandler(params: {
940
+ $: SunEditor.Deps;
941
+ xmlHttp: XMLHttpRequest;
942
+ info: AudioInfo;
943
+ }): PromiseLike<boolean>;
830
944
  /**
831
945
  * @callback
832
946
  * @description Fired before an audio file is uploaded to the server.
@@ -839,7 +953,11 @@ declare function audioUploadHandler(params: { $: SunEditor.Deps; xmlHttp: XMLHtt
839
953
  * @param {(newInfo?: AudioInfo | null) => void} params.handler - handler function
840
954
  * @returns {PromiseLike<boolean | AudioInfo| void>}
841
955
  */
842
- declare function onAudioUploadBefore(params: { $: SunEditor.Deps; info: AudioInfo; handler: (newInfo?: AudioInfo | null) => void }): PromiseLike<boolean | AudioInfo | void>;
956
+ declare function onAudioUploadBefore(params: {
957
+ $: SunEditor.Deps;
958
+ info: AudioInfo;
959
+ handler: (newInfo?: AudioInfo | null) => void;
960
+ }): PromiseLike<boolean | AudioInfo | void>;
843
961
  /**
844
962
  * @callback
845
963
  * @description Fired when an audio upload fails due to size limits, server errors, or other issues.
@@ -854,7 +972,14 @@ declare function onAudioUploadBefore(params: { $: SunEditor.Deps; info: AudioInf
854
972
  * @param {File} [params.file] - File object
855
973
  * @returns {PromiseLike<string | void>}
856
974
  */
857
- declare function onAudioUploadError(params: { $: SunEditor.Deps; error: string; limitSize?: number; uploadSize?: number; currentSize?: number; file?: File }): PromiseLike<string | void>;
975
+ declare function onAudioUploadError(params: {
976
+ $: SunEditor.Deps;
977
+ error: string;
978
+ limitSize?: number;
979
+ uploadSize?: number;
980
+ currentSize?: number;
981
+ file?: File;
982
+ }): PromiseLike<string | void>;
858
983
  /**
859
984
  * @callback
860
985
  * @description Fired after audio files are successfully loaded into the editor.
@@ -879,7 +1004,15 @@ declare function onAudioLoad(params: { $: SunEditor.Deps; infoList: Array<FileMa
879
1004
  * @param {number} params.remainingFilesCount - remaining files count
880
1005
  * @param {string} params.pluginName - plugin name
881
1006
  */
882
- declare function onAudioAction(params: { $: SunEditor.Deps; info: FileManagementInfo; element: HTMLElement | null; state: 'create' | 'update' | 'delete'; index: number; remainingFilesCount: number; pluginName: string }): void;
1007
+ declare function onAudioAction(params: {
1008
+ $: SunEditor.Deps;
1009
+ info: FileManagementInfo;
1010
+ element: HTMLElement | null;
1011
+ state: 'create' | 'update' | 'delete';
1012
+ index: number;
1013
+ remainingFilesCount: number;
1014
+ pluginName: string;
1015
+ }): void;
883
1016
  /**
884
1017
  * @callback
885
1018
  * @description Fired before an audio element is deleted from the editor.
@@ -892,7 +1025,12 @@ declare function onAudioAction(params: { $: SunEditor.Deps; info: FileManagement
892
1025
  * @param {string} params.url - audio url
893
1026
  * @returns {PromiseLike<boolean>}
894
1027
  */
895
- declare function onAudioDeleteBefore(params: { $: SunEditor.Deps; element: HTMLElement; container: HTMLElement; url: string }): PromiseLike<boolean>;
1028
+ declare function onAudioDeleteBefore(params: {
1029
+ $: SunEditor.Deps;
1030
+ element: HTMLElement;
1031
+ container: HTMLElement;
1032
+ url: string;
1033
+ }): PromiseLike<boolean>;
896
1034
  /**
897
1035
  * @callback
898
1036
  * @description Fired before a file is uploaded to the server (via `fileUpload` plugin).
@@ -905,7 +1043,11 @@ declare function onAudioDeleteBefore(params: { $: SunEditor.Deps; element: HTMLE
905
1043
  * @param {(newInfo?: FileInfo | null) => void} params.handler - handler function
906
1044
  * @returns {PromiseLike<boolean | FileInfo | void>}
907
1045
  */
908
- declare function onFileUploadBefore(params: { $: SunEditor.Deps; info: FileInfo; handler: (newInfo?: FileInfo | null) => void }): PromiseLike<boolean | FileInfo | void>;
1046
+ declare function onFileUploadBefore(params: {
1047
+ $: SunEditor.Deps;
1048
+ info: FileInfo;
1049
+ handler: (newInfo?: FileInfo | null) => void;
1050
+ }): PromiseLike<boolean | FileInfo | void>;
909
1051
  /**
910
1052
  * @callback
911
1053
  * @description Fired after files are successfully uploaded and loaded into the editor.
@@ -930,7 +1072,15 @@ declare function onFileLoad(params: { $: SunEditor.Deps; infoList: Array<FileMan
930
1072
  * @param {number} params.remainingFilesCount - remaining files count
931
1073
  * @param {string} params.pluginName - plugin name
932
1074
  */
933
- declare function onFileAction(params: { $: SunEditor.Deps; info: FileManagementInfo; element: HTMLElement | null; state: 'create' | 'update' | 'delete'; index: number; remainingFilesCount: number; pluginName: string }): void;
1075
+ declare function onFileAction(params: {
1076
+ $: SunEditor.Deps;
1077
+ info: FileManagementInfo;
1078
+ element: HTMLElement | null;
1079
+ state: 'create' | 'update' | 'delete';
1080
+ index: number;
1081
+ remainingFilesCount: number;
1082
+ pluginName: string;
1083
+ }): void;
934
1084
  /**
935
1085
  * @callback
936
1086
  * @description Fired when a file upload fails due to size limits, server errors, or other issues.
@@ -945,7 +1095,14 @@ declare function onFileAction(params: { $: SunEditor.Deps; info: FileManagementI
945
1095
  * @param {File} [params.file] - File object
946
1096
  * @returns {PromiseLike<string | void>}
947
1097
  */
948
- declare function onFileUploadError(params: { $: SunEditor.Deps; error: string; limitSize?: number; uploadSize?: number; currentSize?: number; file?: File }): PromiseLike<string | void>;
1098
+ declare function onFileUploadError(params: {
1099
+ $: SunEditor.Deps;
1100
+ error: string;
1101
+ limitSize?: number;
1102
+ uploadSize?: number;
1103
+ currentSize?: number;
1104
+ file?: File;
1105
+ }): PromiseLike<string | void>;
949
1106
  /**
950
1107
  * @callback
951
1108
  * @description Fired before a file link is deleted from the editor.
@@ -958,7 +1115,12 @@ declare function onFileUploadError(params: { $: SunEditor.Deps; error: string; l
958
1115
  * @param {string} params.url - file url
959
1116
  * @returns {PromiseLike<boolean>}
960
1117
  */
961
- declare function onFileDeleteBefore(params: { $: SunEditor.Deps; element: HTMLElement; container: HTMLElement; url: string }): PromiseLike<boolean>;
1118
+ declare function onFileDeleteBefore(params: {
1119
+ $: SunEditor.Deps;
1120
+ element: HTMLElement;
1121
+ container: HTMLElement;
1122
+ url: string;
1123
+ }): PromiseLike<boolean>;
962
1124
  /**
963
1125
  * @callback
964
1126
  * @description Fired before the editor content is exported to PDF.
@@ -984,7 +1146,15 @@ declare function onExportPDFBefore(params: { $: SunEditor.Deps; target: HTMLElem
984
1146
  * @param {number} params.remainingFilesCount - remaining files count
985
1147
  * @param {string} params.pluginName - plugin name
986
1148
  */
987
- declare function onFileManagerAction(params: { $: SunEditor.Deps; info: FileManagementInfo; element: HTMLElement | null; state: 'create' | 'update' | 'delete'; index: number; remainingFilesCount: number; pluginName: string }): void;
1149
+ declare function onFileManagerAction(params: {
1150
+ $: SunEditor.Deps;
1151
+ info: FileManagementInfo;
1152
+ element: HTMLElement | null;
1153
+ state: 'create' | 'update' | 'delete';
1154
+ index: number;
1155
+ remainingFilesCount: number;
1156
+ pluginName: string;
1157
+ }): void;
988
1158
  /**
989
1159
  * @callback
990
1160
  * @description Fired before an embed URL is processed and inserted into the editor.
@@ -1013,5 +1183,11 @@ declare function onEmbedInputBefore(
1013
1183
  * @param {string} params.url - embed url
1014
1184
  * @returns {PromiseLike<boolean>}
1015
1185
  */
1016
- declare function onEmbedDeleteBefore(params: { $: SunEditor.Deps; element: HTMLElement; container: HTMLElement; align: string; url: string }): PromiseLike<boolean>;
1186
+ declare function onEmbedDeleteBefore(params: {
1187
+ $: SunEditor.Deps;
1188
+ element: HTMLElement;
1189
+ container: HTMLElement;
1190
+ align: string;
1191
+ url: string;
1192
+ }): PromiseLike<boolean>;
1017
1193
  export {};
@@ -46,13 +46,15 @@ export function htmlToEntity(content: string): string;
46
46
  */
47
47
  export function entityToHTML(content: string): string;
48
48
  /**
49
- * @description Debounce function
49
+ * @description Debounce function. The returned function exposes a `cancel()` method that clears any
50
+ * pending invocation (useful when an event — e.g. ESC — should abort a scheduled callback).
50
51
  * @param {(...args: *) => void} func function
51
52
  * @param {number} wait delay ms
52
- * @returns {*} executedFunction
53
+ * @returns {*} executedFunction — the debounced function, with a `cancel()` method attached
53
54
  * @example
54
55
  * const debouncedSave = converter.debounce(() => save(), 300);
55
56
  * input.addEventListener('input', debouncedSave);
57
+ * // later: debouncedSave.cancel();
56
58
  */
57
59
  export function debounce(func: (...args: any) => void, wait: number): any;
58
60
  /**