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
@@ -4,9 +4,13 @@ import { dom } from '../../helper';
4
4
 
5
5
  /**
6
6
  * @typedef {Object} FontColorPluginOptions
7
- * @property {Array<string|{value: string, name: string}>} [items] - Color list
7
+ * @property {Array<string|{value: string, name: string}>} [items] - Color list.
8
+ * Use HEX strings or objects with `value`/`name` for labeled colors.
8
9
  * @property {number} [splitNum] - Number of colors per line
9
10
  * @property {boolean} [disableHEXInput] - Disable HEX input
11
+ * ```js
12
+ * { items: ['#ff0000', '#00ff00', { value: '#0000ff', name: 'Blue' }], splitNum: 6 }
13
+ * ```
10
14
  */
11
15
 
12
16
  /**
@@ -4,6 +4,12 @@ import { dom } from '../../helper';
4
4
  /**
5
5
  * @typedef {Object} HRPluginOptions
6
6
  * @property {Array<{name: string, class: string, style?: string}>} [items] - HR list
7
+ * ```js
8
+ * [
9
+ * { name: 'Solid', class: '__se__solid', style: 'border-top: 1px solid #000;' },
10
+ * { name: 'Dashed', class: '__se__dashed' }
11
+ * ]
12
+ * ```
7
13
  */
8
14
 
9
15
  /**
@@ -3,7 +3,10 @@ import { dom } from '../../helper';
3
3
 
4
4
  /**
5
5
  * @typedef {Object} LayoutPluginOptions
6
- * @property {Array<{name: string, html: string}>} [items] - Layout list
6
+ * @property {Array<{name: string, html: string}>} [items] - Layout list. Each item defines a named layout template with raw HTML.
7
+ * ```js
8
+ * [{ name: 'Two Columns', html: '<div style="display:flex"><div style="flex:1">Left</div><div style="flex:1">Right</div></div>' }]
9
+ * ```
7
10
  */
8
11
 
9
12
  /**
@@ -4,6 +4,9 @@ import { dom } from '../../helper';
4
4
  /**
5
5
  * @typedef {Object} LineHeightPluginOptions
6
6
  * @property {Array<{text: string, value: string}>} [items] - Line height list
7
+ * ```js
8
+ * [{ text: 'Single', value: '1' }, { text: '1.5', value: '1.5' }, { text: 'Double', value: '2' }]
9
+ * ```
7
10
  */
8
11
 
9
12
  /**
@@ -4,15 +4,16 @@ import { dom } from '../../helper';
4
4
  /**
5
5
  * @typedef {Object} ParagraphStylePluginOptions
6
6
  * @property {Array<string|{name: string, class: string, _class: string}>} [items] - Paragraph item list
7
- * @example
8
- * use default paragraph styles
7
+ * ```js
8
+ * // use default paragraph styles
9
9
  * ['spaced', 'bordered', 'neon']
10
- * custom paragraph styles
10
+ * // custom paragraph styles
11
11
  * [
12
12
  * { name: 'spaced', class: '__se__p-spaced', _class: '' },
13
13
  * { name: 'bordered', class: '__se__p-bordered', _class: '' },
14
14
  * { name: 'neon', class: '__se__p-neon', _class: '' }
15
15
  * ]
16
+ * ```
16
17
  */
17
18
 
18
19
  /**
@@ -75,9 +76,8 @@ class ParagraphStyle extends PluginDropdown {
75
76
  }
76
77
 
77
78
  // change format class
78
- const toggleClass = dom.utils.hasClass(target, 'active') ? dom.utils.removeClass : dom.utils.addClass;
79
79
  for (let i = 0, len = selectedFormsts.length; i < len; i++) {
80
- toggleClass(selectedFormsts[i], value);
80
+ dom.utils.toggleClass(selectedFormsts[i], value);
81
81
  }
82
82
 
83
83
  this.$.menu.dropdownOff();
@@ -21,7 +21,10 @@ const { _w, ON_OVER_COMPONENT } = env;
21
21
  * @property {"x"|"y"|"xy"} [scrollType='x'] - Scroll type (`x`, `y`, `xy`)
22
22
  * @property {"top"|"bottom"} [captionPosition='bottom'] - Caption position (`top`, `bottom`)
23
23
  * @property {"cell"|"table"} [cellControllerPosition='cell'] - Cell controller position (`cell`, `table`)
24
- * @property {Array} [colorList] - Color list, used in cell color picker
24
+ * @property {Array<string>} [colorList] - HEX color list for the cell background color picker.
25
+ * ```js
26
+ * { colorList: ['#bbf7d0', '#fde68a', '#fecaca', '#e9d5ff'] }
27
+ * ```
25
28
  */
26
29
 
27
30
  /**
@@ -190,7 +190,7 @@ export function CreateHTML_controller_properties({ lang, icons, options }) {
190
190
  const html = /*html*/ `
191
191
  <div class="se-controller-content">
192
192
  <div class="se-controller-header">
193
- <button type="button" data-command="close_props" class="se-btn se-close-btn close" title="${lang.close}" aria-label="${lang.close}">${icons.cancel}</button>
193
+ <button type="button" data-command="close" class="se-btn se-close-btn close" title="${lang.close}" aria-label="${lang.close}">${icons.cancel}</button>
194
194
  <span class="se-controller-title">${lang.tableProperties}</span>
195
195
  </div>
196
196
  <div class="se-controller-body">
@@ -311,15 +311,23 @@ export class TableGridService {
311
311
  if (remove) {
312
312
  dom.utils.removeItem(cols[insertIndex]);
313
313
  } else {
314
- let totalW = 0;
315
- for (let i = 0, len = cols.length, w; i < len; i++) {
316
- w = numbers.get(cols[i].style.width);
317
- w -= Math.round((w * len * 0.1) / 2);
318
- totalW += w;
319
- cols[i].style.width = `${w}%`;
314
+ const isAutoLayout = !dom.utils.hasClass(this.#main._element, 'se-table-layout-fixed') && this.#main._element.style.tableLayout !== 'fixed';
315
+ const hasWidth = !isAutoLayout && Array.prototype.some.call(cols, (col) => numbers.get(col.style.width) > 0);
316
+
317
+ if (hasWidth) {
318
+ let totalW = 0;
319
+ for (let i = 0, len = cols.length, w; i < len; i++) {
320
+ w = numbers.get(cols[i].style.width);
321
+ w -= Math.round((w * len * 0.1) / 2);
322
+ totalW += w;
323
+ cols[i].style.width = `${w}%`;
324
+ }
325
+ const newCol = dom.utils.createElement('col', { style: `width:${100 - totalW}%` });
326
+ colgroup.insertBefore(newCol, cols[insertIndex]);
327
+ } else {
328
+ // auto layout or no explicit widths — add bare col, let browser distribute
329
+ colgroup.insertBefore(dom.utils.createElement('col'), cols[insertIndex] || null);
320
330
  }
321
- const newCol = dom.utils.createElement('col', { style: `width:${100 - totalW}%` });
322
- colgroup.insertBefore(newCol, cols[insertIndex]);
323
331
  }
324
332
  }
325
333
 
@@ -597,7 +597,6 @@ export class TableStyleService {
597
597
  align_v = verticalAlign;
598
598
  this._propsCache = [];
599
599
 
600
- const tempColorStyles = _w.getComputedStyle(this.#$.eventManager.__focusTemp);
601
600
  for (let i = 0, t, isBreak; (t = targets[i]); i++) {
602
601
  // eslint-disable-next-line no-shadow
603
602
  const { cssText, border, backgroundColor, color, textAlign, verticalAlign, fontWeight, textDecoration, fontStyle } = t.style;
@@ -606,16 +605,13 @@ export class TableStyleService {
606
605
 
607
606
  const { c, s, w } = this.#getBorderStyle(border);
608
607
 
609
- // colors
608
+ // use getComputedStyle to normalize any CSS color format to rgb
610
609
  let hexBackColor = backgroundColor;
611
610
  let hexColor = color;
612
- if (hexBackColor) {
613
- this.#$.eventManager.__focusTemp.style.backgroundColor = hexBackColor;
614
- hexBackColor = tempColorStyles.backgroundColor;
615
- }
616
- if (hexColor) {
617
- this.#$.eventManager.__focusTemp.style.color = hexColor;
618
- hexColor = tempColorStyles.color;
611
+ if (hexBackColor || hexColor) {
612
+ const computed = _w.getComputedStyle(t);
613
+ if (hexBackColor) hexBackColor = computed.backgroundColor;
614
+ if (hexColor) hexColor = computed.color;
619
615
  }
620
616
 
621
617
  if (b_color && cellBorder.c !== c) b_color = '';
@@ -4,6 +4,9 @@ import { dom } from '../../helper';
4
4
  /**
5
5
  * @typedef {Object} TemplatePluginOptions
6
6
  * @property {Array<{name: string, html: string}>} [items] - Template list
7
+ * ```js
8
+ * [{ name: 'Greeting', html: '<p>Hello! Thank you for contacting us.</p>' }]
9
+ * ```
7
10
  */
8
11
 
9
12
  /**
@@ -3,7 +3,11 @@ import { dom } from '../../helper';
3
3
 
4
4
  /**
5
5
  * @typedef {Object} TextStylePluginOptions
6
- * @property {Array<string|{name: string, class: string, tag?: string}>} [items] - Text style item list
6
+ * @property {Array<string|{name: string, class: string, tag?: string}>} [items] - Text style item list.
7
+ * Use string shortcuts for built-in styles (e.g., `'shadow'`), or objects for custom styles.
8
+ * ```js
9
+ * ['shadow', { name: 'Highlight', class: 'my-highlight', tag: 'mark' }]
10
+ * ```
7
11
  */
8
12
 
9
13
  /**
@@ -12,7 +12,11 @@ const { debounce } = converter;
12
12
  * @property {number} [limitSize=5] - The number of items to display in the mention list
13
13
  * @property {number} [searchStartLength=0] - The number of characters to start searching for the mention list
14
14
  * @property {number} [delayTime=200] - The time to wait before displaying the mention list
15
- * @property {Array<{key: string, name: string, url: string}>} [data] - Use data without using API
15
+ * @property {Array<{key: string, name: string, url: string}>} [data] - Static mention data (used instead of API).
16
+ * ```js
17
+ * // data
18
+ * [{ key: 'john', name: 'John Doe', url: '/users/john' }]
19
+ * ```
16
20
  * @property {string} [apiUrl] - The URL to call the mention list
17
21
  * @property {Object<string, string>} [apiHeaders] - The headers to send with the API call
18
22
  * @property {boolean} [useCachingData=true] - Whether to cache the mention list data
@@ -1,5 +1,6 @@
1
1
  // command
2
2
  import blockquote from './command/blockquote';
3
+ import codeBlock from './command/codeBlock';
3
4
  import exportPDF from './command/exportPDF';
4
5
  import fileUpload from './command/fileUpload';
5
6
  import list_bulleted from './command/list_bulleted';
@@ -48,6 +49,7 @@ import anchor from './popup/anchor';
48
49
 
49
50
  export {
50
51
  blockquote,
52
+ codeBlock,
51
53
  exportPDF,
52
54
  fileUpload,
53
55
  list_bulleted,
@@ -84,6 +86,7 @@ export {
84
86
  };
85
87
  export default {
86
88
  blockquote,
89
+ codeBlock,
87
90
  exportPDF,
88
91
  fileUpload,
89
92
  list_bulleted,
@@ -94,9 +94,16 @@ const DEFAULT_UNIT_MAP = {
94
94
  * - Accepted values include: `'px'`, `'pt'`, `'em'`, `'rem'`, `'vw'`, `'vh'`, `'%'` or `'text'`.
95
95
  * - If `'text'` is used, a text-based font size list is applied.
96
96
  * @property {boolean} [showDefaultSizeLabel=true] - Determines whether the default size label is displayed in the dropdown menu.
97
- * @property {boolean} [showIncDecControls=false] - When `true`, displays increase and decrease buttons for font size adjustments.
98
- * @property {boolean} [disableInput=true] - When `true`, disables the direct font size input box.
99
- * @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.
97
+ * @property {boolean} [showIncDecControls] - When `true`, displays increase and decrease buttons for font size adjustments.
98
+ * - Defaults to `false`. Always `false` when `sizeUnit` is `'text'` (ignored).
99
+ * @property {boolean} [disableInput] - When `true`, disables the direct font size input box.
100
+ * - Defaults to `true` when `sizeUnit` is `'text'`, otherwise `false`.
101
+ * @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.
102
+ * 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.
103
+ * When `sizeUnit` is `'text'`, list items use `{title: string, size: string}` instead of numbers.
104
+ * ```js
105
+ * { unitMap: { px: { default: 16, inc: 1, min: 8, max: 72, list: [8, 12, 16, 20, 24, 32, 48] } } }
106
+ * ```
100
107
  */
101
108
 
102
109
  /**
@@ -7,10 +7,11 @@ const { NO_EVENT, ON_OVER_COMPONENT } = env;
7
7
 
8
8
  /**
9
9
  * @typedef {Object} AudioPluginOptions
10
- * @property {string} [defaultWidth="300px"] - The default width of the `AUDIO` tag (e.g., `"300px"`).
11
- * @property {string} [defaultHeight="150px"] - The default height of the `AUDIO` tag (e.g., `"150px"`).
10
+ * @property {string} [defaultWidth="300px"] - The default width of the `AUDIO` tag.
11
+ * @property {string} [defaultHeight="150px"] - The default height of the `AUDIO` tag.
12
12
  * @property {boolean} [createFileInput] - Whether to create a file input element.
13
- * @property {boolean} [createUrlInput] - Whether to create a URL input element (default is `true` if file input is not created).
13
+ * @property {boolean} [createUrlInput] - Whether to create a URL input element.
14
+ * - Defaults to `true`. Always `true` when `createFileInput` is `false`.
14
15
  * @property {string} [uploadUrl] - The URL to which files will be uploaded.
15
16
  * @property {Object<string, string>} [uploadHeaders] - Headers to include in the file upload request.
16
17
  * @property {number} [uploadSizeLimit] - The total upload size limit in bytes.
@@ -18,6 +19,9 @@ const { NO_EVENT, ON_OVER_COMPONENT } = env;
18
19
  * @property {boolean} [allowMultiple] - Whether to allow multiple file uploads.
19
20
  * @property {string} [acceptedFormats="audio/*"] - Accepted file formats (default is `"audio/*"`).
20
21
  * @property {Object<string, string>} [audioTagAttributes] - Additional attributes to set on the `AUDIO` tag.
22
+ * ```js
23
+ * { audioTagAttributes: { controls: 'true', preload: 'metadata' } }
24
+ * ```
21
25
  * @property {SunEditor.ComponentInsertType} [insertBehavior] - Component insertion behavior for selection and cursor placement.
22
26
  * - [default: `options.get('componentInsertBehavior')`]
23
27
  * - `auto`: Move cursor to the next line if possible, otherwise select the component.
@@ -15,28 +15,31 @@ const { _w, NO_EVENT } = env;
15
15
  * @property {number} [uploadSizeLimit] - The total file upload size limit in bytes.
16
16
  * @property {number} [uploadSingleSizeLimit] - The single file upload size limit in bytes.
17
17
  * @property {Object<string, string>} [iframeTagAttributes] - Additional attributes to set on the `IFRAME` tag.
18
- * @property {string} [query_youtube] - YouTube query parameter.
19
- * @property {string} [query_vimeo] - Vimeo query parameter.
20
- * @property {Array<RegExp>} [urlPatterns] - Additional URL patterns for embed.
21
- * @property {Object<string, {pattern: RegExp, action: (url: string) => string, tag: string}>} [embedQuery] - Custom query objects for additional embedding services.
22
- * Example :
18
+ * ```js
19
+ * { iframeTagAttributes: { allowfullscreen: 'true', loading: 'lazy' } }
20
+ * ```
21
+ * @property {string} [query_youtube] - YouTube query parameter appended to the embed URL.
22
+ * ```js
23
+ * { query_youtube: 'autoplay=1&mute=1' }
24
+ * ```
25
+ * @property {string} [query_vimeo] - Vimeo query parameter appended to the embed URL.
26
+ * ```js
27
+ * { query_vimeo: 'autoplay=1' }
28
+ * ```
29
+ * @property {Array<RegExp>} [urlPatterns] - Additional URL patterns to recognize as embeddable content.
30
+ * @property {Object<string, {pattern: RegExp, action: (url: string) => string, tag: string}>} [embedQuery] - Custom embed service definitions.
31
+ * 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.
32
+ * ```js
23
33
  * {
24
- * facebook: {
25
- * pattern: /(?:https?:\/\/)?(?:www\.)?(?:facebook\.com)\/(.+)/i,
26
- * action: (url) => {
27
- * return `https://www.facebook.com/plugins/post.php?href=${encodeURIComponent(url)}&show_text=true&width=500`;
28
- * },
29
- * tag: 'iframe'
30
- * },
31
- * twitter: {
32
- * pattern: /(?:https?:\/\/)?(?:www\.)?(?:twitter\.com)\/(status|embed)\/(.+)/i,
33
- * action: (url) => {
34
- * return `https://platform.twitter.com/embed/Tweet.html?url=${encodeURIComponent(url)}`;
35
- * },
36
- * tag: 'iframe'
37
- * },
38
- * // Additional services...
34
+ * embedQuery: {
35
+ * facebook: {
36
+ * pattern: /(?:https?:\/\/)?(?:www\.)?facebook\.com\/(.+)/i,
37
+ * action: (url) => `https://www.facebook.com/plugins/post.php?href=${encodeURIComponent(url)}`,
38
+ * tag: 'iframe'
39
+ * }
40
+ * }
39
41
  * }
42
+ * ```
40
43
  * @property {SunEditor.Module.Figure.Controls} [controls] - Figure controls.
41
44
  * @property {SunEditor.ComponentInsertType} [insertBehavior] - Component insertion behavior for selection and cursor placement.
42
45
  * - [default: `options.get('componentInsertBehavior')`]
@@ -19,9 +19,13 @@ const { NO_EVENT } = env;
19
19
  * @property {string} [defaultHeight="auto"] - The default height of the image. If a number is provided, `"px"` will be appended.
20
20
  * @property {boolean} [percentageOnlySize=false] - Whether to allow only percentage-based sizing.
21
21
  * @property {boolean} [createFileInput=true] - Whether to create a file input element for image uploads.
22
- * @property {boolean} [createUrlInput=true] - Whether to create a URL input element for image insertion.
22
+ * @property {boolean} [createUrlInput] - Whether to create a URL input element for image insertion.
23
+ * - Defaults to `true`. Always `true` when `createFileInput` is `false`.
23
24
  * @property {string} [uploadUrl] - The URL endpoint for image file uploads.
24
25
  * @property {Object<string, string>} [uploadHeaders] - Additional headers to include in the file upload request.
26
+ * ```js
27
+ * { uploadUrl: '/api/upload/image', uploadHeaders: { Authorization: 'Bearer token' } }
28
+ * ```
25
29
  * @property {number} [uploadSizeLimit] - The total upload size limit in bytes.
26
30
  * @property {number} [uploadSingleSizeLimit] - The single file upload size limit in bytes.
27
31
  * @property {boolean} [allowMultiple=false] - Whether multiple image uploads are allowed.
@@ -8,11 +8,16 @@ const { _w, _d } = env;
8
8
  * @typedef {Object} MathPluginOptions
9
9
  * @property {boolean} [canResize=true] - Whether the math modal can be resized.
10
10
  * @property {boolean} [autoHeight=false] - Whether to automatically adjust the height of the modal.
11
- * @property {Array<object>} [fontSizeList] - A list of font size options for rendering math expressions.
11
+ * @property {Array<{text: string, value: string, default?: true}>} [fontSizeList] - A list of font size options for the math expression size selector.
12
+ * ```js
13
+ * // fontSizeList
14
+ * [{ text: '1', value: '1em', default: true }, { text: '1.5', value: '1.5em' }, { text: '2', value: '2em' }]
15
+ * ```
12
16
  * @property {?(...args: *) => *} [onPaste] - A callback function to handle paste events in the math input area.
13
17
  * @property {Object} [formSize={}] - An object specifying the dimensions for the math modal.
14
18
  * @property {string} [formSize.width="460px"] - The default width of the math modal.
15
- * @property {string} [formSize.height="14em"] - The default height of the math modal.
19
+ * @property {string} [formSize.height] - The default height of the math modal.
20
+ * - Defaults to `"14em"`. When `autoHeight` is `true`, defaults to `formSize.minHeight`.
16
21
  * @property {string} [formSize.maxWidth] - The maximum width of the math modal.
17
22
  * @property {string} [formSize.maxHeight] - The maximum height of the math modal.
18
23
  * @property {string} [formSize.minWidth="400px"] - The minimum width of the math modal.
@@ -16,21 +16,38 @@ import { CreateHTML_modal } from './render/video.html';
16
16
  * @property {string} [defaultHeight] - The default height of the video element. If a number is provided, `"px"` will be appended.
17
17
  * @property {boolean} [percentageOnlySize=false] - Whether to allow only percentage-based sizing.
18
18
  * @property {boolean} [createFileInput=false] - Whether to create a file input element for video uploads.
19
- * @property {boolean} [createUrlInput=true] - Whether to create a URL input element for video embedding.
19
+ * @property {boolean} [createUrlInput] - Whether to create a URL input element for video embedding.
20
+ * - Defaults to `true`. Always `true` when `createFileInput` is `false`.
20
21
  * @property {string} [uploadUrl] - The URL endpoint for video file uploads.
21
22
  * @property {Object<string, string>} [uploadHeaders] - Additional headers to include in the video upload request.
22
23
  * @property {number} [uploadSizeLimit] - The total upload size limit for videos in bytes.
23
24
  * @property {number} [uploadSingleSizeLimit] - The single file upload size limit for videos in bytes.
24
25
  * @property {boolean} [allowMultiple=false] - Whether multiple video uploads are allowed.
25
26
  * @property {string} [acceptedFormats="video/*"] - Accepted file formats for video uploads (`"video/*"`).
26
- * @property {number} [defaultRatio=0.5625] - The default aspect ratio for the video (e.g., 16:9 is 0.5625).
27
+ * @property {number} [defaultRatio=0.5625] - The default aspect ratio for the video (height/width, e.g. 16:9 `9/16 = 0.5625`).
27
28
  * @property {boolean} [showRatioOption=true] - Whether to display the ratio option in the modal.
28
- * @property {Array} [ratioOptions] - Custom ratio options for video resizing.
29
+ * @property {Array<{name: string, value: number}>} [ratioOptions] - Custom ratio options for video resizing (value = height/width).
30
+ * ```js
31
+ * // ratioOptions
32
+ * [{ name: '16:9', value: 0.5625 }, { name: '4:3', value: 0.75 }]
33
+ * ```
29
34
  * @property {Object<string, string>} [videoTagAttributes] - Additional attributes to set on the `VIDEO` tag.
35
+ * ```js
36
+ * { videoTagAttributes: { controls: 'true', muted: 'true', playsinline: '' } }
37
+ * ```
30
38
  * @property {Object<string, string>} [iframeTagAttributes] - Additional attributes to set on the `IFRAME` tag.
39
+ * ```js
40
+ * { iframeTagAttributes: { allowfullscreen: 'true', loading: 'lazy' } }
41
+ * ```
31
42
  * @property {string} [query_youtube=""] - Additional query parameters for YouTube embedding.
43
+ * ```js
44
+ * { query_youtube: 'autoplay=1&mute=1' }
45
+ * ```
32
46
  * @property {string} [query_vimeo=""] - Additional query parameters for Vimeo embedding.
33
- * @property {Object<string, {pattern: RegExp, action: (url: string) => string, tag: string}>} [embedQuery] - Custom query objects for additional embedding services.
47
+ * ```js
48
+ * { query_vimeo: 'autoplay=1' }
49
+ * ```
50
+ * @property {Object<string, {pattern: RegExp, action: (url: string) => string, tag: string}>} [embedQuery] - Custom embed service definitions (see `EmbedPluginOptions.embedQuery`).
34
51
  * @property {Array<RegExp>} [urlPatterns] - Additional URL patterns for video embedding.
35
52
  * @property {Array<string>} [extensions] - Additional file extensions to be recognized for video uploads.
36
53
  * @property {SunEditor.Module.Figure.Controls} [controls] - Figure controls.
@@ -38,15 +38,19 @@
38
38
  --se-edit-outline: #444;
39
39
 
40
40
  /** --------------------------- layout - [colors] ----------- */
41
- /* main shell and typography */
42
- --se-main-font-family: Helvetica Neue;
43
41
  --se-main-out-color: #444;
44
42
  --se-main-color: #ccc;
45
43
  --se-main-color-lighter: #aaa;
46
44
  --se-main-background-color: #0f1828;
47
- --se-code-view-color: #030712;
45
+ --se-code-view-color: #ccc;
48
46
  --se-main-font-color: #ccc;
49
- --se-code-view-background-color: #ddd;
47
+ --se-code-view-background-color: #0d1520;
48
+ --se-code-view-line-color: #8899aa;
49
+ --se-code-view-line-background-color: #0f1828;
50
+ --se-markdown-view-color: #ccc;
51
+ --se-markdown-view-background-color: #0d1520;
52
+ --se-markdown-view-line-color: #8899aa;
53
+ --se-markdown-view-line-background-color: #0f1828;
50
54
  --se-main-divider-color: #555;
51
55
  --se-main-border-color: #666;
52
56
  --se-main-outline-color: #444;
@@ -54,6 +58,11 @@
54
58
  --se-statusbar-font-color: #aaa;
55
59
  --se-overlay-background-color: #111;
56
60
 
61
+ /* finder */
62
+ --se-find-match-color: rgba(255, 213, 0, 0.3);
63
+ --se-find-current-color: rgba(255, 150, 50, 0.55);
64
+ --se-find-no-match-color: rgba(255, 80, 80, 0.2);
65
+
57
66
  /* hover states */
58
67
  --se-hover-color: #162040;
59
68
  --se-hover-dark-color: #304878;
@@ -38,8 +38,6 @@
38
38
  --se-edit-outline: #c4a06e;
39
39
 
40
40
  /** --------------------------- layout - [colors] ----------- */
41
- /* main shell and typography */
42
- --se-main-font-family: Helvetica Neue;
43
41
  --se-main-out-color: #ebe4d5;
44
42
  --se-main-color: #2b2b2b;
45
43
  --se-main-color-lighter: #555555;
@@ -47,6 +45,12 @@
47
45
  --se-code-view-color: #2b2b2b;
48
46
  --se-main-font-color: #2b2b2b;
49
47
  --se-code-view-background-color: #fefcf6;
48
+ --se-code-view-line-color: #8a7e68;
49
+ --se-code-view-line-background-color: #f5f0e0;
50
+ --se-markdown-view-color: #2b2b2b;
51
+ --se-markdown-view-background-color: #fefcf6;
52
+ --se-markdown-view-line-color: #8a7e68;
53
+ --se-markdown-view-line-background-color: #f5f0e0;
50
54
  --se-main-divider-color: #d5c9b0;
51
55
  --se-main-border-color: #c4a06e;
52
56
  --se-main-outline-color: #e0d6c2;
@@ -54,6 +58,11 @@
54
58
  --se-statusbar-font-color: #666666;
55
59
  --se-overlay-background-color: rgba(0, 0, 0, 0.3);
56
60
 
61
+ /* finder */
62
+ --se-find-match-color: rgba(255, 213, 0, 0.4);
63
+ --se-find-current-color: rgba(255, 150, 50, 0.65);
64
+ --se-find-no-match-color: rgba(255, 80, 80, 0.12);
65
+
57
66
  /* hover states */
58
67
  --se-hover-color: #d6e8f8;
59
68
  --se-hover-dark-color: #6ba3d6;
@@ -39,15 +39,19 @@
39
39
  --se-edit-outline: #3b4048;
40
40
 
41
41
  /** --------------------------- layout - [colors] ----------- */
42
- /* main shell and typography */
43
- --se-main-font-family: Helvetica Neue;
44
42
  --se-main-out-color: #21252b;
45
43
  --se-main-color: #d7dae0;
46
44
  --se-main-color-lighter: #abb2bf;
47
45
  --se-main-background-color: #282c34;
48
- --se-code-view-color: #181a1f;
46
+ --se-code-view-color: #d7dae0;
49
47
  --se-main-font-color: #d7dae0;
50
- --se-code-view-background-color: #d7dae0;
48
+ --se-code-view-background-color: #1e2127;
49
+ --se-code-view-line-color: #abb2bf;
50
+ --se-code-view-line-background-color: #282c34;
51
+ --se-markdown-view-color: #d7dae0;
52
+ --se-markdown-view-background-color: #1e2127;
53
+ --se-markdown-view-line-color: #abb2bf;
54
+ --se-markdown-view-line-background-color: #282c34;
51
55
  --se-main-divider-color: #3b4048;
52
56
  --se-main-border-color: #3e4451;
53
57
  --se-main-outline-color: #2f333d;
@@ -55,6 +59,11 @@
55
59
  --se-statusbar-font-color: #9da5b4;
56
60
  --se-overlay-background-color: rgba(0, 0, 0, 0.55);
57
61
 
62
+ /* finder */
63
+ --se-find-match-color: rgba(255, 213, 0, 0.3);
64
+ --se-find-current-color: rgba(255, 150, 50, 0.55);
65
+ --se-find-no-match-color: rgba(255, 80, 80, 0.2);
66
+
58
67
  /* hover states */
59
68
  --se-hover-color: #28434c;
60
69
  --se-hover-dark-color: #365864;
@@ -38,15 +38,19 @@
38
38
  --se-edit-outline: #424242;
39
39
 
40
40
  /** --------------------------- layout - [colors] ----------- */
41
- /* main shell and typography */
42
- --se-main-font-family: Helvetica Neue;
43
41
  --se-main-out-color: #2c2c2c;
44
42
  --se-main-color: #e4e4e4;
45
43
  --se-main-color-lighter: #cfcfcf;
46
44
  --se-main-background-color: #212121;
47
- --se-code-view-color: #111111;
45
+ --se-code-view-color: #e4e4e4;
48
46
  --se-main-font-color: #e4e4e4;
49
- --se-code-view-background-color: #dadada;
47
+ --se-code-view-background-color: #1a1a1a;
48
+ --se-code-view-line-color: #999;
49
+ --se-code-view-line-background-color: #252525;
50
+ --se-markdown-view-color: #e4e4e4;
51
+ --se-markdown-view-background-color: #1a1a1a;
52
+ --se-markdown-view-line-color: #999;
53
+ --se-markdown-view-line-background-color: #252525;
50
54
  --se-main-divider-color: #3d4350;
51
55
  --se-main-border-color: #444;
52
56
  --se-main-outline-color: #383838;
@@ -54,6 +58,11 @@
54
58
  --se-statusbar-font-color: #a1a1a1;
55
59
  --se-overlay-background-color: rgba(0, 0, 0, 0.6);
56
60
 
61
+ /* finder */
62
+ --se-find-match-color: rgba(255, 213, 0, 0.3);
63
+ --se-find-current-color: rgba(255, 150, 50, 0.55);
64
+ --se-find-no-match-color: rgba(255, 80, 80, 0.2);
65
+
57
66
  /* hover states */
58
67
  --se-hover-color: #2f3f44;
59
68
  --se-hover-dark-color: #4b6b72;
package/src/typedef.js CHANGED
@@ -195,7 +195,7 @@
195
195
  * @typedef {Object} SunEditor.Event.Info
196
196
  * @property {*} target Target element
197
197
  * @property {string} type Event type
198
- * @property {EventListenerOrEventListenerObject} listener Event listener
198
+ * @property {*} listener Event listener
199
199
  * @property {boolean|AddEventListenerOptions} [useCapture] Event useCapture option
200
200
  */
201
201
 
@@ -203,7 +203,7 @@
203
203
  * EventManager global event information
204
204
  * @typedef {Object} SunEditor.Event.GlobalInfo
205
205
  * @property {string} type Event type
206
- * @property {(...args: *) => *} listener Event listener
206
+ * @property {*} listener Event listener
207
207
  * @property {boolean|AddEventListenerOptions} [useCapture] Use event capture
208
208
  */
209
209
 
@@ -265,10 +265,10 @@
265
265
  * ---[ Auto-generated by scripts/check/gen-button-types.cjs - DO NOT EDIT MANUALLY ]---
266
266
  *
267
267
  * Default command buttons available in the toolbar
268
- * @typedef {"bold"|"underline"|"italic"|"strike"|"subscript"|"superscript"|"removeFormat"|"copyFormat"|"indent"|"outdent"|"fullScreen"|"showBlocks"|"codeView"|"undo"|"redo"|"preview"|"print"|"copy"|"dir"|"dir_ltr"|"dir_rtl"|"save"|"newDocument"|"selectAll"|"pageBreak"|"pageUp"|"pageDown"|"pageNavigator"} SunEditor.UI.ButtonCommand
268
+ * @typedef {"bold"|"underline"|"italic"|"strike"|"subscript"|"superscript"|"removeFormat"|"copyFormat"|"indent"|"outdent"|"fullScreen"|"showBlocks"|"codeView"|"markdownView"|"undo"|"redo"|"preview"|"print"|"copy"|"dir"|"dir_ltr"|"dir_rtl"|"finder"|"save"|"newDocument"|"selectAll"|"pageBreak"|"pageUp"|"pageDown"|"pageNavigator"} SunEditor.UI.ButtonCommand
269
269
  *
270
270
  * Plugin buttons available in the toolbar
271
- * @typedef {"blockquote"|"exportPDF"|"fileUpload"|"list_bulleted"|"list_numbered"|"mention"|"align"|"font"|"fontColor"|"backgroundColor"|"list"|"table"|"blockStyle"|"hr"|"layout"|"lineHeight"|"template"|"paragraphStyle"|"textStyle"|"link"|"image"|"video"|"audio"|"embed"|"math"|"drawing"|"imageGallery"|"videoGallery"|"audioGallery"|"fileGallery"|"fileBrowser"|"fontSize"|"pageNavigator"|"anchor"} SunEditor.UI.ButtonPlugin
271
+ * @typedef {"blockquote"|"codeBlock"|"exportPDF"|"fileUpload"|"list_bulleted"|"list_numbered"|"mention"|"align"|"font"|"fontColor"|"backgroundColor"|"list"|"table"|"blockStyle"|"hr"|"layout"|"lineHeight"|"template"|"paragraphStyle"|"textStyle"|"link"|"image"|"video"|"audio"|"embed"|"math"|"drawing"|"imageGallery"|"videoGallery"|"audioGallery"|"fileGallery"|"fileBrowser"|"fontSize"|"pageNavigator"|"anchor"} SunEditor.UI.ButtonPlugin
272
272
  *
273
273
  * Single button item in the toolbar (includes special controls and custom strings)
274
274
  * @typedef {SunEditor.UI.ButtonCommand|SunEditor.UI.ButtonPlugin|SunEditor.UI.ButtonSpecial|string} SunEditor.UI.ButtonItem
@@ -13,7 +13,9 @@ declare namespace _default {
13
13
  export let outdent: string;
14
14
  export let expansion: string;
15
15
  export let reduction: string;
16
+ export let code_block: string;
16
17
  export let code_view: string;
18
+ export let markdown_view: string;
17
19
  export let preview: string;
18
20
  export let print: string;
19
21
  export let template: string;
@@ -119,12 +121,20 @@ declare namespace _default {
119
121
  export let cut: string;
120
122
  export let PDF: string;
121
123
  export let format_paint: string;
122
- export let find_replace: string;
123
124
  export let drawing: string;
124
125
  export let eraser: string;
125
126
  export let search: string;
126
127
  export let selection_search: string;
127
128
  export let embed: string;
129
+ export let finder: string;
130
+ export let regex: string;
131
+ export let match_case: string;
132
+ export let whole_word: string;
133
+ export let swap_vert: string;
134
+ export let arrow_down_small: string;
135
+ export let arrow_up_small: string;
136
+ export let replaceText: string;
137
+ export let relaceTextAll: string;
128
138
  export let menu_arrow_down: string;
129
139
  export let menu_arrow_up: string;
130
140
  export let menu_arrow_right: string;
@@ -147,6 +157,7 @@ declare namespace _default {
147
157
  export let more_plus: string;
148
158
  export let more_horizontal: string;
149
159
  export let more_vertical: string;
160
+ export let more_flag: string;
150
161
  export let as_inline: string;
151
162
  export let as_block: string;
152
163
  export let page_break: string;
@@ -1 +1 @@
1
- declare module 'suneditor/css';
1
+ declare module 'suneditor/css/editor';