suneditor 3.0.0-beta.1 → 3.0.0-beta.2

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 (47) hide show
  1. package/CONTRIBUTING.md +166 -29
  2. package/README.md +13 -1
  3. package/dist/suneditor.min.css +1 -1
  4. package/dist/suneditor.min.js +1 -1
  5. package/package.json +13 -5
  6. package/src/assets/{variables.css → design/color.css} +34 -58
  7. package/src/assets/design/index.css +3 -0
  8. package/src/assets/design/size.css +35 -0
  9. package/src/assets/design/typography.css +37 -0
  10. package/src/assets/suneditor-contents.css +1 -1
  11. package/src/assets/suneditor.css +24 -17
  12. package/src/core/base/eventHandlers/handler_ww_key_input.js +15 -15
  13. package/src/core/base/eventHandlers/handler_ww_mouse.js +1 -1
  14. package/src/core/base/eventManager.js +21 -9
  15. package/src/core/class/component.js +21 -11
  16. package/src/core/class/menu.js +19 -0
  17. package/src/core/editor.js +3 -3
  18. package/src/core/section/actives.js +42 -4
  19. package/src/core/section/constructor.js +116 -41
  20. package/src/core/section/documentType.js +2 -2
  21. package/src/events.js +13 -1
  22. package/src/helper/dom/domCheck.js +10 -0
  23. package/src/modules/Figure.js +6 -6
  24. package/src/modules/FileManager.js +1 -1
  25. package/src/plugins/command/fileUpload.js +3 -3
  26. package/src/plugins/dropdown/table.js +51 -18
  27. package/src/plugins/modal/audio.js +2 -2
  28. package/src/plugins/modal/embed.js +2 -2
  29. package/src/plugins/modal/image.js +3 -3
  30. package/src/plugins/modal/math.js +2 -2
  31. package/src/plugins/modal/video.js +1 -1
  32. package/src/plugins/popup/anchor.js +1 -1
  33. package/src/suneditor.js +1 -1
  34. package/src/themes/dark.css +78 -45
  35. package/types/core/base/eventManager.d.ts +7 -0
  36. package/types/core/class/component.d.ts +12 -3
  37. package/types/core/class/menu.d.ts +8 -0
  38. package/types/core/section/constructor.d.ts +160 -149
  39. package/types/events.d.ts +1 -0
  40. package/types/helper/dom/domCheck.d.ts +7 -0
  41. package/types/helper/index.d.ts +1 -0
  42. package/types/index.d.ts +1 -1
  43. package/types/plugins/dropdown/table.d.ts +1 -0
  44. package/.eslintignore +0 -7
  45. package/.eslintrc.json +0 -81
  46. /package/src/assets/icons/{_default.js → defaultIcons.js} +0 -0
  47. /package/types/assets/icons/{_default.d.ts → defaultIcons.d.ts} +0 -0
@@ -117,7 +117,161 @@ export function CreateToolBar(
117
117
  key: string;
118
118
  }>;
119
119
  };
120
- export const RO_UNAVAILABD: string[];
120
+ /**
121
+ * @typedef {Object} EditorFrameOptions
122
+ * @property {string} [value=""] - Initial value for the editor.
123
+ * @property {string} [placeholder=""] - Placeholder text.
124
+ * @property {Object<string, string>} [editableFrameAttributes={}] - Attributes for the editable frame[.sun-editor-editable]. (e.g. [key]: value)
125
+ * @property {string} [width="100%"] - Width for the editor.
126
+ * @property {string} [minWidth=""] - Min width for the editor.
127
+ * @property {string} [maxWidth=""] - Max width for the editor.
128
+ * @property {string} [height="auto"] - Height for the editor.
129
+ * @property {string} [minHeight=""] - Min height for the editor.
130
+ * @property {string} [maxHeight=""] - Max height for the editor.
131
+ * @property {string} [editorStyle=""] - Style string of the top frame of the editor. (e.g. "border: 1px solid #ccc;").
132
+ * @property {boolean} [iframe=false] - Content will be placed in an iframe and isolated from the rest of the page.
133
+ * @property {boolean} [iframe_fullPage=false] - Allows the usage of HTML, HEAD, BODY tags and DOCTYPE declaration on the "iframe".
134
+ * @property {Object<string, string>} [iframe_attributes={}] - Attributes of the "iframe". (e.g. {'scrolling': 'no'})
135
+ * @property {string} [iframe_cssFileName="suneditor"] - Name or Array of the CSS file to apply inside the iframe.
136
+ * - You can also use regular expressions.
137
+ * - Applied by searching by filename in the link tag of document,
138
+ * - or put the URL value (".css" can be omitted).
139
+ * @property {boolean} [statusbar=true] - Enables the status bar.
140
+ * @property {boolean} [statusbar_showPathLabel=true] - Displays the current node structure to status bar.
141
+ * @property {boolean} [statusbar_resizeEnable=true] - Enables resize function of bottom status bar
142
+ * @property {boolean} [charCounter=false] - Shows the number of characters in the editor.
143
+ * - If the maxCharCount option has a value, it becomes true.
144
+ * @property {number} [charCounter_max] - The maximum number of characters allowed to be inserted into the editor.
145
+ * @property {string} [charCounter_label] - Text to be displayed in the "charCounter" area of the bottom bar. (e.g. "Characters : 20/200")
146
+ * @property {"char"|"byte"|"byte-html"} [charCounter_type="char"] - Defines the calculation method of the "charCounter" option.
147
+ * - 'char': Characters length.
148
+ * - 'byte': Binary data size of characters.
149
+ * - 'byte-html': Binary data size of the full HTML string.
150
+ */
151
+ /**
152
+ * @typedef {Object} EditorBaseOptions
153
+ * @property {Object<string, *>|Array<Object<string, *>>} [plugins] - Plugin configuration.
154
+ * @property {Array<string>} [excludedPlugins] - Plugin configuration.
155
+ * @property {Array<string[]|string>} [buttonList] - List of toolbar buttons, grouped by sub-arrays.
156
+ * @property {boolean} [v2Migration=false] - Enables migration mode for SunEditor v2.
157
+ * @property {boolean|{tagFilter: boolean, formatFilter: boolean, classFilter: boolean, styleNodeFilter: boolean, attrFilter: boolean, styleFilter: boolean}} [strictMode=true] - Enables strict filtering of tags, attributes, and styles.
158
+ * @property {"classic"|"inline"|"balloon"|"balloon-always"} [mode="classic"] - Toolbar mode: "classic", "inline", "balloon", "balloon-always".
159
+ * @property {string} [type=""] - Editor type: "document:header,page".
160
+ * @property {string} [theme=""] - Editor theme.
161
+ * @property {Object<string, string>} [lang] - Language configuration.
162
+ * @property {Array<string>} [fontSizeUnits=["px", "pt", "em", "rem"]] - Allowed font size units.
163
+ * @property {string} [allowedClassName] - Allowed class names.
164
+ * @property {boolean} [closeModalOutsideClick=false] - Closes modals when clicking outside.
165
+ * @property {boolean} [copyFormatKeepOn=false] - Keeps the format of the copied content.
166
+ * @property {boolean} [syncTabIndent=true] - Synchronizes tab indent with spaces.
167
+ * @property {boolean} [tabDisable=false] - Disables tab key input.
168
+ * @property {boolean} [autoLinkify] - Automatically converts URLs into hyperlinks. ("Link" plugin required)
169
+ * @property {Array<string>} [autoStyleify=["bold", "underline", "italic", "strike"]] - Styles applied automatically on text input.
170
+ * @property {Object<string, string|number>} [scrollToOptions={behavior: "auto", block: "nearest"}] - Configuration for scroll behavior when navigating editor content.
171
+ * @property {Object<string, string|number>} [componentScrollToOptions={behavior: "smooth", block: "center"}] - Configuration for scroll behavior when navigating components.
172
+ * @property {"repeat"|"always"|"none"} [retainStyleMode="repeat"] - This option determines how inline elements (such as <span>, <strong>, etc.) are handled when deleting text.
173
+ * - "repeat": Inline styles are retained unless the backspace key is repeatedly pressed. If the user continuously presses backspace, the styles will eventually be removed.
174
+ * - "none": Inline styles are not retained at all. When deleting text, the associated inline elements are immediately removed along with it.
175
+ * - "always": Inline styles persist indefinitely unless explicitly removed. Even if all text inside an inline element is deleted, the element itself remains until manually removed.
176
+ * @property {Object<string, boolean>} [allowedExtraTags={script: false, style: false, meta: false, link: false, "[a-z]+:[a-z]+": false}] - Specifies extra allowed or disallowed tags.
177
+ * @property {Object<string, (...args: *) => *>} [events={}] - Custom event handlers.
178
+ * @property {string} [__textStyleTags="strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary"] - The basic tags that serves as the base for "textStyleTags"
179
+ * @property {string} [textStyleTags="strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary"] - Additional text style tags.
180
+ * @property {Object<string, string>} [convertTextTags={bold: "strong", underline: "u", italic: "em", strike: "del", subscript: "sub", superscript: "sup"}] - Maps text styles to specific HTML tags.
181
+ * @property {Object<string, string>} [__tagStyles={'table|th|td': 'border|border-[a-z]+|background-color|text-align|float|font-weight|text-decoration|font-style', 'ol|ul': 'list-style-type'}] - The basic tags that serves as the base for "tagStyles"
182
+ * @property {Object<string, string>} [tagStyles={}] - Specifies allowed styles for HTML tags.
183
+ * @property {string} [spanStyles="font-family|font-size|color|background-color"] - Specifies allowed styles for the "span" tag.
184
+ * @property {string} [lineStyles="text-align|margin-left|margin-right|line-height"] - Specifies allowed styles for the "line" element (p..).
185
+ * @property {string} [textDirection="ltr"] - Text direction: "ltr" or "rtl".
186
+ * @property {Array<string>} [reverseButtons=['indent-outdent']] - An array of command pairs whose shortcut icons should be opposite each other, depending on the "textDirection" mode.
187
+ * @property {number} [historyStackDelayTime=400] - Delay time for history stack updates (ms).
188
+ * @property {string} [lineAttrReset=""] - Line properties that should be reset when changing lines (e.g. "id|name").
189
+ * @property {string} [printClass=""] - Class name for printing.
190
+ * @property {string} [defaultLine="p"] - Default line element when inserting new lines.
191
+ * @property {"line"|"br"} [defaultLineBreakFormat="line"] - Specifies the default line break format.
192
+ * - [Recommended] "line" : is a line break that is divided into general tags.
193
+ * - [Not recommended] "br" : Line breaks are treated as <br> on the same line. (like shift+enter)
194
+ * - Line breaks are handled as <br> within "line".
195
+ * - You can create a new "line" by entering a line break twice in a row.
196
+ * - Formats that include "line", such as "Quote", still operate on a "line" basis.
197
+ * - ● suneditor processes work in "line" units.
198
+ * - ● When set to "br", performance may decrease when editing a lot of data.
199
+ * @property {Array<string>} [scopeSelectionTags=["td", "table", "li", "ol", "ul", "pre", "figcaption", "blockquote", "dl", "dt", "dd"]] - Tags treated as whole units when selecting all content.
200
+ * @property {string} [__defaultElementWhitelist="br|div"] - Default allowed HTML elements. The default values are maintained.
201
+ * @property {string} [elementWhitelist=""] - Allowed HTML elements. Delimiter: "|" (e.g. "p|div", "*").
202
+ * @property {string} [elementBlacklist=""] - Disallowed HTML elements. Delimiter: "|" (e.g. "script|style").
203
+ * @property {string} [__defaultAttributeWhitelist] - Allowed attributes. Delimiter: "|" (e.g. "href|target").
204
+ * @property {Object<string, string>} [attributeWhitelist=""] - Allowed attributes. (e.g. {a: "href|target", img: "src|alt"}).
205
+ * @property {Object<string, string>} [attributeBlacklist=""] - Disallowed attributes. (e.g. {a: "href|target", img: "src|alt"}).
206
+ * @property {string} [__defaultFormatLine="P|DIV|H[1-6]|LI|TH|TD|DETAILS"] - Overrides the editor's default "line" element.
207
+ * @property {string} [formatLine="P|DIV|H[1-6]|LI|TH|TD|DETAILS"] - Specifies the editor's "line" elements.
208
+ * - (P, DIV, H[1-6], PRE, LI | class="__se__format__line_xxx")
209
+ * - "line" element also contain "brLine" element
210
+ * @property {string} [__defaultFormatBrLine="PRE"] - Overrides the editor's default "brLine" element.
211
+ * @property {string} [formatBrLine="PRE"] - Specifies the editor's "brLine" elements. (e.g. "PRE").
212
+ * - (PRE | class="__se__format__br_line_xxx")
213
+ * - "brLine" elements is included in the "line" element.
214
+ * - "brLine" elements's line break is "BR" tag.
215
+ * ※ Entering the Enter key in the space on the last line ends "brLine" and appends "line".
216
+ * @property {string} [__defaultFormatClosureBrLine=""] - Overrides the editor's default "closureBrLine" element.
217
+ * @property {string} [formatClosureBrLine=""] - Specifies the editor's "closureBrLine" elements.
218
+ * - (class="__se__format__br_line__closure_xxx")
219
+ * - "closureBrLine" elements is included in the "brLine".
220
+ * - "closureBrLine" elements's line break is "BR" tag.
221
+ * - ※ You cannot exit this format with the Enter key or Backspace key.
222
+ * - ※ Use it only in special cases. ([ex] format of table cells)
223
+ * @property {string} [__defaultFormatBlock="BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|CAPTION|DETAILS"] - Overrides the editor's default "block" element.
224
+ * @property {string} [formatBlock="BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|CAPTION|DETAILS"] - Specifies the editor's "block" elements.
225
+ * - (BLOCKQUOTE, OL, UL, FIGCAPTION, TABLE, THEAD, TBODY, TR, TH, TD | class="__se__format__block_xxx")
226
+ * - "block" is wrap the "line" and "component"
227
+ * @property {string} [__defaultFormatClosureBlock="TH|TD"] - Overrides the editor's default "closureBlock" element.
228
+ * @property {string} [formatClosureBlock="TH|TD"] - Specifies the editor's "closureBlock" elements.
229
+ * - (TH, TD | class="__se__format__block_closure_xxx")
230
+ * - "closureBlock" elements is included in the "block".
231
+ * - "closureBlock" element is wrap the "line" and "component"
232
+ * - ※ You cannot exit this format with the Enter key or Backspace key.
233
+ * - ※ Use it only in special cases. ([ex] format of table cells)
234
+ * @property {string} [allowedEmptyTags=".se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas, details"] - Allowed empty tags.
235
+ * @property {number|string} [toolbar_width="auto"] - Toolbar width.
236
+ * @property {Element|string} [toolbar_container] - Container element for the toolbar.
237
+ * @property {number} [toolbar_sticky=0] - Enables sticky toolbar with optional offset.
238
+ * @property {boolean} [toolbar_hide=false] - Hides toolbar initially.
239
+ * @property {Object} [subToolbar] - Sub-toolbar configuration.
240
+ * @property {Array<Array<string>>} [subToolbar.buttonList] - List of Sub-toolbar buttons, grouped by sub-arrays.
241
+ * @property {"balloon"|"balloon-always"} [subToolbar.mode="balloon"] - Sub-toolbar mode: "balloon", "balloon-always".
242
+ * @property {number|string} [subToolbar.width="auto"] - Sub-toolbar width.
243
+ * @property {Element|string} [statusbar_container] - Container element for the status bar.
244
+ * @property {boolean} [shortcutsHint=true] - Displays shortcut hints in tooltips.
245
+ * @property {boolean} [shortcutsDisable=false] - Disables keyboard shortcuts.
246
+ * @property {Object<string, Array<string>>} [shortcuts] - Custom keyboard shortcuts.
247
+ * @property {number} [fullScreenOffset=0] - Offset applied when entering fullscreen mode.
248
+ * @property {string} [previewTemplate] - Custom template for preview mode.
249
+ * @property {string} [printTemplate] - Custom template for print mode.
250
+ * @property {boolean} [componentAutoSelect=false] - Enables automatic selection of inserted components.
251
+ * @property {string} [defaultUrlProtocol] - Default URL protocol for links.
252
+ * @property {string} [allUsedStyles] - Specifies additional styles to the list of allowed styles. Delimiter: "|" (e.g. "color|background-color").
253
+ * @property {Object<"copy", number>} [toastMessageTime] - {"copy": 1500} - Duration for displaying toast messages.
254
+ * @property {Object<string, string>} [icons] - Overrides the default icons.
255
+ * @property {string} [freeCodeViewMode=false] - Enables free code view mode.
256
+ * @property {boolean} [__lineFormatFilter=true] - Line format filter configuration.
257
+ * @property {boolean} [__pluginRetainFilter=true] - Plugin retain filter configuration.
258
+ * @property {Array<string>} [__listCommonStyle=["fontSize", "color", "fontFamily", "fontWeight", "fontStyle"]] - Defines the list of styles that are applied directly to the `<li>` element
259
+ * - when a text style is applied to the entire list item.
260
+ * - For example, when changing the font size or color of a list item (`<li>`),
261
+ * - these styles will be applied to the `<li>` tag instead of wrapping the content inside additional tags.
262
+ * @property {Object<string, *>} [externalLibs] - External libraries like CodeMirror or MathJax.
263
+ *
264
+ * @property {Object<string, *>} [Dynamic_pluginOptions] - Dynamic plugin options, where the key is the plugin name and the value is its configuration.
265
+ */
266
+ /**
267
+ * @typedef {EditorBaseOptions & EditorFrameOptions} EditorInitOptions
268
+ */
269
+ /**
270
+ * @description For all EditorInitOptions keys, only boolean | null values are allowed.
271
+ * - 'fixed' → Immutable / null → Resettable.
272
+ * @type {Partial<Record<keyof EditorInitOptions, "fixed" | true>>}
273
+ */
274
+ export const OPTION_FIXED_FLAG: Partial<Record<keyof EditorInitOptions, 'fixed' | true>>;
121
275
  export default Constructor;
122
276
  export type EditorFrameOptions = {
123
277
  /**
@@ -402,6 +556,10 @@ export type EditorBaseOptions = {
402
556
  * - ● When set to "br", performance may decrease when editing a lot of data.
403
557
  */
404
558
  defaultLineBreakFormat?: 'line' | 'br';
559
+ /**
560
+ * - Tags treated as whole units when selecting all content.
561
+ */
562
+ scopeSelectionTags?: Array<string>;
405
563
  /**
406
564
  * - Default allowed HTML elements. The default values are maintained.
407
565
  */
@@ -596,158 +754,11 @@ export type EditorBaseOptions = {
596
754
  /**
597
755
  * - Dynamic plugin options, where the key is the plugin name and the value is its configuration.
598
756
  */
599
- PluginOptions?: {
757
+ Dynamic_pluginOptions?: {
600
758
  [x: string]: any;
601
759
  };
602
760
  };
603
761
  export type EditorInitOptions = EditorBaseOptions & EditorFrameOptions;
604
- /**
605
- * @typedef {Object} EditorFrameOptions
606
- * @property {string} [value=""] - Initial value for the editor.
607
- * @property {string} [placeholder=""] - Placeholder text.
608
- * @property {Object<string, string>} [editableFrameAttributes={}] - Attributes for the editable frame[.sun-editor-editable]. (e.g. [key]: value)
609
- * @property {string} [width="100%"] - Width for the editor.
610
- * @property {string} [minWidth=""] - Min width for the editor.
611
- * @property {string} [maxWidth=""] - Max width for the editor.
612
- * @property {string} [height="auto"] - Height for the editor.
613
- * @property {string} [minHeight=""] - Min height for the editor.
614
- * @property {string} [maxHeight=""] - Max height for the editor.
615
- * @property {string} [editorStyle=""] - Style string of the top frame of the editor. (e.g. "border: 1px solid #ccc;").
616
- * @property {boolean} [iframe=false] - Content will be placed in an iframe and isolated from the rest of the page.
617
- * @property {boolean} [iframe_fullPage=false] - Allows the usage of HTML, HEAD, BODY tags and DOCTYPE declaration on the "iframe".
618
- * @property {Object<string, string>} [iframe_attributes={}] - Attributes of the "iframe". (e.g. {'scrolling': 'no'})
619
- * @property {string} [iframe_cssFileName="suneditor"] - Name or Array of the CSS file to apply inside the iframe.
620
- * - You can also use regular expressions.
621
- * - Applied by searching by filename in the link tag of document,
622
- * - or put the URL value (".css" can be omitted).
623
- * @property {boolean} [statusbar=true] - Enables the status bar.
624
- * @property {boolean} [statusbar_showPathLabel=true] - Displays the current node structure to status bar.
625
- * @property {boolean} [statusbar_resizeEnable=true] - Enables resize function of bottom status bar
626
- * @property {boolean} [charCounter=false] - Shows the number of characters in the editor.
627
- * - If the maxCharCount option has a value, it becomes true.
628
- * @property {number} [charCounter_max] - The maximum number of characters allowed to be inserted into the editor.
629
- * @property {string} [charCounter_label] - Text to be displayed in the "charCounter" area of the bottom bar. (e.g. "Characters : 20/200")
630
- * @property {"char"|"byte"|"byte-html"} [charCounter_type="char"] - Defines the calculation method of the "charCounter" option.
631
- * - 'char': Characters length.
632
- * - 'byte': Binary data size of characters.
633
- * - 'byte-html': Binary data size of the full HTML string.
634
- */
635
- /**
636
- * @typedef {Object} EditorBaseOptions
637
- * @property {Object<string, *>|Array<Object<string, *>>} [plugins] - Plugin configuration.
638
- * @property {Array<string>} [excludedPlugins] - Plugin configuration.
639
- * @property {Array<string[]|string>} [buttonList] - List of toolbar buttons, grouped by sub-arrays.
640
- * @property {boolean} [v2Migration=false] - Enables migration mode for SunEditor v2.
641
- * @property {boolean|{tagFilter: boolean, formatFilter: boolean, classFilter: boolean, styleNodeFilter: boolean, attrFilter: boolean, styleFilter: boolean}} [strictMode=true] - Enables strict filtering of tags, attributes, and styles.
642
- * @property {"classic"|"inline"|"balloon"|"balloon-always"} [mode="classic"] - Toolbar mode: "classic", "inline", "balloon", "balloon-always".
643
- * @property {string} [type=""] - Editor type: "document:header,page".
644
- * @property {string} [theme=""] - Editor theme.
645
- * @property {Object<string, string>} [lang] - Language configuration.
646
- * @property {Array<string>} [fontSizeUnits=["px", "pt", "em", "rem"]] - Allowed font size units.
647
- * @property {string} [allowedClassName] - Allowed class names.
648
- * @property {boolean} [closeModalOutsideClick=false] - Closes modals when clicking outside.
649
- * @property {boolean} [copyFormatKeepOn=false] - Keeps the format of the copied content.
650
- * @property {boolean} [syncTabIndent=true] - Synchronizes tab indent with spaces.
651
- * @property {boolean} [tabDisable=false] - Disables tab key input.
652
- * @property {boolean} [autoLinkify] - Automatically converts URLs into hyperlinks. ("Link" plugin required)
653
- * @property {Array<string>} [autoStyleify=["bold", "underline", "italic", "strike"]] - Styles applied automatically on text input.
654
- * @property {Object<string, string|number>} [scrollToOptions={behavior: "auto", block: "nearest"}] - Configuration for scroll behavior when navigating editor content.
655
- * @property {Object<string, string|number>} [componentScrollToOptions={behavior: "smooth", block: "center"}] - Configuration for scroll behavior when navigating components.
656
- * @property {"repeat"|"always"|"none"} [retainStyleMode="repeat"] - This option determines how inline elements (such as <span>, <strong>, etc.) are handled when deleting text.
657
- * - "repeat": Inline styles are retained unless the backspace key is repeatedly pressed. If the user continuously presses backspace, the styles will eventually be removed.
658
- * - "none": Inline styles are not retained at all. When deleting text, the associated inline elements are immediately removed along with it.
659
- * - "always": Inline styles persist indefinitely unless explicitly removed. Even if all text inside an inline element is deleted, the element itself remains until manually removed.
660
- * @property {Object<string, boolean>} [allowedExtraTags={script: false, style: false, meta: false, link: false, "[a-z]+:[a-z]+": false}] - Specifies extra allowed or disallowed tags.
661
- * @property {Object<string, (...args: *) => *>} [events={}] - Custom event handlers.
662
- * @property {string} [__textStyleTags="strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary"] - The basic tags that serves as the base for "textStyleTags"
663
- * @property {string} [textStyleTags="strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary"] - Additional text style tags.
664
- * @property {Object<string, string>} [convertTextTags={bold: "strong", underline: "u", italic: "em", strike: "del", subscript: "sub", superscript: "sup"}] - Maps text styles to specific HTML tags.
665
- * @property {Object<string, string>} [__tagStyles={'table|th|td': 'border|border-[a-z]+|background-color|text-align|float|font-weight|text-decoration|font-style', 'ol|ul': 'list-style-type'}] - The basic tags that serves as the base for "tagStyles"
666
- * @property {Object<string, string>} [tagStyles={}] - Specifies allowed styles for HTML tags.
667
- * @property {string} [spanStyles="font-family|font-size|color|background-color"] - Specifies allowed styles for the "span" tag.
668
- * @property {string} [lineStyles="text-align|margin-left|margin-right|line-height"] - Specifies allowed styles for the "line" element (p..).
669
- * @property {string} [textDirection="ltr"] - Text direction: "ltr" or "rtl".
670
- * @property {Array<string>} [reverseButtons=['indent-outdent']] - An array of command pairs whose shortcut icons should be opposite each other, depending on the "textDirection" mode.
671
- * @property {number} [historyStackDelayTime=400] - Delay time for history stack updates (ms).
672
- * @property {string} [lineAttrReset=""] - Line properties that should be reset when changing lines (e.g. "id|name").
673
- * @property {string} [printClass=""] - Class name for printing.
674
- * @property {string} [defaultLine="p"] - Default line element when inserting new lines.
675
- * @property {"line"|"br"} [defaultLineBreakFormat="line"] - Specifies the default line break format.
676
- * - [Recommended] "line" : is a line break that is divided into general tags.
677
- * - [Not recommended] "br" : Line breaks are treated as <br> on the same line. (like shift+enter)
678
- * - Line breaks are handled as <br> within "line".
679
- * - You can create a new "line" by entering a line break twice in a row.
680
- * - Formats that include "line", such as "Quote", still operate on a "line" basis.
681
- * - ● suneditor processes work in "line" units.
682
- * - ● When set to "br", performance may decrease when editing a lot of data.
683
- * @property {string} [__defaultElementWhitelist="br|div"] - Default allowed HTML elements. The default values are maintained.
684
- * @property {string} [elementWhitelist=""] - Allowed HTML elements. Delimiter: "|" (e.g. "p|div", "*").
685
- * @property {string} [elementBlacklist=""] - Disallowed HTML elements. Delimiter: "|" (e.g. "script|style").
686
- * @property {string} [__defaultAttributeWhitelist] - Allowed attributes. Delimiter: "|" (e.g. "href|target").
687
- * @property {Object<string, string>} [attributeWhitelist=""] - Allowed attributes. (e.g. {a: "href|target", img: "src|alt"}).
688
- * @property {Object<string, string>} [attributeBlacklist=""] - Disallowed attributes. (e.g. {a: "href|target", img: "src|alt"}).
689
- * @property {string} [__defaultFormatLine="P|DIV|H[1-6]|LI|TH|TD|DETAILS"] - Overrides the editor's default "line" element.
690
- * @property {string} [formatLine="P|DIV|H[1-6]|LI|TH|TD|DETAILS"] - Specifies the editor's "line" elements.
691
- * - (P, DIV, H[1-6], PRE, LI | class="__se__format__line_xxx")
692
- * - "line" element also contain "brLine" element
693
- * @property {string} [__defaultFormatBrLine="PRE"] - Overrides the editor's default "brLine" element.
694
- * @property {string} [formatBrLine="PRE"] - Specifies the editor's "brLine" elements. (e.g. "PRE").
695
- * - (PRE | class="__se__format__br_line_xxx")
696
- * - "brLine" elements is included in the "line" element.
697
- * - "brLine" elements's line break is "BR" tag.
698
- * ※ Entering the Enter key in the space on the last line ends "brLine" and appends "line".
699
- * @property {string} [__defaultFormatClosureBrLine=""] - Overrides the editor's default "closureBrLine" element.
700
- * @property {string} [formatClosureBrLine=""] - Specifies the editor's "closureBrLine" elements.
701
- * - (class="__se__format__br_line__closure_xxx")
702
- * - "closureBrLine" elements is included in the "brLine".
703
- * - "closureBrLine" elements's line break is "BR" tag.
704
- * - ※ You cannot exit this format with the Enter key or Backspace key.
705
- * - ※ Use it only in special cases. ([ex] format of table cells)
706
- * @property {string} [__defaultFormatBlock="BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|CAPTION|DETAILS"] - Overrides the editor's default "block" element.
707
- * @property {string} [formatBlock="BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|CAPTION|DETAILS"] - Specifies the editor's "block" elements.
708
- * - (BLOCKQUOTE, OL, UL, FIGCAPTION, TABLE, THEAD, TBODY, TR, TH, TD | class="__se__format__block_xxx")
709
- * - "block" is wrap the "line" and "component"
710
- * @property {string} [__defaultFormatClosureBlock="TH|TD"] - Overrides the editor's default "closureBlock" element.
711
- * @property {string} [formatClosureBlock="TH|TD"] - Specifies the editor's "closureBlock" elements.
712
- * - (TH, TD | class="__se__format__block_closure_xxx")
713
- * - "closureBlock" elements is included in the "block".
714
- * - "closureBlock" element is wrap the "line" and "component"
715
- * - ※ You cannot exit this format with the Enter key or Backspace key.
716
- * - ※ Use it only in special cases. ([ex] format of table cells)
717
- * @property {string} [allowedEmptyTags=".se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas, details"] - Allowed empty tags.
718
- * @property {number|string} [toolbar_width="auto"] - Toolbar width.
719
- * @property {Element|string} [toolbar_container] - Container element for the toolbar.
720
- * @property {number} [toolbar_sticky=0] - Enables sticky toolbar with optional offset.
721
- * @property {boolean} [toolbar_hide=false] - Hides toolbar initially.
722
- * @property {Object} [subToolbar] - Sub-toolbar configuration.
723
- * @property {Array<Array<string>>} [subToolbar.buttonList] - List of Sub-toolbar buttons, grouped by sub-arrays.
724
- * @property {"balloon"|"balloon-always"} [subToolbar.mode="balloon"] - Sub-toolbar mode: "balloon", "balloon-always".
725
- * @property {number|string} [subToolbar.width="auto"] - Sub-toolbar width.
726
- * @property {Element|string} [statusbar_container] - Container element for the status bar.
727
- * @property {boolean} [shortcutsHint=true] - Displays shortcut hints in tooltips.
728
- * @property {boolean} [shortcutsDisable=false] - Disables keyboard shortcuts.
729
- * @property {Object<string, Array<string>>} [shortcuts] - Custom keyboard shortcuts.
730
- * @property {number} [fullScreenOffset=0] - Offset applied when entering fullscreen mode.
731
- * @property {string} [previewTemplate] - Custom template for preview mode.
732
- * @property {string} [printTemplate] - Custom template for print mode.
733
- * @property {boolean} [componentAutoSelect=false] - Enables automatic selection of inserted components.
734
- * @property {string} [defaultUrlProtocol] - Default URL protocol for links.
735
- * @property {string} [allUsedStyles] - Specifies additional styles to the list of allowed styles. Delimiter: "|" (e.g. "color|background-color").
736
- * @property {Object<"copy", number>} [toastMessageTime] - {"copy": 1500} - Duration for displaying toast messages.
737
- * @property {Object<string, string>} [icons] - Overrides the default icons.
738
- * @property {string} [freeCodeViewMode=false] - Enables free code view mode.
739
- * @property {boolean} [__lineFormatFilter=true] - Line format filter configuration.
740
- * @property {boolean} [__pluginRetainFilter=true] - Plugin retain filter configuration.
741
- * @property {Array<string>} [__listCommonStyle=["fontSize", "color", "fontFamily", "fontWeight", "fontStyle"]] - Defines the list of styles that are applied directly to the `<li>` element
742
- * - when a text style is applied to the entire list item.
743
- * - For example, when changing the font size or color of a list item (`<li>`),
744
- * - these styles will be applied to the `<li>` tag instead of wrapping the content inside additional tags.
745
- * @property {Object<string, *>} [externalLibs] - External libraries like CodeMirror or MathJax.
746
- * @property {Object<string, *>} [PluginOptions] - Dynamic plugin options, where the key is the plugin name and the value is its configuration.
747
- */
748
- /**
749
- * @typedef {EditorBaseOptions & EditorFrameOptions} EditorInitOptions
750
- */
751
762
  /**
752
763
  * @description Creates a new SunEditor instance with specified options.
753
764
  * @param {Array<{target: Element, key: *, options: EditorFrameOptions}>} editorTargets - Target element or multi-root object.
package/types/events.d.ts CHANGED
@@ -48,6 +48,7 @@ declare namespace _default {
48
48
  let onExportPDFBefore: any;
49
49
  let onFileManagerAction: any;
50
50
  let onEmbedInputBefore: any;
51
+ let onEmbedDeleteBefore: any;
51
52
  }
52
53
  export default _default;
53
54
  export type ControllerInstance = import('./modules/Controller').default;
@@ -102,6 +102,12 @@ export function isIFrame(node: (Node | string) | null): node is HTMLIFrameElemen
102
102
  * @returns {boolean}
103
103
  */
104
104
  export function isFigure(node: (Node | string) | null): boolean;
105
+ /**
106
+ * @description Checks whether the given node is a content-less (void) HTML tag
107
+ * @param {?Node|string} node The element or element name to check
108
+ * @returns {boolean}
109
+ */
110
+ export function isContentLess(node: (Node | string) | null): boolean;
105
111
  /**
106
112
  * @description Check the line element is empty.
107
113
  * @param {Node} node "line" element node
@@ -171,6 +177,7 @@ declare namespace check {
171
177
  export { isMedia };
172
178
  export { isIFrame };
173
179
  export { isFigure };
180
+ export { isContentLess };
174
181
  export { isEmptyLine };
175
182
  export { isWysiwygFrame };
176
183
  export { isNonEditable };
@@ -95,6 +95,7 @@ export const dom: {
95
95
  isMedia: typeof import('./dom/domCheck').isMedia;
96
96
  isIFrame: typeof import('./dom/domCheck').isIFrame;
97
97
  isFigure: typeof import('./dom/domCheck').isFigure;
98
+ isContentLess: typeof import('./dom/domCheck').isContentLess;
98
99
  isEmptyLine: typeof import('./dom/domCheck').isEmptyLine;
99
100
  isWysiwygFrame: typeof import('./dom/domCheck').isWysiwygFrame;
100
101
  isNonEditable: typeof import('./dom/domCheck').isNonEditable;
package/types/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  export * from './events';
6
6
  export * from './index';
7
7
  export * from './suneditor';
8
- export * from './assets/icons/_default';
8
+ export * from './assets/icons/defaultIcons';
9
9
  export * from './core/editor';
10
10
  export * from './core/base/eventManager';
11
11
  export * from './core/base/history';
@@ -138,6 +138,7 @@ declare class Table extends EditorInjector {
138
138
  _fixedColumn: boolean;
139
139
  _physical_cellCnt: number;
140
140
  _logical_cellCnt: number;
141
+ _cellCnt: number;
141
142
  _rowCnt: number;
142
143
  _rowIndex: number;
143
144
  _physical_cellIndex: number;
package/.eslintignore DELETED
@@ -1,7 +0,0 @@
1
- node_modules
2
- dist
3
- sample
4
- test
5
- karma.conf.js
6
- webpack/**/*
7
- **/*.css
package/.eslintrc.json DELETED
@@ -1,81 +0,0 @@
1
- {
2
- "plugins": ["prettier", "@typescript-eslint", "compat"],
3
- "extends": ["eslint:recommended", "plugin:prettier/recommended", "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended"],
4
- "parser": "@typescript-eslint/parser",
5
- "parserOptions": {
6
- "ecmaVersion": 2020,
7
- "sourceType": "module"
8
- },
9
- "env": {
10
- "browser": true,
11
- "node": true,
12
- "es2022": true
13
- },
14
- "globals": {
15
- "ActiveXObject": "writable",
16
- "Selection": "writable",
17
- "Node": "writable",
18
- "Range": "writable"
19
- },
20
- "rules": {
21
- "compat/compat": "error",
22
- "eqeqeq": "error",
23
- "strict": ["error", "safe"],
24
- "no-undef": "off",
25
- "no-loop-func": "off",
26
- "no-shadow": "error",
27
- "no-unused-expressions": "off",
28
- "curly": "off",
29
- "prefer-const": "error",
30
- "no-var": "error",
31
- "no-console": ["warn", { "allow": ["warn", "error"] }],
32
- "no-unused-vars": [
33
- "warn",
34
- {
35
- "argsIgnorePattern": "^_",
36
- "varsIgnorePattern": "^_"
37
- }
38
- ],
39
- "@typescript-eslint/no-explicit-any": "off",
40
- "@typescript-eslint/no-var-requires": "off",
41
- "@typescript-eslint/no-unused-expressions": "off",
42
- "@typescript-eslint/no-unused-vars": [
43
- "warn",
44
- {
45
- "argsIgnorePattern": "^_",
46
- "varsIgnorePattern": "^_"
47
- }
48
- ],
49
- "prettier/prettier": [
50
- "error",
51
- {
52
- "arrowParens": "always",
53
- "bracketSpacing": true,
54
- "endOfLine": "auto",
55
- "htmlWhitespaceSensitivity": "css",
56
- "insertPragma": false,
57
- "jsxBracketSameLine": false,
58
- "jsxSingleQuote": true,
59
- "printWidth": 240,
60
- "proseWrap": "preserve",
61
- "quoteProps": "as-needed",
62
- "requirePragma": false,
63
- "semi": true,
64
- "singleQuote": true,
65
- "tabWidth": 4,
66
- "trailingComma": "none",
67
- "useTabs": true,
68
- "vueIndentScriptAndStyle": false
69
- }
70
- ]
71
- },
72
- "overrides": [
73
- {
74
- "files": ["*.d.ts"],
75
- "rules": {
76
- "no-unused-vars": "off",
77
- "@typescript-eslint/no-unused-vars": "off"
78
- }
79
- }
80
- ]
81
- }