suneditor 3.0.0-beta.2 → 3.0.0-beta.20

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 (177) hide show
  1. package/CONTRIBUTING.md +186 -184
  2. package/LICENSE +21 -21
  3. package/README.md +157 -180
  4. package/dist/suneditor.min.css +1 -1
  5. package/dist/suneditor.min.js +1 -1
  6. package/package.json +126 -123
  7. package/src/assets/design/color.css +131 -121
  8. package/src/assets/design/index.css +3 -3
  9. package/src/assets/design/size.css +37 -35
  10. package/src/assets/design/typography.css +37 -37
  11. package/src/assets/icons/defaultIcons.js +247 -232
  12. package/src/assets/suneditor-contents.css +779 -778
  13. package/src/assets/suneditor.css +43 -35
  14. package/src/core/base/eventHandlers/handler_toolbar.js +135 -135
  15. package/src/core/base/eventHandlers/handler_ww_clipboard.js +56 -56
  16. package/src/core/base/eventHandlers/handler_ww_dragDrop.js +115 -113
  17. package/src/core/base/eventHandlers/handler_ww_key_input.js +1200 -1200
  18. package/src/core/base/eventHandlers/handler_ww_mouse.js +194 -194
  19. package/src/core/base/eventManager.js +1550 -1484
  20. package/src/core/base/history.js +355 -355
  21. package/src/core/class/char.js +163 -162
  22. package/src/core/class/component.js +856 -842
  23. package/src/core/class/format.js +3433 -3422
  24. package/src/core/class/html.js +1927 -1890
  25. package/src/core/class/menu.js +357 -346
  26. package/src/core/class/nodeTransform.js +424 -424
  27. package/src/core/class/offset.js +858 -891
  28. package/src/core/class/selection.js +710 -620
  29. package/src/core/class/shortcuts.js +98 -98
  30. package/src/core/class/toolbar.js +438 -430
  31. package/src/core/class/ui.js +424 -422
  32. package/src/core/class/viewer.js +750 -750
  33. package/src/core/editor.js +1810 -1708
  34. package/src/core/section/actives.js +268 -241
  35. package/src/core/section/constructor.js +1348 -1661
  36. package/src/core/section/context.js +102 -102
  37. package/src/core/section/documentType.js +582 -561
  38. package/src/core/section/options.js +367 -0
  39. package/src/core/util/instanceCheck.js +59 -0
  40. package/src/editorInjector/_classes.js +36 -36
  41. package/src/editorInjector/_core.js +92 -92
  42. package/src/editorInjector/index.js +75 -75
  43. package/src/events.js +634 -622
  44. package/src/helper/clipboard.js +59 -59
  45. package/src/helper/converter.js +586 -564
  46. package/src/helper/dom/domCheck.js +304 -304
  47. package/src/helper/dom/domQuery.js +677 -669
  48. package/src/helper/dom/domUtils.js +618 -557
  49. package/src/helper/dom/index.js +12 -12
  50. package/src/helper/env.js +249 -240
  51. package/src/helper/index.js +25 -25
  52. package/src/helper/keyCodeMap.js +183 -183
  53. package/src/helper/numbers.js +72 -72
  54. package/src/helper/unicode.js +47 -47
  55. package/src/langs/ckb.js +231 -231
  56. package/src/langs/cs.js +231 -231
  57. package/src/langs/da.js +231 -231
  58. package/src/langs/de.js +231 -231
  59. package/src/langs/en.js +230 -230
  60. package/src/langs/es.js +231 -231
  61. package/src/langs/fa.js +231 -231
  62. package/src/langs/fr.js +231 -231
  63. package/src/langs/he.js +231 -231
  64. package/src/langs/hu.js +230 -230
  65. package/src/langs/index.js +28 -28
  66. package/src/langs/it.js +231 -231
  67. package/src/langs/ja.js +230 -230
  68. package/src/langs/km.js +230 -230
  69. package/src/langs/ko.js +230 -230
  70. package/src/langs/lv.js +231 -231
  71. package/src/langs/nl.js +231 -231
  72. package/src/langs/pl.js +231 -231
  73. package/src/langs/pt_br.js +231 -231
  74. package/src/langs/ro.js +231 -231
  75. package/src/langs/ru.js +231 -231
  76. package/src/langs/se.js +231 -231
  77. package/src/langs/tr.js +231 -231
  78. package/src/langs/uk.js +231 -231
  79. package/src/langs/ur.js +231 -231
  80. package/src/langs/zh_cn.js +231 -231
  81. package/src/modules/ApiManager.js +191 -191
  82. package/src/modules/Browser.js +669 -667
  83. package/src/modules/ColorPicker.js +364 -362
  84. package/src/modules/Controller.js +474 -454
  85. package/src/modules/Figure.js +1620 -1617
  86. package/src/modules/FileManager.js +359 -359
  87. package/src/modules/HueSlider.js +577 -565
  88. package/src/modules/Modal.js +346 -346
  89. package/src/modules/ModalAnchorEditor.js +643 -643
  90. package/src/modules/SelectMenu.js +549 -549
  91. package/src/modules/_DragHandle.js +17 -17
  92. package/src/modules/index.js +14 -14
  93. package/src/plugins/browser/audioGallery.js +83 -83
  94. package/src/plugins/browser/fileBrowser.js +103 -103
  95. package/src/plugins/browser/fileGallery.js +83 -83
  96. package/src/plugins/browser/imageGallery.js +81 -81
  97. package/src/plugins/browser/videoGallery.js +103 -103
  98. package/src/plugins/command/blockquote.js +61 -60
  99. package/src/plugins/command/exportPDF.js +134 -134
  100. package/src/plugins/command/fileUpload.js +456 -456
  101. package/src/plugins/command/list_bulleted.js +149 -148
  102. package/src/plugins/command/list_numbered.js +152 -151
  103. package/src/plugins/dropdown/align.js +157 -155
  104. package/src/plugins/dropdown/backgroundColor.js +108 -104
  105. package/src/plugins/dropdown/font.js +141 -137
  106. package/src/plugins/dropdown/fontColor.js +109 -105
  107. package/src/plugins/dropdown/formatBlock.js +170 -178
  108. package/src/plugins/dropdown/hr.js +152 -152
  109. package/src/plugins/dropdown/layout.js +83 -83
  110. package/src/plugins/dropdown/lineHeight.js +131 -130
  111. package/src/plugins/dropdown/list.js +123 -122
  112. package/src/plugins/dropdown/paragraphStyle.js +138 -138
  113. package/src/plugins/dropdown/table.js +4110 -4000
  114. package/src/plugins/dropdown/template.js +83 -83
  115. package/src/plugins/dropdown/textStyle.js +149 -149
  116. package/src/plugins/field/mention.js +242 -242
  117. package/src/plugins/index.js +120 -120
  118. package/src/plugins/input/fontSize.js +414 -410
  119. package/src/plugins/input/pageNavigator.js +71 -70
  120. package/src/plugins/modal/audio.js +677 -677
  121. package/src/plugins/modal/drawing.js +537 -531
  122. package/src/plugins/modal/embed.js +886 -886
  123. package/src/plugins/modal/image.js +1377 -1376
  124. package/src/plugins/modal/link.js +248 -240
  125. package/src/plugins/modal/math.js +563 -563
  126. package/src/plugins/modal/video.js +1226 -1226
  127. package/src/plugins/popup/anchor.js +224 -222
  128. package/src/suneditor.js +114 -107
  129. package/src/themes/dark.css +132 -122
  130. package/src/typedef.js +132 -130
  131. package/types/assets/icons/defaultIcons.d.ts +8 -0
  132. package/types/core/base/eventManager.d.ts +29 -4
  133. package/types/core/class/char.d.ts +2 -1
  134. package/types/core/class/component.d.ts +1 -2
  135. package/types/core/class/format.d.ts +8 -1
  136. package/types/core/class/html.d.ts +8 -0
  137. package/types/core/class/menu.d.ts +8 -0
  138. package/types/core/class/offset.d.ts +24 -26
  139. package/types/core/class/selection.d.ts +2 -0
  140. package/types/core/class/toolbar.d.ts +6 -0
  141. package/types/core/class/ui.d.ts +1 -1
  142. package/types/core/editor.d.ts +34 -12
  143. package/types/core/section/constructor.d.ts +5 -638
  144. package/types/core/section/documentType.d.ts +12 -2
  145. package/types/core/section/options.d.ts +740 -0
  146. package/types/core/util/instanceCheck.d.ts +50 -0
  147. package/types/editorInjector/_core.d.ts +5 -5
  148. package/types/editorInjector/index.d.ts +2 -2
  149. package/types/events.d.ts +2 -0
  150. package/types/helper/converter.d.ts +9 -0
  151. package/types/helper/dom/domQuery.d.ts +5 -5
  152. package/types/helper/dom/domUtils.d.ts +8 -0
  153. package/types/helper/env.d.ts +6 -1
  154. package/types/helper/index.d.ts +4 -1
  155. package/types/index.d.ts +122 -120
  156. package/types/langs/_Lang.d.ts +194 -194
  157. package/types/modules/ColorPicker.d.ts +5 -1
  158. package/types/modules/Controller.d.ts +8 -4
  159. package/types/modules/Figure.d.ts +2 -1
  160. package/types/modules/HueSlider.d.ts +4 -1
  161. package/types/modules/SelectMenu.d.ts +1 -1
  162. package/types/plugins/command/blockquote.d.ts +1 -0
  163. package/types/plugins/command/list_bulleted.d.ts +1 -0
  164. package/types/plugins/command/list_numbered.d.ts +1 -0
  165. package/types/plugins/dropdown/align.d.ts +1 -0
  166. package/types/plugins/dropdown/backgroundColor.d.ts +1 -0
  167. package/types/plugins/dropdown/font.d.ts +1 -0
  168. package/types/plugins/dropdown/fontColor.d.ts +1 -0
  169. package/types/plugins/dropdown/formatBlock.d.ts +3 -2
  170. package/types/plugins/dropdown/lineHeight.d.ts +1 -0
  171. package/types/plugins/dropdown/list.d.ts +1 -0
  172. package/types/plugins/dropdown/table.d.ts +6 -0
  173. package/types/plugins/input/fontSize.d.ts +1 -0
  174. package/types/plugins/modal/drawing.d.ts +4 -0
  175. package/types/plugins/modal/link.d.ts +32 -15
  176. package/types/suneditor.d.ts +13 -9
  177. package/types/typedef.d.ts +8 -0
@@ -0,0 +1,367 @@
1
+ export const DEFAULTS = {
2
+ BUTTON_LIST: [
3
+ ['undo', 'redo'],
4
+ '|',
5
+ ['bold', 'underline', 'italic', 'strike', '|', 'subscript', 'superscript'],
6
+ '|',
7
+ ['removeFormat'],
8
+ '|',
9
+ ['outdent', 'indent'],
10
+ '|',
11
+ ['fullScreen', 'showBlocks', 'codeView'],
12
+ '|',
13
+ ['preview', 'print']
14
+ ],
15
+
16
+ REQUIRED_FORMAT_LINE: 'div',
17
+ REQUIRED_ELEMENT_WHITELIST: 'br|div',
18
+
19
+ ELEMENT_WHITELIST:
20
+ 'p|pre|blockquote|h1|h2|h3|h4|h5|h6|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|colgroup|col|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',
21
+ TEXT_STYLE_TAGS: 'strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary',
22
+
23
+ SCOPE_SELECTION_TAGS: ['td', 'table', 'li', 'ol', 'ul', 'pre', 'figcaption', 'blockquote', 'dl', 'dt', 'dd'],
24
+
25
+ ATTRIBUTE_WHITELIST:
26
+ 'contenteditable|target|href|title|download|rel|src|alt|class|type|colspan|rowspan' +
27
+ '|width|height|controls|autoplay|loop|muted|poster|preload|playsinline|volume|crossorigin|disableRemotePlayback|controlsList' +
28
+ '|allowfullscreen|sandbox|loading|allow|referrerpolicy|frameborder|scrolling',
29
+
30
+ FORMAT_LINE: 'P|H[1-6]|LI|TH|TD|DETAILS',
31
+ FORMAT_BR_LINE: 'PRE',
32
+ FORMAT_CLOSURE_BR_LINE: '',
33
+ FORMAT_BLOCK: 'BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|CAPTION|DETAILS',
34
+ FORMAT_CLOSURE_BLOCK: 'TH|TD',
35
+
36
+ ALLOWED_EMPTY_NODE_LIST: '.se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas, details',
37
+
38
+ SIZE_UNITS: ['px', 'pt', 'em', 'rem'],
39
+
40
+ CLASS_NAME: '^__se__|^se-|^katex|^MathJax',
41
+ CLASS_MJX: 'mjx-container|mjx-math|mjx-mrow|mjx-mi|mjx-mo|mjx-mn|mjx-msup|mjx-mfrac|mjx-munderover',
42
+ EXTRA_TAG_MAP: { script: false, style: false, meta: false, link: false, '[a-z]+:[a-z]+': false },
43
+
44
+ CONTENT_STYLES:
45
+ 'background|background-clip|background-color|' +
46
+ '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|' +
47
+ 'box-shadow|box-sizing|' +
48
+ 'caption-side|color|content|' +
49
+ 'direction|display|' +
50
+ 'float|font|font-family|font-size|font-style|font-weight|' +
51
+ 'height|' +
52
+ 'left|letter-spacing|line-height|list-style-position|list-style-type|' +
53
+ '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|' +
54
+ 'outline|overflow|' +
55
+ 'position|padding|padding-bottom|padding-inline-start|padding-left|padding-right|padding-top|' +
56
+ 'page-break-before|page-break-after|page-break-inside|' +
57
+ 'rotate|rotateX|rotateY|' +
58
+ 'table-layout|text-align|text-decoration|text-shadow|text-transform|top|' +
59
+ 'text-indent|text-rendering|' +
60
+ 'vertical-align|visibility|' +
61
+ 'white-space|width|word-break|word-wrap',
62
+ TAG_STYLES: {
63
+ 'table|th|td': 'border|border-[a-z]+|color|background-color|text-align|float|font-weight|text-decoration|font-style|vertical-align|text-align',
64
+ 'table|td': 'width',
65
+ tr: 'height',
66
+ col: 'width',
67
+ 'ol|ul': 'list-style-type'
68
+ },
69
+ SPAN_STYLES: 'font-family|font-size|color|background-color|width|height',
70
+ LINE_STYLES: 'text-align|margin-left|margin-right|line-height',
71
+
72
+ RETAIN_STYLE_MODE: ['repeat', 'always', 'none']
73
+ };
74
+
75
+ /**
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={spellcheck: "false"}] - 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=null] - The maximum number of characters allowed to be inserted into the editor.
100
+ * @property {string} [charCounter_label=null] - 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.
105
+ */
106
+
107
+ /**
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=CONSTANTS.BUTTON_LIST] - List of toolbar buttons, grouped by sub-arrays.
112
+ * - The default follows {@link DEFAULTS.BUTTON_LIST}
113
+ * @property {boolean} [v2Migration=false] - Enables migration mode for SunEditor v2.
114
+ * @property {boolean|{tagFilter: boolean, formatFilter: boolean, classFilter: boolean, textStyleTagFilter: boolean, attrFilter: boolean, styleFilter: boolean}} [strictMode=true] - Enables strict filtering of tags, attributes, and styles.
115
+ * @property {"classic"|"inline"|"balloon"|"balloon-always"} [mode="classic"] - Toolbar mode: "classic", "inline", "balloon", "balloon-always".
116
+ * @property {string} [type=""] - Editor type: "document:header,page".
117
+ * @property {string} [theme=""] - Editor theme.
118
+ * @property {Object<string, string>} [lang] - Language configuration. default : EN
119
+ * @property {Array<string>} [fontSizeUnits=CONSTANTS.SIZE_UNITS] - Allowed font size units.
120
+ * - The default follows {@link DEFAULTS.SIZE_UNITS}
121
+ * @property {string} [allowedClassName=""] - Allowed class names.
122
+ * - Added the default value {@link DEFAULTS.CLASS_NAME}
123
+ * @property {boolean} [closeModalOutsideClick=false] - Closes modals when clicking outside.
124
+ * @property {boolean} [copyFormatKeepOn=false] - Keeps the format of the copied content.
125
+ * @property {boolean} [syncTabIndent=true] - Synchronizes tab indent with spaces.
126
+ * @property {boolean} [tabDisable=false] - Disables tab key input.
127
+ * @property {boolean} [autoLinkify] - Automatically converts URLs into hyperlinks. ("Link" plugin required)
128
+ * - Default value is determined dynamically based on whether the 'link' plugin is enabled. (default : Boolean(plugins.link))
129
+ * @property {Array<string>} [autoStyleify=["bold", "underline", "italic", "strike"]] - Styles applied automatically on text input.
130
+ * @property {"repeat"|"always"|"none"} [retainStyleMode="repeat"] - This option determines how inline elements (such as <span>, <strong>, etc.) are handled when deleting text.
131
+ * - "repeat": Inline styles are retained unless the backspace key is repeatedly pressed. If the user continuously presses backspace, the styles will eventually be removed.
132
+ * - "none": Inline styles are not retained at all. When deleting text, the associated inline elements are immediately removed along with it.
133
+ * - "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.
134
+ * @property {Object<string, boolean>} [allowedExtraTags=CONSTANTS.EXTRA_TAG_MAP] - Specifies extra allowed or disallowed tags.
135
+ * - The default follows {@link DEFAULTS.EXTRA_TAG_MAP}
136
+ * @property {Object<string, (...args: *) => *>} [events={}] - Custom event handlers.
137
+ * @property {string} [__textStyleTags=CONSTANTS.TEXT_STYLE_TAGS] - The basic tags that serves as the base for "textStyleTags"
138
+ * - The default follows {@link DEFAULTS.TEXT_STYLE_TAGS}
139
+ * @property {string} [textStyleTags=__textStyleTags] - Additional text style tags.
140
+ * - The default follows {@link EditorBaseOptions.__textStyleTags}
141
+ * @property {Object<string, string>} [convertTextTags={bold: "strong", underline: "u", italic: "em", strike: "del", subscript: "sub", superscript: "sup"}] - Maps text styles to specific HTML tags.
142
+ * @property {string} [allUsedStyles] - Specifies additional styles to the list of allowed styles. Delimiter: "|" (e.g. "color|background-color").
143
+ * @property {Object<string, string>} [__tagStyles=CONSTANTS.TAG_STYLES] - The basic tags that serves as the base for "tagStyles"
144
+ * - The default follows {@link DEFAULTS.TAG_STYLES}
145
+ * @property {Object<string, string>} [tagStyles={}] - Specifies allowed styles for HTML tags.
146
+ * @property {string} [spanStyles=CONSTANTS.SPAN_STYLES] - Specifies allowed styles for the "span" tag.
147
+ * - The default follows {@link DEFAULTS.SPAN_STYLES}
148
+ * @property {string} [lineStyles=CONSTANTS.LINE_STYLES] - Specifies allowed styles for the "line" element (p..).
149
+ * - The default follows {@link DEFAULTS.LINE_STYLES}
150
+ * @property {string} [textDirection="ltr"] - Text direction: "ltr" or "rtl".
151
+ * @property {Array<string>} [reverseButtons=['indent-outdent']] - An array of command pairs whose shortcut icons should be opposite each other, depending on the "textDirection" mode.
152
+ * @property {number} [historyStackDelayTime=400] - Delay time for history stack updates (ms).
153
+ * @property {string} [lineAttrReset=""] - Line properties that should be reset when changing lines (e.g. "id|name").
154
+ * @property {string} [printClass=""] - Class name for printing.
155
+ * @property {string} [defaultLine="p"] - Default line element when inserting new lines.
156
+ * @property {"line"|"br"} [defaultLineBreakFormat="line"] - Specifies the default line break format.
157
+ * - [Recommended] "line" : is a line break that is divided into general tags.
158
+ * - [Not recommended] "br" : Line breaks are treated as <br> on the same line. (like shift+enter)
159
+ * - Line breaks are handled as <br> within "line".
160
+ * - You can create a new "line" by entering a line break twice in a row.
161
+ * - Formats that include "line", such as "Quote", still operate on a "line" basis.
162
+ * - ● suneditor processes work in "line" units.
163
+ * - ● When set to "br", performance may decrease when editing a lot of data.
164
+ * @property {Array<string>} [scopeSelectionTags=CONSTANTS.SCOPE_SELECTION_TAGS] - Tags treated as whole units when selecting all content.
165
+ * - The default follows {@link DEFAULTS.SCOPE_SELECTION_TAGS}
166
+ * @property {string} [__defaultElementWhitelist] - A custom string used to construct a list of HTML elements to allow.
167
+ * - The final list of allowed elements (regex pattern) is dynamically generated according to the following rules:
168
+ * - A list of required elements, {@link DEFAULTS.REQUIRED_ELEMENT_WHITELIST}, is always included.
169
+ * - If a string value is provided for this option (`__defaultElementWhitelist`):** That string value is used.
170
+ * - If this option is not provided or is not a string: The default constant {@link DEFAULTS.ELEMENT_WHITELIST} is used.
171
+ * - 1. If no options are given, the final pattern is:
172
+ * - 'a|img|p|div|...' (REQUIRED + DEFAULT)
173
+ * - 2. If options are given directly, the final pattern is:
174
+ * - 'a|img|custom|tags' (REQUIRED + options.__defaultElementWhitelist)
175
+ * @property {string} [elementWhitelist=""] - Specifies HTML elements to additionally allow beyond the 'default' allow list. Delimiter: "|" (e.g. "p|div", "*").
176
+ * - The value entered here will be added to the end of the default list determined by the {@link EditorBaseOptions.__defaultElementWhitelist} logic above.
177
+ * @property {string} [elementBlacklist=""] - Filters by specifying HTML elements that should not be used. Delimiter: "|" (e.g. "script|style").
178
+ * - Tags specified here will eventually be removed, even if they are included in other whitelists.
179
+ * @property {string} [__defaultAttributeWhitelist=CONSTANTS.ATTRIBUTE_WHITELIST] - A complete list of attributes that are allowed by default on all tags. Delimiter: "|" (e.g. "href|target").
180
+ * - The default follows {@link DEFAULTS.ATTRIBUTE_WHITELIST}
181
+ * @property {Object<string, string>} [attributeWhitelist=null] - Specifies additional attributes to allow for each tag. (e.g. {a: "href|target", img: "src|alt", "*": "id"}).
182
+ * - Rules for objects specified here will be merged into the {@link EditorBaseOptions.__defaultAttributeWhitelist}.
183
+ * @property {Object<string, string>} [attributeBlacklist=null] - Filter by specifying attributes to disallow by tag. (e.g. {a: "href|target", img: "src|alt", "*": "name"}).
184
+ * - Attributes specified here will eventually be removed even if they are allowed by other settings.
185
+ * @property {string} [__defaultFormatLine=CONSTANTS.FORMAT_LINE] - Specifies the tag to be used as the editor's default "line" element.
186
+ * - The default follows {@link DEFAULTS.FORMAT_LINE}
187
+ * - A list of required elements, {@link DEFAULTS.REQUIRED_FORMAT_LINE}, is always included.
188
+ * @property {string} [formatLine=__defaultFormatLine] - Additionally allowed "line" elements beyond the default. Delimiter: "|" (e.g. "p|div").
189
+ * It is concatenated with the value of {@link EditorBaseOptions.__defaultFormatLine} to form the final 'line' element list.
190
+ * - "line" element also contain "brLine" element
191
+ * @property {string} [__defaultFormatBrLine=CONSTANTS.FORMAT_BR_LINE] - Specifies the tag to be used as the editor's default "brLine" element.
192
+ * - The default follows {@link DEFAULTS.FORMAT_BR_LINE}
193
+ * @property {string} [formatBrLine=__defaultFormatBrLine] - Additionally allowed "brLine" elements beyond the default. (e.g. "PRE").
194
+ * - It is concatenated with the value of {@link EditorBaseOptions.__defaultFormatBrLine} to form the final 'brLine' element list.
195
+ * - "brLine" elements is included in the "line" element.
196
+ * - "brLine" elements's line break is "BR" tag.
197
+ * ※ Entering the Enter key in the space on the last line ends "brLine" and appends "line".
198
+ * @property {string} [__defaultFormatClosureBrLine=CONSTANTS.FORMAT_CLOSURE_BR_LINE] - Specifies the tag to be used as the editor's default "closureBrLine" element.
199
+ * - The default follows {@link DEFAULTS.FORMAT_CLOSURE_BR_LINE}
200
+ * @property {string} [formatClosureBrLine=__defaultFormatClosureBrLine] - Additionally allowed "closureBrLine" elements beyond the default.
201
+ * - It is concatenated with the value of {@link EditorBaseOptions.__defaultFormatClosureBrLine} to form the final 'closureBrLine' element list.
202
+ * - "closureBrLine" elements is included in the "brLine".
203
+ * - "closureBrLine" elements's line break is "BR" tag.
204
+ * - ※ You cannot exit this format with the Enter key or Backspace key.
205
+ * - ※ Use it only in special cases. ([ex] format of table cells)
206
+ * @property {string} [__defaultFormatBlock=CONSTANTS.FORMAT_BLOCK] - Specifies the tag to be used as the editor's default "block" element.
207
+ * - The default follows {@link DEFAULTS.FORMAT_BLOCK}
208
+ * @property {string} [formatBlock=__defaultFormatBlock] - Additionally allowed "block" elements beyond the default.
209
+ * - It is concatenated with the value of {@link EditorBaseOptions.__defaultFormatBlock} to form the final 'block' element list.
210
+ * - "block" is wrap the "line" and "component"
211
+ * @property {string} [__defaultFormatClosureBlock=CONSTANTS.FORMAT_CLOSURE_BLOCK] - Specifies the tag to be used as the editor's default "closureBlock" element.
212
+ * - The default follows {@link DEFAULTS.FORMAT_CLOSURE_BLOCK}
213
+ * @property {string} [formatClosureBlock=__defaultFormatClosureBlock] - Additionally allowed "closureBlock" elements beyond the default.
214
+ * - It is concatenated with the value of {@link EditorBaseOptions.__defaultFormatClosureBlock} to form the final 'closureBlock' element list.
215
+ * - "closureBlock" elements is included in the "block".
216
+ * - "closureBlock" element is wrap the "line" and "component"
217
+ * - ※ You cannot exit this format with the Enter key or Backspace key.
218
+ * - ※ Use it only in special cases. (e.g. format of table cells)
219
+ * @property {string} [allowedEmptyTags=CONSTANTS.ALLOWED_EMPTY_NODE_LIST] - A list of tags that are allowed to be kept even if their values are empty.
220
+ * - The default follows {@link DEFAULTS.ALLOWED_EMPTY_NODE_LIST}
221
+ * - It is concatenated with the value of {@link DEFAULTS.ALLOWED_EMPTY_NODE_LIST} to form the final 'allowedEmptyTags' list.
222
+ * @property {number|string} [toolbar_width="auto"] - Toolbar width.
223
+ * @property {Element|string} [toolbar_container] - Container element for the toolbar.
224
+ * @property {number} [toolbar_sticky=0] - Enables sticky toolbar with optional offset.
225
+ * @property {boolean} [toolbar_hide=false] - Hides toolbar initially.
226
+ * @property {Object} [subToolbar={}] - Sub-toolbar configuration.
227
+ * @property {Array<Array<string>>} [subToolbar.buttonList] - List of Sub-toolbar buttons, grouped by sub-arrays.
228
+ * @property {"balloon"|"balloon-always"} [subToolbar.mode="balloon"] - Sub-toolbar mode: "balloon", "balloon-always".
229
+ * @property {number|string} [subToolbar.width="auto"] - Sub-toolbar width.
230
+ * @property {Element|string} [statusbar_container] - Container element for the status bar.
231
+ * @property {boolean} [shortcutsHint=true] - Displays shortcut hints in tooltips.
232
+ * @property {boolean} [shortcutsDisable=false] - Disables keyboard shortcuts.
233
+ * @property {Object<string, Array<string>>} [shortcuts={}] - Custom keyboard shortcuts.
234
+ * @property {number} [fullScreenOffset=0] - Offset applied when entering fullscreen mode.
235
+ * @property {string} [previewTemplate=null] - Custom template for preview mode.
236
+ * @property {string} [printTemplate=null] - Custom template for print mode.
237
+ * @property {boolean} [componentAutoSelect=false] - Enables automatic selection of inserted components.
238
+ * @property {string} [defaultUrlProtocol=null] - Default URL protocol for links.
239
+ * @property {Object<"copy", number>} [toastMessageTime={copy: 1500}] - {"copy": 1500} - Duration for displaying toast messages.
240
+ * @property {Object<string, string>} [icons] - Overrides the default icons.
241
+ * @property {string} [freeCodeViewMode=false] - Enables free code view mode.
242
+ * @property {boolean} [__lineFormatFilter=true] - Line format filter configuration.
243
+ * @property {boolean|Object<string, boolean>} [__pluginRetainFilter=true] - Plugin retain filter configuration.
244
+ * - You can turn it off/on globally with true/false or set it per plugin. (e.g. { table: false })
245
+ * @property {Array<string>} [__listCommonStyle=["fontSize", "color", "fontFamily", "fontWeight", "fontStyle"]] - Defines the list of styles that are applied directly to the `<li>` element
246
+ * - when a text style is applied to the entire list item.
247
+ * - For example, when changing the font size or color of a list item (`<li>`),
248
+ * - these styles will be applied to the `<li>` tag instead of wrapping the content inside additional tags.
249
+ * @property {Object<string, *>} [externalLibs] - External libraries like CodeMirror or MathJax.
250
+ *
251
+ * @property {Object<string, *>} [Dynamic_pluginOptions] - Dynamic plugin options, where the key is the plugin name and the value is its configuration.
252
+ */
253
+
254
+ /**
255
+ * @typedef {EditorBaseOptions & EditorFrameOptions} EditorInitOptions
256
+ */
257
+
258
+ /** ------------- [OPTIONS FRAG] ------------- */
259
+ /**
260
+ * @description For all EditorInitOptions keys, only boolean | null values are allowed.
261
+ * - 'fixed' → Immutable / null → Resettable.
262
+ * @type {Partial<Record<keyof EditorInitOptions, "fixed" | true>>}
263
+ */
264
+ export const OPTION_FRAME_FIXED_FLAG = {
265
+ value: 'fixed',
266
+ placeholder: true,
267
+ editableFrameAttributes: true,
268
+ width: true,
269
+ minWidth: true,
270
+ maxWidth: true,
271
+ height: true,
272
+ minHeight: true,
273
+ maxHeight: true,
274
+ editorStyle: true,
275
+ iframe: 'fixed',
276
+ iframe_fullPage: 'fixed',
277
+ iframe_attributes: true,
278
+ iframe_cssFileName: true,
279
+ statusbar: true,
280
+ statusbar_showPathLabel: true,
281
+ statusbar_resizeEnable: 'fixed',
282
+ charCounter: true,
283
+ charCounter_max: true,
284
+ charCounter_label: true,
285
+ charCounter_type: true
286
+ };
287
+ /**
288
+ * @description For all EditorInitOptions keys, only boolean | null values are allowed.
289
+ * - 'fixed' → Immutable / null → Resettable.
290
+ * @type {Partial<Record<keyof EditorInitOptions, "fixed" | true>>}
291
+ */
292
+ export const OPTION_FIXED_FLAG = {
293
+ plugins: 'fixed',
294
+ excludedPlugins: 'fixed',
295
+ buttonList: 'fixed',
296
+ v2Migration: 'fixed',
297
+ strictMode: 'fixed',
298
+ mode: 'fixed',
299
+ type: 'fixed',
300
+ theme: true,
301
+ lang: 'fixed',
302
+ fontSizeUnits: 'fixed',
303
+ allowedClassName: 'fixed',
304
+ closeModalOutsideClick: 'fixed',
305
+ copyFormatKeepOn: true,
306
+ syncTabIndent: true,
307
+ tabDisable: true,
308
+ autoLinkify: true,
309
+ autoStyleify: true,
310
+ retainStyleMode: true,
311
+ allowedExtraTags: 'fixed',
312
+ events: true,
313
+ __textStyleTags: 'fixed',
314
+ textStyleTags: 'fixed',
315
+ convertTextTags: 'fixed',
316
+ __tagStyles: 'fixed',
317
+ tagStyles: 'fixed',
318
+ spanStyles: 'fixed',
319
+ lineStyles: 'fixed',
320
+ textDirection: true,
321
+ reverseButtons: 'fixed',
322
+ historyStackDelayTime: true,
323
+ lineAttrReset: true,
324
+ printClass: true,
325
+ defaultLine: 'fixed',
326
+ defaultLineBreakFormat: true,
327
+ scopeSelectionTags: true,
328
+ __defaultElementWhitelist: 'fixed',
329
+ elementWhitelist: 'fixed',
330
+ elementBlacklist: 'fixed',
331
+ __defaultAttributeWhitelist: 'fixed',
332
+ attributeWhitelist: 'fixed',
333
+ attributeBlacklist: 'fixed',
334
+ __defaultFormatLine: 'fixed',
335
+ formatLine: 'fixed',
336
+ __defaultFormatBrLine: 'fixed',
337
+ formatBrLine: 'fixed',
338
+ __defaultFormatClosureBrLine: 'fixed',
339
+ formatClosureBrLine: 'fixed',
340
+ __defaultFormatBlock: 'fixed',
341
+ formatBlock: 'fixed',
342
+ __defaultFormatClosureBlock: 'fixed',
343
+ formatClosureBlock: 'fixed',
344
+ allowedEmptyTags: true,
345
+ toolbar_width: true,
346
+ toolbar_container: 'fixed',
347
+ toolbar_sticky: true,
348
+ toolbar_hide: true,
349
+ subToolbar: 'fixed',
350
+ statusbar_container: 'fixed',
351
+ shortcutsHint: true,
352
+ shortcutsDisable: 'fixed',
353
+ shortcuts: 'fixed',
354
+ fullScreenOffset: true,
355
+ previewTemplate: true,
356
+ printTemplate: true,
357
+ componentAutoSelect: true,
358
+ defaultUrlProtocol: true,
359
+ allUsedStyles: 'fixed',
360
+ toastMessageTime: true,
361
+ icons: 'fixed',
362
+ freeCodeViewMode: true,
363
+ __lineFormatFilter: true,
364
+ __pluginRetainFilter: true,
365
+ __listCommonStyle: 'fixed',
366
+ externalLibs: 'fixed'
367
+ };
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @typedef {InstanceCheck} InstanceCheckThis
3
+ */
4
+
5
+ /**
6
+ * @constructor
7
+ * @this {InstanceCheck}
8
+ * @description iframe-safe instanceof check utility class
9
+ * @param {__se__EditorCore} editor - The root editor instance
10
+ */
11
+ function InstanceCheck(editor) {
12
+ this.editor = editor;
13
+ }
14
+
15
+ InstanceCheck.prototype = {
16
+ /**
17
+ * @param {*} obj
18
+ * @returns {obj is Node}
19
+ */
20
+ isNode(obj) {
21
+ return obj instanceof this._getFrameWindow().Node;
22
+ },
23
+
24
+ /**
25
+ * @param {*} obj
26
+ * @returns {obj is Element}
27
+ */
28
+ isElement(obj) {
29
+ return obj instanceof this._getFrameWindow().Element;
30
+ },
31
+
32
+ /**
33
+ * @param {*} obj
34
+ * @returns {obj is Range}
35
+ */
36
+ isRange(obj) {
37
+ return obj instanceof this._getFrameWindow().Range;
38
+ },
39
+
40
+ /**
41
+ * @param {*} obj
42
+ * @returns {obj is Selection}
43
+ */
44
+ isSelection(obj) {
45
+ return obj instanceof this._getFrameWindow().Selection;
46
+ },
47
+
48
+ /**
49
+ * @private
50
+ * @returns {window}
51
+ */
52
+ _getFrameWindow() {
53
+ return this.editor.frameContext.get('_ww');
54
+ },
55
+
56
+ constructor: InstanceCheck
57
+ };
58
+
59
+ export default InstanceCheck;
@@ -1,36 +1,36 @@
1
- /**
2
- * @private
3
- * @description Add all inner classes to the editor instance.
4
- * @param {__se__EditorCore} editor - The root editor instance
5
- */
6
- function ClassInjector(editor) {
7
- /** @description Toolbar class instance @type {__se__EditorCore['toolbar']} */
8
- this.toolbar = editor.toolbar;
9
- /** @description Sub-Toolbar class instance @type {__se__EditorCore['subToolbar']|null} */
10
- this.subToolbar = null;
11
- if (editor.subToolbar) this.subToolbar = editor.subToolbar;
12
- /** @description Char class instance @type {__se__EditorCore['char']} */
13
- this.char = editor.char;
14
- /** @description Component class instance @type {__se__EditorCore['component']} */
15
- this.component = editor.component;
16
- /** @description Format class instance @type {__se__EditorCore['format']} */
17
- this.format = editor.format;
18
- /** @description HTML class instance @type {__se__EditorCore['html']} */
19
- this.html = editor.html;
20
- /** @description Menu class instance @type {__se__EditorCore['menu']} */
21
- this.menu = editor.menu;
22
- /** @description NodeTransform class instance @type {__se__EditorCore['nodeTransform']} */
23
- this.nodeTransform = editor.nodeTransform;
24
- /** @description Offset class instance @type {__se__EditorCore['offset']} */
25
- this.offset = editor.offset;
26
- /** @description Selection class instance @type {__se__EditorCore['selection']} */
27
- this.selection = editor.selection;
28
- /** @description Shortcuts class instance @type {__se__EditorCore['shortcuts']} */
29
- this.shortcuts = editor.shortcuts;
30
- /** @description UI class instance @type {__se__EditorCore['ui']} */
31
- this.ui = editor.ui;
32
- /** @description Viewer class instance @type {__se__EditorCore['viewer']} */
33
- this.viewer = editor.viewer;
34
- }
35
-
36
- export default ClassInjector;
1
+ /**
2
+ * @private
3
+ * @description Add all inner classes to the editor instance.
4
+ * @param {__se__EditorCore} editor - The root editor instance
5
+ */
6
+ function ClassInjector(editor) {
7
+ /** @description Toolbar class instance @type {__se__EditorCore['toolbar']} */
8
+ this.toolbar = editor.toolbar;
9
+ /** @description Sub-Toolbar class instance @type {__se__EditorCore['subToolbar']|null} */
10
+ this.subToolbar = null;
11
+ if (editor.subToolbar) this.subToolbar = editor.subToolbar;
12
+ /** @description Char class instance @type {__se__EditorCore['char']} */
13
+ this.char = editor.char;
14
+ /** @description Component class instance @type {__se__EditorCore['component']} */
15
+ this.component = editor.component;
16
+ /** @description Format class instance @type {__se__EditorCore['format']} */
17
+ this.format = editor.format;
18
+ /** @description HTML class instance @type {__se__EditorCore['html']} */
19
+ this.html = editor.html;
20
+ /** @description Menu class instance @type {__se__EditorCore['menu']} */
21
+ this.menu = editor.menu;
22
+ /** @description NodeTransform class instance @type {__se__EditorCore['nodeTransform']} */
23
+ this.nodeTransform = editor.nodeTransform;
24
+ /** @description Offset class instance @type {__se__EditorCore['offset']} */
25
+ this.offset = editor.offset;
26
+ /** @description Selection class instance @type {__se__EditorCore['selection']} */
27
+ this.selection = editor.selection;
28
+ /** @description Shortcuts class instance @type {__se__EditorCore['shortcuts']} */
29
+ this.shortcuts = editor.shortcuts;
30
+ /** @description UI class instance @type {__se__EditorCore['ui']} */
31
+ this.ui = editor.ui;
32
+ /** @description Viewer class instance @type {__se__EditorCore['viewer']} */
33
+ this.viewer = editor.viewer;
34
+ }
35
+
36
+ export default ClassInjector;