suneditor 3.0.0-beta.3 → 3.0.0-beta.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/CONTRIBUTING.md +8 -8
  2. package/README.md +44 -49
  3. package/dist/suneditor.min.css +1 -1
  4. package/dist/suneditor.min.js +1 -1
  5. package/package.json +95 -53
  6. package/src/assets/design/color.css +2 -2
  7. package/src/assets/design/size.css +2 -0
  8. package/src/assets/icons/defaultIcons.js +16 -1
  9. package/src/assets/suneditor-contents.css +9 -8
  10. package/src/assets/suneditor.css +29 -26
  11. package/src/core/{section → base}/actives.js +20 -12
  12. package/src/core/base/history.js +4 -4
  13. package/src/core/class/char.js +10 -10
  14. package/src/core/class/component.js +146 -57
  15. package/src/core/class/format.js +94 -2458
  16. package/src/core/class/html.js +187 -129
  17. package/src/core/class/inline.js +1853 -0
  18. package/src/core/class/listFormat.js +582 -0
  19. package/src/core/class/menu.js +14 -3
  20. package/src/core/class/nodeTransform.js +9 -14
  21. package/src/core/class/offset.js +162 -197
  22. package/src/core/class/selection.js +137 -34
  23. package/src/core/class/toolbar.js +73 -52
  24. package/src/core/class/ui.js +11 -11
  25. package/src/core/class/viewer.js +56 -55
  26. package/src/core/config/context.js +122 -0
  27. package/src/core/config/frameContext.js +204 -0
  28. package/src/core/config/options.js +639 -0
  29. package/src/core/editor.js +181 -108
  30. package/src/core/event/actions/index.js +229 -0
  31. package/src/core/event/effects/common.registry.js +60 -0
  32. package/src/core/event/effects/keydown.registry.js +551 -0
  33. package/src/core/event/effects/ruleHelpers.js +145 -0
  34. package/src/core/{base → event}/eventManager.js +119 -201
  35. package/src/core/event/executor.js +21 -0
  36. package/src/core/{base/eventHandlers → event/handlers}/handler_toolbar.js +4 -4
  37. package/src/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.js +2 -2
  38. package/src/core/event/handlers/handler_ww_input.js +77 -0
  39. package/src/core/event/handlers/handler_ww_key.js +228 -0
  40. package/src/core/{base/eventHandlers → event/handlers}/handler_ww_mouse.js +3 -3
  41. package/src/core/event/ports.js +211 -0
  42. package/src/core/event/reducers/keydown.reducer.js +89 -0
  43. package/src/core/event/rules/keydown.rule.arrow.js +54 -0
  44. package/src/core/event/rules/keydown.rule.backspace.js +202 -0
  45. package/src/core/event/rules/keydown.rule.delete.js +126 -0
  46. package/src/core/event/rules/keydown.rule.enter.js +144 -0
  47. package/src/core/event/rules/keydown.rule.tab.js +29 -0
  48. package/src/core/section/constructor.js +79 -388
  49. package/src/core/section/documentType.js +47 -26
  50. package/src/core/util/instanceCheck.js +59 -0
  51. package/src/editorInjector/_classes.js +4 -0
  52. package/src/editorInjector/_core.js +17 -7
  53. package/src/editorInjector/index.js +10 -2
  54. package/src/events.js +6 -0
  55. package/src/helper/clipboard.js +24 -10
  56. package/src/helper/converter.js +17 -12
  57. package/src/helper/dom/domCheck.js +22 -3
  58. package/src/helper/dom/domQuery.js +91 -45
  59. package/src/helper/dom/domUtils.js +93 -19
  60. package/src/helper/dom/index.js +4 -0
  61. package/src/helper/env.js +11 -7
  62. package/src/helper/keyCodeMap.js +4 -3
  63. package/src/langs/ckb.js +1 -1
  64. package/src/langs/cs.js +1 -1
  65. package/src/langs/da.js +1 -1
  66. package/src/langs/de.js +1 -1
  67. package/src/langs/en.js +1 -1
  68. package/src/langs/es.js +1 -1
  69. package/src/langs/fa.js +1 -1
  70. package/src/langs/fr.js +1 -1
  71. package/src/langs/he.js +1 -1
  72. package/src/langs/hu.js +1 -1
  73. package/src/langs/it.js +1 -1
  74. package/src/langs/ja.js +1 -1
  75. package/src/langs/km.js +1 -1
  76. package/src/langs/ko.js +1 -1
  77. package/src/langs/lv.js +1 -1
  78. package/src/langs/nl.js +1 -1
  79. package/src/langs/pl.js +1 -1
  80. package/src/langs/pt_br.js +10 -10
  81. package/src/langs/ro.js +1 -1
  82. package/src/langs/ru.js +1 -1
  83. package/src/langs/se.js +1 -1
  84. package/src/langs/tr.js +1 -1
  85. package/src/langs/uk.js +1 -1
  86. package/src/langs/ur.js +1 -1
  87. package/src/langs/zh_cn.js +1 -1
  88. package/src/modules/ApiManager.js +25 -18
  89. package/src/modules/Browser.js +52 -61
  90. package/src/modules/ColorPicker.js +37 -38
  91. package/src/modules/Controller.js +85 -79
  92. package/src/modules/Figure.js +275 -187
  93. package/src/modules/FileManager.js +86 -92
  94. package/src/modules/HueSlider.js +67 -35
  95. package/src/modules/Modal.js +84 -77
  96. package/src/modules/ModalAnchorEditor.js +62 -79
  97. package/src/modules/SelectMenu.js +89 -86
  98. package/src/plugins/browser/audioGallery.js +9 -5
  99. package/src/plugins/browser/fileBrowser.js +10 -6
  100. package/src/plugins/browser/fileGallery.js +9 -5
  101. package/src/plugins/browser/imageGallery.js +9 -5
  102. package/src/plugins/browser/videoGallery.js +11 -6
  103. package/src/plugins/command/blockquote.js +1 -0
  104. package/src/plugins/command/exportPDF.js +11 -8
  105. package/src/plugins/command/fileUpload.js +41 -29
  106. package/src/plugins/command/list_bulleted.js +2 -1
  107. package/src/plugins/command/list_numbered.js +2 -1
  108. package/src/plugins/dropdown/align.js +8 -2
  109. package/src/plugins/dropdown/backgroundColor.js +19 -11
  110. package/src/plugins/dropdown/font.js +15 -9
  111. package/src/plugins/dropdown/fontColor.js +19 -11
  112. package/src/plugins/dropdown/formatBlock.js +7 -2
  113. package/src/plugins/dropdown/hr.js +7 -3
  114. package/src/plugins/dropdown/layout.js +6 -2
  115. package/src/plugins/dropdown/lineHeight.js +8 -3
  116. package/src/plugins/dropdown/list.js +2 -1
  117. package/src/plugins/dropdown/paragraphStyle.js +15 -11
  118. package/src/plugins/dropdown/{table.js → table/index.js} +514 -362
  119. package/src/plugins/dropdown/template.js +6 -2
  120. package/src/plugins/dropdown/textStyle.js +7 -3
  121. package/src/plugins/field/mention.js +33 -27
  122. package/src/plugins/input/fontSize.js +44 -37
  123. package/src/plugins/input/pageNavigator.js +3 -2
  124. package/src/plugins/modal/audio.js +90 -85
  125. package/src/plugins/modal/drawing.js +58 -66
  126. package/src/plugins/modal/embed.js +193 -180
  127. package/src/plugins/modal/image.js +441 -439
  128. package/src/plugins/modal/link.js +31 -8
  129. package/src/plugins/modal/math.js +23 -22
  130. package/src/plugins/modal/video.js +233 -230
  131. package/src/plugins/popup/anchor.js +24 -18
  132. package/src/suneditor.js +69 -24
  133. package/src/typedef.js +42 -19
  134. package/types/assets/icons/defaultIcons.d.ts +8 -0
  135. package/types/core/class/char.d.ts +1 -1
  136. package/types/core/class/component.d.ts +29 -7
  137. package/types/core/class/format.d.ts +4 -354
  138. package/types/core/class/html.d.ts +13 -4
  139. package/types/core/class/inline.d.ts +263 -0
  140. package/types/core/class/listFormat.d.ts +135 -0
  141. package/types/core/class/menu.d.ts +10 -2
  142. package/types/core/class/offset.d.ts +24 -26
  143. package/types/core/class/selection.d.ts +2 -0
  144. package/types/core/class/toolbar.d.ts +24 -11
  145. package/types/core/class/ui.d.ts +1 -1
  146. package/types/core/class/viewer.d.ts +1 -1
  147. package/types/core/config/context.d.ts +157 -0
  148. package/types/core/config/frameContext.d.ts +367 -0
  149. package/types/core/config/options.d.ts +1119 -0
  150. package/types/core/editor.d.ts +101 -66
  151. package/types/core/event/actions/index.d.ts +47 -0
  152. package/types/core/event/effects/common.registry.d.ts +50 -0
  153. package/types/core/event/effects/keydown.registry.d.ts +73 -0
  154. package/types/core/event/effects/ruleHelpers.d.ts +31 -0
  155. package/types/core/{base → event}/eventManager.d.ts +15 -46
  156. package/types/core/event/executor.d.ts +6 -0
  157. package/types/core/event/handlers/handler_ww_input.d.ts +41 -0
  158. package/types/core/{base/eventHandlers/handler_ww_key_input.d.ts → event/handlers/handler_ww_key.d.ts} +4 -6
  159. package/types/core/event/ports.d.ts +255 -0
  160. package/types/core/event/reducers/keydown.reducer.d.ts +75 -0
  161. package/types/core/event/rules/keydown.rule.arrow.d.ts +8 -0
  162. package/types/core/event/rules/keydown.rule.backspace.d.ts +9 -0
  163. package/types/core/event/rules/keydown.rule.delete.d.ts +9 -0
  164. package/types/core/event/rules/keydown.rule.enter.d.ts +9 -0
  165. package/types/core/event/rules/keydown.rule.tab.d.ts +9 -0
  166. package/types/core/section/constructor.d.ts +101 -631
  167. package/types/core/section/documentType.d.ts +14 -4
  168. package/types/core/util/instanceCheck.d.ts +50 -0
  169. package/types/editorInjector/_classes.d.ts +4 -0
  170. package/types/editorInjector/_core.d.ts +17 -7
  171. package/types/editorInjector/index.d.ts +10 -2
  172. package/types/events.d.ts +1 -0
  173. package/types/helper/clipboard.d.ts +2 -2
  174. package/types/helper/converter.d.ts +6 -9
  175. package/types/helper/dom/domCheck.d.ts +7 -0
  176. package/types/helper/dom/domQuery.d.ts +19 -8
  177. package/types/helper/dom/domUtils.d.ts +24 -2
  178. package/types/helper/dom/index.d.ts +86 -1
  179. package/types/helper/env.d.ts +6 -1
  180. package/types/helper/index.d.ts +7 -1
  181. package/types/helper/keyCodeMap.d.ts +3 -3
  182. package/types/index.d.ts +23 -117
  183. package/types/langs/index.d.ts +2 -2
  184. package/types/modules/ApiManager.d.ts +1 -8
  185. package/types/modules/Browser.d.ts +4 -62
  186. package/types/modules/ColorPicker.d.ts +4 -21
  187. package/types/modules/Controller.d.ts +8 -64
  188. package/types/modules/Figure.d.ts +54 -50
  189. package/types/modules/FileManager.d.ts +1 -13
  190. package/types/modules/HueSlider.d.ts +13 -3
  191. package/types/modules/Modal.d.ts +0 -43
  192. package/types/modules/ModalAnchorEditor.d.ts +0 -73
  193. package/types/modules/SelectMenu.d.ts +0 -85
  194. package/types/modules/index.d.ts +3 -3
  195. package/types/plugins/browser/audioGallery.d.ts +29 -18
  196. package/types/plugins/browser/fileBrowser.d.ts +38 -27
  197. package/types/plugins/browser/fileGallery.d.ts +29 -18
  198. package/types/plugins/browser/imageGallery.d.ts +24 -16
  199. package/types/plugins/browser/videoGallery.d.ts +29 -18
  200. package/types/plugins/command/blockquote.d.ts +1 -0
  201. package/types/plugins/command/exportPDF.d.ts +18 -18
  202. package/types/plugins/command/fileUpload.d.ts +65 -45
  203. package/types/plugins/command/list_bulleted.d.ts +1 -0
  204. package/types/plugins/command/list_numbered.d.ts +1 -0
  205. package/types/plugins/dropdown/align.d.ts +13 -8
  206. package/types/plugins/dropdown/backgroundColor.d.ts +30 -19
  207. package/types/plugins/dropdown/font.d.ts +13 -12
  208. package/types/plugins/dropdown/fontColor.d.ts +30 -19
  209. package/types/plugins/dropdown/formatBlock.d.ts +13 -8
  210. package/types/plugins/dropdown/hr.d.ts +15 -11
  211. package/types/plugins/dropdown/layout.d.ts +15 -11
  212. package/types/plugins/dropdown/lineHeight.d.ts +16 -11
  213. package/types/plugins/dropdown/list.d.ts +1 -0
  214. package/types/plugins/dropdown/paragraphStyle.d.ts +31 -27
  215. package/types/plugins/dropdown/table/index.d.ts +582 -0
  216. package/types/plugins/dropdown/table.d.ts +41 -86
  217. package/types/plugins/dropdown/template.d.ts +15 -11
  218. package/types/plugins/dropdown/textStyle.d.ts +19 -11
  219. package/types/plugins/field/mention.d.ts +58 -56
  220. package/types/plugins/index.d.ts +38 -38
  221. package/types/plugins/input/fontSize.d.ts +46 -50
  222. package/types/plugins/modal/audio.d.ts +26 -56
  223. package/types/plugins/modal/drawing.d.ts +0 -85
  224. package/types/plugins/modal/embed.d.ts +15 -79
  225. package/types/plugins/modal/image.d.ts +24 -136
  226. package/types/plugins/modal/link.d.ts +34 -15
  227. package/types/plugins/modal/math.d.ts +0 -16
  228. package/types/plugins/modal/video.d.ts +17 -86
  229. package/types/plugins/popup/anchor.d.ts +1 -8
  230. package/types/suneditor.d.ts +70 -19
  231. package/types/typedef.d.ts +60 -46
  232. package/src/core/base/eventHandlers/handler_ww_key_input.js +0 -1200
  233. package/src/core/section/context.js +0 -102
  234. package/types/core/section/context.d.ts +0 -45
  235. package/types/langs/_Lang.d.ts +0 -194
  236. /package/src/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.js +0 -0
  237. /package/types/core/{section → base}/actives.d.ts +0 -0
  238. /package/types/core/{base/eventHandlers → event/handlers}/handler_toolbar.d.ts +0 -0
  239. /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.d.ts +0 -0
  240. /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.d.ts +0 -0
  241. /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_mouse.d.ts +0 -0
@@ -1,347 +1,39 @@
1
1
  import _icons from '../../assets/icons/defaultIcons';
2
2
  import _defaultLang from '../../langs/en';
3
- import { CreateContext, CreateFrameContext } from './context';
3
+ import { CreateContext } from '../config/context';
4
+ import { CreateFrameContext } from '../config/frameContext';
4
5
  import { dom, numbers, converter, env } from '../../helper';
6
+ import { DEFAULTS } from '../config/options';
5
7
 
6
8
  const _d = env._d;
7
- const DEFAULT_BUTTON_LIST = [
8
- ['undo', 'redo'],
9
- '|',
10
- ['bold', 'underline', 'italic', 'strike', '|', 'subscript', 'superscript'],
11
- '|',
12
- ['removeFormat'],
13
- '|',
14
- ['outdent', 'indent'],
15
- '|',
16
- ['fullScreen', 'showBlocks', 'codeView'],
17
- '|',
18
- ['preview', 'print']
19
- ];
20
-
21
- const REQUIRED_FORMAT_LINE = 'div';
22
- const REQUIRED_ELEMENT_WHITELIST = 'br|div';
23
- const DEFAULT_ELEMENT_WHITELIST =
24
- 'p|pre|blockquote|h1|h2|h3|h4|h5|h6|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|caption|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code|svg|path|details|summary';
25
- const DEFAULT_TEXT_STYLE_TAGS = 'strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary';
26
-
27
- /* scopeSelectionTags */
28
- const DEFAULT_SCOPE_SELECTION_TAGS = 'td|table|li|ol|ul|pre|figcaption|blockquote|dl|dt|dd';
29
-
30
- const _video_audio_attr = '|controls|autoplay|loop|muted|poster|preload|playsinline|volume|crossorigin|disableRemotePlayback|controlsList';
31
- const _iframe_attr = '|allowfullscreen|sandbox|loading|allow|referrerpolicy|frameborder|scrolling';
32
- const DEFAULT_ATTRIBUTE_WHITELIST = 'contenteditable|target|href|title|download|rel|src|alt|class|type|colspan|rowspan' + _video_audio_attr + _iframe_attr;
33
-
34
- const DEFAULT_FORMAT_LINE = 'P|H[1-6]|LI|TH|TD|DETAILS';
35
- const DEFAULT_FORMAT_BR_LINE = 'PRE';
36
- const DEFAULT_FORMAT_CLOSURE_BR_LINE = '';
37
- const DEFAULT_FORMAT_BLOCK = 'BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|CAPTION|DETAILS';
38
- const DEFAULT_FORMAT_CLOSURE_BLOCK = 'TH|TD';
39
-
40
- const DEFAULT_ALLOWED_EMPTY_NODE_LIST = '.se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas, details';
41
-
42
- const DEFAULT_SIZE_UNITS = ['px', 'pt', 'em', 'rem'];
43
-
44
- const DEFAULT_CLASS_NAME = '^__se__|^se-|^katex|^MathJax';
45
- const DEFAULT_CLASS_MJX = 'mjx-container|mjx-math|mjx-mrow|mjx-mi|mjx-mo|mjx-mn|mjx-msup|mjx-mfrac|mjx-munderover';
46
- const DEFAULT_EXTRA_TAG_MAP = { script: false, style: false, meta: false, link: false, '[a-z]+:[a-z]+': false };
47
-
48
- const DEFAULT_TAG_STYLES = {
49
- 'table|th|td': 'border|border-[a-z]+|background-color|text-align|float|font-weight|text-decoration|font-style',
50
- 'ol|ul': 'list-style-type'
51
- };
52
- const DEFAULT_TEXT_STYLES = 'font-family|font-size|color|background-color';
53
- const DEFAULT_LINE_STYLES = 'text-align|margin-left|margin-right|line-height';
54
- const DEFAULT_CONTENT_STYLES =
55
- 'background|background-clip|background-color|' +
56
- 'border|border-bottom|border-collapse|border-color|border-image|border-left-width|border-radius|border-right-width|border-spacing|border-style|border-top|border-width|' +
57
- 'box-shadow|box-sizing|' +
58
- 'caption-side|color|content|' +
59
- 'direction|display|' +
60
- 'float|font|font-family|font-size|font-style|font-weight|' +
61
- 'height|' +
62
- 'left|letter-spacing|line-height|list-style-position|list-style-type|' +
63
- 'margin|margin-block-end|margin-block-start|margin-bottom|margin-inline-end|margin-inline-start|margin-left|margin-right|margin-top|max-width|min-width|' +
64
- 'outline|overflow|' +
65
- 'position|padding|padding-bottom|padding-inline-start|padding-left|padding-right|padding-top|' +
66
- 'page-break-before|page-break-after|page-break-inside|' +
67
- 'rotate|rotateX|rotateY|' +
68
- 'table-layout|text-align|text-decoration|text-shadow|text-transform|top|' +
69
- 'text-indent|text-rendering|' +
70
- 'vertical-align|visibility|' +
71
- 'white-space|width|word-break|word-wrap';
72
-
73
- const RETAIN_STYLE_MODE = ['repeat', 'always', 'none'];
74
9
 
75
10
  /**
76
- * @typedef {Object} EditorFrameOptions
77
- * @property {string} [value=""] - Initial value for the editor.
78
- * @property {string} [placeholder=""] - Placeholder text.
79
- * @property {Object<string, string>} [editableFrameAttributes={}] - Attributes for the editable frame[.sun-editor-editable]. (e.g. [key]: value)
80
- * @property {string} [width="100%"] - Width for the editor.
81
- * @property {string} [minWidth=""] - Min width for the editor.
82
- * @property {string} [maxWidth=""] - Max width for the editor.
83
- * @property {string} [height="auto"] - Height for the editor.
84
- * @property {string} [minHeight=""] - Min height for the editor.
85
- * @property {string} [maxHeight=""] - Max height for the editor.
86
- * @property {string} [editorStyle=""] - Style string of the top frame of the editor. (e.g. "border: 1px solid #ccc;").
87
- * @property {boolean} [iframe=false] - Content will be placed in an iframe and isolated from the rest of the page.
88
- * @property {boolean} [iframe_fullPage=false] - Allows the usage of HTML, HEAD, BODY tags and DOCTYPE declaration on the "iframe".
89
- * @property {Object<string, string>} [iframe_attributes={}] - Attributes of the "iframe". (e.g. {'scrolling': 'no'})
90
- * @property {string} [iframe_cssFileName="suneditor"] - Name or Array of the CSS file to apply inside the iframe.
91
- * - You can also use regular expressions.
92
- * - Applied by searching by filename in the link tag of document,
93
- * - or put the URL value (".css" can be omitted).
94
- * @property {boolean} [statusbar=true] - Enables the status bar.
95
- * @property {boolean} [statusbar_showPathLabel=true] - Displays the current node structure to status bar.
96
- * @property {boolean} [statusbar_resizeEnable=true] - Enables resize function of bottom status bar
97
- * @property {boolean} [charCounter=false] - Shows the number of characters in the editor.
98
- * - If the maxCharCount option has a value, it becomes true.
99
- * @property {number} [charCounter_max] - The maximum number of characters allowed to be inserted into the editor.
100
- * @property {string} [charCounter_label] - Text to be displayed in the "charCounter" area of the bottom bar. (e.g. "Characters : 20/200")
101
- * @property {"char"|"byte"|"byte-html"} [charCounter_type="char"] - Defines the calculation method of the "charCounter" option.
102
- * - 'char': Characters length.
103
- * - 'byte': Binary data size of characters.
104
- * - 'byte-html': Binary data size of the full HTML string.
11
+ * @typedef {import('../config/options').AllBaseOptions} AllBaseOptions_constructor
105
12
  */
106
13
 
107
14
  /**
108
- * @typedef {Object} EditorBaseOptions
109
- * @property {Object<string, *>|Array<Object<string, *>>} [plugins] - Plugin configuration.
110
- * @property {Array<string>} [excludedPlugins] - Plugin configuration.
111
- * @property {Array<string[]|string>} [buttonList] - List of toolbar buttons, grouped by sub-arrays.
112
- * @property {boolean} [v2Migration=false] - Enables migration mode for SunEditor v2.
113
- * @property {boolean|{tagFilter: boolean, formatFilter: boolean, classFilter: boolean, styleNodeFilter: boolean, attrFilter: boolean, styleFilter: boolean}} [strictMode=true] - Enables strict filtering of tags, attributes, and styles.
114
- * @property {"classic"|"inline"|"balloon"|"balloon-always"} [mode="classic"] - Toolbar mode: "classic", "inline", "balloon", "balloon-always".
115
- * @property {string} [type=""] - Editor type: "document:header,page".
116
- * @property {string} [theme=""] - Editor theme.
117
- * @property {Object<string, string>} [lang] - Language configuration.
118
- * @property {Array<string>} [fontSizeUnits=["px", "pt", "em", "rem"]] - Allowed font size units.
119
- * @property {string} [allowedClassName] - Allowed class names.
120
- * @property {boolean} [closeModalOutsideClick=false] - Closes modals when clicking outside.
121
- * @property {boolean} [copyFormatKeepOn=false] - Keeps the format of the copied content.
122
- * @property {boolean} [syncTabIndent=true] - Synchronizes tab indent with spaces.
123
- * @property {boolean} [tabDisable=false] - Disables tab key input.
124
- * @property {boolean} [autoLinkify] - Automatically converts URLs into hyperlinks. ("Link" plugin required)
125
- * @property {Array<string>} [autoStyleify=["bold", "underline", "italic", "strike"]] - Styles applied automatically on text input.
126
- * @property {Object<string, string|number>} [scrollToOptions={behavior: "auto", block: "nearest"}] - Configuration for scroll behavior when navigating editor content.
127
- * @property {Object<string, string|number>} [componentScrollToOptions={behavior: "smooth", block: "center"}] - Configuration for scroll behavior when navigating components.
128
- * @property {"repeat"|"always"|"none"} [retainStyleMode="repeat"] - This option determines how inline elements (such as <span>, <strong>, etc.) are handled when deleting text.
129
- * - "repeat": Inline styles are retained unless the backspace key is repeatedly pressed. If the user continuously presses backspace, the styles will eventually be removed.
130
- * - "none": Inline styles are not retained at all. When deleting text, the associated inline elements are immediately removed along with it.
131
- * - "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.
132
- * @property {Object<string, boolean>} [allowedExtraTags={script: false, style: false, meta: false, link: false, "[a-z]+:[a-z]+": false}] - Specifies extra allowed or disallowed tags.
133
- * @property {Object<string, (...args: *) => *>} [events={}] - Custom event handlers.
134
- * @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"
135
- * @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.
136
- * @property {Object<string, string>} [convertTextTags={bold: "strong", underline: "u", italic: "em", strike: "del", subscript: "sub", superscript: "sup"}] - Maps text styles to specific HTML tags.
137
- * @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"
138
- * @property {Object<string, string>} [tagStyles={}] - Specifies allowed styles for HTML tags.
139
- * @property {string} [spanStyles="font-family|font-size|color|background-color"] - Specifies allowed styles for the "span" tag.
140
- * @property {string} [lineStyles="text-align|margin-left|margin-right|line-height"] - Specifies allowed styles for the "line" element (p..).
141
- * @property {string} [textDirection="ltr"] - Text direction: "ltr" or "rtl".
142
- * @property {Array<string>} [reverseButtons=['indent-outdent']] - An array of command pairs whose shortcut icons should be opposite each other, depending on the "textDirection" mode.
143
- * @property {number} [historyStackDelayTime=400] - Delay time for history stack updates (ms).
144
- * @property {string} [lineAttrReset=""] - Line properties that should be reset when changing lines (e.g. "id|name").
145
- * @property {string} [printClass=""] - Class name for printing.
146
- * @property {string} [defaultLine="p"] - Default line element when inserting new lines.
147
- * @property {"line"|"br"} [defaultLineBreakFormat="line"] - Specifies the default line break format.
148
- * - [Recommended] "line" : is a line break that is divided into general tags.
149
- * - [Not recommended] "br" : Line breaks are treated as <br> on the same line. (like shift+enter)
150
- * - Line breaks are handled as <br> within "line".
151
- * - You can create a new "line" by entering a line break twice in a row.
152
- * - Formats that include "line", such as "Quote", still operate on a "line" basis.
153
- * - ● suneditor processes work in "line" units.
154
- * - ● When set to "br", performance may decrease when editing a lot of data.
155
- * @property {Array<string>} [scopeSelectionTags=["td", "table", "li", "ol", "ul", "pre", "figcaption", "blockquote", "dl", "dt", "dd"]] - Tags treated as whole units when selecting all content.
156
- * @property {string} [__defaultElementWhitelist="br|div"] - Default allowed HTML elements. The default values are maintained.
157
- * @property {string} [elementWhitelist=""] - Allowed HTML elements. Delimiter: "|" (e.g. "p|div", "*").
158
- * @property {string} [elementBlacklist=""] - Disallowed HTML elements. Delimiter: "|" (e.g. "script|style").
159
- * @property {string} [__defaultAttributeWhitelist] - Allowed attributes. Delimiter: "|" (e.g. "href|target").
160
- * @property {Object<string, string>} [attributeWhitelist=""] - Allowed attributes. (e.g. {a: "href|target", img: "src|alt"}).
161
- * @property {Object<string, string>} [attributeBlacklist=""] - Disallowed attributes. (e.g. {a: "href|target", img: "src|alt"}).
162
- * @property {string} [__defaultFormatLine="P|DIV|H[1-6]|LI|TH|TD|DETAILS"] - Overrides the editor's default "line" element.
163
- * @property {string} [formatLine="P|DIV|H[1-6]|LI|TH|TD|DETAILS"] - Specifies the editor's "line" elements.
164
- * - (P, DIV, H[1-6], PRE, LI | class="__se__format__line_xxx")
165
- * - "line" element also contain "brLine" element
166
- * @property {string} [__defaultFormatBrLine="PRE"] - Overrides the editor's default "brLine" element.
167
- * @property {string} [formatBrLine="PRE"] - Specifies the editor's "brLine" elements. (e.g. "PRE").
168
- * - (PRE | class="__se__format__br_line_xxx")
169
- * - "brLine" elements is included in the "line" element.
170
- * - "brLine" elements's line break is "BR" tag.
171
- * ※ Entering the Enter key in the space on the last line ends "brLine" and appends "line".
172
- * @property {string} [__defaultFormatClosureBrLine=""] - Overrides the editor's default "closureBrLine" element.
173
- * @property {string} [formatClosureBrLine=""] - Specifies the editor's "closureBrLine" elements.
174
- * - (class="__se__format__br_line__closure_xxx")
175
- * - "closureBrLine" elements is included in the "brLine".
176
- * - "closureBrLine" elements's line break is "BR" tag.
177
- * - ※ You cannot exit this format with the Enter key or Backspace key.
178
- * - ※ Use it only in special cases. ([ex] format of table cells)
179
- * @property {string} [__defaultFormatBlock="BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|CAPTION|DETAILS"] - Overrides the editor's default "block" element.
180
- * @property {string} [formatBlock="BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|CAPTION|DETAILS"] - Specifies the editor's "block" elements.
181
- * - (BLOCKQUOTE, OL, UL, FIGCAPTION, TABLE, THEAD, TBODY, TR, TH, TD | class="__se__format__block_xxx")
182
- * - "block" is wrap the "line" and "component"
183
- * @property {string} [__defaultFormatClosureBlock="TH|TD"] - Overrides the editor's default "closureBlock" element.
184
- * @property {string} [formatClosureBlock="TH|TD"] - Specifies the editor's "closureBlock" elements.
185
- * - (TH, TD | class="__se__format__block_closure_xxx")
186
- * - "closureBlock" elements is included in the "block".
187
- * - "closureBlock" element is wrap the "line" and "component"
188
- * - ※ You cannot exit this format with the Enter key or Backspace key.
189
- * - ※ Use it only in special cases. ([ex] format of table cells)
190
- * @property {string} [allowedEmptyTags=".se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas, details"] - Allowed empty tags.
191
- * @property {number|string} [toolbar_width="auto"] - Toolbar width.
192
- * @property {Element|string} [toolbar_container] - Container element for the toolbar.
193
- * @property {number} [toolbar_sticky=0] - Enables sticky toolbar with optional offset.
194
- * @property {boolean} [toolbar_hide=false] - Hides toolbar initially.
195
- * @property {Object} [subToolbar] - Sub-toolbar configuration.
196
- * @property {Array<Array<string>>} [subToolbar.buttonList] - List of Sub-toolbar buttons, grouped by sub-arrays.
197
- * @property {"balloon"|"balloon-always"} [subToolbar.mode="balloon"] - Sub-toolbar mode: "balloon", "balloon-always".
198
- * @property {number|string} [subToolbar.width="auto"] - Sub-toolbar width.
199
- * @property {Element|string} [statusbar_container] - Container element for the status bar.
200
- * @property {boolean} [shortcutsHint=true] - Displays shortcut hints in tooltips.
201
- * @property {boolean} [shortcutsDisable=false] - Disables keyboard shortcuts.
202
- * @property {Object<string, Array<string>>} [shortcuts] - Custom keyboard shortcuts.
203
- * @property {number} [fullScreenOffset=0] - Offset applied when entering fullscreen mode.
204
- * @property {string} [previewTemplate] - Custom template for preview mode.
205
- * @property {string} [printTemplate] - Custom template for print mode.
206
- * @property {boolean} [componentAutoSelect=false] - Enables automatic selection of inserted components.
207
- * @property {string} [defaultUrlProtocol] - Default URL protocol for links.
208
- * @property {string} [allUsedStyles] - Specifies additional styles to the list of allowed styles. Delimiter: "|" (e.g. "color|background-color").
209
- * @property {Object<"copy", number>} [toastMessageTime] - {"copy": 1500} - Duration for displaying toast messages.
210
- * @property {Object<string, string>} [icons] - Overrides the default icons.
211
- * @property {string} [freeCodeViewMode=false] - Enables free code view mode.
212
- * @property {boolean} [__lineFormatFilter=true] - Line format filter configuration.
213
- * @property {boolean} [__pluginRetainFilter=true] - Plugin retain filter configuration.
214
- * @property {Array<string>} [__listCommonStyle=["fontSize", "color", "fontFamily", "fontWeight", "fontStyle"]] - Defines the list of styles that are applied directly to the `<li>` element
215
- * - when a text style is applied to the entire list item.
216
- * - For example, when changing the font size or color of a list item (`<li>`),
217
- * - these styles will be applied to the `<li>` tag instead of wrapping the content inside additional tags.
218
- * @property {Object<string, *>} [externalLibs] - External libraries like CodeMirror or MathJax.
219
- *
220
- * @property {Object<string, *>} [Dynamic_pluginOptions] - Dynamic plugin options, where the key is the plugin name and the value is its configuration.
15
+ * @typedef {Object} ConstructorReturnType
16
+ * @property {__se__Context} context - Editor context object
17
+ * @property {HTMLElement} carrierWrapper - Carrier wrapper element
18
+ * @property {__se__BaseOptions} options - Processed editor options (Map)
19
+ * @property {Object<string, *>} plugins - Loaded plugins
20
+ * @property {Object<string, string>} icons - Icon set
21
+ * @property {Object<string, string>} lang - Language pack
22
+ * @property {string|null} value - Initial editor value
23
+ * @property {string|null} rootId - Root frame ID
24
+ * @property {Array<string|null>} rootKeys - Array of frame keys
25
+ * @property {Map<string|null, ReturnType<import('../config/frameContext').CreateFrameContext>>} frameRoots - Map of frame contexts
26
+ * @property {Object<string, Array<HTMLElement>>} pluginCallButtons - Plugin toolbar buttons
27
+ * @property {Array<HTMLElement>} responsiveButtons - Responsive toolbar buttons
28
+ * @property {Object<string, Array<HTMLElement>>|[]} pluginCallButtons_sub - Sub-toolbar plugin buttons
29
+ * @property {Array<HTMLElement>} responsiveButtons_sub - Sub-toolbar responsive buttons
221
30
  */
222
31
 
223
- /**
224
- * @typedef {EditorBaseOptions & EditorFrameOptions} EditorInitOptions
225
- */
226
-
227
- /** ------------- [OPTIONS FRAG] ------------- */
228
- /**
229
- * @description For all EditorInitOptions keys, only boolean | null values are allowed.
230
- * - 'fixed' → Immutable / null → Resettable.
231
- * @type {Partial<Record<keyof EditorInitOptions, "fixed" | true>>}
232
- */
233
- export const OPTION_FRAME_FIXED_FLAG = {
234
- value: 'fixed',
235
- placeholder: true,
236
- editableFrameAttributes: true,
237
- width: true,
238
- minWidth: true,
239
- maxWidth: true,
240
- height: true,
241
- minHeight: true,
242
- maxHeight: true,
243
- editorStyle: true,
244
- iframe: 'fixed',
245
- iframe_fullPage: 'fixed',
246
- iframe_attributes: true,
247
- iframe_cssFileName: true,
248
- statusbar: true,
249
- statusbar_showPathLabel: true,
250
- statusbar_resizeEnable: 'fixed',
251
- charCounter: true,
252
- charCounter_max: true,
253
- charCounter_label: true,
254
- charCounter_type: true
255
- };
256
- /**
257
- * @description For all EditorInitOptions keys, only boolean | null values are allowed.
258
- * - 'fixed' → Immutable / null → Resettable.
259
- * @type {Partial<Record<keyof EditorInitOptions, "fixed" | true>>}
260
- */
261
- export const OPTION_FIXED_FLAG = {
262
- plugins: 'fixed',
263
- excludedPlugins: 'fixed',
264
- buttonList: 'fixed',
265
- v2Migration: 'fixed',
266
- strictMode: 'fixed',
267
- mode: 'fixed',
268
- type: 'fixed',
269
- theme: true,
270
- lang: 'fixed',
271
- fontSizeUnits: 'fixed',
272
- allowedClassName: 'fixed',
273
- closeModalOutsideClick: 'fixed',
274
- copyFormatKeepOn: true,
275
- syncTabIndent: true,
276
- tabDisable: true,
277
- autoLinkify: true,
278
- autoStyleify: true,
279
- scrollToOptions: true,
280
- componentScrollToOptions: true,
281
- retainStyleMode: true,
282
- allowedExtraTags: 'fixed',
283
- events: true,
284
- __textStyleTags: 'fixed',
285
- textStyleTags: 'fixed',
286
- convertTextTags: 'fixed',
287
- __tagStyles: 'fixed',
288
- tagStyles: 'fixed',
289
- spanStyles: 'fixed',
290
- lineStyles: 'fixed',
291
- textDirection: true,
292
- reverseButtons: 'fixed',
293
- historyStackDelayTime: true,
294
- lineAttrReset: true,
295
- printClass: true,
296
- defaultLine: 'fixed',
297
- defaultLineBreakFormat: true,
298
- scopeSelectionTags: true,
299
- __defaultElementWhitelist: 'fixed',
300
- elementWhitelist: 'fixed',
301
- elementBlacklist: 'fixed',
302
- __defaultAttributeWhitelist: 'fixed',
303
- attributeWhitelist: 'fixed',
304
- attributeBlacklist: 'fixed',
305
- __defaultFormatLine: 'fixed',
306
- formatLine: 'fixed',
307
- __defaultFormatBrLine: 'fixed',
308
- formatBrLine: 'fixed',
309
- __defaultFormatClosureBrLine: 'fixed',
310
- formatClosureBrLine: 'fixed',
311
- __defaultFormatBlock: 'fixed',
312
- formatBlock: 'fixed',
313
- __defaultFormatClosureBlock: 'fixed',
314
- formatClosureBlock: 'fixed',
315
- allowedEmptyTags: true,
316
- toolbar_width: true,
317
- toolbar_container: 'fixed',
318
- toolbar_sticky: true,
319
- toolbar_hide: true,
320
- subToolbar: 'fixed',
321
- statusbar_container: 'fixed',
322
- shortcutsHint: true,
323
- shortcutsDisable: 'fixed',
324
- shortcuts: 'fixed',
325
- fullScreenOffset: true,
326
- previewTemplate: true,
327
- printTemplate: true,
328
- componentAutoSelect: true,
329
- defaultUrlProtocol: true,
330
- allUsedStyles: 'fixed',
331
- toastMessageTime: true,
332
- icons: 'fixed',
333
- freeCodeViewMode: true,
334
- __lineFormatFilter: true,
335
- __pluginRetainFilter: true,
336
- __listCommonStyle: 'fixed',
337
- externalLibs: 'fixed'
338
- };
339
-
340
32
  /**
341
33
  * @description Creates a new SunEditor instance with specified options.
342
- * @param {Array<{target: Element, key: *, options: EditorFrameOptions}>} editorTargets - Target element or multi-root object.
343
- * @param {EditorInitOptions} options - Configuration options for the editor.
344
- * @returns {Object<string, *>} - SunEditor instance with context, options, and DOM elements.
34
+ * @param {Array<{target: Element, key: *, options: __se__EditorFrameOptions}>} editorTargets - Target element or multi-root object.
35
+ * @param {__se__EditorOptions} options - Configuration options for the editor.
36
+ * @returns {ConstructorReturnType} - SunEditor instance with context, options, and DOM elements.
345
37
  */
346
38
  function Constructor(editorTargets, options) {
347
39
  if (typeof options !== 'object') options = {};
@@ -431,7 +123,7 @@ function Constructor(editorTargets, options) {
431
123
  subbar.style.visibility = 'hidden';
432
124
  // subbar mode must be balloon-*
433
125
  subbar.className += ' se-toolbar-balloon se-toolbar-sub';
434
- subbar.style.width = o.get('toolbar.sub_width');
126
+ subbar.style.width = o.get('toolbar_sub_width');
435
127
  subbar.appendChild(dom.utils.createElement('DIV', { class: 'se-arrow' }));
436
128
  }
437
129
 
@@ -569,7 +261,7 @@ function Constructor(editorTargets, options) {
569
261
  * @param {Element|null} button Command button element
570
262
  * @param {Map<string, *>} keyMap Map to store shortcut key info
571
263
  * @param {Array} rc "_reverseCommandArray" option
572
- * @param {Array} reverseKeys Reverse key array
264
+ * @param {Set} reverseKeys Reverse key array
573
265
  */
574
266
  export function CreateShortcuts(command, button, values, keyMap, rc, reverseKeys) {
575
267
  if (!values || values.length < 2) return;
@@ -580,7 +272,7 @@ export function CreateShortcuts(command, button, values, keyMap, rc, reverseKeys
580
272
  a = values[i].split('+');
581
273
 
582
274
  plugin = null;
583
- method = a[a.length - 1].trim?.();
275
+ method = a.at(-1).trim?.();
584
276
  if (method.startsWith('~')) {
585
277
  // plugin key, method
586
278
  plugin = command;
@@ -630,7 +322,7 @@ export function CreateShortcuts(command, button, values, keyMap, rc, reverseKeys
630
322
  if (!keyMap.has(k)) {
631
323
  r = rc.indexOf(command);
632
324
  r = r === -1 ? '' : numbers.isOdd(r) ? rc[r + 1] : rc[r - 1];
633
- if (r) reverseKeys.push(k);
325
+ if (r) reverseKeys.add(k);
634
326
 
635
327
  keyMap.set(k, { c, s, edge, space, enter, textTrigger, plugin, command, method, r, type: button?.getAttribute('data-type'), button, key: k });
636
328
  }
@@ -661,23 +353,27 @@ function _mergeObject(a, b) {
661
353
  }, {});
662
354
  }
663
355
 
356
+ /**
357
+ * @typedef {Object} InitOptionsReturnType
358
+ * @property {__se__BaseOptions} o - Processed base options (Map containing {@link AllBaseOptions_constructor} keys)
359
+ * @property {Object<string, string>} i - Icon set
360
+ * @property {Object<string, string>} l - Language pack
361
+ * @property {string|null} v - Initial editor value
362
+ * @property {Array<string[]|string>} buttons - Toolbar button list (arrays for groups, strings for single buttons)
363
+ * @property {Array<string[]|string>|null} subButtons - Sub-toolbar button list
364
+ * @property {Element|null} statusbarContainer - Container element for status bar (if specified)
365
+ * @property {Map<string|null, __se__FrameOptions>} frameMap - Map of frame-specific options (frame key => {@link __se__FrameOptions})
366
+ */
367
+
664
368
  /**
665
369
  * @description Initialize options
666
- * @param {EditorInitOptions} options Configuration options for the editor.
667
- * @param {Array<{target: Element, key: *, options: EditorFrameOptions}>} editorTargets Target textarea
370
+ * @param {__se__EditorOptions} options Configuration options for the editor.
371
+ * @param {Array<{target: Element, key: *, options: __se__EditorFrameOptions}>} editorTargets Target textarea
668
372
  * @param {Object<string, *>} plugins Plugins object
669
- * @returns {{o: Map<string, *>, i: Object<string, string>, l: Object<string, string>, v: string, buttons: Array<string[]|string>, subButtons: Array<string[]|string>, statusbarContainer: Element|null, frameMap: Map<*, *>}}
670
- * - o: options
671
- * - i: icons
672
- * - l: lang
673
- * - v: value
674
- * - buttons: Toolbar button list
675
- * - subButtons: Sub-Toolbar button list
676
- * - statusbarContainer: statusbar container
677
- * - frameMap: converted options map
373
+ * @returns {InitOptionsReturnType} Initialized options and configuration
678
374
  */
679
375
  export function InitOptions(options, editorTargets, plugins) {
680
- const buttonList = options.buttonList || DEFAULT_BUTTON_LIST;
376
+ const buttonList = options.buttonList || DEFAULTS.BUTTON_LIST;
681
377
  const o = new Map();
682
378
 
683
379
  /** Multi root */
@@ -695,7 +391,7 @@ export function InitOptions(options, editorTargets, plugins) {
695
391
  tagFilter: modeValue,
696
392
  formatFilter: modeValue,
697
393
  classFilter: modeValue,
698
- styleNodeFilter: modeValue,
394
+ textStyleTagFilter: modeValue,
699
395
  attrFilter: modeValue,
700
396
  styleFilter: modeValue,
701
397
  ...(typeof options.strictMode === 'boolean' ? {} : options.strictMode)
@@ -709,8 +405,8 @@ export function InitOptions(options, editorTargets, plugins) {
709
405
  o.set('_themeClass', options.theme ? ` se-theme-${options.theme}` : '');
710
406
  o.set('_type_options', options.type?.split(':')[1] || '');
711
407
  o.set('externalLibs', options.externalLibs || {});
712
- o.set('fontSizeUnits', Array.isArray(options.fontSizeUnits) && options.fontSizeUnits.length > 0 ? options.fontSizeUnits.map((v) => v.toLowerCase()) : DEFAULT_SIZE_UNITS);
713
- o.set('allowedClassName', new RegExp(`${options.allowedClassName && typeof options.allowedClassName === 'string' ? options.allowedClassName + '|' : ''}${DEFAULT_CLASS_NAME}`));
408
+ o.set('fontSizeUnits', Array.isArray(options.fontSizeUnits) && options.fontSizeUnits.length > 0 ? options.fontSizeUnits.map((v) => v.toLowerCase()) : DEFAULTS.SIZE_UNITS);
409
+ o.set('allowedClassName', new RegExp(`${options.allowedClassName && typeof options.allowedClassName === 'string' ? options.allowedClassName + '|' : ''}${DEFAULTS.CLASS_NAME}`));
714
410
  o.set('closeModalOutsideClick', !!options.closeModalOutsideClick);
715
411
 
716
412
  // format
@@ -721,18 +417,14 @@ export function InitOptions(options, editorTargets, plugins) {
721
417
  o.set('autoLinkify', options.autoLinkify ?? !!plugins.link);
722
418
  o.set('autoStyleify', Array.isArray(options.autoStyleify) ? options.autoStyleify : ['bold', 'underline', 'italic', 'strike']);
723
419
 
724
- // scroll options
725
- o.set('scrollToOptions', { behavior: 'auto', block: 'nearest', ...options.scrollToOptions });
726
- o.set('componentScrollToOptions', { behavior: 'smooth', block: 'center', ...options.componentScrollToOptions });
727
-
728
420
  let retainStyleMode = options.retainStyleMode;
729
- if (typeof retainStyleMode === 'string' && !RETAIN_STYLE_MODE.includes(retainStyleMode)) {
730
- console.error(`Invalid retainStyleMode: ${retainStyleMode}. Valid options are ${RETAIN_STYLE_MODE.join(', ')}. Using default 'once'.`);
421
+ if (typeof retainStyleMode === 'string' && !DEFAULTS.RETAIN_STYLE_MODE.includes(retainStyleMode)) {
422
+ console.error(`Invalid retainStyleMode: ${retainStyleMode}. Valid options are ${DEFAULTS.RETAIN_STYLE_MODE.join(', ')}. Using default 'once'.`);
731
423
  retainStyleMode = 'repeat';
732
424
  }
733
425
  o.set('retainStyleMode', retainStyleMode);
734
426
 
735
- const allowedExtraTags = { ...DEFAULT_EXTRA_TAG_MAP, ...options.allowedExtraTags, '-': true };
427
+ const allowedExtraTags = { ...DEFAULTS.EXTRA_TAG_MAP, ...options.allowedExtraTags, '-': true };
736
428
  const extraKeys = Object.keys(allowedExtraTags);
737
429
  const allowedKeys = extraKeys.filter((k) => allowedExtraTags[k]).join('|');
738
430
  const disallowedKeys = extraKeys.filter((k) => !allowedExtraTags[k]).join('|');
@@ -742,7 +434,7 @@ export function InitOptions(options, editorTargets, plugins) {
742
434
  o.set('events', options.events || {});
743
435
 
744
436
  // text style tags
745
- o.set('textStyleTags', (typeof options.__textStyleTags === 'string' ? options.__textStyleTags : DEFAULT_TEXT_STYLE_TAGS) + (options.textStyleTags ? '|' + options.textStyleTags : ''));
437
+ o.set('textStyleTags', (typeof options.__textStyleTags === 'string' ? options.__textStyleTags : DEFAULTS.TEXT_STYLE_TAGS) + (options.textStyleTags ? '|' + options.textStyleTags : ''));
746
438
  const textTags = _mergeObject(
747
439
  {
748
440
  bold: 'strong',
@@ -758,15 +450,15 @@ export function InitOptions(options, editorTargets, plugins) {
758
450
  o.set('_textStyleTags', Object.values(textTags).concat(['span', 'li']));
759
451
  o.set(
760
452
  'tagStyles',
761
- [{ ...DEFAULT_TAG_STYLES, ...(options.__tagStyles || {}) }, options.tagStyles || {}].reduce((_default, _new) => {
453
+ [{ ...DEFAULTS.TAG_STYLES, ...(options.__tagStyles || {}) }, options.tagStyles || {}].reduce((_default, _new) => {
762
454
  for (const key in _new) {
763
455
  _default[key] = _new[key];
764
456
  }
765
457
  return _default;
766
458
  }, {})
767
459
  );
768
- o.set('_textStylesRegExp', new RegExp(`\\s*[^-a-zA-Z](${DEFAULT_TEXT_STYLES}${options.spanStyles ? '|' + options.spanStyles : ''})\\s*:[^;]+(?!;)*`, 'gi'));
769
- o.set('_lineStylesRegExp', new RegExp(`\\s*[^-a-zA-Z](${DEFAULT_LINE_STYLES}${options.lineStyles ? '|' + options.lineStyles : ''})\\s*:[^;]+(?!;)*`, 'gi'));
460
+ o.set('_textStylesRegExp', new RegExp(`\\s*[^-a-zA-Z](${DEFAULTS.SPAN_STYLES}${options.spanStyles ? '|' + options.spanStyles : ''})\\s*:[^;]+(?!;)*`, 'gi'));
461
+ o.set('_lineStylesRegExp', new RegExp(`\\s*[^-a-zA-Z](${DEFAULTS.LINE_STYLES}${options.lineStyles ? '|' + options.lineStyles : ''})\\s*:[^;]+(?!;)*`, 'gi'));
770
462
  o.set('_defaultStyleTagMap', {
771
463
  strong: textTags.bold,
772
464
  b: textTags.bold,
@@ -816,7 +508,7 @@ export function InitOptions(options, editorTargets, plugins) {
816
508
 
817
509
  // etc
818
510
  o.set('historyStackDelayTime', typeof options.historyStackDelayTime === 'number' ? options.historyStackDelayTime : 400);
819
- o.set('_editableClass', 'sun-editor-editable' + o.get('_themeClass') + (o.get('_rtl') ? ' se-rtl' : '') + (o.get('type') === 'document' ? ' se-type-document-editable' : ''));
511
+ o.set('_editableClass', 'sun-editor-editable' + o.get('_themeClass') + (o.get('_rtl') ? ' se-rtl' : '') + (o.get('type') === 'document' ? ' se-type-document-editable-a4' : ''));
820
512
  o.set('lineAttrReset', ['id'].concat(options.lineAttrReset && typeof options.lineAttrReset === 'string' ? options.lineAttrReset.toLowerCase().split('|') : []));
821
513
  o.set('printClass', typeof options.printClass === 'string' ? options.printClass + ' ' + o.get('_editableClass') : null);
822
514
 
@@ -824,10 +516,10 @@ export function InitOptions(options, editorTargets, plugins) {
824
516
  // default line
825
517
  o.set('defaultLine', typeof options.defaultLine === 'string' && options.defaultLine.length > 0 ? options.defaultLine : 'p');
826
518
  o.set('defaultLineBreakFormat', options.defaultLineBreakFormat || 'line');
827
- o.set('scopeSelectionTags', options.scopeSelectionTags || DEFAULT_SCOPE_SELECTION_TAGS.split('|'));
519
+ o.set('scopeSelectionTags', options.scopeSelectionTags || DEFAULTS.SCOPE_SELECTION_TAGS);
828
520
  // element
829
521
  const elw = (typeof options.elementWhitelist === 'string' ? options.elementWhitelist : '').toLowerCase();
830
- const mjxEls = o.get('externalLibs').mathjax ? DEFAULT_CLASS_MJX + '|' : '';
522
+ const mjxEls = o.get('externalLibs').mathjax ? DEFAULTS.CLASS_MJX + '|' : '';
831
523
  o.set('elementWhitelist', elw + (elw ? '|' : '') + mjxEls + o.get('_allowedExtraTag'));
832
524
  const elb = _createBlacklist((typeof options.elementBlacklist === 'string' ? options.elementBlacklist : '').toLowerCase(), o.get('defaultLine'));
833
525
  o.set('elementBlacklist', elb + (elb ? '|' : '') + o.get('_disallowedExtraTag'));
@@ -839,7 +531,7 @@ export function InitOptions(options, editorTargets, plugins) {
839
531
  'formatClosureBrLine',
840
532
  _createFormatInfo(
841
533
  options.formatClosureBrLine,
842
- (options.__defaultFormatClosureBrLine = typeof options.__defaultFormatClosureBrLine === 'string' ? options.__defaultFormatClosureBrLine : DEFAULT_FORMAT_CLOSURE_BR_LINE).toLowerCase(),
534
+ (options.__defaultFormatClosureBrLine = typeof options.__defaultFormatClosureBrLine === 'string' ? options.__defaultFormatClosureBrLine : DEFAULTS.FORMAT_CLOSURE_BR_LINE).toLowerCase(),
843
535
  o.get('elementBlacklist')
844
536
  )
845
537
  );
@@ -847,15 +539,15 @@ export function InitOptions(options, editorTargets, plugins) {
847
539
  'formatBrLine',
848
540
  _createFormatInfo(
849
541
  (options.formatBrLine || '') + '|' + o.get('formatClosureBrLine').str,
850
- (options.__defaultFormatBrLine = typeof options.__defaultFormatBrLine === 'string' ? options.__defaultFormatBrLine : DEFAULT_FORMAT_BR_LINE).toLowerCase(),
542
+ (options.__defaultFormatBrLine = typeof options.__defaultFormatBrLine === 'string' ? options.__defaultFormatBrLine : DEFAULTS.FORMAT_BR_LINE).toLowerCase(),
851
543
  o.get('elementBlacklist')
852
544
  )
853
545
  );
854
546
  o.set(
855
547
  'formatLine',
856
548
  _createFormatInfo(
857
- REQUIRED_FORMAT_LINE + '|' + (options.formatLine || '') + '|' + o.get('formatBrLine').str,
858
- (options.__defaultFormatLine = typeof options.__defaultFormatLine === 'string' ? options.__defaultFormatLine : DEFAULT_FORMAT_LINE).toLowerCase(),
549
+ DEFAULTS.REQUIRED_FORMAT_LINE + '|' + (options.formatLine || '') + '|' + o.get('formatBrLine').str,
550
+ (options.__defaultFormatLine = typeof options.__defaultFormatLine === 'string' ? options.__defaultFormatLine : DEFAULTS.FORMAT_LINE).toLowerCase(),
859
551
  o.get('elementBlacklist')
860
552
  )
861
553
  );
@@ -869,7 +561,7 @@ export function InitOptions(options, editorTargets, plugins) {
869
561
  'formatClosureBlock',
870
562
  _createFormatInfo(
871
563
  options.formatClosureBlock,
872
- (options.__defaultFormatClosureBlock = typeof options.__defaultFormatClosureBlock === 'string' ? options.__defaultFormatClosureBlock : DEFAULT_FORMAT_CLOSURE_BLOCK).toLowerCase(),
564
+ (options.__defaultFormatClosureBlock = typeof options.__defaultFormatClosureBlock === 'string' ? options.__defaultFormatClosureBlock : DEFAULTS.FORMAT_CLOSURE_BLOCK).toLowerCase(),
873
565
  o.get('elementBlacklist')
874
566
  )
875
567
  );
@@ -877,16 +569,16 @@ export function InitOptions(options, editorTargets, plugins) {
877
569
  'formatBlock',
878
570
  _createFormatInfo(
879
571
  (options.formatBlock || '') + '|' + o.get('formatClosureBlock').str,
880
- (options.__defaultFormatBlock = typeof options.__defaultFormatBlock === 'string' ? options.__defaultFormatBlock : DEFAULT_FORMAT_BLOCK).toLowerCase(),
572
+ (options.__defaultFormatBlock = typeof options.__defaultFormatBlock === 'string' ? options.__defaultFormatBlock : DEFAULTS.FORMAT_BLOCK).toLowerCase(),
881
573
  o.get('elementBlacklist')
882
574
  )
883
575
  );
884
576
 
885
- o.set('allowedEmptyTags', DEFAULT_ALLOWED_EMPTY_NODE_LIST + (options.allowedEmptyTags ? ', ' + options.allowedEmptyTags : ''));
577
+ o.set('allowedEmptyTags', DEFAULTS.ALLOWED_EMPTY_NODE_LIST + (options.allowedEmptyTags ? ', ' + options.allowedEmptyTags : ''));
886
578
 
887
579
  /** __defaults */
888
- o.set('__defaultElementWhitelist', REQUIRED_ELEMENT_WHITELIST + '|' + (typeof options.__defaultElementWhitelist === 'string' ? options.__defaultElementWhitelist : DEFAULT_ELEMENT_WHITELIST).toLowerCase());
889
- o.set('__defaultAttributeWhitelist', (typeof options.__defaultAttributeWhitelist === 'string' ? options.__defaultAttributeWhitelist : DEFAULT_ATTRIBUTE_WHITELIST).toLowerCase());
580
+ o.set('__defaultElementWhitelist', DEFAULTS.REQUIRED_ELEMENT_WHITELIST + '|' + (typeof options.__defaultElementWhitelist === 'string' ? options.__defaultElementWhitelist : DEFAULTS.ELEMENT_WHITELIST).toLowerCase());
581
+ o.set('__defaultAttributeWhitelist', (typeof options.__defaultAttributeWhitelist === 'string' ? options.__defaultAttributeWhitelist : DEFAULTS.ATTRIBUTE_WHITELIST).toLowerCase());
890
582
  // --- create element whitelist (__defaultElementWhiteList + elementWhitelist + format[line, BrLine, Block, Closureblock, ClosureBrLine] - elementBlacklist)
891
583
  o.set('_editorElementWhitelist', o.get('elementWhitelist') === '*' ? '*' : _createWhitelist(o));
892
584
 
@@ -904,7 +596,7 @@ export function InitOptions(options, editorTargets, plugins) {
904
596
  console.warn('[SUNEDITOR.create.subToolbar.fail] When the "mode" option is "balloon-*", the "subToolbar" option is omitted.');
905
597
  } else {
906
598
  o.set('_subMode', subbar.mode || 'balloon');
907
- o.set('toolbar.sub_width', subbar.width ? (numbers.is(subbar.width) ? subbar.width + 'px' : subbar.width) : 'auto');
599
+ o.set('toolbar_sub_width', subbar.width ? (numbers.is(subbar.width) ? subbar.width + 'px' : subbar.width) : 'auto');
908
600
  subButtons = o.get('_rtl') ? subbar.buttonList.reverse() : subbar.buttonList;
909
601
  o.set('buttons_sub', new Set(subButtons.toString().split(',')));
910
602
  }
@@ -945,12 +637,12 @@ export function InitOptions(options, editorTargets, plugins) {
945
637
  _h3: ['c+s+Digit3|Numpad3+$~formatBlock.applyHeaderByShortcut', '']
946
638
  },
947
639
  options.shortcuts || {}
948
- ].reduce((_default, _new) => {
640
+ ].reduce((_default, _new) => {
949
641
  for (const key in _new) {
950
642
  _default[key] = _new[key];
951
643
  }
952
644
  return _default;
953
- }, {});
645
+ }, {});
954
646
  o.set('shortcuts', shortcuts);
955
647
 
956
648
  /** View */
@@ -959,7 +651,7 @@ export function InitOptions(options, editorTargets, plugins) {
959
651
  o.set('printTemplate', typeof options.printTemplate === 'string' ? options.printTemplate : null);
960
652
 
961
653
  /** --- Media select */
962
- o.set('componentAutoSelect', options.componentAutoSelect === undefined ? false : !!options.componentAutoSelect);
654
+ o.set('componentInsertBehavior', ['auto', 'select', 'line', 'none'].includes(options.componentInsertBehavior) ? options.componentInsertBehavior : 'auto');
963
655
 
964
656
  /** --- Url input protocol */
965
657
  o.set('defaultUrlProtocol', typeof options.defaultUrlProtocol === 'string' ? options.defaultUrlProtocol : null);
@@ -991,14 +683,14 @@ export function InitOptions(options, editorTargets, plugins) {
991
683
  _default[key] = _new[key];
992
684
  }
993
685
  return _default;
994
- }, {});
686
+ }, {});
995
687
  o.set('icons', icons);
996
688
 
997
689
  /** Create all used styles */
998
- const allUsedStyles = new Set(DEFAULT_CONTENT_STYLES.split('|'));
690
+ const allUsedStyles = new Set(DEFAULTS.CONTENT_STYLES.split('|'));
999
691
  const _ss = options.spanStyles?.split('|') || [];
1000
692
  const _ls = o.get('__listCommonStyle');
1001
- const _dts = DEFAULT_TEXT_STYLES.split('|');
693
+ const _dts = DEFAULTS.SPAN_STYLES.split('|');
1002
694
  for (let i = 0, len = _dts.length; i < len; i++) {
1003
695
  allUsedStyles.add(_dts[i]);
1004
696
  }
@@ -1045,7 +737,7 @@ export function CreateStatusbar(targetOptions, statusbar) {
1045
737
  let charCounter = null;
1046
738
 
1047
739
  if (targetOptions.get('statusbar')) {
1048
- statusbar = statusbar || dom.utils.createElement('DIV', { class: 'se-status-bar sun-editor-common' });
740
+ statusbar ||= dom.utils.createElement('DIV', { class: 'se-status-bar sun-editor-common' });
1049
741
 
1050
742
  /** navigation */
1051
743
  navigation = statusbar.querySelector('.se-navigation') || dom.utils.createElement('DIV', { class: 'se-navigation sun-editor-common' });
@@ -1085,9 +777,9 @@ export function CreateStatusbar(targetOptions, statusbar) {
1085
777
 
1086
778
  /**
1087
779
  * @description Initialize options.
1088
- * @param {EditorFrameOptions} o - Target options
1089
- * @param {EditorInitOptions} origin - Full options
1090
- * @returns {Map<string, *>}
780
+ * @param {__se__EditorFrameOptions} o - Target options
781
+ * @param {__se__EditorOptions} origin - Full options
782
+ * @returns {__se__FrameOptions} Processed frame options Map
1091
783
  */
1092
784
  function InitFrameOptions(o, origin) {
1093
785
  const fo = new Map();
@@ -1121,7 +813,7 @@ function InitFrameOptions(o, origin) {
1121
813
  // value
1122
814
  fo.set('value', value);
1123
815
  fo.set('placeholder', placeholder);
1124
- fo.set('editableFrameAttributes', editableFrameAttributes || {});
816
+ fo.set('editableFrameAttributes', { spellcheck: 'false', ...editableFrameAttributes });
1125
817
  // styles
1126
818
  fo.set('width', width ? (numbers.is(width) ? width + 'px' : width) : '100%');
1127
819
  fo.set('minWidth', (numbers.is(minWidth) ? minWidth + 'px' : minWidth) || '');
@@ -1167,7 +859,7 @@ function _initTargetElements(key, options, topDiv, targetOptions) {
1167
859
  /** editor */
1168
860
  // wysiwyg div or iframe
1169
861
  const wysiwygDiv = dom.utils.createElement(!targetOptions.get('iframe') ? 'DIV' : 'IFRAME', {
1170
- class: 'se-wrapper-inner se-wrapper-wysiwyg',
862
+ class: 'se-wrapper-inner se-wrapper-wysiwyg' + (options.get('type') === 'document' ? ' se-type-document-iframe-a4' : ''),
1171
863
  'data-root-key': key
1172
864
  });
1173
865
 
@@ -1393,7 +1085,7 @@ function _createModuleGroup() {
1393
1085
  * @returns {{li: HTMLElement, button: HTMLElement}}
1394
1086
  */
1395
1087
  function _createButton(className, title, dataCommand, dataType, innerHTML, _disabled, icons) {
1396
- if (!innerHTML) innerHTML = '';
1088
+ innerHTML ||= '';
1397
1089
 
1398
1090
  const oLi = dom.utils.createElement('LI');
1399
1091
  const label = title || '';
@@ -1407,7 +1099,7 @@ function _createButton(className, title, dataCommand, dataType, innerHTML, _disa
1407
1099
  'data-type': dataType,
1408
1100
  'aria-label': label.replace(/<span .+<\/span>/, ''),
1409
1101
  tabindex: '-1'
1410
- })
1102
+ })
1411
1103
  );
1412
1104
 
1413
1105
  if (!isDiv) {
@@ -1587,7 +1279,6 @@ export function CreateToolBar(buttonList, plugins, options, icons, lang, isUpdat
1587
1279
  // default command
1588
1280
  if (button === 'copy' && !env.isClipboardSupported) {
1589
1281
  console.warn('[SUNEDITOR.constructor.warn] Clipboard is not supported in this browser. : [copy] button is not rendered.');
1590
- continue;
1591
1282
  }
1592
1283
  modules = defaultButtonList[button];
1593
1284
  }