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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/CONTRIBUTING.md +8 -8
  2. package/README.md +44 -49
  3. package/dist/suneditor.min.css +1 -1
  4. package/dist/suneditor.min.js +1 -1
  5. package/package.json +95 -53
  6. package/src/assets/design/color.css +2 -2
  7. package/src/assets/design/size.css +2 -0
  8. package/src/assets/icons/defaultIcons.js +16 -1
  9. package/src/assets/suneditor-contents.css +9 -8
  10. package/src/assets/suneditor.css +29 -26
  11. package/src/core/{section → base}/actives.js +20 -12
  12. package/src/core/base/history.js +4 -4
  13. package/src/core/class/char.js +10 -10
  14. package/src/core/class/component.js +146 -57
  15. package/src/core/class/format.js +94 -2458
  16. package/src/core/class/html.js +187 -129
  17. package/src/core/class/inline.js +1853 -0
  18. package/src/core/class/listFormat.js +582 -0
  19. package/src/core/class/menu.js +14 -3
  20. package/src/core/class/nodeTransform.js +9 -14
  21. package/src/core/class/offset.js +162 -197
  22. package/src/core/class/selection.js +137 -34
  23. package/src/core/class/toolbar.js +73 -52
  24. package/src/core/class/ui.js +11 -11
  25. package/src/core/class/viewer.js +56 -55
  26. package/src/core/config/context.js +122 -0
  27. package/src/core/config/frameContext.js +204 -0
  28. package/src/core/config/options.js +639 -0
  29. package/src/core/editor.js +181 -108
  30. package/src/core/event/actions/index.js +229 -0
  31. package/src/core/event/effects/common.registry.js +60 -0
  32. package/src/core/event/effects/keydown.registry.js +551 -0
  33. package/src/core/event/effects/ruleHelpers.js +145 -0
  34. package/src/core/{base → event}/eventManager.js +119 -201
  35. package/src/core/event/executor.js +21 -0
  36. package/src/core/{base/eventHandlers → event/handlers}/handler_toolbar.js +4 -4
  37. package/src/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.js +2 -2
  38. package/src/core/event/handlers/handler_ww_input.js +77 -0
  39. package/src/core/event/handlers/handler_ww_key.js +228 -0
  40. package/src/core/{base/eventHandlers → event/handlers}/handler_ww_mouse.js +3 -3
  41. package/src/core/event/ports.js +211 -0
  42. package/src/core/event/reducers/keydown.reducer.js +89 -0
  43. package/src/core/event/rules/keydown.rule.arrow.js +54 -0
  44. package/src/core/event/rules/keydown.rule.backspace.js +202 -0
  45. package/src/core/event/rules/keydown.rule.delete.js +126 -0
  46. package/src/core/event/rules/keydown.rule.enter.js +144 -0
  47. package/src/core/event/rules/keydown.rule.tab.js +29 -0
  48. package/src/core/section/constructor.js +79 -388
  49. package/src/core/section/documentType.js +47 -26
  50. package/src/core/util/instanceCheck.js +59 -0
  51. package/src/editorInjector/_classes.js +4 -0
  52. package/src/editorInjector/_core.js +17 -7
  53. package/src/editorInjector/index.js +10 -2
  54. package/src/events.js +6 -0
  55. package/src/helper/clipboard.js +24 -10
  56. package/src/helper/converter.js +17 -12
  57. package/src/helper/dom/domCheck.js +22 -3
  58. package/src/helper/dom/domQuery.js +91 -45
  59. package/src/helper/dom/domUtils.js +93 -19
  60. package/src/helper/dom/index.js +4 -0
  61. package/src/helper/env.js +11 -7
  62. package/src/helper/keyCodeMap.js +4 -3
  63. package/src/langs/ckb.js +1 -1
  64. package/src/langs/cs.js +1 -1
  65. package/src/langs/da.js +1 -1
  66. package/src/langs/de.js +1 -1
  67. package/src/langs/en.js +1 -1
  68. package/src/langs/es.js +1 -1
  69. package/src/langs/fa.js +1 -1
  70. package/src/langs/fr.js +1 -1
  71. package/src/langs/he.js +1 -1
  72. package/src/langs/hu.js +1 -1
  73. package/src/langs/it.js +1 -1
  74. package/src/langs/ja.js +1 -1
  75. package/src/langs/km.js +1 -1
  76. package/src/langs/ko.js +1 -1
  77. package/src/langs/lv.js +1 -1
  78. package/src/langs/nl.js +1 -1
  79. package/src/langs/pl.js +1 -1
  80. package/src/langs/pt_br.js +10 -10
  81. package/src/langs/ro.js +1 -1
  82. package/src/langs/ru.js +1 -1
  83. package/src/langs/se.js +1 -1
  84. package/src/langs/tr.js +1 -1
  85. package/src/langs/uk.js +1 -1
  86. package/src/langs/ur.js +1 -1
  87. package/src/langs/zh_cn.js +1 -1
  88. package/src/modules/ApiManager.js +25 -18
  89. package/src/modules/Browser.js +52 -61
  90. package/src/modules/ColorPicker.js +37 -38
  91. package/src/modules/Controller.js +85 -79
  92. package/src/modules/Figure.js +275 -187
  93. package/src/modules/FileManager.js +86 -92
  94. package/src/modules/HueSlider.js +67 -35
  95. package/src/modules/Modal.js +84 -77
  96. package/src/modules/ModalAnchorEditor.js +62 -79
  97. package/src/modules/SelectMenu.js +89 -86
  98. package/src/plugins/browser/audioGallery.js +9 -5
  99. package/src/plugins/browser/fileBrowser.js +10 -6
  100. package/src/plugins/browser/fileGallery.js +9 -5
  101. package/src/plugins/browser/imageGallery.js +9 -5
  102. package/src/plugins/browser/videoGallery.js +11 -6
  103. package/src/plugins/command/blockquote.js +1 -0
  104. package/src/plugins/command/exportPDF.js +11 -8
  105. package/src/plugins/command/fileUpload.js +41 -29
  106. package/src/plugins/command/list_bulleted.js +2 -1
  107. package/src/plugins/command/list_numbered.js +2 -1
  108. package/src/plugins/dropdown/align.js +8 -2
  109. package/src/plugins/dropdown/backgroundColor.js +19 -11
  110. package/src/plugins/dropdown/font.js +15 -9
  111. package/src/plugins/dropdown/fontColor.js +19 -11
  112. package/src/plugins/dropdown/formatBlock.js +7 -2
  113. package/src/plugins/dropdown/hr.js +7 -3
  114. package/src/plugins/dropdown/layout.js +6 -2
  115. package/src/plugins/dropdown/lineHeight.js +8 -3
  116. package/src/plugins/dropdown/list.js +2 -1
  117. package/src/plugins/dropdown/paragraphStyle.js +15 -11
  118. package/src/plugins/dropdown/{table.js → table/index.js} +514 -362
  119. package/src/plugins/dropdown/template.js +6 -2
  120. package/src/plugins/dropdown/textStyle.js +7 -3
  121. package/src/plugins/field/mention.js +33 -27
  122. package/src/plugins/input/fontSize.js +44 -37
  123. package/src/plugins/input/pageNavigator.js +3 -2
  124. package/src/plugins/modal/audio.js +90 -85
  125. package/src/plugins/modal/drawing.js +58 -66
  126. package/src/plugins/modal/embed.js +193 -180
  127. package/src/plugins/modal/image.js +441 -439
  128. package/src/plugins/modal/link.js +31 -8
  129. package/src/plugins/modal/math.js +23 -22
  130. package/src/plugins/modal/video.js +233 -230
  131. package/src/plugins/popup/anchor.js +24 -18
  132. package/src/suneditor.js +69 -24
  133. package/src/typedef.js +42 -19
  134. package/types/assets/icons/defaultIcons.d.ts +8 -0
  135. package/types/core/class/char.d.ts +1 -1
  136. package/types/core/class/component.d.ts +29 -7
  137. package/types/core/class/format.d.ts +4 -354
  138. package/types/core/class/html.d.ts +13 -4
  139. package/types/core/class/inline.d.ts +263 -0
  140. package/types/core/class/listFormat.d.ts +135 -0
  141. package/types/core/class/menu.d.ts +10 -2
  142. package/types/core/class/offset.d.ts +24 -26
  143. package/types/core/class/selection.d.ts +2 -0
  144. package/types/core/class/toolbar.d.ts +24 -11
  145. package/types/core/class/ui.d.ts +1 -1
  146. package/types/core/class/viewer.d.ts +1 -1
  147. package/types/core/config/context.d.ts +157 -0
  148. package/types/core/config/frameContext.d.ts +367 -0
  149. package/types/core/config/options.d.ts +1119 -0
  150. package/types/core/editor.d.ts +101 -66
  151. package/types/core/event/actions/index.d.ts +47 -0
  152. package/types/core/event/effects/common.registry.d.ts +50 -0
  153. package/types/core/event/effects/keydown.registry.d.ts +73 -0
  154. package/types/core/event/effects/ruleHelpers.d.ts +31 -0
  155. package/types/core/{base → event}/eventManager.d.ts +15 -46
  156. package/types/core/event/executor.d.ts +6 -0
  157. package/types/core/event/handlers/handler_ww_input.d.ts +41 -0
  158. package/types/core/{base/eventHandlers/handler_ww_key_input.d.ts → event/handlers/handler_ww_key.d.ts} +4 -6
  159. package/types/core/event/ports.d.ts +255 -0
  160. package/types/core/event/reducers/keydown.reducer.d.ts +75 -0
  161. package/types/core/event/rules/keydown.rule.arrow.d.ts +8 -0
  162. package/types/core/event/rules/keydown.rule.backspace.d.ts +9 -0
  163. package/types/core/event/rules/keydown.rule.delete.d.ts +9 -0
  164. package/types/core/event/rules/keydown.rule.enter.d.ts +9 -0
  165. package/types/core/event/rules/keydown.rule.tab.d.ts +9 -0
  166. package/types/core/section/constructor.d.ts +101 -631
  167. package/types/core/section/documentType.d.ts +14 -4
  168. package/types/core/util/instanceCheck.d.ts +50 -0
  169. package/types/editorInjector/_classes.d.ts +4 -0
  170. package/types/editorInjector/_core.d.ts +17 -7
  171. package/types/editorInjector/index.d.ts +10 -2
  172. package/types/events.d.ts +1 -0
  173. package/types/helper/clipboard.d.ts +2 -2
  174. package/types/helper/converter.d.ts +6 -9
  175. package/types/helper/dom/domCheck.d.ts +7 -0
  176. package/types/helper/dom/domQuery.d.ts +19 -8
  177. package/types/helper/dom/domUtils.d.ts +24 -2
  178. package/types/helper/dom/index.d.ts +86 -1
  179. package/types/helper/env.d.ts +6 -1
  180. package/types/helper/index.d.ts +7 -1
  181. package/types/helper/keyCodeMap.d.ts +3 -3
  182. package/types/index.d.ts +23 -117
  183. package/types/langs/index.d.ts +2 -2
  184. package/types/modules/ApiManager.d.ts +1 -8
  185. package/types/modules/Browser.d.ts +4 -62
  186. package/types/modules/ColorPicker.d.ts +4 -21
  187. package/types/modules/Controller.d.ts +8 -64
  188. package/types/modules/Figure.d.ts +54 -50
  189. package/types/modules/FileManager.d.ts +1 -13
  190. package/types/modules/HueSlider.d.ts +13 -3
  191. package/types/modules/Modal.d.ts +0 -43
  192. package/types/modules/ModalAnchorEditor.d.ts +0 -73
  193. package/types/modules/SelectMenu.d.ts +0 -85
  194. package/types/modules/index.d.ts +3 -3
  195. package/types/plugins/browser/audioGallery.d.ts +29 -18
  196. package/types/plugins/browser/fileBrowser.d.ts +38 -27
  197. package/types/plugins/browser/fileGallery.d.ts +29 -18
  198. package/types/plugins/browser/imageGallery.d.ts +24 -16
  199. package/types/plugins/browser/videoGallery.d.ts +29 -18
  200. package/types/plugins/command/blockquote.d.ts +1 -0
  201. package/types/plugins/command/exportPDF.d.ts +18 -18
  202. package/types/plugins/command/fileUpload.d.ts +65 -45
  203. package/types/plugins/command/list_bulleted.d.ts +1 -0
  204. package/types/plugins/command/list_numbered.d.ts +1 -0
  205. package/types/plugins/dropdown/align.d.ts +13 -8
  206. package/types/plugins/dropdown/backgroundColor.d.ts +30 -19
  207. package/types/plugins/dropdown/font.d.ts +13 -12
  208. package/types/plugins/dropdown/fontColor.d.ts +30 -19
  209. package/types/plugins/dropdown/formatBlock.d.ts +13 -8
  210. package/types/plugins/dropdown/hr.d.ts +15 -11
  211. package/types/plugins/dropdown/layout.d.ts +15 -11
  212. package/types/plugins/dropdown/lineHeight.d.ts +16 -11
  213. package/types/plugins/dropdown/list.d.ts +1 -0
  214. package/types/plugins/dropdown/paragraphStyle.d.ts +31 -27
  215. package/types/plugins/dropdown/table/index.d.ts +582 -0
  216. package/types/plugins/dropdown/table.d.ts +41 -86
  217. package/types/plugins/dropdown/template.d.ts +15 -11
  218. package/types/plugins/dropdown/textStyle.d.ts +19 -11
  219. package/types/plugins/field/mention.d.ts +58 -56
  220. package/types/plugins/index.d.ts +38 -38
  221. package/types/plugins/input/fontSize.d.ts +46 -50
  222. package/types/plugins/modal/audio.d.ts +26 -56
  223. package/types/plugins/modal/drawing.d.ts +0 -85
  224. package/types/plugins/modal/embed.d.ts +15 -79
  225. package/types/plugins/modal/image.d.ts +24 -136
  226. package/types/plugins/modal/link.d.ts +34 -15
  227. package/types/plugins/modal/math.d.ts +0 -16
  228. package/types/plugins/modal/video.d.ts +17 -86
  229. package/types/plugins/popup/anchor.d.ts +1 -8
  230. package/types/suneditor.d.ts +70 -19
  231. package/types/typedef.d.ts +60 -46
  232. package/src/core/base/eventHandlers/handler_ww_key_input.js +0 -1200
  233. package/src/core/section/context.js +0 -102
  234. package/types/core/section/context.d.ts +0 -45
  235. package/types/langs/_Lang.d.ts +0 -194
  236. /package/src/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.js +0 -0
  237. /package/types/core/{section → base}/actives.d.ts +0 -0
  238. /package/types/core/{base/eventHandlers → event/handlers}/handler_toolbar.d.ts +0 -0
  239. /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.d.ts +0 -0
  240. /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.d.ts +0 -0
  241. /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_mouse.d.ts +0 -0
@@ -15,10 +15,10 @@ declare class DocumentType {
15
15
  */
16
16
  constructor(editor: __se__EditorCore, fc: __se__FrameContext);
17
17
  editor: import('../editor').default;
18
- context: __se__Context;
18
+ context: import('../config/context').ContextUtil;
19
19
  selection: import('../class/selection').default;
20
20
  offset: import('../class/offset').default;
21
- fc: __se__FrameContext;
21
+ fc: import('../config/frameContext').FrameContextUtil;
22
22
  ww: any;
23
23
  wwFrame: any;
24
24
  wwWidth: number;
@@ -57,6 +57,16 @@ declare class DocumentType {
57
57
  * @returns {Promise<void>}
58
58
  */
59
59
  rePage(force: boolean): Promise<void>;
60
+ /**
61
+ * @private
62
+ * @description Calculates and compensates for the vertical gap between the rendered content (current page)
63
+ * - and the mirrored preview page due to differences in width and layout.
64
+ * @param {number} t - The initial top position value to be adjusted.
65
+ * @param {HTMLElement[]} chr - The elements array in the current (main) page.
66
+ * @param {HTMLElement[]} mChr - The elements array in the mirrored page.
67
+ * @returns {number|null} - The adjusted top value.
68
+ */
69
+ _calcPageBreakTop(t: number, chr: HTMLElement[], mChr: HTMLElement[]): number | null;
60
70
  /**
61
71
  * @private
62
72
  * @description Initializes the cache for document elements.
@@ -67,7 +77,7 @@ declare class DocumentType {
67
77
  * @private
68
78
  * @description Retrieves the element at a given position.
69
79
  * @param {number} pageTop - The vertical position to check.
70
- * @param {NodeList} mChr - List of mirrored elements.
80
+ * @param {HTMLElement[]} mChr - List of mirrored elements.
71
81
  * @returns {{ci: number, cm: number, ch: number}} The closest element and its related data.
72
82
  * - ci: The index of the closest element.
73
83
  * - cm: The distance between the top of the closest element and the given position.
@@ -75,7 +85,7 @@ declare class DocumentType {
75
85
  */
76
86
  _getElementAtPosition(
77
87
  pageTop: number,
78
- mChr: NodeList
88
+ mChr: HTMLElement[]
79
89
  ): {
80
90
  ci: number;
81
91
  cm: number;
@@ -0,0 +1,50 @@
1
+ export default InstanceCheck;
2
+ export type InstanceCheckThis = InstanceCheck;
3
+ /**
4
+ * @typedef {InstanceCheck} InstanceCheckThis
5
+ */
6
+ /**
7
+ * @constructor
8
+ * @this {InstanceCheck}
9
+ * @description iframe-safe instanceof check utility class
10
+ * @param {__se__EditorCore} editor - The root editor instance
11
+ */
12
+ declare function InstanceCheck(this: InstanceCheck, editor: __se__EditorCore): void;
13
+ declare class InstanceCheck {
14
+ /**
15
+ * @typedef {InstanceCheck} InstanceCheckThis
16
+ */
17
+ /**
18
+ * @constructor
19
+ * @this {InstanceCheck}
20
+ * @description iframe-safe instanceof check utility class
21
+ * @param {__se__EditorCore} editor - The root editor instance
22
+ */
23
+ constructor(this: InstanceCheck, editor: __se__EditorCore);
24
+ editor: import('../editor').default;
25
+ /**
26
+ * @param {*} obj
27
+ * @returns {obj is Node}
28
+ */
29
+ isNode(obj: any): obj is Node;
30
+ /**
31
+ * @param {*} obj
32
+ * @returns {obj is Element}
33
+ */
34
+ isElement(obj: any): obj is Element;
35
+ /**
36
+ * @param {*} obj
37
+ * @returns {obj is Range}
38
+ */
39
+ isRange(obj: any): obj is Range;
40
+ /**
41
+ * @param {*} obj
42
+ * @returns {obj is Selection}
43
+ */
44
+ isSelection(obj: any): obj is Selection;
45
+ /**
46
+ * @private
47
+ * @returns {window}
48
+ */
49
+ _getFrameWindow(): Window & typeof globalThis;
50
+ }
@@ -24,6 +24,10 @@ declare class ClassInjector {
24
24
  format: __se__EditorCore['format'];
25
25
  /** @description HTML class instance @type {__se__EditorCore['html']} */
26
26
  html: __se__EditorCore['html'];
27
+ /** @description Inline format class instance @type {__se__EditorCore['inline']} */
28
+ inline: __se__EditorCore['inline'];
29
+ /** @description List format class instance @type {__se__EditorCore['listFormat']} */
30
+ listFormat: __se__EditorCore['listFormat'];
27
31
  /** @description Menu class instance @type {__se__EditorCore['menu']} */
28
32
  menu: __se__EditorCore['menu'];
29
33
  /** @description NodeTransform class instance @type {__se__EditorCore['nodeTransform']} */
@@ -19,6 +19,11 @@ export default class CoreInjector {
19
19
  * @type {__se__EditorCore['eventManager']}
20
20
  */
21
21
  eventManager: __se__EditorCore['eventManager'];
22
+ /**
23
+ * @description The util/instanceCheck instance.
24
+ * @type {__se__EditorCore['instanceCheck']}
25
+ */
26
+ instanceCheck: __se__EditorCore['instanceCheck'];
22
27
  /**
23
28
  * @description The history manager instance.
24
29
  * @type {__se__EditorCore['history']}
@@ -50,12 +55,22 @@ export default class CoreInjector {
50
55
  */
51
56
  status: __se__EditorStatus;
52
57
  /**
53
- * @description The editor's context map.
58
+ * @description The editor's [frame] context utility object.
59
+ * @type {__se__EditorCore['frameContext']}
60
+ */
61
+ frameContext: __se__EditorCore['frameContext'];
62
+ /**
63
+ * @description The editor's [frame] options utility object.
64
+ * @type {__se__EditorCore['frameOptions']}
65
+ */
66
+ frameOptions: __se__EditorCore['frameOptions'];
67
+ /**
68
+ * @description The editor's context utility object.
54
69
  * @type {__se__EditorCore['context']}
55
70
  */
56
71
  context: __se__EditorCore['context'];
57
72
  /**
58
- * @description The editor's options map.
73
+ * @description The editor's options utility object.
59
74
  * @type {__se__EditorCore['options']}
60
75
  */
61
76
  options: __se__EditorCore['options'];
@@ -84,9 +99,4 @@ export default class CoreInjector {
84
99
  * @type {Document}
85
100
  */
86
101
  _d: Document;
87
- /**
88
- * @description The shadow root object (if any).
89
- * @type {__se__EditorCore['_shadowRoot']}
90
- */
91
- _shadowRoot: __se__EditorCore['_shadowRoot'];
92
102
  }
@@ -14,6 +14,8 @@ declare class EditorInjector {
14
14
  editor: __se__EditorCore;
15
15
  /** @type {import('./_core').default['eventManager']} */
16
16
  eventManager: import('./_core').default['eventManager'];
17
+ /** @type {import('./_core').default['instanceCheck']} */
18
+ instanceCheck: import('./_core').default['instanceCheck'];
17
19
  /** @type {import('./_core').default['history']} */
18
20
  history: import('./_core').default['history'];
19
21
  /** @type {import('./_core').default['events']} */
@@ -26,6 +28,10 @@ declare class EditorInjector {
26
28
  plugins: import('./_core').default['plugins'];
27
29
  /** @type {import('./_core').default['status']} */
28
30
  status: import('./_core').default['status'];
31
+ /** @type {import('./_core').default['frameContext']} */
32
+ frameContext: import('./_core').default['frameContext'];
33
+ /** @type {import('./_core').default['frameOptions']} */
34
+ frameOptions: import('./_core').default['frameOptions'];
29
35
  /** @type {import('./_core').default['context']} */
30
36
  context: import('./_core').default['context'];
31
37
  /** @type {import('./_core').default['options']} */
@@ -40,8 +46,6 @@ declare class EditorInjector {
40
46
  _w: import('./_core').default['_w'];
41
47
  /** @type {import('./_core').default['_d']} */
42
48
  _d: import('./_core').default['_d'];
43
- /** @type {import('./_core').default['_shadowRoot']} */
44
- _shadowRoot: import('./_core').default['_shadowRoot'];
45
49
  /** @type {import('./_classes').default['toolbar']} */
46
50
  toolbar: import('./_classes').default['toolbar'];
47
51
  /** @type {import('./_classes').default['subToolbar']} */
@@ -54,6 +58,10 @@ declare class EditorInjector {
54
58
  format: import('./_classes').default['format'];
55
59
  /** @type {import('./_classes').default['html']} */
56
60
  html: import('./_classes').default['html'];
61
+ /** @type {import('./_classes').default['inline']} */
62
+ inline: import('./_classes').default['inline'];
63
+ /** @type {import('./_classes').default['listFormat']} */
64
+ listFormat: import('./_classes').default['listFormat'];
57
65
  /** @type {import('./_classes').default['menu']} */
58
66
  menu: import('./_classes').default['menu'];
59
67
  /** @type {import('./_classes').default['nodeTransform']} */
package/types/events.d.ts CHANGED
@@ -3,6 +3,7 @@ declare namespace _default {
3
3
  let onScroll: any;
4
4
  let onMouseDown: any;
5
5
  let onClick: any;
6
+ let onBeforeInput: any;
6
7
  let onInput: any;
7
8
  let onMouseLeave: any;
8
9
  let onKeyDown: any;
@@ -3,9 +3,9 @@
3
3
  * - Iframe is replaced with a placeholder : <div data-se-iframe-holder-src="iframe.src">[iframe: iframe.src]</div>
4
4
  * - "iframe placeholder" is re-rendered in html.clean when pasted into the editor.
5
5
  * @param {Element|Text|string} content Content to be copied to the clipboard
6
- * @returns {Promise<void>}
6
+ * @returns {Promise<void|false>} If it fails, it returns false.
7
7
  */
8
- export function write(content: Element | Text | string): Promise<void>;
8
+ export function write(content: Element | Text | string): Promise<void | false>;
9
9
  declare namespace _default {
10
10
  export { write };
11
11
  }
@@ -150,21 +150,17 @@ export function spanToStyleNode(
150
150
  * @returns {string} The updated URL with the query string appended.
151
151
  */
152
152
  export function addUrlQuery(url: string, query: string): string;
153
+ /**
154
+ * @typedef {import('../core/config/options').OptionStyleResult} OptionStyleResult_converter
155
+ */
153
156
  /**
154
157
  * @description Converts options-related styles and returns them for each frame.
155
158
  * @param {Map<string, *>} fo editor.frameOptions
156
159
  * @param {string} cssText Style string
157
- * @returns {{top: string, frame: string, editor: string}}
160
+ * @returns {OptionStyleResult_converter}
158
161
  * @private
159
162
  */
160
- export function _setDefaultOptionStyle(
161
- fo: Map<string, any>,
162
- cssText: string
163
- ): {
164
- top: string;
165
- frame: string;
166
- editor: string;
167
- };
163
+ export function _setDefaultOptionStyle(fo: Map<string, any>, cssText: string): OptionStyleResult_converter;
168
164
  /**
169
165
  * @description Set default style tag of the iframe
170
166
  * @param {Array<string>} linkNames link names array of CSS files
@@ -178,6 +174,7 @@ export function _setIframeStyleLinks(linkNames: Array<string>): string;
178
174
  */
179
175
  export function _setAutoHeightStyle(frameHeight: string): string;
180
176
  export default converter;
177
+ export type OptionStyleResult_converter = import('../core/config/options').OptionStyleResult;
181
178
  declare namespace converter {
182
179
  export { htmlToJson };
183
180
  export { jsonToHtml };
@@ -114,6 +114,12 @@ export function isContentLess(node: (Node | string) | null): boolean;
114
114
  * @returns {boolean}
115
115
  */
116
116
  export function isEmptyLine(node: Node): boolean;
117
+ /**
118
+ * @description Checks if the given node is a container component (class "se-component-container").
119
+ * @param {Node} element
120
+ * @returns {boolean} True if the node is a container component, otherwise false.
121
+ */
122
+ export function isComponentContainer(element: Node): boolean;
117
123
  /**
118
124
  * @description It is judged whether it is the edit region top div element or iframe's body tag.
119
125
  * @param {?Node} node The node to check
@@ -179,6 +185,7 @@ declare namespace check {
179
185
  export { isFigure };
180
186
  export { isContentLess };
181
187
  export { isEmptyLine };
188
+ export { isComponentContainer };
182
189
  export { isWysiwygFrame };
183
190
  export { isNonEditable };
184
191
  export { isSpanWithoutAttr };
@@ -32,22 +32,32 @@ export function getNodePath(
32
32
  * @returns {T}
33
33
  */
34
34
  export function getNodeFromPath<T extends Node>(offsets: Array<number>, parentNode: Node): T;
35
+ /**
36
+ * @template {HTMLElement} T
37
+ * @description Get all "child node" of the argument value element
38
+ * @param {Node} element element to get child node
39
+ * @param {?(current: *) => boolean} validation Conditional function
40
+ * @returns {T|null}
41
+ */
42
+ export function getChildNode<T extends HTMLElement>(element: Node, validation: ((current: any) => boolean) | null): T | null;
35
43
  /**
36
44
  * @template {HTMLElement} T
37
45
  * @description Get all "children" of the argument value element (Without text nodes)
38
46
  * @param {Node} element element to get child node
39
47
  * @param {?(current: *) => boolean} validation Conditional function
48
+ * @param {?number} depth Number of child levels to depth.
40
49
  * @returns {Array<T>}
41
50
  */
42
- export function getListChildren<T extends HTMLElement>(element: Node, validation: ((current: any) => boolean) | null): Array<T>;
51
+ export function getListChildren<T extends HTMLElement>(element: Node, validation: ((current: any) => boolean) | null, depth: number | null): Array<T>;
43
52
  /**
44
53
  * @template {Node} T
45
54
  * @description Get all "childNodes" of the argument value element (Include text nodes)
46
55
  * @param {Node} element element to get child node
47
56
  * @param {?(current: *) => boolean} validation Conditional function
57
+ * @param {?number} depth Number of child levels to depth.
48
58
  * @returns {Array<T>}
49
59
  */
50
- export function getListChildNodes<T extends Node>(element: Node, validation: ((current: any) => boolean) | null): Array<T>;
60
+ export function getListChildNodes<T extends Node>(element: Node, validation: ((current: any) => boolean) | null, depth: number | null): Array<T>;
51
61
  /**
52
62
  * @description Returns the number of parents nodes.
53
63
  * - "0" when the parent node is the WYSIWYG area.
@@ -186,14 +196,14 @@ export function findTabEndIndex(line: Node, baseIndex: number, minTabSize: numbe
186
196
  */
187
197
  export function findVisualLastCell(cells: HTMLTableCellElement[]): HTMLTableCellElement | null;
188
198
  /**
189
- * @description Get nearest scrollable parent
190
- * @param {Node} element Element
191
- * @returns {HTMLElement|null}
199
+ * @description Finds and returns parent containers that are scrollable.
200
+ * @param {HTMLElement} element - Element to start with
201
+ * @returns {HTMLElement[]} - Array (in descending order)
192
202
  */
193
- export function getScrollParent(element: Node): HTMLElement | null;
203
+ export function getScrollParents(element: HTMLElement): HTMLElement[];
194
204
  /**
195
205
  * @description Get the argument iframe's document object if use the "iframe" or "fullPage" options
196
- * @param {HTMLIFrameElement} iframe Iframe element (this.editor.frameContext.get('wysiwygFrame'))
206
+ * @param {HTMLIFrameElement} iframe Iframe element (this.frameContext.get('wysiwygFrame'))
197
207
  * @returns {Document}
198
208
  */
199
209
  export function getIframeDocument(iframe: HTMLIFrameElement): Document;
@@ -202,6 +212,7 @@ declare namespace query {
202
212
  export { getPositionIndex };
203
213
  export { getNodePath };
204
214
  export { getNodeFromPath };
215
+ export { getChildNode };
205
216
  export { getListChildren };
206
217
  export { getListChildNodes };
207
218
  export { getNodeDepth };
@@ -218,6 +229,6 @@ declare namespace query {
218
229
  export { findTextIndexOnLine };
219
230
  export { findTabEndIndex };
220
231
  export { findVisualLastCell };
221
- export { getScrollParent };
232
+ export { getScrollParents };
222
233
  export { getIframeDocument };
223
234
  }
@@ -115,13 +115,20 @@ export function changeTxt(node: Node, txt: string): void;
115
115
  * @param {string|number} value Style value
116
116
  */
117
117
  export function setStyle(elements: Node | Node[], styleName: string, value: string | number): void;
118
+ /**
119
+ * @description Gets the style value of the element. If the elements is an array, the style of the first element is returned.
120
+ * @param {Node} element Element to get style from.
121
+ * @param {string} styleName Style attribute name (e.g., 'marginLeft', 'textAlign').
122
+ * @returns {string | undefined} The value of the style attribute, or undefined if the element does not exist.
123
+ */
124
+ export function getStyle(element: Node, styleName: string): string | undefined;
118
125
  /**
119
126
  * @description In the predefined code view mode, the buttons except the executable button are changed to the 'disabled' state.
120
- * @param {Array<HTMLButtonElement|HTMLInputElement>} buttonList (Button | Input) Element array
127
+ * @param {__se__NodeCollection} buttonList (Button | Input) Element array
121
128
  * @param {boolean} disabled Disabled value
122
129
  * @param {boolean} [important=false] If priveleged mode should be used (Necessary to switch importantDisabled buttons)
123
130
  */
124
- export function setDisabled(buttonList: Array<HTMLButtonElement | HTMLInputElement>, disabled: boolean, important?: boolean): void;
131
+ export function setDisabled(buttonList: __se__NodeCollection, disabled: boolean, important?: boolean): void;
125
132
  /**
126
133
  * @description Determine whether any of the matched elements are assigned the given class
127
134
  * @param {?Node} element Elements to search class name
@@ -188,6 +195,18 @@ export function applyInlineStylesAll(wwTarget: Node, includeWW: boolean, styles:
188
195
  * @returns {Promise<void>}
189
196
  */
190
197
  export function waitForMediaLoad(target: Node, timeout?: number): Promise<void>;
198
+ /**
199
+ * @description Gets a CSS variable on the root element of the editor.
200
+ * @param {string} name - The CSS variable name (e.g. `--se-color-primary`)
201
+ * @return {string} The value of the CSS variable
202
+ */
203
+ export function getRootCssVar(name: string): string;
204
+ /**
205
+ * @description Sets a CSS variable on the root element of the editor.
206
+ * @param {string} name - The CSS variable name (e.g. `--se-color-primary`)
207
+ * @param {string} value - The CSS variable value
208
+ */
209
+ export function setRootCssVar(name: string, value: string): void;
191
210
  /**
192
211
  * @description Create tooltip HTML
193
212
  * @param {string} text Tooltip text
@@ -212,6 +231,7 @@ declare namespace utils {
212
231
  export { changeElement };
213
232
  export { changeTxt };
214
233
  export { setStyle };
234
+ export { getStyle };
215
235
  export { setDisabled };
216
236
  export { hasClass };
217
237
  export { addClass };
@@ -222,5 +242,7 @@ declare namespace utils {
222
242
  export { getViewportSize };
223
243
  export { applyInlineStylesAll };
224
244
  export { waitForMediaLoad };
245
+ export { getRootCssVar };
246
+ export { setRootCssVar };
225
247
  export { createTooltipInner };
226
248
  }
@@ -1,9 +1,94 @@
1
+ export const domQuery: {
2
+ getPositionIndex: typeof import('./domQuery').getPositionIndex;
3
+ getNodePath: typeof import('./domQuery').getNodePath;
4
+ getNodeFromPath: typeof import('./domQuery').getNodeFromPath;
5
+ getChildNode: typeof import('./domQuery').getChildNode;
6
+ getListChildren: typeof import('./domQuery').getListChildren;
7
+ getListChildNodes: typeof import('./domQuery').getListChildNodes;
8
+ getNodeDepth: typeof import('./domQuery').getNodeDepth;
9
+ sortNodeByDepth: typeof import('./domQuery').sortNodeByDepth;
10
+ compareElements: typeof import('./domQuery').compareElements;
11
+ getParentElement: typeof import('./domQuery').getParentElement;
12
+ getParentElements: typeof import('./domQuery').getParentElements;
13
+ getCommandTarget: typeof import('./domQuery').getCommandTarget;
14
+ getEventTarget: typeof import('./domQuery').getEventTarget;
15
+ getEdgeChild: typeof import('./domQuery').getEdgeChild;
16
+ getEdgeChildNodes: typeof import('./domQuery').getEdgeChildNodes;
17
+ getPreviousDeepestNode: typeof import('./domQuery').getPreviousDeepestNode;
18
+ getNextDeepestNode: typeof import('./domQuery').getNextDeepestNode;
19
+ findTextIndexOnLine: typeof import('./domQuery').findTextIndexOnLine;
20
+ findTabEndIndex: typeof import('./domQuery').findTabEndIndex;
21
+ findVisualLastCell: typeof import('./domQuery').findVisualLastCell;
22
+ getScrollParents: typeof import('./domQuery').getScrollParents;
23
+ getIframeDocument: typeof import('./domQuery').getIframeDocument;
24
+ };
25
+ export const domCheck: {
26
+ isZeroWidth: typeof import('./domCheck').isZeroWidth;
27
+ isEdgePoint: typeof import('./domCheck').isEdgePoint;
28
+ isText: typeof import('./domCheck').isText;
29
+ isElement: typeof import('./domCheck').isElement;
30
+ isInputElement: typeof import('./domCheck').isInputElement;
31
+ isButtonElement: typeof import('./domCheck').isButtonElement;
32
+ isList: typeof import('./domCheck').isList;
33
+ isListCell: typeof import('./domCheck').isListCell;
34
+ isTable: typeof import('./domCheck').isTable;
35
+ isTableElements: typeof import('./domCheck').isTableElements;
36
+ isTableCell: typeof import('./domCheck').isTableCell;
37
+ isTableRow: typeof import('./domCheck').isTableRow;
38
+ isBreak: typeof import('./domCheck').isBreak;
39
+ isAnchor: typeof import('./domCheck').isAnchor;
40
+ isMedia: typeof import('./domCheck').isMedia;
41
+ isIFrame: typeof import('./domCheck').isIFrame;
42
+ isFigure: typeof import('./domCheck').isFigure;
43
+ isContentLess: typeof import('./domCheck').isContentLess;
44
+ isEmptyLine: typeof import('./domCheck').isEmptyLine;
45
+ isComponentContainer: typeof import('./domCheck').isComponentContainer;
46
+ isWysiwygFrame: typeof import('./domCheck').isWysiwygFrame;
47
+ isNonEditable: typeof import('./domCheck').isNonEditable;
48
+ isSpanWithoutAttr: typeof import('./domCheck').isSpanWithoutAttr;
49
+ isSameAttributes: typeof import('./domCheck').isSameAttributes;
50
+ isExcludeFormat: typeof import('./domCheck').isExcludeFormat;
51
+ isUneditable: typeof import('./domCheck').isUneditable;
52
+ isImportantDisabled: typeof import('./domCheck').isImportantDisabled;
53
+ };
54
+ export const domUtils: {
55
+ clone: typeof import('./domUtils').clone;
56
+ createElement: typeof import('./domUtils').createElement;
57
+ createTextNode: typeof import('./domUtils').createTextNode;
58
+ getAttributesToString: typeof import('./domUtils').getAttributesToString;
59
+ arrayFilter: typeof import('./domUtils').arrayFilter;
60
+ arrayFind: typeof import('./domUtils').arrayFind;
61
+ arrayIncludes: typeof import('./domUtils').arrayIncludes;
62
+ getArrayIndex: typeof import('./domUtils').getArrayIndex;
63
+ nextIndex: typeof import('./domUtils').nextIndex;
64
+ prevIndex: typeof import('./domUtils').prevIndex;
65
+ copyTagAttributes: typeof import('./domUtils').copyTagAttributes;
66
+ copyFormatAttributes: typeof import('./domUtils').copyFormatAttributes;
67
+ removeItem: typeof import('./domUtils').removeItem;
68
+ changeElement: typeof import('./domUtils').changeElement;
69
+ changeTxt: typeof import('./domUtils').changeTxt;
70
+ setStyle: typeof import('./domUtils').setStyle;
71
+ getStyle: typeof import('./domUtils').getStyle;
72
+ setDisabled: typeof import('./domUtils').setDisabled;
73
+ hasClass: typeof import('./domUtils').hasClass;
74
+ addClass: typeof import('./domUtils').addClass;
75
+ removeClass: typeof import('./domUtils').removeClass;
76
+ toggleClass: typeof import('./domUtils').toggleClass;
77
+ flashClass: typeof import('./domUtils').flashClass;
78
+ getClientSize: typeof import('./domUtils').getClientSize;
79
+ getViewportSize: typeof import('./domUtils').getViewportSize;
80
+ applyInlineStylesAll: typeof import('./domUtils').applyInlineStylesAll;
81
+ waitForMediaLoad: typeof import('./domUtils').waitForMediaLoad;
82
+ getRootCssVar: typeof import('./domUtils').getRootCssVar;
83
+ setRootCssVar: typeof import('./domUtils').setRootCssVar;
84
+ createTooltipInner: typeof import('./domUtils').createTooltipInner;
85
+ };
1
86
  export default dom;
2
87
  declare namespace dom {
3
88
  export { query };
4
89
  export { check };
5
90
  export { utils };
6
91
  }
7
- import query from './domQuery';
8
92
  import check from './domCheck';
93
+ import query from './domQuery';
9
94
  import utils from './domUtils';
@@ -78,10 +78,14 @@ export const isChromium: boolean;
78
78
  export const isSafari: boolean;
79
79
  /**
80
80
  * @description Check if User Agent is Mobile device.
81
- * - when the device is touchable, it is judged as a mobile device.
82
81
  * @type {boolean}
83
82
  */
84
83
  export const isMobile: boolean;
84
+ /**
85
+ * @description Check if the device is touchable.
86
+ * @type {boolean}
87
+ */
88
+ export const isTouchDevice: boolean;
85
89
  /**
86
90
  * @description Check if User Agent is Android mobile device.
87
91
  * @type {boolean}
@@ -124,6 +128,7 @@ declare namespace env {
124
128
  export { isOSX_IOS };
125
129
  export { isAndroid };
126
130
  export { isMobile };
131
+ export { isTouchDevice };
127
132
  export { cmdIcon };
128
133
  export { shiftIcon };
129
134
  export { DPI };
@@ -16,6 +16,7 @@ export const env: {
16
16
  isOSX_IOS: boolean;
17
17
  isAndroid: boolean;
18
18
  isMobile: boolean;
19
+ isTouchDevice: boolean;
19
20
  cmdIcon: string;
20
21
  shiftIcon: string;
21
22
  DPI: number;
@@ -59,6 +60,7 @@ export const dom: {
59
60
  getPositionIndex: typeof import('./dom/domQuery').getPositionIndex;
60
61
  getNodePath: typeof import('./dom/domQuery').getNodePath;
61
62
  getNodeFromPath: typeof import('./dom/domQuery').getNodeFromPath;
63
+ getChildNode: typeof import('./dom/domQuery').getChildNode;
62
64
  getListChildren: typeof import('./dom/domQuery').getListChildren;
63
65
  getListChildNodes: typeof import('./dom/domQuery').getListChildNodes;
64
66
  getNodeDepth: typeof import('./dom/domQuery').getNodeDepth;
@@ -75,7 +77,7 @@ export const dom: {
75
77
  findTextIndexOnLine: typeof import('./dom/domQuery').findTextIndexOnLine;
76
78
  findTabEndIndex: typeof import('./dom/domQuery').findTabEndIndex;
77
79
  findVisualLastCell: typeof import('./dom/domQuery').findVisualLastCell;
78
- getScrollParent: typeof import('./dom/domQuery').getScrollParent;
80
+ getScrollParents: typeof import('./dom/domQuery').getScrollParents;
79
81
  getIframeDocument: typeof import('./dom/domQuery').getIframeDocument;
80
82
  };
81
83
  check: {
@@ -98,6 +100,7 @@ export const dom: {
98
100
  isFigure: typeof import('./dom/domCheck').isFigure;
99
101
  isContentLess: typeof import('./dom/domCheck').isContentLess;
100
102
  isEmptyLine: typeof import('./dom/domCheck').isEmptyLine;
103
+ isComponentContainer: typeof import('./dom/domCheck').isComponentContainer;
101
104
  isWysiwygFrame: typeof import('./dom/domCheck').isWysiwygFrame;
102
105
  isNonEditable: typeof import('./dom/domCheck').isNonEditable;
103
106
  isSpanWithoutAttr: typeof import('./dom/domCheck').isSpanWithoutAttr;
@@ -123,6 +126,7 @@ export const dom: {
123
126
  changeElement: typeof import('./dom/domUtils').changeElement;
124
127
  changeTxt: typeof import('./dom/domUtils').changeTxt;
125
128
  setStyle: typeof import('./dom/domUtils').setStyle;
129
+ getStyle: typeof import('./dom/domUtils').getStyle;
126
130
  setDisabled: typeof import('./dom/domUtils').setDisabled;
127
131
  hasClass: typeof import('./dom/domUtils').hasClass;
128
132
  addClass: typeof import('./dom/domUtils').addClass;
@@ -133,6 +137,8 @@ export const dom: {
133
137
  getViewportSize: typeof import('./dom/domUtils').getViewportSize;
134
138
  applyInlineStylesAll: typeof import('./dom/domUtils').applyInlineStylesAll;
135
139
  waitForMediaLoad: typeof import('./dom/domUtils').waitForMediaLoad;
140
+ getRootCssVar: typeof import('./dom/domUtils').getRootCssVar;
141
+ setRootCssVar: typeof import('./dom/domUtils').setRootCssVar;
136
142
  createTooltipInner: typeof import('./dom/domUtils').createTooltipInner;
137
143
  };
138
144
  };
@@ -18,11 +18,11 @@ export function isCtrl(e: KeyboardEvent): boolean;
18
18
  */
19
19
  export function isAlt(e: KeyboardEvent): boolean;
20
20
  /**
21
- * @description event.isComposing check
22
- * @param {KeyboardEvent} e Event object
21
+ * @description Check if the event is related to IME composition (in-progress or commit).
22
+ * @param {KeyboardEvent|InputEvent} e Event object
23
23
  * @returns {boolean}
24
24
  */
25
- export function isComposing(e: KeyboardEvent): boolean;
25
+ export function isComposing(e: KeyboardEvent | InputEvent): boolean;
26
26
  /**
27
27
  * @description Backspace key check
28
28
  * @param {string} code Event.code