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
@@ -1,4 +1,19 @@
1
1
  export default ExportPDF;
2
+ export type ExportPDFPluginOptions = {
3
+ /**
4
+ * - Server request URL for PDF generation
5
+ */
6
+ apiUrl: string;
7
+ /**
8
+ * - Name of the generated PDF file
9
+ */
10
+ fileName?: string;
11
+ };
12
+ /**
13
+ * @typedef ExportPDFPluginOptions
14
+ * @property {string} apiUrl - Server request URL for PDF generation
15
+ * @property {string} [fileName="suneditor-pdf"] - Name of the generated PDF file
16
+ */
2
17
  /**
3
18
  * @class
4
19
  * @description Export PDF plugin
@@ -10,17 +25,9 @@ declare class ExportPDF extends EditorInjector {
10
25
  /**
11
26
  * @constructor
12
27
  * @param {__se__EditorCore} editor - The root editor instance
13
- * @param {Object} pluginOptions - plugin options
14
- * @param {string} pluginOptions.apiUrl - server request url
15
- * @param {string} pluginOptions.fileName - file name
28
+ * @param {ExportPDFPluginOptions} pluginOptions - plugin options
16
29
  */
17
- constructor(
18
- editor: __se__EditorCore,
19
- pluginOptions: {
20
- apiUrl: string;
21
- fileName: string;
22
- }
23
- );
30
+ constructor(editor: __se__EditorCore, pluginOptions: ExportPDFPluginOptions);
24
31
  title: any;
25
32
  icon: string;
26
33
  apiUrl: string;
@@ -33,14 +40,7 @@ declare class ExportPDF extends EditorInjector {
33
40
  * @returns {Promise<void>}
34
41
  */
35
42
  action(): Promise<void>;
36
- /**
37
- * @private
38
- * @description Sends the editor content to the server for PDF generation.
39
- * @param {HTMLElement} ww - A temporary container holding the formatted editor content.
40
- * @returns {Promise<void>} Resolves when the PDF file is successfully downloaded.
41
- * @throws {Error} Throws an error if the server response indicates a failure.
42
- */
43
- private _createByServer;
43
+ #private;
44
44
  }
45
45
  import EditorInjector from '../../editorInjector';
46
46
  import { ApiManager } from '../../modules';
@@ -1,4 +1,64 @@
1
1
  export default FileUpload;
2
+ export type FileUploadPluginOptions = {
3
+ /**
4
+ * - Server request URL for file upload
5
+ */
6
+ uploadUrl: string;
7
+ /**
8
+ * - Server request headers
9
+ */
10
+ uploadHeaders?: {
11
+ [x: string]: string;
12
+ };
13
+ /**
14
+ * - Total upload size limit in bytes
15
+ */
16
+ uploadSizeLimit?: string;
17
+ /**
18
+ * - Single file size limit in bytes
19
+ */
20
+ uploadSingleSizeLimit?: string;
21
+ /**
22
+ * - Allow multiple file uploads
23
+ */
24
+ allowMultiple?: boolean;
25
+ /**
26
+ * - Accepted file formats (e.g., 'image/*, .pdf')
27
+ */
28
+ acceptedFormats?: string;
29
+ /**
30
+ * - Specify the default form of the file component as 'box' or 'link'
31
+ */
32
+ as?: string;
33
+ /**
34
+ * - Additional controls to be added to the figure
35
+ */
36
+ controls?: Array<string>;
37
+ /**
38
+ * - Component insertion behavior for selection and cursor placement. [default: options.get('componentInsertBehavior')]
39
+ * - `auto`: Move cursor to the next line if possible, otherwise select the component.
40
+ * - `select`: Always select the inserted component.
41
+ * - `line`: Move cursor to the next line if possible, or create a new line and move there.
42
+ * - `none`: Do nothing.
43
+ */
44
+ insertBehavior?: __se__ComponentInsertBehaviorType;
45
+ };
46
+ /**
47
+ * @typedef FileUploadPluginOptions
48
+ * @property {string} uploadUrl - Server request URL for file upload
49
+ * @property {Object<string, string>} [uploadHeaders] - Server request headers
50
+ * @property {string} [uploadSizeLimit] - Total upload size limit in bytes
51
+ * @property {string} [uploadSingleSizeLimit] - Single file size limit in bytes
52
+ * @property {boolean} [allowMultiple=false] - Allow multiple file uploads
53
+ * @property {string} [acceptedFormats="*"] - Accepted file formats (e.g., 'image/*, .pdf')
54
+ * @property {string} [as="box"] - Specify the default form of the file component as 'box' or 'link'
55
+ * @property {Array<string>} [controls] - Additional controls to be added to the figure
56
+ * @property {__se__ComponentInsertBehaviorType} [insertBehavior] - Component insertion behavior for selection and cursor placement. [default: options.get('componentInsertBehavior')]
57
+ * - `auto`: Move cursor to the next line if possible, otherwise select the component.
58
+ * - `select`: Always select the inserted component.
59
+ * - `line`: Move cursor to the next line if possible, or create a new line and move there.
60
+ * - `none`: Do nothing.
61
+ */
2
62
  /**
3
63
  * @class
4
64
  * @description File upload plugin
@@ -19,33 +79,9 @@ declare class FileUpload extends EditorInjector {
19
79
  /**
20
80
  * @constructor
21
81
  * @param {__se__EditorCore} editor - The root editor instance
22
- * @param {Object} pluginOptions - plugin options
23
- * @param {string} pluginOptions.uploadUrl - server request url
24
- * @param {Object<string, string>=} pluginOptions.uploadHeaders - server request headers
25
- * @param {string=} pluginOptions.uploadSizeLimit - upload size limit
26
- * @param {string=} pluginOptions.uploadSingleSizeLimit - upload single size limit
27
- * @param {boolean=} pluginOptions.allowMultiple - allow multiple files
28
- * @param {string=} pluginOptions.acceptedFormats - accepted formats
29
- * @param {string=} pluginOptions.as - Whether to use the 'Box' or 'Link' conversion button
30
- * @param {Array<string>} pluginOptions.controls - Additional controls to be added to the figure
31
- */
32
- constructor(
33
- editor: __se__EditorCore,
34
- pluginOptions: {
35
- uploadUrl: string;
36
- uploadHeaders?:
37
- | {
38
- [x: string]: string;
39
- }
40
- | undefined;
41
- uploadSizeLimit?: string | undefined;
42
- uploadSingleSizeLimit?: string | undefined;
43
- allowMultiple?: boolean | undefined;
44
- acceptedFormats?: string | undefined;
45
- as?: string | undefined;
46
- controls: Array<string>;
47
- }
48
- );
82
+ * @param {FileUploadPluginOptions} pluginOptions - plugin options
83
+ */
84
+ constructor(editor: __se__EditorCore, pluginOptions: FileUploadPluginOptions);
49
85
  title: any;
50
86
  icon: string;
51
87
  uploadUrl: string;
@@ -56,10 +92,9 @@ declare class FileUpload extends EditorInjector {
56
92
  uploadSingleSizeLimit: number;
57
93
  allowMultiple: boolean;
58
94
  acceptedFormats: string;
59
- _acceptedCheck: string[];
60
95
  as: string;
96
+ insertBehavior: __se__ComponentInsertBehaviorType;
61
97
  input: HTMLElement;
62
- _element: HTMLElement;
63
98
  figure: Figure;
64
99
  fileManager: FileManager;
65
100
  controller: Controller;
@@ -121,7 +156,7 @@ declare class FileUpload extends EditorInjector {
121
156
  * @description Create file element
122
157
  * @param {string} url File URL
123
158
  * @param {File|{name: string, size: number}} file File object
124
- * @param {boolean} isLast Is last file
159
+ * @param {boolean} isLast Indicates whether this is the last file in the batch (used for scroll and insert actions).
125
160
  */
126
161
  create(
127
162
  url: string,
@@ -133,21 +168,6 @@ declare class FileUpload extends EditorInjector {
133
168
  },
134
169
  isLast: boolean
135
170
  ): void;
136
- /**
137
- * @private
138
- * @description Processes the server response after file upload.
139
- * - Registers the uploaded files in the editor.
140
- * @param {Object<string, *>} response - The response object from the server.
141
- */
142
- private _register;
143
- /**
144
- * @private
145
- * @description Handles file upload errors.
146
- * - Displays an error message if the upload fails.
147
- * @param {Object<string, *>} response - The error response from the server.
148
- * @returns {Promise<void>}
149
- */
150
- private _error;
151
171
  #private;
152
172
  }
153
173
  import EditorInjector from '../../editorInjector';
@@ -17,6 +17,7 @@ declare class List_bulleted extends EditorInjector {
17
17
  * @param {?HTMLElement=} element - Node element where the cursor is currently located
18
18
  * @param {?HTMLElement=} target - The plugin's toolbar button element
19
19
  * @returns {boolean} - Whether the plugin is active
20
+ * - If it returns "undefined", it will no longer be called in this scope.
20
21
  */
21
22
  active(element?: (HTMLElement | null) | undefined, target?: (HTMLElement | null) | undefined): boolean;
22
23
  /**
@@ -17,6 +17,7 @@ declare class List_numbered extends EditorInjector {
17
17
  * @param {?HTMLElement=} element - Node element where the cursor is currently located
18
18
  * @param {?HTMLElement=} target - The plugin's toolbar button element
19
19
  * @returns {boolean} - Whether the plugin is active
20
+ * - If it returns "undefined", it will no longer be called in this scope.
20
21
  */
21
22
  active(element?: (HTMLElement | null) | undefined, target?: (HTMLElement | null) | undefined): boolean;
22
23
  /**
@@ -1,4 +1,14 @@
1
1
  export default Align;
2
+ export type AlignPluginOptions = {
3
+ /**
4
+ * - Align items
5
+ */
6
+ items?: Array<'right' | 'center' | 'left' | 'justify'>;
7
+ };
8
+ /**
9
+ * @typedef {Object} AlignPluginOptions
10
+ * @property {Array.<"right"|"center"|"left"|"justify">} [items] - Align items
11
+ */
2
12
  /**
3
13
  * @class
4
14
  * @description Align plugin
@@ -9,15 +19,9 @@ declare class Align extends EditorInjector {
9
19
  static className: string;
10
20
  /**
11
21
  * @param {__se__EditorCore} editor - The root editor instance
12
- * @param {Object} pluginOptions
13
- * @param {Array.<"right"|"center"|"left"|"justify">} pluginOptions.items - Align items
22
+ * @param {AlignPluginOptions} pluginOptions - Plugin options
14
23
  */
15
- constructor(
16
- editor: __se__EditorCore,
17
- pluginOptions: {
18
- items: Array<'right' | 'center' | 'left' | 'justify'>;
19
- }
20
- );
24
+ constructor(editor: __se__EditorCore, pluginOptions: AlignPluginOptions);
21
25
  title: any;
22
26
  icon: string;
23
27
  _itemMenu: HTMLUListElement;
@@ -35,6 +39,7 @@ declare class Align extends EditorInjector {
35
39
  * @param {?HTMLElement=} element - Node element where the cursor is currently located
36
40
  * @param {?HTMLElement=} target - The plugin's toolbar button element
37
41
  * @returns {boolean} - Whether the plugin is active
42
+ * - If it returns "undefined", it will no longer be called in this scope.
38
43
  */
39
44
  active(element?: (HTMLElement | null) | undefined, target?: (HTMLElement | null) | undefined): boolean;
40
45
  /**
@@ -1,4 +1,30 @@
1
1
  export default BackgroundColor;
2
+ export type BackgroundColorPluginOptions = {
3
+ /**
4
+ * - Color list
5
+ */
6
+ items?: Array<
7
+ | string
8
+ | {
9
+ value: string;
10
+ name: string;
11
+ }
12
+ >;
13
+ /**
14
+ * - Number of colors per line
15
+ */
16
+ splitNum?: number;
17
+ /**
18
+ * - Disable HEX input
19
+ */
20
+ disableHEXInput?: boolean;
21
+ };
22
+ /**
23
+ * @typedef {Object} BackgroundColorPluginOptions
24
+ * @property {Array<string|{value: string, name: string}>} [items] - Color list
25
+ * @property {number} [splitNum] - Number of colors per line
26
+ * @property {boolean} [disableHEXInput] - Disable HEX input
27
+ */
2
28
  /**
3
29
  * @class
4
30
  * @description Text background color plugin
@@ -10,25 +36,9 @@ declare class BackgroundColor extends EditorInjector {
10
36
  /**
11
37
  * @constructor
12
38
  * @param {__se__EditorCore} editor - The root editor instance
13
- * @param {Object} pluginOptions
14
- * @param {Array<string|{value: string, name: string}>} pluginOptions.items - Color list
15
- * @param {number} pluginOptions.splitNum - Number of colors per line
16
- * @param {boolean} pluginOptions.disableHEXInput - Disable HEX input
17
- */
18
- constructor(
19
- editor: __se__EditorCore,
20
- pluginOptions: {
21
- items: Array<
22
- | string
23
- | {
24
- value: string;
25
- name: string;
26
- }
27
- >;
28
- splitNum: number;
29
- disableHEXInput: boolean;
30
- }
31
- );
39
+ * @param {BackgroundColorPluginOptions} pluginOptions - Plugin options
40
+ */
41
+ constructor(editor: __se__EditorCore, pluginOptions: BackgroundColorPluginOptions);
32
42
  title: any;
33
43
  icon: string;
34
44
  colorPicker: ColorPicker;
@@ -38,6 +48,7 @@ declare class BackgroundColor extends EditorInjector {
38
48
  * @param {?HTMLElement=} element - Node element where the cursor is currently located
39
49
  * @param {?HTMLElement=} target - The plugin's toolbar button element
40
50
  * @returns {boolean} - Whether the plugin is active
51
+ * - If it returns "undefined", it will no longer be called in this scope.
41
52
  */
42
53
  active(element?: (HTMLElement | null) | undefined, target?: (HTMLElement | null) | undefined): boolean;
43
54
  /**
@@ -1,4 +1,14 @@
1
1
  export default Font;
2
+ export type FontPluginOptions = {
3
+ /**
4
+ * - Font list
5
+ */
6
+ items?: Array<string>;
7
+ };
8
+ /**
9
+ * @typedef {Object} FontPluginOptions
10
+ * @property {Array<string>} [items] - Font list
11
+ */
2
12
  /**
3
13
  * @class
4
14
  * @description Text font plugin
@@ -10,19 +20,9 @@ declare class Font extends EditorInjector {
10
20
  /**
11
21
  * @constructor
12
22
  * @param {__se__EditorCore} editor - The root editor instance
13
- * @param {Object} pluginOptions
14
- * @param {Array<string>} pluginOptions.items - Font list
15
- * @param {number} pluginOptions.splitNum - Number of colors per line
16
- * @param {boolean} pluginOptions.disableHEXInput - Disable HEX input
23
+ * @param {FontPluginOptions} pluginOptions - plugin options
17
24
  */
18
- constructor(
19
- editor: __se__EditorCore,
20
- pluginOptions: {
21
- items: Array<string>;
22
- splitNum: number;
23
- disableHEXInput: boolean;
24
- }
25
- );
25
+ constructor(editor: __se__EditorCore, pluginOptions: FontPluginOptions);
26
26
  title: any;
27
27
  inner: string;
28
28
  currentFont: string;
@@ -34,6 +34,7 @@ declare class Font extends EditorInjector {
34
34
  * @param {?HTMLElement=} element - Node element where the cursor is currently located
35
35
  * @param {?HTMLElement=} target - The plugin's toolbar button element
36
36
  * @returns {boolean} - Whether the plugin is active
37
+ * - If it returns "undefined", it will no longer be called in this scope.
37
38
  */
38
39
  active(element?: (HTMLElement | null) | undefined, target?: (HTMLElement | null) | undefined): boolean;
39
40
  /**
@@ -1,4 +1,30 @@
1
1
  export default FontColor;
2
+ export type FontColorPluginOptions = {
3
+ /**
4
+ * - Color list
5
+ */
6
+ items?: Array<
7
+ | string
8
+ | {
9
+ value: string;
10
+ name: string;
11
+ }
12
+ >;
13
+ /**
14
+ * - Number of colors per line
15
+ */
16
+ splitNum?: number;
17
+ /**
18
+ * - Disable HEX input
19
+ */
20
+ disableHEXInput?: boolean;
21
+ };
22
+ /**
23
+ * @typedef {Object} FontColorPluginOptions
24
+ * @property {Array<string|{value: string, name: string}>} [items] - Color list
25
+ * @property {number} [splitNum] - Number of colors per line
26
+ * @property {boolean} [disableHEXInput] - Disable HEX input
27
+ */
2
28
  /**
3
29
  * @class
4
30
  * @description Font color plugin
@@ -10,25 +36,9 @@ declare class FontColor extends EditorInjector {
10
36
  /**
11
37
  * @constructor
12
38
  * @param {__se__EditorCore} editor - The root editor instance
13
- * @param {Object} pluginOptions
14
- * @param {Array<string|{value: string, name: string}>} pluginOptions.items - Color list
15
- * @param {number} pluginOptions.splitNum - Number of colors per line
16
- * @param {boolean} pluginOptions.disableHEXInput - Disable HEX input
17
- */
18
- constructor(
19
- editor: __se__EditorCore,
20
- pluginOptions: {
21
- items: Array<
22
- | string
23
- | {
24
- value: string;
25
- name: string;
26
- }
27
- >;
28
- splitNum: number;
29
- disableHEXInput: boolean;
30
- }
31
- );
39
+ * @param {FontColorPluginOptions} pluginOptions - Plugin options
40
+ */
41
+ constructor(editor: __se__EditorCore, pluginOptions: FontColorPluginOptions);
32
42
  title: any;
33
43
  icon: string;
34
44
  colorPicker: ColorPicker;
@@ -38,6 +48,7 @@ declare class FontColor extends EditorInjector {
38
48
  * @param {?HTMLElement=} element - Node element where the cursor is currently located
39
49
  * @param {?HTMLElement=} target - The plugin's toolbar button element
40
50
  * @returns {boolean} - Whether the plugin is active
51
+ * - If it returns "undefined", it will no longer be called in this scope.
41
52
  */
42
53
  active(element?: (HTMLElement | null) | undefined, target?: (HTMLElement | null) | undefined): boolean;
43
54
  /**
@@ -1,4 +1,14 @@
1
1
  export default FormatBlock;
2
+ export type FormatBlockPluginOptions = {
3
+ /**
4
+ * - Format list
5
+ */
6
+ items?: Array<string>;
7
+ };
8
+ /**
9
+ * @typedef {Object} FormatBlockPluginOptions
10
+ * @property {Array<string>} [items] - Format list
11
+ */
2
12
  /**
3
13
  * @class
4
14
  * @description FormatBlock Plugin (P, BLOCKQUOTE, PRE, H1, H2...)
@@ -10,15 +20,9 @@ declare class FormatBlock extends EditorInjector {
10
20
  /**
11
21
  * @constructor
12
22
  * @param {__se__EditorCore} editor - The root editor instance
13
- * @param {Object} pluginOptions
14
- * @param {Array<string>} pluginOptions.items - Format list
23
+ * @param {FormatBlockPluginOptions} pluginOptions - Plugin options
15
24
  */
16
- constructor(
17
- editor: __se__EditorCore,
18
- pluginOptions: {
19
- items: Array<string>;
20
- }
21
- );
25
+ constructor(editor: __se__EditorCore, pluginOptions: FormatBlockPluginOptions);
22
26
  title: any;
23
27
  inner: string;
24
28
  formatList: NodeListOf<Element>;
@@ -29,6 +33,7 @@ declare class FormatBlock extends EditorInjector {
29
33
  * @param {?HTMLElement=} element - Node element where the cursor is currently located
30
34
  * @param {?HTMLElement=} target - The plugin's toolbar button element
31
35
  * @returns {boolean} - Whether the plugin is active
36
+ * - If it returns "undefined", it will no longer be called in this scope.
32
37
  */
33
38
  active(element?: (HTMLElement | null) | undefined, target?: (HTMLElement | null) | undefined): boolean;
34
39
  /**
@@ -1,4 +1,17 @@
1
1
  export default HR;
2
+ export type HRPluginOptions = {
3
+ /**
4
+ * - HR list
5
+ */
6
+ items?: Array<{
7
+ name: string;
8
+ class: string;
9
+ }>;
10
+ };
11
+ /**
12
+ * @typedef {Object} HRPluginOptions
13
+ * @property {Array<{name: string, class: string}>} [items] - HR list
14
+ */
2
15
  /**
3
16
  * @class
4
17
  * @description HR Plugin
@@ -16,18 +29,9 @@ declare class HR extends EditorInjector {
16
29
  /**
17
30
  * @constructor
18
31
  * @param {__se__EditorCore} editor - The root editor instance
19
- * @param {Object} pluginOptions
20
- * @param {Array<{name: string, class: string}>} pluginOptions.items - HR list
32
+ * @param {HRPluginOptions} pluginOptions - Plugin options
21
33
  */
22
- constructor(
23
- editor: __se__EditorCore,
24
- pluginOptions: {
25
- items: Array<{
26
- name: string;
27
- class: string;
28
- }>;
29
- }
30
- );
34
+ constructor(editor: __se__EditorCore, pluginOptions: HRPluginOptions);
31
35
  title: any;
32
36
  icon: string;
33
37
  list: NodeListOf<HTMLButtonElement>;
@@ -1,4 +1,17 @@
1
1
  export default Layout;
2
+ export type LayoutPluginOptions = {
3
+ /**
4
+ * - Layout list
5
+ */
6
+ items?: Array<{
7
+ name: string;
8
+ html: string;
9
+ }>;
10
+ };
11
+ /**
12
+ * @typedef {Object} LayoutPluginOptions
13
+ * @property {Array<{name: string, html: string}>} [items] - Layout list
14
+ */
2
15
  /**
3
16
  * @class
4
17
  * @description Layout Plugin, Apply layout to the entire editor.
@@ -10,18 +23,9 @@ declare class Layout 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 - Layout list
26
+ * @param {LayoutPluginOptions} 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: LayoutPluginOptions);
25
29
  title: any;
26
30
  icon: string;
27
31
  selectedIndex: number;
@@ -1,4 +1,17 @@
1
1
  export default LineHeight;
2
+ export type LineHeightPluginOptions = {
3
+ /**
4
+ * - Line height list
5
+ */
6
+ items?: Array<{
7
+ text: string;
8
+ value: number;
9
+ }>;
10
+ };
11
+ /**
12
+ * @typedef {Object} LineHeightPluginOptions
13
+ * @property {Array<{text: string, value: number}>} [items] - Line height list
14
+ */
2
15
  /**
3
16
  * @class
4
17
  * @description Line height Plugin
@@ -10,18 +23,9 @@ declare class LineHeight extends EditorInjector {
10
23
  /**
11
24
  * @constructor
12
25
  * @param {__se__EditorCore} editor - The root editor instance
13
- * @param {Object} pluginOptions
14
- * @param {Array<{text: string, value: number}>} pluginOptions.items - Line height list
26
+ * @param {LineHeightPluginOptions} pluginOptions - Plugin options
15
27
  */
16
- constructor(
17
- editor: __se__EditorCore,
18
- pluginOptions: {
19
- items: Array<{
20
- text: string;
21
- value: number;
22
- }>;
23
- }
24
- );
28
+ constructor(editor: __se__EditorCore, pluginOptions: LineHeightPluginOptions);
25
29
  title: any;
26
30
  icon: string;
27
31
  sizeList: NodeListOf<Element>;
@@ -32,6 +36,7 @@ declare class LineHeight extends EditorInjector {
32
36
  * @param {?HTMLElement=} element - Node element where the cursor is currently located
33
37
  * @param {?HTMLElement=} target - The plugin's toolbar button element
34
38
  * @returns {boolean} - Whether the plugin is active
39
+ * - If it returns "undefined", it will no longer be called in this scope.
35
40
  */
36
41
  active(element?: (HTMLElement | null) | undefined, target?: (HTMLElement | null) | undefined): boolean;
37
42
  /**
@@ -20,6 +20,7 @@ declare class List extends EditorInjector {
20
20
  * @param {?HTMLElement=} element - Node element where the cursor is currently located
21
21
  * @param {?HTMLElement=} target - The plugin's toolbar button element
22
22
  * @returns {boolean} - Whether the plugin is active
23
+ * - If it returns "undefined", it will no longer be called in this scope.
23
24
  */
24
25
  active(element?: (HTMLElement | null) | undefined, target?: (HTMLElement | null) | undefined): boolean;
25
26
  /**
@@ -1,4 +1,30 @@
1
1
  export default ParagraphStyle;
2
+ export type ParagraphStylePluginOptions = {
3
+ /**
4
+ * - Paragraph item list
5
+ */
6
+ items?: Array<
7
+ | string
8
+ | {
9
+ name: string;
10
+ class: string;
11
+ _class: string;
12
+ }
13
+ >;
14
+ };
15
+ /**
16
+ * @typedef {Object} ParagraphStylePluginOptions
17
+ * @property {Array<string|{name: string, class: string, _class: string}>} [items] - Paragraph item list
18
+ * @example
19
+ * use default paragraph styles
20
+ * ['spaced', 'bordered', 'neon']
21
+ * custom paragraph styles
22
+ * [
23
+ * { name: 'spaced', class: '__se__p-spaced', _class: '' },
24
+ * { name: 'bordered', class: '__se__p-bordered', _class: '' },
25
+ * { name: 'neon', class: '__se__p-neon', _class: '' }
26
+ * ]
27
+ */
2
28
  /**
3
29
  * @class
4
30
  * @description A plugin to style lines using classes.
@@ -8,33 +34,11 @@ declare class ParagraphStyle extends EditorInjector {
8
34
  static type: string;
9
35
  static className: string;
10
36
  /**
11
- * @constructor
12
- * @param {__se__EditorCore} editor - The root editor instance
13
- * @param {Object} pluginOptions
14
- * @param {Array<string|{name: string, class: string, _class: string}>} pluginOptions.items - Paragraph item list
15
- * @example
16
- * use default paragraph styles
17
- * ['spaced', 'bordered', 'neon']
18
- * custom paragraph styles
19
- [
20
- { name: 'spaced', class: '__se__p-spaced', _class: '' },
21
- { name: 'bordered', class: '__se__p-bordered', _class: '' },
22
- { name: 'neon', class: '__se__p-neon', _class: ''}
23
- ]
24
- */
25
- constructor(
26
- editor: __se__EditorCore,
27
- pluginOptions: {
28
- items: Array<
29
- | string
30
- | {
31
- name: string;
32
- class: string;
33
- _class: string;
34
- }
35
- >;
36
- }
37
- );
37
+ * @constructor
38
+ * @param {__se__EditorCore} editor - The root editor instance
39
+ * @param {ParagraphStylePluginOptions} pluginOptions - Plugin options
40
+ */
41
+ constructor(editor: __se__EditorCore, pluginOptions: ParagraphStylePluginOptions);
38
42
  title: any;
39
43
  icon: string;
40
44
  classList: NodeListOf<Element>;