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
@@ -18,6 +18,31 @@ export type TableCtrlProps = {
18
18
  font_italic: HTMLButtonElement;
19
19
  font_strike: HTMLButtonElement;
20
20
  };
21
+ export type TablePluginOptions = {
22
+ /**
23
+ * - Scroll type ('x', 'y', 'xy')
24
+ */
25
+ scrollType?: 'x' | 'y' | 'xy';
26
+ /**
27
+ * - Caption position ('top', 'bottom')
28
+ */
29
+ captionPosition?: 'top' | 'bottom';
30
+ /**
31
+ * - Cell controller position ('cell', 'table')
32
+ */
33
+ cellControllerPosition?: 'cell' | 'table';
34
+ /**
35
+ * - Color list, used in cell color picker
36
+ */
37
+ colorList?: any[];
38
+ };
39
+ /**
40
+ * @typedef {Object} TablePluginOptions
41
+ * @property {"x"|"y"|"xy"} [scrollType='x'] - Scroll type ('x', 'y', 'xy')
42
+ * @property {"top"|"bottom"} [captionPosition='bottom'] - Caption position ('top', 'bottom')
43
+ * @property {"cell"|"table"} [cellControllerPosition='cell'] - Cell controller position ('cell', 'table')
44
+ * @property {Array} [colorList] - Color list, used in cell color picker
45
+ */
21
46
  /**
22
47
  * @class
23
48
  * @description Table Plugin
@@ -38,21 +63,9 @@ declare class Table extends EditorInjector {
38
63
  /**
39
64
  * @constructor
40
65
  * @param {__se__EditorCore} editor - The root editor instance
41
- * @param {Object} pluginOptions
42
- * @param {"x"|"y"|"xy"} [pluginOptions.scrollType='x'] - Scroll type ('x', 'y', 'xy')
43
- * @param {"top"|"bottom"} [pluginOptions.captionPosition='bottom'] - Caption position ('top', 'bottom')
44
- * @param {"cell"|"table"} [pluginOptions.cellControllerPosition='cell'] - Cell controller position ('cell', 'table')
45
- * @param {Array} [pluginOptions.colorList] - Color list, used in cell color picker
46
- */
47
- constructor(
48
- editor: __se__EditorCore,
49
- pluginOptions: {
50
- scrollType?: 'x' | 'y' | 'xy';
51
- captionPosition?: 'top' | 'bottom';
52
- cellControllerPosition?: 'cell' | 'table';
53
- colorList?: any[];
54
- }
55
- );
66
+ * @param {TablePluginOptions} pluginOptions - Plugin options
67
+ */
68
+ constructor(editor: __se__EditorCore, pluginOptions: TablePluginOptions);
56
69
  title: any;
57
70
  icon: string;
58
71
  figureScrollList: string[];
@@ -117,65 +130,11 @@ declare class Table extends EditorInjector {
117
130
  mergeButton: HTMLButtonElement;
118
131
  /** @type {HTMLButtonElement} */
119
132
  unmergeButton: HTMLButtonElement;
120
- _resizing: boolean;
121
- _resizeLine: any;
122
- _resizeLinePrev: any;
123
- /** @type {HTMLElement} */
124
- _figure: HTMLElement;
125
133
  /**
126
134
  * @description Same value a "this._selectedTable", but it maintain prev table element
127
135
  * @type {HTMLTableElement}
128
136
  */
129
137
  _element: HTMLTableElement;
130
- /** @type {HTMLTableCellElement} */
131
- _tdElement: HTMLTableCellElement;
132
- /** @type {HTMLTableRowElement} */
133
- _trElement: HTMLTableRowElement;
134
- /** @type {HTMLTableRowElement[]|HTMLCollectionOf<HTMLTableRowElement>} */
135
- _trElements: HTMLTableRowElement[] | HTMLCollectionOf<HTMLTableRowElement>;
136
- _tableXY: any[];
137
- _maxWidth: boolean;
138
- _fixedColumn: boolean;
139
- _physical_cellCnt: number;
140
- _logical_cellCnt: number;
141
- _cellCnt: number;
142
- _rowCnt: number;
143
- _rowIndex: number;
144
- _physical_cellIndex: number;
145
- _logical_cellIndex: number;
146
- _current_colSpan: number;
147
- _current_rowSpan: number;
148
- /** @type {HTMLTableElement} */
149
- _selectedTable: HTMLTableElement;
150
- /** @type {HTMLTableCellElement} */
151
- _fixedCell: HTMLTableCellElement;
152
- /** @type {HTMLTableCellElement} */
153
- _selectedCell: HTMLTableCellElement;
154
- /** @type {HTMLTableCellElement[]} */
155
- _selectedCells: HTMLTableCellElement[];
156
- _shift: boolean;
157
- __s: boolean;
158
- _fixedCellName: string;
159
- _ref: {
160
- _i: number;
161
- cs: any;
162
- ce: any;
163
- rs: any;
164
- re: any;
165
- };
166
- _bindMultiOn: any;
167
- _bindMultiOff: any;
168
- _bindShiftOff: any;
169
- _bindTouchOff: any;
170
- __globalEvents: {
171
- on: any;
172
- off: any;
173
- shiftOff: any;
174
- touchOff: any;
175
- resize: any;
176
- resizeStop: any;
177
- resizeKeyDown: any;
178
- };
179
138
  /**
180
139
  * @editorMethod Editor.core
181
140
  * @description Executes the main execution method of the plugin.
@@ -188,6 +147,13 @@ declare class Table extends EditorInjector {
188
147
  * @param {HTMLElement} target Target component element
189
148
  */
190
149
  select(target: HTMLElement): void;
150
+ /**
151
+ * @editorMethod Editor.Component
152
+ * @description Method to delete a component of a plugin, called by the "FileManager", "Controller" module.
153
+ * @param {HTMLElement} target Target element
154
+ * @returns {Promise<void>}
155
+ */
156
+ destroy(target: HTMLElement): Promise<void>;
191
157
  /**
192
158
  * @editorMethod Editor.component
193
159
  * @description Executes the method that is called when a component copy is requested.
@@ -368,23 +334,6 @@ declare class Table extends EditorInjector {
368
334
  * @description Toggles the visibility of the table caption (`<caption>`). If the caption is present, it is removed; if absent, it is added.
369
335
  */
370
336
  toggleCaption(): void;
371
- /**
372
- * @private
373
- * @description Updates table styles.
374
- * @param {string} styles - Styles to update.
375
- * @param {boolean} ondisplay - Whether to update display.
376
- */
377
- private _setTableStyle;
378
- /**
379
- * @private
380
- * @description Sets the merge/split button visibility.
381
- */
382
- private _setMergeSplitButton;
383
- /**
384
- * @private
385
- * @description Sets the unmerge button visibility.
386
- */
387
- private _setUnMergeButton;
388
337
  /**
389
338
  * @private
390
339
  * @description Sets the controller position for a cell.
@@ -409,6 +358,12 @@ declare class Table extends EditorInjector {
409
358
  * @param {Node} target - The target figure element.
410
359
  */
411
360
  private _figureOpen;
361
+ /**
362
+ * @private
363
+ * @description Converts the width of <col> elements to percentages.
364
+ * @param {HTMLTableElement} target - The target table element.
365
+ */
366
+ private _resizePercentCol;
412
367
  /**
413
368
  * @private
414
369
  * @description Starts resizing a table cell.
@@ -1,4 +1,17 @@
1
1
  export default Template;
2
+ export type TemplatePluginOptions = {
3
+ /**
4
+ * - Template list
5
+ */
6
+ items?: Array<{
7
+ name: string;
8
+ html: string;
9
+ }>;
10
+ };
11
+ /**
12
+ * @typedef {Object} TemplatePluginOptions
13
+ * @property {Array<{name: string, html: string}>} [items] - Template list
14
+ */
2
15
  /**
3
16
  * @class
4
17
  * @description Template Plugin, Apply a template to the selection.
@@ -10,18 +23,9 @@ declare class Template extends EditorInjector {
10
23
  /**
11
24
  * @constructor
12
25
  * @param {__se__EditorCore} editor - The root editor instance
13
- * @param {Object} pluginOptions
14
- * @param {Array<{name: string, html: string}>} pluginOptions.items - Template list
26
+ * @param {TemplatePluginOptions} pluginOptions - Plugin options
15
27
  */
16
- constructor(
17
- editor: __se__EditorCore,
18
- pluginOptions: {
19
- items: Array<{
20
- name: string;
21
- html: string;
22
- }>;
23
- }
24
- );
28
+ constructor(editor: __se__EditorCore, pluginOptions: TemplatePluginOptions);
25
29
  title: any;
26
30
  icon: string;
27
31
  selectedIndex: number;
@@ -1,4 +1,21 @@
1
1
  export default TextStyle;
2
+ export type TextStylePluginOptions = {
3
+ /**
4
+ * - Text style item list
5
+ */
6
+ items: Array<
7
+ | string
8
+ | {
9
+ name: string;
10
+ class: string;
11
+ tag: string;
12
+ }
13
+ >;
14
+ };
15
+ /**
16
+ * @typedef {Object} TextStylePluginOptions
17
+ * @property {Array<string|{name: string, class: string, tag: string}>} items - Text style item list
18
+ */
2
19
  /**
3
20
  * @class
4
21
  * @description Text style Plugin, Applies a tag that specifies text styles to a selection.
@@ -10,18 +27,9 @@ declare class TextStyle extends EditorInjector {
10
27
  /**
11
28
  * @constructor
12
29
  * @param {__se__EditorCore} editor - The root editor instance
13
- * @param {Object} pluginOptions
14
- * @param {Array<{name: string, html: string}>} pluginOptions.items - Template list
30
+ * @param {TextStylePluginOptions} pluginOptions - Plugin options
15
31
  */
16
- constructor(
17
- editor: __se__EditorCore,
18
- pluginOptions: {
19
- items: Array<{
20
- name: string;
21
- html: string;
22
- }>;
23
- }
24
- );
32
+ constructor(editor: __se__EditorCore, pluginOptions: TextStylePluginOptions);
25
33
  title: any;
26
34
  icon: string;
27
35
  styleList: NodeListOf<Element>;
@@ -1,4 +1,60 @@
1
1
  export default Mention;
2
+ export type MentionPluginOptions = {
3
+ /**
4
+ * - The character that triggers the mention list
5
+ */
6
+ triggerText?: string;
7
+ /**
8
+ * - The number of items to display in the mention list
9
+ */
10
+ limitSize?: number;
11
+ /**
12
+ * - The number of characters to start searching for the mention list
13
+ */
14
+ searchStartLength?: number;
15
+ /**
16
+ * - The time to wait before displaying the mention list
17
+ */
18
+ delayTime?: number;
19
+ /**
20
+ * - Use data without using API
21
+ */
22
+ data?: Array<{
23
+ key: string;
24
+ name: string;
25
+ url: string;
26
+ }>;
27
+ /**
28
+ * - The URL to call the mention list
29
+ */
30
+ apiUrl?: string;
31
+ /**
32
+ * - The headers to send with the API call
33
+ */
34
+ apiHeaders?: {
35
+ [x: string]: string;
36
+ };
37
+ /**
38
+ * - Whether to cache the mention list data
39
+ */
40
+ useCachingData?: boolean;
41
+ /**
42
+ * - Whether to cache the mention list data in the field
43
+ */
44
+ useCachingFieldData?: boolean;
45
+ };
46
+ /**
47
+ * @typedef {Object} MentionPluginOptions
48
+ * @property {string} [triggerText="@"] - The character that triggers the mention list
49
+ * @property {number} [limitSize=5] - The number of items to display in the mention list
50
+ * @property {number} [searchStartLength=0] - The number of characters to start searching for the mention list
51
+ * @property {number} [delayTime=200] - The time to wait before displaying the mention list
52
+ * @property {Array<{key: string, name: string, url: string}>} [data] - Use data without using API
53
+ * @property {string} [apiUrl] - The URL to call the mention list
54
+ * @property {Object<string, string>} [apiHeaders] - The headers to send with the API call
55
+ * @property {boolean} [useCachingData=true] - Whether to cache the mention list data
56
+ * @property {boolean} [useCachingFieldData=true] - Whether to cache the mention list data in the field
57
+ */
2
58
  /**
3
59
  * @class
4
60
  * @description Mention Plugin
@@ -14,41 +70,9 @@ declare class Mention extends EditorInjector {
14
70
  /**
15
71
  * @constructor
16
72
  * @param {__se__EditorCore} editor - The root editor instance
17
- * @param {Object} pluginOptions
18
- * @param {string=} [pluginOptions.triggerText="@"] The character that triggers the mention list. Default is '@'.
19
- * @param {number=} [pluginOptions.limitSize=5] The number of items to display in the mention list. Default is 5.
20
- * @param {number=} [pluginOptions.searchStartLength=0] The number of characters to start searching for the mention list. Default is 0.
21
- * @param {number=} [pluginOptions.delayTime=200] The time to wait before displaying the mention list. Default is 200ms.
22
- * @param {Array<{key: string, name: string, url: string}>=} pluginOptions.data Use data without using API.
23
- * @param {string=} pluginOptions.apiUrl The URL to call the mention list. Default is ''.
24
- * @param {Object<string, string>=} pluginOptions.apiHeaders The headers to send with the API call. Default is {}.
25
- * @param {boolean=} [pluginOptions.useCachingData=true] Whether to cache the mention list data. Default is true.
26
- * @param {boolean=} [pluginOptions.useCachingFieldData=true] Whether to cache the mention list data in the field. Default is true.
73
+ * @param {MentionPluginOptions} pluginOptions
27
74
  */
28
- constructor(
29
- editor: __se__EditorCore,
30
- pluginOptions: {
31
- triggerText?: string | undefined;
32
- limitSize?: number | undefined;
33
- searchStartLength?: number | undefined;
34
- delayTime?: number | undefined;
35
- data?:
36
- | Array<{
37
- key: string;
38
- name: string;
39
- url: string;
40
- }>
41
- | undefined;
42
- apiUrl?: string | undefined;
43
- apiHeaders?:
44
- | {
45
- [x: string]: string;
46
- }
47
- | undefined;
48
- useCachingData?: boolean | undefined;
49
- useCachingFieldData?: boolean | undefined;
50
- }
51
- );
75
+ constructor(editor: __se__EditorCore, pluginOptions: MentionPluginOptions);
52
76
  title: any;
53
77
  icon: string;
54
78
  triggerText: string;
@@ -61,10 +85,6 @@ declare class Mention extends EditorInjector {
61
85
  url: string;
62
86
  }[];
63
87
  apiUrl: string;
64
- _delay: number;
65
- _lastAtPos: number;
66
- _anchorOffset: number;
67
- _anchorNode: Node;
68
88
  apiManager: ApiManager;
69
89
  cachingData: Map<any, any>;
70
90
  cachingFieldData: any[];
@@ -76,24 +96,6 @@ declare class Mention extends EditorInjector {
76
96
  * @returns {Promise<boolean>}
77
97
  */
78
98
  onInput(): Promise<boolean>;
79
- /**
80
- * @private
81
- * @description Generates the mention list based on user input.
82
- * - Fetches data from cache, direct data, or an API.
83
- * - Creates and opens the mention dropdown.
84
- * - Caches the fetched data for future use.
85
- * @param {string} value - The mention query text.
86
- * @param {Node} targetNode - The node where the mention is triggered.
87
- * @returns {Promise<boolean>} - Returns `true` if the mention list is displayed, `false` otherwise.
88
- */
89
- private _createMentionList;
90
- /**
91
- * @private
92
- * @description Constructs the API request URL with the mention query.
93
- * @param {string} key - The mention query text.
94
- * @returns {string} - The formatted API request URL.
95
- */
96
- private _createUrl;
97
99
  #private;
98
100
  }
99
101
  import EditorInjector from '../../editorInjector';
@@ -35,73 +35,73 @@ declare namespace _default {
35
35
  export { anchor };
36
36
  }
37
37
  export default _default;
38
+ import audioGallery from './browser/audioGallery';
39
+ import fileBrowser from './browser/fileBrowser';
40
+ import fileGallery from './browser/fileGallery';
41
+ import imageGallery from './browser/imageGallery';
42
+ import videoGallery from './browser/videoGallery';
38
43
  import blockquote from './command/blockquote';
39
44
  import exportPDF from './command/exportPDF';
40
45
  import fileUpload from './command/fileUpload';
41
46
  import list_bulleted from './command/list_bulleted';
42
47
  import list_numbered from './command/list_numbered';
43
- import mention from './field/mention';
44
48
  import align from './dropdown/align';
49
+ import backgroundColor from './dropdown/backgroundColor';
45
50
  import font from './dropdown/font';
46
51
  import fontColor from './dropdown/fontColor';
47
- import backgroundColor from './dropdown/backgroundColor';
48
- import list from './dropdown/list';
49
- import table from './dropdown/table';
50
52
  import formatBlock from './dropdown/formatBlock';
51
53
  import hr from './dropdown/hr';
52
54
  import layout from './dropdown/layout';
53
55
  import lineHeight from './dropdown/lineHeight';
54
- import template from './dropdown/template';
56
+ import list from './dropdown/list';
55
57
  import paragraphStyle from './dropdown/paragraphStyle';
58
+ import table from './dropdown/table';
59
+ import template from './dropdown/template';
56
60
  import textStyle from './dropdown/textStyle';
57
- import link from './modal/link';
58
- import image from './modal/image';
59
- import video from './modal/video';
61
+ import mention from './field/mention';
62
+ import fontSize from './input/fontSize';
63
+ import pageNavigator from './input/pageNavigator';
60
64
  import audio from './modal/audio';
65
+ import drawing from './modal/drawing';
61
66
  import embed from './modal/embed';
67
+ import image from './modal/image';
68
+ import link from './modal/link';
62
69
  import math from './modal/math';
63
- import drawing from './modal/drawing';
64
- import imageGallery from './browser/imageGallery';
65
- import videoGallery from './browser/videoGallery';
66
- import audioGallery from './browser/audioGallery';
67
- import fileGallery from './browser/fileGallery';
68
- import fileBrowser from './browser/fileBrowser';
69
- import fontSize from './input/fontSize';
70
- import pageNavigator from './input/pageNavigator';
70
+ import video from './modal/video';
71
71
  import anchor from './popup/anchor';
72
72
  export {
73
+ align,
74
+ anchor,
75
+ audio,
76
+ audioGallery,
77
+ backgroundColor,
73
78
  blockquote,
79
+ drawing,
80
+ embed,
74
81
  exportPDF,
82
+ fileBrowser,
83
+ fileGallery,
75
84
  fileUpload,
76
- list_bulleted,
77
- list_numbered,
78
- mention,
79
- align,
80
85
  font,
81
86
  fontColor,
82
- backgroundColor,
83
- list,
84
- table,
87
+ fontSize,
85
88
  formatBlock,
86
89
  hr,
90
+ image,
91
+ imageGallery,
87
92
  layout,
88
93
  lineHeight,
89
- template,
90
- paragraphStyle,
91
- textStyle,
92
94
  link,
93
- image,
94
- video,
95
- audio,
96
- embed,
95
+ list,
96
+ list_bulleted,
97
+ list_numbered,
97
98
  math,
98
- drawing,
99
- imageGallery,
100
- videoGallery,
101
- audioGallery,
102
- fileGallery,
103
- fileBrowser,
104
- fontSize,
99
+ mention,
105
100
  pageNavigator,
106
- anchor
101
+ paragraphStyle,
102
+ table,
103
+ template,
104
+ textStyle,
105
+ video,
106
+ videoGallery
107
107
  };
@@ -1,4 +1,46 @@
1
1
  export default FontSize;
2
+ export type FontSizePluginOptions = {
3
+ /**
4
+ * - The unit for the font size.
5
+ * - Accepted values include: 'px', 'pt', 'em', 'rem', 'vw', 'vh', '%' or 'text'.
6
+ * - If 'text' is used, a text-based font size list is applied.
7
+ */
8
+ sizeUnit?: string;
9
+ /**
10
+ * - Determines whether the default size label is displayed in the dropdown menu.
11
+ */
12
+ showDefaultSizeLabel?: boolean;
13
+ /**
14
+ * - When true, displays increase and decrease buttons for font size adjustments.
15
+ */
16
+ showIncDecControls?: boolean;
17
+ /**
18
+ * - When true, disables the direct font size input box.
19
+ */
20
+ disableInput?: boolean;
21
+ /**
22
+ * - Optional object to override or extend the default unit mapping for font sizes.
23
+ */
24
+ unitMap?: {
25
+ [x: string]: {
26
+ default: number;
27
+ inc: number;
28
+ min: number;
29
+ max: number;
30
+ list: Array<number>;
31
+ };
32
+ };
33
+ };
34
+ /**
35
+ * @typedef {Object} FontSizePluginOptions
36
+ * @property {string} [sizeUnit='px'] - The unit for the font size.
37
+ * - Accepted values include: 'px', 'pt', 'em', 'rem', 'vw', 'vh', '%' or 'text'.
38
+ * - If 'text' is used, a text-based font size list is applied.
39
+ * @property {boolean} [showDefaultSizeLabel=true] - Determines whether the default size label is displayed in the dropdown menu.
40
+ * @property {boolean} [showIncDecControls=false] - When true, displays increase and decrease buttons for font size adjustments.
41
+ * @property {boolean} [disableInput=true] - When true, disables the direct font size input box.
42
+ * @property {Object<string, {default: number, inc: number, min: number, max: number, list: Array<number>}>} [unitMap={}] - Optional object to override or extend the default unit mapping for font sizes.
43
+ */
2
44
  /**
3
45
  * @class
4
46
  * @description FontSize Plugin
@@ -13,33 +55,9 @@ declare class FontSize extends EditorInjector {
13
55
  /**
14
56
  * @constructor
15
57
  * @param {__se__EditorCore} editor - The root editor instance
16
- * @param {Object} pluginOptions - Configuration options for the FontSize plugin.
17
- * @param {string=} [pluginOptions.sizeUnit='px'] - The unit for the font size.
18
- * - Accepted values include: 'px', 'pt', 'em', 'rem', 'vw', 'vh', '%' or 'text'.
19
- * - If 'text' is used, a text-based font size list is applied.
20
- * @param {boolean=} [pluginOptions.showDefaultSizeLabel=true] - Determines whether the default size label is displayed in the dropdown menu.
21
- * @param {boolean=} [pluginOptions.showIncDecControls=false] - When true, displays increase and decrease buttons for font size adjustments.
22
- * @param {boolean=} [pluginOptions.disableInput=true] - When true, disables the direct font size input box.
23
- * @param {Object<string, {default: number, inc: number, min: number, max: number, list: Array<number>}>} [pluginOptions.unitMap={}] - Optional object to override or extend the default unit mapping for font sizes.
58
+ * @param {FontSizePluginOptions} pluginOptions - Configuration options for the FontSize plugin.
24
59
  */
25
- constructor(
26
- editor: __se__EditorCore,
27
- pluginOptions: {
28
- sizeUnit?: string | undefined;
29
- showDefaultSizeLabel?: boolean | undefined;
30
- showIncDecControls?: boolean | undefined;
31
- disableInput?: boolean | undefined;
32
- unitMap?: {
33
- [x: string]: {
34
- default: number;
35
- inc: number;
36
- min: number;
37
- max: number;
38
- list: Array<number>;
39
- };
40
- };
41
- }
42
- );
60
+ constructor(editor: __se__EditorCore, pluginOptions: FontSizePluginOptions);
43
61
  unitMap: {
44
62
  text: {
45
63
  default: string;
@@ -107,13 +125,13 @@ declare class FontSize extends EditorInjector {
107
125
  sizeList: NodeListOf<Element>;
108
126
  hasInputFocus: boolean;
109
127
  isInputActive: boolean;
110
- _disableInput: boolean;
111
128
  /**
112
129
  * @editorMethod Editor.EventManager
113
130
  * @description Executes the method that is called whenever the cursor position changes.
114
131
  * @param {?HTMLElement=} element - Node element where the cursor is currently located
115
132
  * @param {?HTMLElement=} target - The plugin's toolbar button element
116
133
  * @returns {boolean} - Whether the plugin is active
134
+ * - If it returns "undefined", it will no longer be called in this scope.
117
135
  */
118
136
  active(element?: (HTMLElement | null) | undefined, target?: (HTMLElement | null) | undefined): boolean;
119
137
  /**
@@ -143,28 +161,6 @@ declare class FontSize extends EditorInjector {
143
161
  * @param {HTMLElement} target - The plugin's toolbar button element
144
162
  */
145
163
  action(target: HTMLElement): void;
146
- /**
147
- * @private
148
- * @description Retrieves the default font size of the editor.
149
- * @returns {string} - The computed font size from the editor.
150
- */
151
- private _getDefaultSize;
152
- /**
153
- * @private
154
- * @description Extracts the font size and unit from the given element or input value.
155
- * @param {string|Element} target - The target input or element.
156
- * @returns {{ unit: string, value: number|string }} - An object containing:
157
- * - `unit` (string): The detected font size unit.
158
- * - `value` (number|string): The numeric font size value or text-based size.
159
- */
160
- private _getSize;
161
- /**
162
- * @private
163
- * @description Sets the font size in the toolbar input field or button label.
164
- * @param {HTMLElement} target - The target element in the toolbar.
165
- * @param {string|number} value - The font size value.
166
- * @returns {string|number} - The applied font size.
167
- */
168
- private _setSize;
164
+ #private;
169
165
  }
170
166
  import EditorInjector from '../../editorInjector';