suneditor 3.0.0-rc.4 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/README.md +4 -3
  2. package/dist/suneditor-contents.min.css +1 -1
  3. package/dist/suneditor.min.css +1 -1
  4. package/dist/suneditor.min.js +1 -1
  5. package/package.json +10 -6
  6. package/src/assets/design/color.css +14 -2
  7. package/src/assets/design/typography.css +5 -0
  8. package/src/assets/icons/defaultIcons.js +22 -4
  9. package/src/assets/suneditor-contents.css +1 -1
  10. package/src/assets/suneditor.css +312 -18
  11. package/src/core/config/eventManager.js +6 -9
  12. package/src/core/editor.js +1 -1
  13. package/src/core/event/actions/index.js +5 -0
  14. package/src/core/event/effects/keydown.registry.js +25 -0
  15. package/src/core/event/eventOrchestrator.js +69 -2
  16. package/src/core/event/handlers/handler_ww_mouse.js +1 -0
  17. package/src/core/event/rules/keydown.rule.backspace.js +9 -1
  18. package/src/core/kernel/coreKernel.js +4 -0
  19. package/src/core/kernel/store.js +2 -0
  20. package/src/core/logic/dom/char.js +11 -0
  21. package/src/core/logic/dom/format.js +22 -0
  22. package/src/core/logic/dom/html.js +126 -11
  23. package/src/core/logic/dom/nodeTransform.js +13 -0
  24. package/src/core/logic/dom/offset.js +100 -37
  25. package/src/core/logic/dom/selection.js +54 -22
  26. package/src/core/logic/panel/finder.js +982 -0
  27. package/src/core/logic/panel/menu.js +8 -6
  28. package/src/core/logic/panel/toolbar.js +112 -19
  29. package/src/core/logic/panel/viewer.js +214 -43
  30. package/src/core/logic/shell/_commandExecutor.js +7 -1
  31. package/src/core/logic/shell/commandDispatcher.js +1 -1
  32. package/src/core/logic/shell/component.js +5 -7
  33. package/src/core/logic/shell/history.js +24 -0
  34. package/src/core/logic/shell/shortcuts.js +3 -3
  35. package/src/core/logic/shell/ui.js +25 -26
  36. package/src/core/schema/frameContext.js +15 -1
  37. package/src/core/schema/options.js +180 -39
  38. package/src/core/section/constructor.js +61 -20
  39. package/src/core/section/documentType.js +2 -2
  40. package/src/events.js +12 -0
  41. package/src/helper/clipboard.js +1 -1
  42. package/src/helper/converter.js +15 -0
  43. package/src/helper/dom/domQuery.js +12 -0
  44. package/src/helper/dom/domUtils.js +26 -14
  45. package/src/helper/index.js +3 -0
  46. package/src/helper/markdown.js +876 -0
  47. package/src/interfaces/plugins.js +7 -5
  48. package/src/langs/ckb.js +9 -0
  49. package/src/langs/cs.js +9 -0
  50. package/src/langs/da.js +9 -0
  51. package/src/langs/de.js +9 -0
  52. package/src/langs/en.js +9 -0
  53. package/src/langs/es.js +9 -0
  54. package/src/langs/fa.js +9 -0
  55. package/src/langs/fr.js +9 -0
  56. package/src/langs/he.js +9 -0
  57. package/src/langs/hu.js +9 -0
  58. package/src/langs/it.js +9 -0
  59. package/src/langs/ja.js +9 -0
  60. package/src/langs/km.js +9 -0
  61. package/src/langs/ko.js +9 -0
  62. package/src/langs/lv.js +9 -0
  63. package/src/langs/nl.js +9 -0
  64. package/src/langs/pl.js +9 -0
  65. package/src/langs/pt_br.js +9 -0
  66. package/src/langs/ro.js +9 -0
  67. package/src/langs/ru.js +9 -0
  68. package/src/langs/se.js +9 -0
  69. package/src/langs/tr.js +9 -0
  70. package/src/langs/uk.js +9 -0
  71. package/src/langs/ur.js +9 -0
  72. package/src/langs/zh_cn.js +9 -0
  73. package/src/modules/contract/Browser.js +31 -1
  74. package/src/modules/contract/ColorPicker.js +6 -0
  75. package/src/modules/contract/Controller.js +77 -39
  76. package/src/modules/contract/Figure.js +57 -0
  77. package/src/modules/contract/Modal.js +6 -0
  78. package/src/modules/manager/ApiManager.js +53 -4
  79. package/src/modules/manager/FileManager.js +18 -1
  80. package/src/modules/ui/ModalAnchorEditor.js +35 -2
  81. package/src/modules/ui/SelectMenu.js +44 -12
  82. package/src/plugins/browser/fileBrowser.js +5 -2
  83. package/src/plugins/command/codeBlock.js +324 -0
  84. package/src/plugins/command/exportPDF.js +15 -3
  85. package/src/plugins/command/fileUpload.js +4 -1
  86. package/src/plugins/dropdown/backgroundColor.js +5 -1
  87. package/src/plugins/dropdown/blockStyle.js +8 -2
  88. package/src/plugins/dropdown/fontColor.js +5 -1
  89. package/src/plugins/dropdown/hr.js +6 -0
  90. package/src/plugins/dropdown/layout.js +4 -1
  91. package/src/plugins/dropdown/lineHeight.js +3 -0
  92. package/src/plugins/dropdown/paragraphStyle.js +5 -5
  93. package/src/plugins/dropdown/table/index.js +4 -1
  94. package/src/plugins/dropdown/table/render/table.html.js +1 -1
  95. package/src/plugins/dropdown/table/services/table.grid.js +16 -8
  96. package/src/plugins/dropdown/table/services/table.style.js +5 -9
  97. package/src/plugins/dropdown/template.js +3 -0
  98. package/src/plugins/dropdown/textStyle.js +5 -1
  99. package/src/plugins/field/mention.js +5 -1
  100. package/src/plugins/index.js +3 -0
  101. package/src/plugins/input/fontSize.js +10 -3
  102. package/src/plugins/modal/audio.js +7 -3
  103. package/src/plugins/modal/embed.js +23 -20
  104. package/src/plugins/modal/image/index.js +5 -1
  105. package/src/plugins/modal/math.js +7 -2
  106. package/src/plugins/modal/video/index.js +21 -4
  107. package/src/themes/cobalt.css +13 -4
  108. package/src/themes/cream.css +11 -2
  109. package/src/themes/dark.css +13 -4
  110. package/src/themes/midnight.css +13 -4
  111. package/src/typedef.js +4 -4
  112. package/types/assets/icons/defaultIcons.d.ts +12 -1
  113. package/types/assets/suneditor.css.d.ts +1 -1
  114. package/types/core/config/eventManager.d.ts +6 -8
  115. package/types/core/event/actions/index.d.ts +1 -0
  116. package/types/core/event/effects/keydown.registry.d.ts +2 -0
  117. package/types/core/event/eventOrchestrator.d.ts +2 -1
  118. package/types/core/kernel/coreKernel.d.ts +5 -0
  119. package/types/core/kernel/store.d.ts +5 -0
  120. package/types/core/logic/dom/char.d.ts +11 -0
  121. package/types/core/logic/dom/format.d.ts +22 -0
  122. package/types/core/logic/dom/html.d.ts +16 -0
  123. package/types/core/logic/dom/nodeTransform.d.ts +13 -0
  124. package/types/core/logic/dom/offset.d.ts +23 -2
  125. package/types/core/logic/dom/selection.d.ts +9 -3
  126. package/types/core/logic/panel/finder.d.ts +83 -0
  127. package/types/core/logic/panel/toolbar.d.ts +14 -1
  128. package/types/core/logic/panel/viewer.d.ts +22 -2
  129. package/types/core/logic/shell/shortcuts.d.ts +1 -1
  130. package/types/core/schema/frameContext.d.ts +22 -0
  131. package/types/core/schema/options.d.ts +362 -79
  132. package/types/events.d.ts +11 -0
  133. package/types/helper/converter.d.ts +15 -0
  134. package/types/helper/dom/domQuery.d.ts +12 -0
  135. package/types/helper/dom/domUtils.d.ts +23 -2
  136. package/types/helper/index.d.ts +5 -0
  137. package/types/helper/markdown.d.ts +27 -0
  138. package/types/interfaces/plugins.d.ts +7 -5
  139. package/types/langs/_Lang.d.ts +9 -0
  140. package/types/modules/contract/Browser.d.ts +36 -2
  141. package/types/modules/contract/ColorPicker.d.ts +6 -0
  142. package/types/modules/contract/Controller.d.ts +35 -1
  143. package/types/modules/contract/Figure.d.ts +57 -0
  144. package/types/modules/contract/Modal.d.ts +6 -0
  145. package/types/modules/manager/ApiManager.d.ts +26 -0
  146. package/types/modules/manager/FileManager.d.ts +17 -0
  147. package/types/modules/ui/ModalAnchorEditor.d.ts +41 -4
  148. package/types/modules/ui/SelectMenu.d.ts +40 -2
  149. package/types/plugins/browser/fileBrowser.d.ts +10 -4
  150. package/types/plugins/command/codeBlock.d.ts +53 -0
  151. package/types/plugins/command/fileUpload.d.ts +8 -2
  152. package/types/plugins/dropdown/backgroundColor.d.ts +10 -2
  153. package/types/plugins/dropdown/blockStyle.d.ts +14 -2
  154. package/types/plugins/dropdown/fontColor.d.ts +10 -2
  155. package/types/plugins/dropdown/hr.d.ts +12 -0
  156. package/types/plugins/dropdown/layout.d.ts +8 -2
  157. package/types/plugins/dropdown/lineHeight.d.ts +6 -0
  158. package/types/plugins/dropdown/paragraphStyle.d.ts +14 -3
  159. package/types/plugins/dropdown/table/index.d.ts +9 -3
  160. package/types/plugins/dropdown/template.d.ts +6 -0
  161. package/types/plugins/dropdown/textStyle.d.ts +10 -2
  162. package/types/plugins/field/mention.d.ts +10 -2
  163. package/types/plugins/index.d.ts +3 -0
  164. package/types/plugins/input/fontSize.d.ts +18 -4
  165. package/types/plugins/modal/audio.d.ts +14 -6
  166. package/types/plugins/modal/embed.d.ts +44 -38
  167. package/types/plugins/modal/image/index.d.ts +9 -1
  168. package/types/plugins/modal/link.d.ts +6 -2
  169. package/types/plugins/modal/math.d.ts +23 -5
  170. package/types/plugins/modal/video/index.d.ts +49 -9
  171. package/types/typedef.d.ts +5 -2
@@ -13,14 +13,21 @@ export type FontSizePluginOptions = {
13
13
  showDefaultSizeLabel?: boolean;
14
14
  /**
15
15
  * - When `true`, displays increase and decrease buttons for font size adjustments.
16
+ * - Defaults to `false`. Always `false` when `sizeUnit` is `'text'` (ignored).
16
17
  */
17
18
  showIncDecControls?: boolean;
18
19
  /**
19
20
  * - When `true`, disables the direct font size input box.
21
+ * - Defaults to `true` when `sizeUnit` is `'text'`, otherwise `false`.
20
22
  */
21
23
  disableInput?: boolean;
22
24
  /**
23
- * - Optional object to override or extend the default unit mapping for font sizes.
25
+ * - Override or extend the default unit mapping for font sizes.
26
+ * Each key is a unit name (e.g., `'px'`, `'em'`). `default`: initial size, `inc`: step for inc/dec buttons, `min`/`max`: range limits, `list`: dropdown values.
27
+ * When `sizeUnit` is `'text'`, list items use `{title: string, size: string}` instead of numbers.
28
+ * ```js
29
+ * { unitMap: { px: { default: 16, inc: 1, min: 8, max: 72, list: [8, 12, 16, 20, 24, 32, 48] } } }
30
+ * ```
24
31
  */
25
32
  unitMap?: {
26
33
  [x: string]: {
@@ -38,9 +45,16 @@ export type FontSizePluginOptions = {
38
45
  * - Accepted values include: `'px'`, `'pt'`, `'em'`, `'rem'`, `'vw'`, `'vh'`, `'%'` or `'text'`.
39
46
  * - If `'text'` is used, a text-based font size list is applied.
40
47
  * @property {boolean} [showDefaultSizeLabel=true] - Determines whether the default size label is displayed in the dropdown menu.
41
- * @property {boolean} [showIncDecControls=false] - When `true`, displays increase and decrease buttons for font size adjustments.
42
- * @property {boolean} [disableInput=true] - When `true`, disables the direct font size input box.
43
- * @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.
48
+ * @property {boolean} [showIncDecControls] - When `true`, displays increase and decrease buttons for font size adjustments.
49
+ * - Defaults to `false`. Always `false` when `sizeUnit` is `'text'` (ignored).
50
+ * @property {boolean} [disableInput] - When `true`, disables the direct font size input box.
51
+ * - Defaults to `true` when `sizeUnit` is `'text'`, otherwise `false`.
52
+ * @property {Object<string, {default: number, inc: number, min: number, max: number, list: Array<number>}>} [unitMap={}] - Override or extend the default unit mapping for font sizes.
53
+ * Each key is a unit name (e.g., `'px'`, `'em'`). `default`: initial size, `inc`: step for inc/dec buttons, `min`/`max`: range limits, `list`: dropdown values.
54
+ * When `sizeUnit` is `'text'`, list items use `{title: string, size: string}` instead of numbers.
55
+ * ```js
56
+ * { unitMap: { px: { default: 16, inc: 1, min: 8, max: 72, list: [8, 12, 16, 20, 24, 32, 48] } } }
57
+ * ```
44
58
  */
45
59
  /**
46
60
  * @class
@@ -2,11 +2,11 @@ import type {} from '../../typedef';
2
2
  export default Audio_;
3
3
  export type AudioPluginOptions = {
4
4
  /**
5
- * - The default width of the `AUDIO` tag (e.g., `"300px"`).
5
+ * - The default width of the `AUDIO` tag.
6
6
  */
7
7
  defaultWidth?: string;
8
8
  /**
9
- * - The default height of the `AUDIO` tag (e.g., `"150px"`).
9
+ * - The default height of the `AUDIO` tag.
10
10
  */
11
11
  defaultHeight?: string;
12
12
  /**
@@ -14,7 +14,8 @@ export type AudioPluginOptions = {
14
14
  */
15
15
  createFileInput?: boolean;
16
16
  /**
17
- * - Whether to create a URL input element (default is `true` if file input is not created).
17
+ * - Whether to create a URL input element.
18
+ * - Defaults to `true`. Always `true` when `createFileInput` is `false`.
18
19
  */
19
20
  createUrlInput?: boolean;
20
21
  /**
@@ -45,6 +46,9 @@ export type AudioPluginOptions = {
45
46
  acceptedFormats?: string;
46
47
  /**
47
48
  * - Additional attributes to set on the `AUDIO` tag.
49
+ * ```js
50
+ * { audioTagAttributes: { controls: 'true', preload: 'metadata' } }
51
+ * ```
48
52
  */
49
53
  audioTagAttributes?: {
50
54
  [x: string]: string;
@@ -61,10 +65,11 @@ export type AudioPluginOptions = {
61
65
  };
62
66
  /**
63
67
  * @typedef {Object} AudioPluginOptions
64
- * @property {string} [defaultWidth="300px"] - The default width of the `AUDIO` tag (e.g., `"300px"`).
65
- * @property {string} [defaultHeight="150px"] - The default height of the `AUDIO` tag (e.g., `"150px"`).
68
+ * @property {string} [defaultWidth="300px"] - The default width of the `AUDIO` tag.
69
+ * @property {string} [defaultHeight="150px"] - The default height of the `AUDIO` tag.
66
70
  * @property {boolean} [createFileInput] - Whether to create a file input element.
67
- * @property {boolean} [createUrlInput] - Whether to create a URL input element (default is `true` if file input is not created).
71
+ * @property {boolean} [createUrlInput] - Whether to create a URL input element.
72
+ * - Defaults to `true`. Always `true` when `createFileInput` is `false`.
68
73
  * @property {string} [uploadUrl] - The URL to which files will be uploaded.
69
74
  * @property {Object<string, string>} [uploadHeaders] - Headers to include in the file upload request.
70
75
  * @property {number} [uploadSizeLimit] - The total upload size limit in bytes.
@@ -72,6 +77,9 @@ export type AudioPluginOptions = {
72
77
  * @property {boolean} [allowMultiple] - Whether to allow multiple file uploads.
73
78
  * @property {string} [acceptedFormats="audio/*"] - Accepted file formats (default is `"audio/*"`).
74
79
  * @property {Object<string, string>} [audioTagAttributes] - Additional attributes to set on the `AUDIO` tag.
80
+ * ```js
81
+ * { audioTagAttributes: { controls: 'true', preload: 'metadata' } }
82
+ * ```
75
83
  * @property {SunEditor.ComponentInsertType} [insertBehavior] - Component insertion behavior for selection and cursor placement.
76
84
  * - [default: `options.get('componentInsertBehavior')`]
77
85
  * - `auto`: Move cursor to the next line if possible, otherwise select the component.
@@ -41,42 +41,45 @@ export type EmbedPluginOptions = {
41
41
  uploadSingleSizeLimit?: number;
42
42
  /**
43
43
  * - Additional attributes to set on the `IFRAME` tag.
44
+ * ```js
45
+ * { iframeTagAttributes: { allowfullscreen: 'true', loading: 'lazy' } }
46
+ * ```
44
47
  */
45
48
  iframeTagAttributes?: {
46
49
  [x: string]: string;
47
50
  };
48
51
  /**
49
- * - YouTube query parameter.
52
+ * - YouTube query parameter appended to the embed URL.
53
+ * ```js
54
+ * { query_youtube: 'autoplay=1&mute=1' }
55
+ * ```
50
56
  */
51
57
  query_youtube?: string;
52
58
  /**
53
- * - Vimeo query parameter.
59
+ * - Vimeo query parameter appended to the embed URL.
60
+ * ```js
61
+ * { query_vimeo: 'autoplay=1' }
62
+ * ```
54
63
  */
55
64
  query_vimeo?: string;
56
65
  /**
57
- * - Additional URL patterns for embed.
66
+ * - Additional URL patterns to recognize as embeddable content.
58
67
  */
59
68
  urlPatterns?: Array<RegExp>;
60
69
  /**
61
- * - Custom query objects for additional embedding services.
62
- * Example :
70
+ * - Custom embed service definitions.
71
+ * Each key is a service name, with `pattern` to match the URL, `action` to transform it into an embed URL, and `tag` for the output element.
72
+ * ```js
63
73
  * {
74
+ * embedQuery: {
64
75
  * facebook: {
65
- * pattern: /(?:https?:\/\/)?(?:www\.)?(?:facebook\.com)\/(.+)/i,
66
- * action: (url) => {
67
- * return `https://www.facebook.com/plugins/post.php?href=${encodeURIComponent(url)}&show_text=true&width=500`;
68
- * },
76
+ * pattern: /(?:https?:\/\/)?(?:www\.)?facebook\.com\/(.+)/i,
77
+ * action: (url) => `https://www.facebook.com/plugins/post.php?href=${encodeURIComponent(url)}`,
69
78
  * tag: 'iframe'
70
- * },
71
- * twitter: {
72
- * pattern: /(?:https?:\/\/)?(?:www\.)?(?:twitter\.com)\/(status|embed)\/(.+)/i,
73
- * action: (url) => {
74
- * return `https://platform.twitter.com/embed/Tweet.html?url=${encodeURIComponent(url)}`;
75
- * },
76
- * tag: 'iframe'
77
- * },
78
- * // Additional services...
79
79
  * }
80
+ * }
81
+ * }
82
+ * ```
80
83
  */
81
84
  embedQuery?: {
82
85
  [x: string]: {
@@ -111,28 +114,31 @@ export type EmbedPluginOptions = {
111
114
  * @property {number} [uploadSizeLimit] - The total file upload size limit in bytes.
112
115
  * @property {number} [uploadSingleSizeLimit] - The single file upload size limit in bytes.
113
116
  * @property {Object<string, string>} [iframeTagAttributes] - Additional attributes to set on the `IFRAME` tag.
114
- * @property {string} [query_youtube] - YouTube query parameter.
115
- * @property {string} [query_vimeo] - Vimeo query parameter.
116
- * @property {Array<RegExp>} [urlPatterns] - Additional URL patterns for embed.
117
- * @property {Object<string, {pattern: RegExp, action: (url: string) => string, tag: string}>} [embedQuery] - Custom query objects for additional embedding services.
118
- * Example :
117
+ * ```js
118
+ * { iframeTagAttributes: { allowfullscreen: 'true', loading: 'lazy' } }
119
+ * ```
120
+ * @property {string} [query_youtube] - YouTube query parameter appended to the embed URL.
121
+ * ```js
122
+ * { query_youtube: 'autoplay=1&mute=1' }
123
+ * ```
124
+ * @property {string} [query_vimeo] - Vimeo query parameter appended to the embed URL.
125
+ * ```js
126
+ * { query_vimeo: 'autoplay=1' }
127
+ * ```
128
+ * @property {Array<RegExp>} [urlPatterns] - Additional URL patterns to recognize as embeddable content.
129
+ * @property {Object<string, {pattern: RegExp, action: (url: string) => string, tag: string}>} [embedQuery] - Custom embed service definitions.
130
+ * Each key is a service name, with `pattern` to match the URL, `action` to transform it into an embed URL, and `tag` for the output element.
131
+ * ```js
119
132
  * {
120
- * facebook: {
121
- * pattern: /(?:https?:\/\/)?(?:www\.)?(?:facebook\.com)\/(.+)/i,
122
- * action: (url) => {
123
- * return `https://www.facebook.com/plugins/post.php?href=${encodeURIComponent(url)}&show_text=true&width=500`;
124
- * },
125
- * tag: 'iframe'
126
- * },
127
- * twitter: {
128
- * pattern: /(?:https?:\/\/)?(?:www\.)?(?:twitter\.com)\/(status|embed)\/(.+)/i,
129
- * action: (url) => {
130
- * return `https://platform.twitter.com/embed/Tweet.html?url=${encodeURIComponent(url)}`;
131
- * },
132
- * tag: 'iframe'
133
- * },
134
- * // Additional services...
133
+ * embedQuery: {
134
+ * facebook: {
135
+ * pattern: /(?:https?:\/\/)?(?:www\.)?facebook\.com\/(.+)/i,
136
+ * action: (url) => `https://www.facebook.com/plugins/post.php?href=${encodeURIComponent(url)}`,
137
+ * tag: 'iframe'
138
+ * }
139
+ * }
135
140
  * }
141
+ * ```
136
142
  * @property {SunEditor.Module.Figure.Controls} [controls] - Figure controls.
137
143
  * @property {SunEditor.ComponentInsertType} [insertBehavior] - Component insertion behavior for selection and cursor placement.
138
144
  * - [default: `options.get('componentInsertBehavior')`]
@@ -27,6 +27,7 @@ export type ImagePluginOptions = {
27
27
  createFileInput?: boolean;
28
28
  /**
29
29
  * - Whether to create a URL input element for image insertion.
30
+ * - Defaults to `true`. Always `true` when `createFileInput` is `false`.
30
31
  */
31
32
  createUrlInput?: boolean;
32
33
  /**
@@ -35,6 +36,9 @@ export type ImagePluginOptions = {
35
36
  uploadUrl?: string;
36
37
  /**
37
38
  * - Additional headers to include in the file upload request.
39
+ * ```js
40
+ * { uploadUrl: '/api/upload/image', uploadHeaders: { Authorization: 'Bearer token' } }
41
+ * ```
38
42
  */
39
43
  uploadHeaders?: {
40
44
  [x: string]: string;
@@ -109,9 +113,13 @@ export type ImageState = {
109
113
  * @property {string} [defaultHeight="auto"] - The default height of the image. If a number is provided, `"px"` will be appended.
110
114
  * @property {boolean} [percentageOnlySize=false] - Whether to allow only percentage-based sizing.
111
115
  * @property {boolean} [createFileInput=true] - Whether to create a file input element for image uploads.
112
- * @property {boolean} [createUrlInput=true] - Whether to create a URL input element for image insertion.
116
+ * @property {boolean} [createUrlInput] - Whether to create a URL input element for image insertion.
117
+ * - Defaults to `true`. Always `true` when `createFileInput` is `false`.
113
118
  * @property {string} [uploadUrl] - The URL endpoint for image file uploads.
114
119
  * @property {Object<string, string>} [uploadHeaders] - Additional headers to include in the file upload request.
120
+ * ```js
121
+ * { uploadUrl: '/api/upload/image', uploadHeaders: { Authorization: 'Bearer token' } }
122
+ * ```
115
123
  * @property {number} [uploadSizeLimit] - The total upload size limit in bytes.
116
124
  * @property {number} [uploadSingleSizeLimit] - The single file upload size limit in bytes.
117
125
  * @property {boolean} [allowMultiple=false] - Whether multiple image uploads are allowed.
@@ -80,11 +80,15 @@ declare class Link extends PluginModal {
80
80
  */
81
81
  noAutoPrefix?: boolean;
82
82
  /**
83
- * - The `rel` attribute list of anchor tag.
83
+ * - Available `rel` attribute values shown as checkboxes in the link modal.
84
84
  */
85
85
  relList?: Array<string>;
86
86
  /**
87
- * - Default `rel` attributes of anchor tag.
87
+ * - Default `rel` values auto-applied by condition.
88
+ * `default` is always applied, `check_new_window` when "Open in new window" is checked, `check_bookmark` for bookmark links.
89
+ * ```js
90
+ * { relList: ['nofollow', 'noreferrer', 'noopener'], defaultRel: { default: 'noopener', check_new_window: 'noreferrer' } }
91
+ * ```
88
92
  */
89
93
  defaultRel?: {
90
94
  default?: string;
@@ -10,9 +10,17 @@ export type MathPluginOptions = {
10
10
  */
11
11
  autoHeight?: boolean;
12
12
  /**
13
- * - A list of font size options for rendering math expressions.
13
+ * - A list of font size options for the math expression size selector.
14
+ * ```js
15
+ * // fontSizeList
16
+ * [{ text: '1', value: '1em', default: true }, { text: '1.5', value: '1.5em' }, { text: '2', value: '2em' }]
17
+ * ```
14
18
  */
15
- fontSizeList?: Array<object>;
19
+ fontSizeList?: Array<{
20
+ text: string;
21
+ value: string;
22
+ default?: true;
23
+ }>;
16
24
  /**
17
25
  * - A callback function to handle paste events in the math input area.
18
26
  */
@@ -33,11 +41,16 @@ export type MathPluginOptions = {
33
41
  * @typedef {Object} MathPluginOptions
34
42
  * @property {boolean} [canResize=true] - Whether the math modal can be resized.
35
43
  * @property {boolean} [autoHeight=false] - Whether to automatically adjust the height of the modal.
36
- * @property {Array<object>} [fontSizeList] - A list of font size options for rendering math expressions.
44
+ * @property {Array<{text: string, value: string, default?: true}>} [fontSizeList] - A list of font size options for the math expression size selector.
45
+ * ```js
46
+ * // fontSizeList
47
+ * [{ text: '1', value: '1em', default: true }, { text: '1.5', value: '1.5em' }, { text: '2', value: '2em' }]
48
+ * ```
37
49
  * @property {?(...args: *) => *} [onPaste] - A callback function to handle paste events in the math input area.
38
50
  * @property {Object} [formSize={}] - An object specifying the dimensions for the math modal.
39
51
  * @property {string} [formSize.width="460px"] - The default width of the math modal.
40
- * @property {string} [formSize.height="14em"] - The default height of the math modal.
52
+ * @property {string} [formSize.height] - The default height of the math modal.
53
+ * - Defaults to `"14em"`. When `autoHeight` is `true`, defaults to `formSize.minHeight`.
41
54
  * @property {string} [formSize.maxWidth] - The maximum width of the math modal.
42
55
  * @property {string} [formSize.maxHeight] - The maximum height of the math modal.
43
56
  * @property {string} [formSize.minWidth="400px"] - The minimum width of the math modal.
@@ -72,6 +85,7 @@ declare class Math_ extends PluginModal {
72
85
  width: string;
73
86
  /**
74
87
  * - The default height of the math modal.
88
+ * - Defaults to `"14em"`. When `autoHeight` is `true`, defaults to `formSize.minHeight`.
75
89
  */
76
90
  height: string;
77
91
  /**
@@ -93,7 +107,11 @@ declare class Math_ extends PluginModal {
93
107
  };
94
108
  canResize: boolean;
95
109
  autoHeight: boolean;
96
- fontSizeList: any[];
110
+ fontSizeList: {
111
+ text: string;
112
+ value: string;
113
+ default?: true;
114
+ }[];
97
115
  onPaste: (...args: any) => any;
98
116
  };
99
117
  defaultFontSize: any;
@@ -27,6 +27,7 @@ export type VideoPluginOptions = {
27
27
  createFileInput?: boolean;
28
28
  /**
29
29
  * - Whether to create a URL input element for video embedding.
30
+ * - Defaults to `true`. Always `true` when `createFileInput` is `false`.
30
31
  */
31
32
  createUrlInput?: boolean;
32
33
  /**
@@ -56,7 +57,7 @@ export type VideoPluginOptions = {
56
57
  */
57
58
  acceptedFormats?: string;
58
59
  /**
59
- * - The default aspect ratio for the video (e.g., 16:9 is 0.5625).
60
+ * - The default aspect ratio for the video (height/width, e.g. 16:9 `9/16 = 0.5625`).
60
61
  */
61
62
  defaultRatio?: number;
62
63
  /**
@@ -64,31 +65,50 @@ export type VideoPluginOptions = {
64
65
  */
65
66
  showRatioOption?: boolean;
66
67
  /**
67
- * - Custom ratio options for video resizing.
68
+ * - Custom ratio options for video resizing (value = height/width).
69
+ * ```js
70
+ * // ratioOptions
71
+ * [{ name: '16:9', value: 0.5625 }, { name: '4:3', value: 0.75 }]
72
+ * ```
68
73
  */
69
- ratioOptions?: any[];
74
+ ratioOptions?: Array<{
75
+ name: string;
76
+ value: number;
77
+ }>;
70
78
  /**
71
79
  * - Additional attributes to set on the `VIDEO` tag.
80
+ * ```js
81
+ * { videoTagAttributes: { controls: 'true', muted: 'true', playsinline: '' } }
82
+ * ```
72
83
  */
73
84
  videoTagAttributes?: {
74
85
  [x: string]: string;
75
86
  };
76
87
  /**
77
88
  * - Additional attributes to set on the `IFRAME` tag.
89
+ * ```js
90
+ * { iframeTagAttributes: { allowfullscreen: 'true', loading: 'lazy' } }
91
+ * ```
78
92
  */
79
93
  iframeTagAttributes?: {
80
94
  [x: string]: string;
81
95
  };
82
96
  /**
83
97
  * - Additional query parameters for YouTube embedding.
98
+ * ```js
99
+ * { query_youtube: 'autoplay=1&mute=1' }
100
+ * ```
84
101
  */
85
102
  query_youtube?: string;
86
103
  /**
87
104
  * - Additional query parameters for Vimeo embedding.
105
+ * ```js
106
+ * { query_vimeo: 'autoplay=1' }
107
+ * ```
88
108
  */
89
109
  query_vimeo?: string;
90
110
  /**
91
- * - Custom query objects for additional embedding services.
111
+ * - Custom embed service definitions (see `EmbedPluginOptions.embedQuery`).
92
112
  */
93
113
  embedQuery?: {
94
114
  [x: string]: {
@@ -132,21 +152,38 @@ export type VideoState = {
132
152
  * @property {string} [defaultHeight] - The default height of the video element. If a number is provided, `"px"` will be appended.
133
153
  * @property {boolean} [percentageOnlySize=false] - Whether to allow only percentage-based sizing.
134
154
  * @property {boolean} [createFileInput=false] - Whether to create a file input element for video uploads.
135
- * @property {boolean} [createUrlInput=true] - Whether to create a URL input element for video embedding.
155
+ * @property {boolean} [createUrlInput] - Whether to create a URL input element for video embedding.
156
+ * - Defaults to `true`. Always `true` when `createFileInput` is `false`.
136
157
  * @property {string} [uploadUrl] - The URL endpoint for video file uploads.
137
158
  * @property {Object<string, string>} [uploadHeaders] - Additional headers to include in the video upload request.
138
159
  * @property {number} [uploadSizeLimit] - The total upload size limit for videos in bytes.
139
160
  * @property {number} [uploadSingleSizeLimit] - The single file upload size limit for videos in bytes.
140
161
  * @property {boolean} [allowMultiple=false] - Whether multiple video uploads are allowed.
141
162
  * @property {string} [acceptedFormats="video/*"] - Accepted file formats for video uploads (`"video/*"`).
142
- * @property {number} [defaultRatio=0.5625] - The default aspect ratio for the video (e.g., 16:9 is 0.5625).
163
+ * @property {number} [defaultRatio=0.5625] - The default aspect ratio for the video (height/width, e.g. 16:9 `9/16 = 0.5625`).
143
164
  * @property {boolean} [showRatioOption=true] - Whether to display the ratio option in the modal.
144
- * @property {Array} [ratioOptions] - Custom ratio options for video resizing.
165
+ * @property {Array<{name: string, value: number}>} [ratioOptions] - Custom ratio options for video resizing (value = height/width).
166
+ * ```js
167
+ * // ratioOptions
168
+ * [{ name: '16:9', value: 0.5625 }, { name: '4:3', value: 0.75 }]
169
+ * ```
145
170
  * @property {Object<string, string>} [videoTagAttributes] - Additional attributes to set on the `VIDEO` tag.
171
+ * ```js
172
+ * { videoTagAttributes: { controls: 'true', muted: 'true', playsinline: '' } }
173
+ * ```
146
174
  * @property {Object<string, string>} [iframeTagAttributes] - Additional attributes to set on the `IFRAME` tag.
175
+ * ```js
176
+ * { iframeTagAttributes: { allowfullscreen: 'true', loading: 'lazy' } }
177
+ * ```
147
178
  * @property {string} [query_youtube=""] - Additional query parameters for YouTube embedding.
179
+ * ```js
180
+ * { query_youtube: 'autoplay=1&mute=1' }
181
+ * ```
148
182
  * @property {string} [query_vimeo=""] - Additional query parameters for Vimeo embedding.
149
- * @property {Object<string, {pattern: RegExp, action: (url: string) => string, tag: string}>} [embedQuery] - Custom query objects for additional embedding services.
183
+ * ```js
184
+ * { query_vimeo: 'autoplay=1' }
185
+ * ```
186
+ * @property {Object<string, {pattern: RegExp, action: (url: string) => string, tag: string}>} [embedQuery] - Custom embed service definitions (see `EmbedPluginOptions.embedQuery`).
150
187
  * @property {Array<RegExp>} [urlPatterns] - Additional URL patterns for video embedding.
151
188
  * @property {Array<string>} [extensions] - Additional file extensions to be recognized for video uploads.
152
189
  * @property {SunEditor.Module.Figure.Controls} [controls] - Figure controls.
@@ -208,7 +245,10 @@ declare class Video extends PluginModal {
208
245
  acceptedFormats: string;
209
246
  defaultRatio: number;
210
247
  showRatioOption: boolean;
211
- ratioOptions: any[];
248
+ ratioOptions: {
249
+ name: string;
250
+ value: number;
251
+ }[];
212
252
  videoTagAttributes: {
213
253
  [x: string]: string;
214
254
  };
@@ -179,7 +179,7 @@ declare global {
179
179
  /**
180
180
  * Event listener
181
181
  */
182
- listener: EventListenerOrEventListenerObject;
182
+ listener: any;
183
183
  /**
184
184
  * Event useCapture option
185
185
  */
@@ -196,7 +196,7 @@ declare global {
196
196
  /**
197
197
  * Event listener
198
198
  */
199
- listener: (...args: any) => any;
199
+ listener: any;
200
200
  /**
201
201
  * Use event capture
202
202
  */
@@ -279,6 +279,7 @@ declare global {
279
279
  | 'fullScreen'
280
280
  | 'showBlocks'
281
281
  | 'codeView'
282
+ | 'markdownView'
282
283
  | 'undo'
283
284
  | 'redo'
284
285
  | 'preview'
@@ -287,6 +288,7 @@ declare global {
287
288
  | 'dir'
288
289
  | 'dir_ltr'
289
290
  | 'dir_rtl'
291
+ | 'finder'
290
292
  | 'save'
291
293
  | 'newDocument'
292
294
  | 'selectAll'
@@ -299,6 +301,7 @@ declare global {
299
301
  */
300
302
  type ButtonPlugin =
301
303
  | 'blockquote'
304
+ | 'codeBlock'
302
305
  | 'exportPDF'
303
306
  | 'fileUpload'
304
307
  | 'list_bulleted'