suneditor 3.1.4 → 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 (216) 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 +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 -93
  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 +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 +83 -2
  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/ColorPicker.d.ts +2 -2
  197. package/types/modules/contract/Controller.d.ts +7 -0
  198. package/types/modules/contract/Figure.d.ts +31 -4
  199. package/types/modules/ui/CommandMenu.d.ts +262 -0
  200. package/types/modules/ui/SelectMenu.d.ts +56 -3
  201. package/types/modules/ui/index.d.ts +1 -0
  202. package/types/plugins/browser/audioGallery.d.ts +1 -1
  203. package/types/plugins/browser/fileBrowser.d.ts +1 -1
  204. package/types/plugins/browser/fileGallery.d.ts +1 -1
  205. package/types/plugins/browser/imageGallery.d.ts +1 -1
  206. package/types/plugins/browser/videoGallery.d.ts +1 -1
  207. package/types/plugins/dropdown/align.d.ts +1 -1
  208. package/types/plugins/dropdown/blockStyle.d.ts +3 -1
  209. package/types/plugins/dropdown/table/index.d.ts +4 -1
  210. package/types/plugins/dropdown/table/services/table.clipboard.d.ts +5 -1
  211. package/types/plugins/dropdown/table/services/table.grid.d.ts +10 -2
  212. package/types/plugins/field/autocomplete.d.ts +0 -1
  213. package/types/plugins/field/slashCommand.d.ts +165 -0
  214. package/types/plugins/index.d.ts +3 -0
  215. package/types/plugins/modal/link.d.ts +4 -1
  216. package/types/typedef.d.ts +48 -23
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
  /**
@@ -61,7 +61,15 @@ export function isTable(node: (Node | string) | null): node is HTMLTableElement;
61
61
  * @param {?Node|string} node The element or element name to check
62
62
  * @returns {node is HTMLTableElement|HTMLTableSectionElement|HTMLTableRowElement|HTMLTableCellElement|HTMLTableColElement|HTMLTableColElement}
63
63
  */
64
- export function isTableElements(node: (Node | string) | null): node is HTMLTableElement | HTMLTableSectionElement | HTMLTableRowElement | HTMLTableCellElement | HTMLTableColElement | HTMLTableColElement;
64
+ export function isTableElements(
65
+ node: (Node | string) | null,
66
+ ): node is
67
+ | HTMLTableElement
68
+ | HTMLTableSectionElement
69
+ | HTMLTableRowElement
70
+ | HTMLTableCellElement
71
+ | HTMLTableColElement
72
+ | HTMLTableColElement;
65
73
  /**
66
74
  * @description Check the node is a table cell (td, th)
67
75
  * @param {?Node|string} node The element or element name to check
@@ -91,7 +99,9 @@ export function isAnchor(node: (Node | string) | null): node is HTMLAnchorElemen
91
99
  * @param {?Node|string} node The element or element name to check
92
100
  * @returns {node is HTMLImageElement|HTMLIFrameElement|HTMLAudioElement|HTMLVideoElement|HTMLCanvasElement}
93
101
  */
94
- export function isMedia(node: (Node | string) | null): node is HTMLImageElement | HTMLIFrameElement | HTMLAudioElement | HTMLVideoElement | HTMLCanvasElement;
102
+ export function isMedia(
103
+ node: (Node | string) | null,
104
+ ): node is HTMLImageElement | HTMLIFrameElement | HTMLAudioElement | HTMLVideoElement | HTMLCanvasElement;
95
105
  /**
96
106
  * @description Check the node is a iframe tag
97
107
  * @param {?Node|string} node The element or element name to check
@@ -40,7 +40,10 @@ export function getNodeFromPath<T extends Node>(offsets: Array<number>, parentNo
40
40
  * @param {?(current: *) => boolean} validation Conditional function
41
41
  * @returns {T|null}
42
42
  */
43
- export function getChildNode<T extends HTMLElement>(element: Node, validation: ((current: any) => boolean) | null): T | null;
43
+ export function getChildNode<T extends HTMLElement>(
44
+ element: Node,
45
+ validation: ((current: any) => boolean) | null,
46
+ ): T | null;
44
47
  /**
45
48
  * @template {HTMLElement} T
46
49
  * @description Get all `children` of the argument value element (Without text nodes)
@@ -49,7 +52,11 @@ export function getChildNode<T extends HTMLElement>(element: Node, validation: (
49
52
  * @param {?number} depth Number of child levels to depth.
50
53
  * @returns {Array<T>}
51
54
  */
52
- export function getListChildren<T extends HTMLElement>(element: Node, validation: ((current: any) => boolean) | null, depth: number | null): Array<T>;
55
+ export function getListChildren<T extends HTMLElement>(
56
+ element: Node,
57
+ validation: ((current: any) => boolean) | null,
58
+ depth: number | null,
59
+ ): Array<T>;
53
60
  /**
54
61
  * @template {Node} T
55
62
  * @description Get all `childNodes` of the argument value element (Include text nodes)
@@ -60,7 +67,11 @@ export function getListChildren<T extends HTMLElement>(element: Node, validation
60
67
  * @example
61
68
  * const allNodes = dom.query.getListChildNodes(container, (node) => node.nodeType === 3);
62
69
  */
63
- export function getListChildNodes<T extends Node>(element: Node, validation: ((current: any) => boolean) | null, depth: number | null): Array<T>;
70
+ export function getListChildNodes<T extends Node>(
71
+ element: Node,
72
+ validation: ((current: any) => boolean) | null,
73
+ depth: number | null,
74
+ ): Array<T>;
64
75
  /**
65
76
  * @description Returns the number of parents nodes.
66
77
  * - `0` when the parent node is the WYSIWYG area.
@@ -115,7 +126,11 @@ export function compareElements(
115
126
  * @param {?number} [depth] Number of parent levels to depth.
116
127
  * @returns {T|null} Not found: `null`
117
128
  */
118
- export function getParentElement<T extends HTMLElement>(element: Node, query: string | ((current: any) => boolean) | Node, depth?: number | null): T | null;
129
+ export function getParentElement<T extends HTMLElement>(
130
+ element: Node,
131
+ query: string | ((current: any) => boolean) | Node,
132
+ depth?: number | null,
133
+ ): T | null;
119
134
  /**
120
135
  * @template {HTMLElement} T
121
136
  * @description Gets all ancestors of the argument value.
@@ -127,7 +142,11 @@ export function getParentElement<T extends HTMLElement>(element: Node, query: st
127
142
  * @param {?number} [depth] Number of parent levels to depth.
128
143
  * @returns {Array<T>} Returned in an array in order.
129
144
  */
130
- export function getParentElements<T extends HTMLElement>(element: Node, query: string | ((current: any) => boolean) | Node, depth?: number | null): Array<T>;
145
+ export function getParentElements<T extends HTMLElement>(
146
+ element: Node,
147
+ query: string | ((current: any) => boolean) | Node,
148
+ depth?: number | null,
149
+ ): Array<T>;
131
150
  /**
132
151
  * @template {HTMLElement} T
133
152
  * @description Gets the element with `data-command` attribute among the parent elements.
@@ -156,7 +175,11 @@ export function getEventTarget<T extends HTMLElement>(event: Event): T | null;
156
175
  * const firstLeaf = dom.query.getEdgeChild(container, (n) => n.nodeType === 3, false);
157
176
  * const lastLeaf = dom.query.getEdgeChild(container, (n) => n.nodeType === 3, true);
158
177
  */
159
- export function getEdgeChild<T extends Node>(node: Node, query: string | ((current: any) => boolean) | Node, last: boolean): T | null;
178
+ export function getEdgeChild<T extends Node>(
179
+ node: Node,
180
+ query: string | ((current: any) => boolean) | Node,
181
+ last: boolean,
182
+ ): T | null;
160
183
  /**
161
184
  * @description Get edge child nodes of the argument value.
162
185
  * - 1. The first node of all the child nodes of the `first` element is returned.
@@ -197,7 +220,12 @@ export function getNextDeepestNode<T extends Node>(node: Node, ceiling?: Node |
197
220
  * @param {?(current: *) => boolean} [validate] Validation function
198
221
  * @returns {number}
199
222
  */
200
- export function findTextIndexOnLine(line: Node, offsetContainer: Node, offset: number, validate?: ((current: any) => boolean) | null): number;
223
+ export function findTextIndexOnLine(
224
+ line: Node,
225
+ offsetContainer: Node,
226
+ offset: number,
227
+ validate?: ((current: any) => boolean) | null,
228
+ ): number;
201
229
  /**
202
230
  * @description Find the end index of a sequence of at least minTabSize consecutive non-breaking spaces or spaces
203
231
  * - which are interpreted as a tab key, occurring after a given base index in a text string.
@@ -53,7 +53,10 @@ export function getAttributesToString(element: Node, exceptAttrs: Array<string>
53
53
  * @param {?(current: *) => boolean} validation Conditional function
54
54
  * @returns {Array<Node>|null}
55
55
  */
56
- export function arrayFilter(array: SunEditor.NodeCollection, validation: ((current: any) => boolean) | null): Array<Node> | null;
56
+ export function arrayFilter(
57
+ array: SunEditor.NodeCollection,
58
+ validation: ((current: any) => boolean) | null,
59
+ ): Array<Node> | null;
57
60
  /**
58
61
  * @description Get the item from the array that matches the condition.
59
62
  * @param {SunEditor.NodeCollection} array Array to get item
@@ -9,10 +9,10 @@ export class PluginBrowser extends Base {
9
9
  /**
10
10
  * @abstract
11
11
  * @description Executes the method that is called when a `Browser` module is opened.
12
- * @param {?(target: Node) => *} [onSelectfunction] - Method to be executed after selecting an item in the gallery
12
+ * @param {?(target: *) => *} [onSelectfunction] - Method to be executed after selecting an item in the gallery
13
13
  * @returns {void}
14
14
  */
15
- open(onSelectfunction?: ((target: Node) => any) | null): void;
15
+ open(onSelectfunction?: ((target: any) => any) | null): void;
16
16
  /**
17
17
  * @abstract
18
18
  * @description Executes the method that is called when a `Browser` module is closed.
@@ -118,7 +118,6 @@ export type _Lang = {
118
118
  math_modal_title: string;
119
119
  maxSize: string;
120
120
  mediaGallery: string;
121
- autocomplete: string;
122
121
  menu_bordered: string;
123
122
  menu_code: string;
124
123
  menu_neon: string;
@@ -78,7 +78,7 @@ declare class ColorPicker {
78
78
  * @description Displays or resets the currently selected color at color list.
79
79
  * @param {Node|string} nodeOrColor Current Selected node
80
80
  * @param {Node} target target
81
- * @param {?(current: Node) => boolean} [stopCondition] - A function used to stop traversing parent nodes while finding the color.
81
+ * @param {?(current: *) => boolean} [stopCondition] - A function used to stop traversing parent nodes while finding the color.
82
82
  * - When this function returns `true`, the traversal ends at that node.
83
83
  * - e.g., `(node) => this.format.isLine(node)` stops at line-level elements like <p>, <div>.
84
84
  * @example
@@ -88,7 +88,7 @@ declare class ColorPicker {
88
88
  * // Initialize with a color string directly (e.g., from a table cell style)
89
89
  * this.colorPicker.init(color?.value || '', button);
90
90
  */
91
- init(nodeOrColor: Node | string, target: Node, stopCondition?: ((current: Node) => boolean) | null): void;
91
+ init(nodeOrColor: Node | string, target: Node, stopCondition?: ((current: any) => boolean) | null): void;
92
92
  /**
93
93
  * @description Store color values
94
94
  * @param {string} hexColorStr Hax color value
@@ -46,6 +46,11 @@ export type ControllerParams = {
46
46
  * Method to be called when the controller is closed.
47
47
  */
48
48
  initMethod?: () => void;
49
+ /**
50
+ * Called on ESC before the controller closes. Return `true`
51
+ * to keep it open (e.g. when an inner sub-panel should absorb the ESC instead).
52
+ */
53
+ escGuard?: () => boolean;
49
54
  /**
50
55
  * If `true`, When the `controller` is opened, buttons without the `se-component-enabled` class are disabled.
51
56
  */
@@ -93,6 +98,8 @@ export type ControllerParams = {
93
98
  * @property {"top"|"bottom"} [position="bottom"] Controller position
94
99
  * @property {boolean} [isWWTarget=true] If the controller is in the WYSIWYG area, set it to `true`.
95
100
  * @property {() => void} [initMethod=null] Method to be called when the controller is closed.
101
+ * @property {() => boolean} [escGuard=null] Called on ESC before the controller closes. Return `true`
102
+ * to keep it open (e.g. when an inner sub-panel should absorb the ESC instead).
96
103
  * @property {boolean} [disabled=false] If `true`, When the `controller` is opened, buttons without the `se-component-enabled` class are disabled.
97
104
  * @property {Array<Controller|HTMLElement>} [parents=[]] The parent `controller` instance array when `controller` is opened nested.
98
105
  * @property {boolean} [parentsHide=false] If `true`, the parent element is hidden when the controller is opened.