suneditor 3.0.0-rc.2 → 3.0.0-rc.3
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.
- package/package.json +4 -4
- package/src/core/kernel/coreKernel.js +6 -6
- package/src/core/kernel/kernelInjector.js +4 -4
- package/src/core/logic/dom/inline.js +9 -5
- package/src/core/schema/options.js +73 -53
- package/src/helper/dom/domCheck.js +2 -1
- package/src/interfaces/contracts.js +6 -5
- package/src/interfaces/plugins.js +7 -6
- package/src/modules/contract/Browser.js +5 -3
- package/src/modules/ui/ModalAnchorEditor.js +1 -1
- package/src/plugins/browser/audioGallery.js +1 -1
- package/src/plugins/browser/fileBrowser.js +3 -3
- package/src/plugins/browser/fileGallery.js +3 -3
- package/src/plugins/browser/imageGallery.js +3 -3
- package/src/plugins/browser/videoGallery.js +3 -3
- package/src/plugins/command/blockquote.js +3 -3
- package/src/plugins/command/exportPDF.js +3 -3
- package/src/plugins/command/fileUpload.js +5 -4
- package/src/plugins/command/list_bulleted.js +3 -3
- package/src/plugins/command/list_numbered.js +3 -3
- package/src/plugins/dropdown/align.js +3 -3
- package/src/plugins/dropdown/backgroundColor.js +3 -3
- package/src/plugins/dropdown/blockStyle.js +3 -3
- package/src/plugins/dropdown/font.js +3 -3
- package/src/plugins/dropdown/fontColor.js +3 -3
- package/src/plugins/dropdown/hr.js +3 -3
- package/src/plugins/dropdown/layout.js +3 -3
- package/src/plugins/dropdown/lineHeight.js +3 -3
- package/src/plugins/dropdown/list.js +3 -3
- package/src/plugins/dropdown/paragraphStyle.js +3 -3
- package/src/plugins/dropdown/table/index.js +3 -3
- package/src/plugins/dropdown/template.js +3 -3
- package/src/plugins/dropdown/textStyle.js +3 -3
- package/src/plugins/field/mention.js +3 -3
- package/src/plugins/input/fontSize.js +3 -3
- package/src/plugins/input/pageNavigator.js +3 -3
- package/src/plugins/modal/audio.js +5 -4
- package/src/plugins/modal/drawing.js +3 -3
- package/src/plugins/modal/embed.js +7 -5
- package/src/plugins/modal/image/index.js +6 -5
- package/src/plugins/modal/link.js +3 -3
- package/src/plugins/modal/math.js +3 -3
- package/src/plugins/modal/video/index.js +9 -6
- package/src/plugins/popup/anchor.js +3 -3
- package/src/themes/cobalt.css +33 -33
- package/src/themes/cream.css +155 -0
- package/src/themes/dark.css +103 -102
- package/src/themes/midnight.css +155 -0
- package/types/core/kernel/kernelInjector.d.ts +4 -4
- package/types/core/logic/dom/inline.d.ts +9 -5
- package/types/core/schema/options.d.ts +152 -94
- package/types/helper/dom/domCheck.d.ts +2 -1
- package/types/interfaces/contracts.d.ts +6 -5
- package/types/interfaces/plugins.d.ts +4 -3
- package/types/modules/contract/Browser.d.ts +4 -2
- package/types/plugins/browser/audioGallery.d.ts +1 -1
- package/types/plugins/browser/fileBrowser.d.ts +2 -2
- package/types/plugins/browser/fileGallery.d.ts +2 -2
- package/types/plugins/browser/imageGallery.d.ts +2 -2
- package/types/plugins/browser/videoGallery.d.ts +2 -2
- package/types/plugins/command/exportPDF.d.ts +2 -2
- package/types/plugins/command/fileUpload.d.ts +6 -4
- package/types/plugins/dropdown/align.d.ts +2 -2
- package/types/plugins/dropdown/backgroundColor.d.ts +2 -2
- package/types/plugins/dropdown/blockStyle.d.ts +2 -2
- package/types/plugins/dropdown/font.d.ts +2 -2
- package/types/plugins/dropdown/fontColor.d.ts +2 -2
- package/types/plugins/dropdown/hr.d.ts +2 -2
- package/types/plugins/dropdown/layout.d.ts +2 -2
- package/types/plugins/dropdown/lineHeight.d.ts +2 -2
- package/types/plugins/dropdown/paragraphStyle.d.ts +2 -2
- package/types/plugins/dropdown/table/index.d.ts +2 -2
- package/types/plugins/dropdown/template.d.ts +2 -2
- package/types/plugins/dropdown/textStyle.d.ts +2 -2
- package/types/plugins/field/mention.d.ts +2 -2
- package/types/plugins/input/fontSize.d.ts +2 -2
- package/types/plugins/modal/audio.d.ts +6 -4
- package/types/plugins/modal/drawing.d.ts +2 -2
- package/types/plugins/modal/embed.d.ts +8 -5
- package/types/plugins/modal/image/index.d.ts +8 -6
- package/types/plugins/modal/link.d.ts +2 -2
- package/types/plugins/modal/math.d.ts +2 -2
- package/types/plugins/modal/video/index.d.ts +10 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "suneditor",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.3",
|
|
4
4
|
"description": "Vanilla JavaScript based WYSIWYG web editor",
|
|
5
5
|
"author": "Yi JiHong",
|
|
6
6
|
"license": "MIT",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"@babel/preset-env": "^7.28.3",
|
|
83
83
|
"@codemirror/lang-html": "^6.4.10",
|
|
84
84
|
"@codemirror/lang-javascript": "^6.2.4",
|
|
85
|
-
"@google-cloud/translate": "^9.
|
|
85
|
+
"@google-cloud/translate": "^9.3.0",
|
|
86
86
|
"@octokit/rest": "^21.1.1",
|
|
87
87
|
"@playwright/test": "^1.56.0",
|
|
88
88
|
"@typescript-eslint/eslint-plugin": "^8.45.0",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"codemirror5": "npm:codemirror@5.65.20",
|
|
98
98
|
"cross-env": "^7.0.3",
|
|
99
99
|
"css-loader": "^7.1.2",
|
|
100
|
-
"css-minimizer-webpack-plugin": "^
|
|
100
|
+
"css-minimizer-webpack-plugin": "^8.0.0",
|
|
101
101
|
"csstype": "^3.1.3",
|
|
102
102
|
"dependency-cruiser": "^17.1.0",
|
|
103
103
|
"eslint": "^9.36.0",
|
|
@@ -170,4 +170,4 @@
|
|
|
170
170
|
"web editor",
|
|
171
171
|
"browser editor"
|
|
172
172
|
]
|
|
173
|
-
}
|
|
173
|
+
}
|
|
@@ -111,13 +111,13 @@ class CoreKernel {
|
|
|
111
111
|
// L2: Config
|
|
112
112
|
this.#registerConfig(product, options);
|
|
113
113
|
|
|
114
|
-
//
|
|
114
|
+
// Deps Phase 1: Config deps added to $ (available to Logic constructors)
|
|
115
115
|
this.#buildConfigDeps();
|
|
116
116
|
|
|
117
117
|
// L3: Logic (dom, shell, ui)
|
|
118
118
|
this.#registerLogic(product);
|
|
119
119
|
|
|
120
|
-
//
|
|
120
|
+
// Deps Phase 2: Logic deps added to $
|
|
121
121
|
this.#assignLogicDeps();
|
|
122
122
|
|
|
123
123
|
//----------------------------------------------
|
|
@@ -145,8 +145,8 @@ class CoreKernel {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
|
-
* @description
|
|
149
|
-
* Logic constructors can access `kernel
|
|
148
|
+
* @description Deps Phase 1: Build Deps bag with config entries only.
|
|
149
|
+
* Logic constructors can access the Deps bag via `kernel.$`.
|
|
150
150
|
*/
|
|
151
151
|
#buildConfigDeps() {
|
|
152
152
|
const contextProvider = this.#config.get('contextProvider');
|
|
@@ -236,8 +236,8 @@ class CoreKernel {
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
/**
|
|
239
|
-
* @description
|
|
240
|
-
* Called after all logic instances are registered
|
|
239
|
+
* @description Deps Phase 2: Add logic entries to the Deps bag (`$`).
|
|
240
|
+
* Called after all logic instances are registered.
|
|
241
241
|
*/
|
|
242
242
|
#assignLogicDeps() {
|
|
243
243
|
const pluginManager = this.#logic.get('pluginManager');
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @description Base class for kernel consumers (plugins,
|
|
3
|
-
* -
|
|
4
|
-
* -
|
|
5
|
-
* - Eliminates circular references by routing through the
|
|
2
|
+
* @description Base class for kernel consumers (plugins, event orchestrator).
|
|
3
|
+
* - Injects `this.$` (Deps bag) — the shared dependency object built by CoreKernel.
|
|
4
|
+
* - `$` is NOT the kernel itself; it is the dependency context that the kernel provides.
|
|
5
|
+
* - Eliminates circular references by routing through the Deps bag.
|
|
6
6
|
*/
|
|
7
7
|
class KernelInjector {
|
|
8
8
|
/** @type {SunEditor.Deps} */
|
|
@@ -34,17 +34,21 @@ class Inline {
|
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* @description Adds, updates, or deletes style nodes from selected text (a, span, strong, etc.).
|
|
37
|
-
* - 1. If `styleNode` is provided, a node with the same tags and attributes is added to the
|
|
37
|
+
* - 1. If `styleNode` is provided, a node with the same tags and attributes is added to the selection.
|
|
38
38
|
* - 2. If the same tag already exists, only its attributes are updated.
|
|
39
39
|
* - 3. If `styleNode` is `null`, existing nodes are updated or removed without adding new ones.
|
|
40
|
-
* - 4. Styles matching those in `stylesToModify` are removed.
|
|
40
|
+
* - 4. Styles matching those in `stylesToModify` are removed.
|
|
41
|
+
* - (Use CSS attribute names, e.g., `background-color`)
|
|
41
42
|
* - 5. Classes matching those in `stylesToModify` (prefixed with `"."`) are removed.
|
|
42
43
|
* - 6. `stylesToModify` is used to avoid duplicate property values from `styleNode`.
|
|
43
|
-
* - 7. Nodes with all styles
|
|
44
|
+
* - 7. Nodes with all styles/classes removed are deleted.
|
|
45
|
+
* - Applies when they match `styleNode`, are in `nodesToRemove`, or `styleNode` is `null`.
|
|
44
46
|
* - 8. Tags matching names in `nodesToRemove` are deleted regardless of their style and class.
|
|
45
|
-
* - 9. If `strictRemove` is `true`, nodes in `nodesToRemove` are only removed
|
|
47
|
+
* - 9. If `strictRemove` is `true`, nodes in `nodesToRemove` are only removed
|
|
48
|
+
* - if all their styles and classes are removed.
|
|
46
49
|
* - 10. The function won't modify nodes if the parent has the same class and style values.
|
|
47
|
-
* - However, if `nodesToRemove` has values, it will work and separate text nodes
|
|
50
|
+
* - However, if `nodesToRemove` has values, it will work and separate text nodes
|
|
51
|
+
* - even if there's no node to replace.
|
|
48
52
|
* @param {?Node} styleNode The element to be added to the selection. If `null`, only existing nodes are modified or removed.
|
|
49
53
|
* @param {Object} [options] Options
|
|
50
54
|
* @param {Array<string>} [options.stylesToModify=null] Array of style or class names to check and modify.
|
|
@@ -118,16 +118,17 @@ export const DEFAULTS = {
|
|
|
118
118
|
* @property {boolean} [iframe_fullPage=false] - Allows the usage of HTML, HEAD, BODY tags and DOCTYPE declaration on the `iframe`.
|
|
119
119
|
* @property {Object<string, string>} [iframe_attributes={}] - Attributes of the `iframe`. (e.g. {'allow-scripts': 'true'})
|
|
120
120
|
* @property {Array<string>} [iframe_cssFileName=["suneditor"]] - CSS files to apply inside the iframe.
|
|
121
|
-
* - String: Filename pattern to search in document
|
|
122
|
-
* - "
|
|
123
|
-
* -
|
|
124
|
-
* -
|
|
121
|
+
* - String: Filename pattern to search in document `<link>` tags.
|
|
122
|
+
* - (e.g. "suneditor" or "suneditor.[a-z0-9]+" matches "suneditor.abc123.css")
|
|
123
|
+
* - "*": Wildcard to include ALL stylesheets from the page.
|
|
124
|
+
* - Array: Multiple patterns (e.g. ["suneditor", "custom", "*"]).
|
|
125
|
+
* - Absolute URLs and data URLs (data:text/css,) are also supported.
|
|
125
126
|
* ///
|
|
126
127
|
*
|
|
127
128
|
* === Statusbar & Character Counter ===
|
|
128
129
|
* @property {boolean} [statusbar=true] - Enables the status bar.
|
|
129
|
-
* @property {boolean} [statusbar_showPathLabel=true] - Displays the current node structure
|
|
130
|
-
* @property {boolean} [statusbar_resizeEnable=true] - Enables resize function of bottom status bar
|
|
130
|
+
* @property {boolean} [statusbar_showPathLabel=true] - Displays the current node structure in the status bar.
|
|
131
|
+
* @property {boolean} [statusbar_resizeEnable=true] - Enables resize function of the bottom status bar.
|
|
131
132
|
* @property {boolean} [charCounter=false] - Shows the number of characters in the editor.
|
|
132
133
|
* - If the `maxCharCount` option has a value, it becomes `true`.
|
|
133
134
|
* @property {?number} [charCounter_max=null] - The maximum number of characters allowed to be inserted into the editor.
|
|
@@ -198,15 +199,16 @@ export const DEFAULTS = {
|
|
|
198
199
|
* @property {Object<string, string>} [__tagStyles=CONSTANTS.TAG_STYLES] - The basic tags that serves as the base for `tagStyles`
|
|
199
200
|
* - The default follows {@link DEFAULTS.TAG_STYLES}
|
|
200
201
|
* @property {string} [__defaultElementWhitelist] - A custom string used to construct a list of HTML elements to allow.
|
|
201
|
-
* - The final list
|
|
202
|
+
* - The final list (regex pattern) is dynamically generated according to the following rules:
|
|
202
203
|
* - A list of required elements, {@link DEFAULTS.REQUIRED_ELEMENT_WHITELIST}, is always included.
|
|
203
|
-
* - If
|
|
204
|
-
* - If
|
|
204
|
+
* - If this option (`__defaultElementWhitelist`) is provided as a string: That value is used.
|
|
205
|
+
* - If not provided or not a string: The default {@link DEFAULTS.ELEMENT_WHITELIST} is used.
|
|
205
206
|
* - 1. If no options are given, the final pattern is:
|
|
206
207
|
* - 'a|img|p|div|...' (REQUIRED + DEFAULT)
|
|
207
208
|
* - 2. If options are given directly, the final pattern is:
|
|
208
209
|
* - 'a|img|custom|tags' (REQUIRED + options.__defaultElementWhitelist)
|
|
209
|
-
* @property {string} [__defaultAttributeWhitelist=CONSTANTS.ATTRIBUTE_WHITELIST] - A complete list of attributes that are allowed by default on all tags.
|
|
210
|
+
* @property {string} [__defaultAttributeWhitelist=CONSTANTS.ATTRIBUTE_WHITELIST] - A complete list of attributes that are allowed by default on all tags.
|
|
211
|
+
* - Delimiter: "|" (e.g. "href|target").
|
|
210
212
|
* - The default follows {@link DEFAULTS.ATTRIBUTE_WHITELIST}
|
|
211
213
|
* ///
|
|
212
214
|
*
|
|
@@ -225,10 +227,9 @@ export const DEFAULTS = {
|
|
|
225
227
|
*
|
|
226
228
|
* === Filters & Behavior ===
|
|
227
229
|
* @property {boolean} [__lineFormatFilter=true] - Line format filter configuration.
|
|
228
|
-
* @property {Array<string>} [__listCommonStyle=["fontSize", "color", "fontFamily", "fontWeight", "fontStyle"]] - Defines the
|
|
229
|
-
* - when a text style is applied to the entire list item.
|
|
230
|
+
* @property {Array<string>} [__listCommonStyle=["fontSize", "color", "fontFamily", "fontWeight", "fontStyle"]] - Defines the styles applied directly to `<li>` when a text style is set on the entire list item.
|
|
230
231
|
* - For example, when changing the font size or color of a list item (`<li>`),
|
|
231
|
-
* - these styles
|
|
232
|
+
* - these styles apply to the `<li>` tag instead of wrapping content in additional tags.
|
|
232
233
|
* @property {{pluginName: string, we: boolean}|boolean} [__pluginRetainFilter=true] - Plugin retain filter configuration. (Internal use primarily)
|
|
233
234
|
* - You can turn it off/on globally with `true`/`false` or set it per plugin. (e.g. { table: false })
|
|
234
235
|
*/
|
|
@@ -255,7 +256,8 @@ export const DEFAULTS = {
|
|
|
255
256
|
* @property {Object<string, string>} [lang] - Language configuration. default : EN
|
|
256
257
|
* @property {Object<string, string>} [icons] - Overrides the default icons.
|
|
257
258
|
* @property {"ltr"|"rtl"} [textDirection="ltr"] - Text direction: `ltr` or `rtl`.
|
|
258
|
-
* @property {Array<string>} [reverseButtons=['indent-outdent']] - An array of command pairs whose shortcut icons should be opposite each other
|
|
259
|
+
* @property {Array<string>} [reverseButtons=['indent-outdent']] - An array of command pairs whose shortcut icons should be opposite each other.
|
|
260
|
+
* - Depends on the `textDirection` mode.
|
|
259
261
|
* ///
|
|
260
262
|
*
|
|
261
263
|
* === Strict & Advanced Filtering ===
|
|
@@ -269,6 +271,13 @@ export const DEFAULTS = {
|
|
|
269
271
|
* }} [strictMode=true] - Enables strict filtering of tags, attributes, and styles.
|
|
270
272
|
* - Use `true` to enable all filters (default), or an object to control individual filters.
|
|
271
273
|
* - Setting `false` is not supported; use the object form to disable specific filters instead.
|
|
274
|
+
* - :filter description
|
|
275
|
+
* - `tagFilter`: Filters disallowed HTML tags (`elementWhitelist`/`elementBlacklist`)
|
|
276
|
+
* - `formatFilter`: Filters format elements (`formatLine`/`formatBlock`)
|
|
277
|
+
* - `classFilter`: Filters disallowed CSS class names (`allowedClassName`)
|
|
278
|
+
* - `textStyleTagFilter`: Filters text style tags (b, i, u, span, etc.)
|
|
279
|
+
* - `attrFilter`: Filters disallowed HTML attributes (`attributeWhitelist`/`attributeBlacklist`)
|
|
280
|
+
* - `styleFilter`: Filters disallowed inline styles (`spanStyles`/`lineStyles`/`allUsedStyles`)
|
|
272
281
|
* @property {Array<string>} [scopeSelectionTags=CONSTANTS.SCOPE_SELECTION_TAGS] - Tags treated as whole units when selecting all content.
|
|
273
282
|
* - The default follows {@link DEFAULTS.SCOPE_SELECTION_TAGS}
|
|
274
283
|
* ///
|
|
@@ -276,21 +285,25 @@ export const DEFAULTS = {
|
|
|
276
285
|
* === Content Filtering & Formatting ===
|
|
277
286
|
* ==
|
|
278
287
|
* #### 1) Tag & Element Control
|
|
279
|
-
* @property {string} [elementWhitelist=""] - Specifies HTML elements to additionally allow beyond the
|
|
280
|
-
* -
|
|
281
|
-
*
|
|
288
|
+
* @property {string} [elementWhitelist=""] - Specifies HTML elements to additionally allow beyond the default allow list.
|
|
289
|
+
* - Delimiter: "|" (e.g. "p|div", "*").
|
|
290
|
+
* - Added to the default list determined by {@link PrivateBaseOptions.__defaultElementWhitelist}.
|
|
291
|
+
* @property {string} [elementBlacklist=""] - Specifies HTML elements that should not be used.
|
|
292
|
+
* - Delimiter: "|" (e.g. "script|style").
|
|
282
293
|
* - Tags specified here will eventually be removed, even if they are included in other whitelists.
|
|
283
294
|
* @property {string} [allowedEmptyTags=CONSTANTS.ALLOWED_EMPTY_NODE_LIST] - A list of tags that are allowed to be kept even if their values are empty.
|
|
284
295
|
* - The default follows {@link DEFAULTS.ALLOWED_EMPTY_NODE_LIST}
|
|
285
|
-
* -
|
|
296
|
+
* - Concatenated with `ALLOWED_EMPTY_NODE_LIST` to form the final `allowedEmptyTags` list.
|
|
286
297
|
* @property {string} [allowedClassName=""] - Allowed class names.
|
|
287
298
|
* - Added the default value {@link DEFAULTS.CLASS_NAME}
|
|
288
299
|
* ///
|
|
289
300
|
*
|
|
290
301
|
* #### 2) Attribute Control
|
|
291
|
-
* @property {{[key: string]: string|undefined}} [attributeWhitelist=null] - Specifies additional attributes to allow for each tag.
|
|
292
|
-
* -
|
|
293
|
-
*
|
|
302
|
+
* @property {{[key: string]: string|undefined}} [attributeWhitelist=null] - Specifies additional attributes to allow for each tag.
|
|
303
|
+
* - (e.g. {a: "href|target", img: "src|alt", "*": "id"})
|
|
304
|
+
* - Rules specified here will be merged into {@link PrivateBaseOptions.__defaultAttributeWhitelist}.
|
|
305
|
+
* @property {{[key: string]: string|undefined}} [attributeBlacklist=null] - Specifies attributes to disallow by tag.
|
|
306
|
+
* - (e.g. {a: "href|target", img: "src|alt", "*": "name"})
|
|
294
307
|
* - Attributes specified here will eventually be removed even if they are allowed by other settings.
|
|
295
308
|
* - A list of required elements, {@link DEFAULTS.REQUIRED_FORMAT_LINE}, is always included.
|
|
296
309
|
* ///
|
|
@@ -299,7 +312,8 @@ export const DEFAULTS = {
|
|
|
299
312
|
* @property {string} [textStyleTags=__textStyleTags] - Additional text style tags.
|
|
300
313
|
* - The default follows {@link PrivateBaseOptions.__textStyleTags}
|
|
301
314
|
* @property {Object<string, string>} [convertTextTags={bold: "strong", underline: "u", italic: "em", strike: "del", subscript: "sub", superscript: "sup"}] - Maps text styles to specific HTML tags.
|
|
302
|
-
* @property {string} [allUsedStyles] - Specifies additional styles to the list of allowed styles.
|
|
315
|
+
* @property {string} [allUsedStyles] - Specifies additional styles to the list of allowed styles.
|
|
316
|
+
* - Delimiter: "|" (e.g. "color|background-color").
|
|
303
317
|
* @property {Object<string, string>} [tagStyles={}] - Specifies allowed styles for HTML tags.
|
|
304
318
|
* @property {string} [spanStyles=CONSTANTS.SPAN_STYLES] - Specifies allowed styles for the `span` tag.
|
|
305
319
|
* - The default follows {@link DEFAULTS.SPAN_STYLES}
|
|
@@ -307,16 +321,18 @@ export const DEFAULTS = {
|
|
|
307
321
|
* - The default follows {@link DEFAULTS.LINE_STYLES}
|
|
308
322
|
* @property {Array<string>} [fontSizeUnits=CONSTANTS.SIZE_UNITS] - Allowed font size units.
|
|
309
323
|
* - The default follows {@link DEFAULTS.SIZE_UNITS}
|
|
310
|
-
* @property {"repeat"|"always"|"none"} [retainStyleMode="repeat"] -
|
|
311
|
-
* - `repeat`:
|
|
312
|
-
* -
|
|
313
|
-
* - `
|
|
324
|
+
* @property {"repeat"|"always"|"none"} [retainStyleMode="repeat"] - Determines how inline elements (e.g. `<span>`, `<strong>`) are handled when deleting text.
|
|
325
|
+
* - `repeat`: Styles are retained unless backspace is repeatedly pressed.
|
|
326
|
+
* - Continuous pressing will eventually remove the styles.
|
|
327
|
+
* - `none`: Styles are not retained. Inline elements are immediately removed with the text.
|
|
328
|
+
* - `always`: Styles persist indefinitely unless explicitly removed.
|
|
329
|
+
* - Even if all text inside an inline element is deleted, the element itself remains.
|
|
314
330
|
* ///
|
|
315
331
|
*
|
|
316
332
|
* #### 4) Line & Block Formatting
|
|
317
333
|
* @property {string} [defaultLine="p"] - Default `line` element when inserting new lines.
|
|
318
334
|
* @property {"line"|"br"} [defaultLineBreakFormat="line"] - Specifies the default line break format.
|
|
319
|
-
* - [Recommended] `line` :
|
|
335
|
+
* - [Recommended] `line` : Line break is divided into general tags.
|
|
320
336
|
* - [Not recommended] `br` : Line breaks are treated as <br> on the same line. (like shift+enter)
|
|
321
337
|
* - Line breaks are handled as <br> within `line`.
|
|
322
338
|
* - You can create a new `line` by entering a line break twice in a row.
|
|
@@ -325,26 +341,26 @@ export const DEFAULTS = {
|
|
|
325
341
|
* - When set to `br`, performance may decrease when editing a lot of data.
|
|
326
342
|
* @property {string} [lineAttrReset=""] - Line properties that should be reset when changing lines (e.g. "id|name").
|
|
327
343
|
* @property {string} [formatLine=__defaultFormatLine] - Additionally allowed `line` elements beyond the default. Delimiter: "|" (e.g. "p|div").
|
|
328
|
-
*
|
|
329
|
-
* - `line` element also
|
|
344
|
+
* - Concatenated with {@link PrivateBaseOptions.__defaultFormatLine} to form the final `line` list.
|
|
345
|
+
* - `line` element also contains `brLine` element.
|
|
330
346
|
* @property {string} [formatBrLine=__defaultFormatBrLine] - Additionally allowed `brLine` elements beyond the default. (e.g. "PRE").
|
|
331
|
-
* -
|
|
332
|
-
* - `brLine` elements
|
|
333
|
-
* - `brLine` elements'
|
|
334
|
-
* ※ Entering the Enter key
|
|
347
|
+
* - Concatenated with {@link PrivateBaseOptions.__defaultFormatBrLine} to form the final `brLine` list.
|
|
348
|
+
* - `brLine` elements are included in the `line` element.
|
|
349
|
+
* - `brLine` elements' line break is `BR` tag.
|
|
350
|
+
* - ※ Entering the Enter key on the last line ends `brLine` and appends `line`.
|
|
335
351
|
* @property {string} [formatClosureBrLine=__defaultFormatClosureBrLine] - Additionally allowed `closureBrLine` elements beyond the default.
|
|
336
|
-
* -
|
|
337
|
-
* - `closureBrLine` elements
|
|
338
|
-
* - `closureBrLine` elements'
|
|
352
|
+
* - Concatenated with {@link PrivateBaseOptions.__defaultFormatClosureBrLine} for the final `closureBrLine` list.
|
|
353
|
+
* - `closureBrLine` elements are included in the `brLine`.
|
|
354
|
+
* - `closureBrLine` elements' line break is `BR` tag.
|
|
339
355
|
* - ※ You cannot exit this format with the Enter key or Backspace key.
|
|
340
356
|
* - ※ Use it only in special cases. ([ex] format of table cells)
|
|
341
357
|
* @property {string} [formatBlock=__defaultFormatBlock] - Additionally allowed `block` elements beyond the default.
|
|
342
|
-
* -
|
|
343
|
-
* - `block`
|
|
358
|
+
* - Concatenated with {@link PrivateBaseOptions.__defaultFormatBlock} to form the final `block` list.
|
|
359
|
+
* - `block` wraps the `line` and `component`.
|
|
344
360
|
* @property {string} [formatClosureBlock=__defaultFormatClosureBlock] - Additionally allowed `closureBlock` elements beyond the default.
|
|
345
|
-
* -
|
|
346
|
-
* - `closureBlock` elements
|
|
347
|
-
* - `closureBlock` element
|
|
361
|
+
* - Concatenated with {@link PrivateBaseOptions.__defaultFormatClosureBlock} for the final `closureBlock` list.
|
|
362
|
+
* - `closureBlock` elements are included in the `block`.
|
|
363
|
+
* - `closureBlock` element wraps the `line` and `component`.
|
|
348
364
|
* - ※ You cannot exit this format with the Enter key or Backspace key.
|
|
349
365
|
* - ※ Use it only in special cases. (e.g. format of table cells)
|
|
350
366
|
* ///
|
|
@@ -370,7 +386,7 @@ export const DEFAULTS = {
|
|
|
370
386
|
* === Advanced Features ===
|
|
371
387
|
* @property {boolean} [copyFormatKeepOn=false] - Keeps the format of the copied content.
|
|
372
388
|
* @property {boolean} [autoLinkify] - Automatically converts URLs into hyperlinks. (`Link` plugin required)
|
|
373
|
-
* - Default
|
|
389
|
+
* - Default: `Boolean(plugins.link)` — determined by whether the `link` plugin is enabled.
|
|
374
390
|
* @property {Array<string>} [autoStyleify=["bold", "underline", "italic", "strike"]] - Styles applied automatically on text input.
|
|
375
391
|
* @property {number} [historyStackDelayTime=400] - Delay time for history stack updates (ms).
|
|
376
392
|
* @property {string} [printClass=""] - Class name for printing.
|
|
@@ -378,7 +394,7 @@ export const DEFAULTS = {
|
|
|
378
394
|
* @property {?string} [previewTemplate=null] - Custom template for preview mode.
|
|
379
395
|
* @property {?string} [printTemplate=null] - Custom template for print mode.
|
|
380
396
|
* @property {SunEditor.ComponentInsertType} [componentInsertBehavior="auto"] - Enables automatic selection of inserted components.
|
|
381
|
-
* - For inline components: places
|
|
397
|
+
* - For inline components: places cursor near the component, or selects if no nearby range.
|
|
382
398
|
* - For block components: executes behavior based on `selectMode`:
|
|
383
399
|
* - `auto`: Move cursor to the next line if possible, otherwise select the component.
|
|
384
400
|
* - `select`: Always select the inserted component.
|
|
@@ -389,7 +405,8 @@ export const DEFAULTS = {
|
|
|
389
405
|
* @property {boolean} [freeCodeViewMode=false] - Enables free code view mode.
|
|
390
406
|
*
|
|
391
407
|
* === Dynamic Options ===
|
|
392
|
-
* @property {Object<string, *>} [externalLibs] - External libraries like CodeMirror or MathJax.
|
|
408
|
+
* @property {Object<string, *>} [externalLibs] - External libraries like CodeMirror or MathJax.
|
|
409
|
+
* - See {@link https://github.com/ARA-developer/suneditor/blob/develop/guide/external-libraries.md External Libraries Guide}
|
|
393
410
|
* @property {Object<string, boolean>} [allowedExtraTags=CONSTANTS.EXTRA_TAG_MAP] - Specifies extra allowed or disallowed tags.
|
|
394
411
|
* - The default follows {@link DEFAULTS.EXTRA_TAG_MAP}
|
|
395
412
|
* ///
|
|
@@ -458,14 +475,17 @@ export const DEFAULTS = {
|
|
|
458
475
|
* @property {Set} [buttons] - List of currently used toolbar buttons
|
|
459
476
|
* @property {Set} [buttons_sub] - List of currently used sub-toolbar buttons
|
|
460
477
|
* @property {string} [toolbar_sub_width] - Sub-toolbar width.
|
|
461
|
-
* @property {string[]} [reverseCommands] - Merged reverse command pairs array
|
|
478
|
+
* @property {string[]} [reverseCommands] - Merged reverse command pairs array.
|
|
479
|
+
* - Includes default `indent-outdent` + user's `reverseButtons`.
|
|
462
480
|
*
|
|
463
481
|
* @property {*} [codeMirror] - CodeMirror configuration object from `externalLibs.codeMirror`.
|
|
464
|
-
* @property {boolean} [codeMirror6Editor] - Whether CodeMirror 6 is available (base-level flag).
|
|
482
|
+
* @property {boolean} [codeMirror6Editor] - Whether CodeMirror 6 is available (base-level flag).
|
|
483
|
+
* - Frame-level stores the actual EditorView instance.
|
|
465
484
|
* @property {boolean} [codeMirror5Editor] - Whether CodeMirror 5 is available (base-level flag). Frame-level stores the actual CM5 instance.
|
|
466
485
|
* @property {boolean} [hasCodeMirror] - Uses CodeMirror for code view.
|
|
467
486
|
*
|
|
468
|
-
* @property {Set<string>} [allUsedStyles] - Processed set of all allowed CSS styles.
|
|
487
|
+
* @property {Set<string>} [allUsedStyles] - Processed set of all allowed CSS styles.
|
|
488
|
+
* - Converted from user's `string` input ("|" delimited) to `Set<string>` in constructor.
|
|
469
489
|
*/
|
|
470
490
|
|
|
471
491
|
// ================================================================================================================================
|
|
@@ -601,12 +621,12 @@ export const OPTION_FIXED_FLAG = {
|
|
|
601
621
|
|
|
602
622
|
/**
|
|
603
623
|
* @typedef {Object} StrictModeOptions
|
|
604
|
-
* @property {boolean} tagFilter
|
|
605
|
-
* @property {boolean} formatFilter
|
|
606
|
-
* @property {boolean} classFilter
|
|
607
|
-
* @property {boolean} textStyleTagFilter
|
|
608
|
-
* @property {boolean} attrFilter
|
|
609
|
-
* @property {boolean} styleFilter
|
|
624
|
+
* @property {boolean} tagFilter - Filters disallowed HTML tags (`elementWhitelist`/`elementBlacklist`)
|
|
625
|
+
* @property {boolean} formatFilter - Filters format elements (`formatLine`/`formatBlock`)
|
|
626
|
+
* @property {boolean} classFilter - Filters disallowed CSS class names (`allowedClassName`)
|
|
627
|
+
* @property {boolean} textStyleTagFilter - Filters text style tags (b, i, u, span, etc.)
|
|
628
|
+
* @property {boolean} attrFilter - Filters disallowed HTML attributes (`attributeWhitelist`/`attributeBlacklist`)
|
|
629
|
+
* @property {boolean} styleFilter - Filters disallowed inline styles (`spanStyles`/`lineStyles`/`allUsedStyles`)
|
|
610
630
|
*/
|
|
611
631
|
|
|
612
632
|
/**
|
|
@@ -26,7 +26,8 @@ export function isZeroWidth(text) {
|
|
|
26
26
|
* @description Determine if this offset is the edge offset of container
|
|
27
27
|
* @param {Node} container The node of the selection object. (range.startContainer..)
|
|
28
28
|
* @param {number} offset The offset of the selection object. (core.getRange().startOffset...)
|
|
29
|
-
* @param {?("front"|"end")} [dir] Select check point
|
|
29
|
+
* @param {?("front"|"end")} [dir] Select check point.
|
|
30
|
+
* - `"front"`: Front edge, `"end"`: End edge, `undefined`: Both edge.
|
|
30
31
|
* @returns {boolean}
|
|
31
32
|
*/
|
|
32
33
|
export function isEdgePoint(container, offset, dir) {
|
|
@@ -29,14 +29,14 @@ export class ModuleModal {
|
|
|
29
29
|
/**
|
|
30
30
|
* @optional
|
|
31
31
|
* Executes the method that is called when a plugin's modal is opened.
|
|
32
|
-
* @param {boolean} isUpdate -
|
|
32
|
+
* @param {boolean} isUpdate - Whether the modal is for editing (`true`) or creating a new one (`false`).
|
|
33
33
|
* @returns {void}
|
|
34
34
|
*/
|
|
35
35
|
modalOn(isUpdate) {}
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* @optional
|
|
39
|
-
* This function is called before the modal window
|
|
39
|
+
* This function is called before the modal window opens or closes.
|
|
40
40
|
* @returns {void}
|
|
41
41
|
*/
|
|
42
42
|
modalInit() {}
|
|
@@ -44,7 +44,7 @@ export class ModuleModal {
|
|
|
44
44
|
/**
|
|
45
45
|
* @optional
|
|
46
46
|
* Modal off callback.
|
|
47
|
-
* @param {boolean} isUpdate -
|
|
47
|
+
* @param {boolean} isUpdate - Whether the modal is for editing (`true`) or creating a new one (`false`).
|
|
48
48
|
* @returns {void}
|
|
49
49
|
*/
|
|
50
50
|
modalOff(isUpdate) {}
|
|
@@ -104,7 +104,7 @@ export class ModuleController {
|
|
|
104
104
|
export class ModuleBrowser {
|
|
105
105
|
/**
|
|
106
106
|
* @optional
|
|
107
|
-
* Executes the method that is called when a `Browser` module
|
|
107
|
+
* Executes the method that is called when a `Browser` module is opened.
|
|
108
108
|
* @returns {void}
|
|
109
109
|
*/
|
|
110
110
|
browserInit() {}
|
|
@@ -123,7 +123,8 @@ export class ModuleColorPicker {
|
|
|
123
123
|
/**
|
|
124
124
|
* @optional
|
|
125
125
|
* Executes the method called when a button of `ColorPicker` module is clicked.
|
|
126
|
-
* -
|
|
126
|
+
* - When applying the `ColorPicker` module globally to the `dropdown` menu,
|
|
127
|
+
* - the default `action` method is not called.
|
|
127
128
|
* @param {SunEditor.Module.HueSlider.Color} color - Selected color information
|
|
128
129
|
* @returns {void}
|
|
129
130
|
*/
|
|
@@ -22,16 +22,17 @@ class Base extends KernelInjector {
|
|
|
22
22
|
* Plugin-specific options
|
|
23
23
|
* @type {{eventIndex?: number, isInputComponent?: boolean}}
|
|
24
24
|
* @property {number} [eventIndex=0] - Plugin event handler execution priority (higher = later)
|
|
25
|
-
* @property {boolean} [isInputComponent=false] - Allow keyboard input inside component (e.g., table cells)
|
|
25
|
+
* @property {boolean} [isInputComponent=false] - Allow keyboard input inside component (e.g., table cells).
|
|
26
|
+
* - Prevents auto-selection on arrow keys.
|
|
26
27
|
*/
|
|
27
28
|
static options = {};
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
31
|
* @constructor
|
|
31
|
-
* @param {SunEditor.Kernel}
|
|
32
|
+
* @param {SunEditor.Kernel} kernel - The Kernel instance
|
|
32
33
|
*/
|
|
33
|
-
constructor(
|
|
34
|
-
super(
|
|
34
|
+
constructor(kernel) {
|
|
35
|
+
super(kernel);
|
|
35
36
|
|
|
36
37
|
// plugin basic properties
|
|
37
38
|
/** @type {string} */
|
|
@@ -61,7 +62,7 @@ export class PluginBrowser extends Base {
|
|
|
61
62
|
|
|
62
63
|
/**
|
|
63
64
|
* @abstract
|
|
64
|
-
* @description Executes the method that is called when a `Browser` module
|
|
65
|
+
* @description Executes the method that is called when a `Browser` module is opened.
|
|
65
66
|
* @param {?(target: Node) => *} [onSelectfunction] - Method to be executed after selecting an item in the gallery
|
|
66
67
|
* @returns {void}
|
|
67
68
|
*/
|
|
@@ -71,7 +72,7 @@ export class PluginBrowser extends Base {
|
|
|
71
72
|
|
|
72
73
|
/**
|
|
73
74
|
* @abstract
|
|
74
|
-
* @description Executes the method that is called when a `Browser` module
|
|
75
|
+
* @description Executes the method that is called when a `Browser` module is closed.
|
|
75
76
|
* @returns {void}
|
|
76
77
|
*/
|
|
77
78
|
close() {
|
|
@@ -31,7 +31,8 @@ import ApiManager from '../manager/ApiManager';
|
|
|
31
31
|
* @property {string} [listClass] - Class name of list div. Required. Can be overridden in browser.
|
|
32
32
|
* @property {(item: BrowserFile) => string} [drawItemHandler] - Function that defines the HTML of a file item. Required. Can be overridden in browser.
|
|
33
33
|
* @property {Array<*>} [props] - `props` argument to `drawItemHandler` function. Optional. Can be overridden in browser.
|
|
34
|
-
* @property {number} [columnSize] - Number of `div.se-file-item-column` to be created.
|
|
34
|
+
* @property {number} [columnSize] - Number of `div.se-file-item-column` to be created.
|
|
35
|
+
* - Optional. Can be overridden in browser. Default: 4.
|
|
35
36
|
* @property {((item: BrowserFile) => string)} [thumbnail] - Default thumbnail
|
|
36
37
|
*/
|
|
37
38
|
|
|
@@ -577,7 +578,7 @@ class Browser {
|
|
|
577
578
|
}
|
|
578
579
|
|
|
579
580
|
/**
|
|
580
|
-
* @param {SunEditor.Deps} $ -
|
|
581
|
+
* @param {SunEditor.Deps} $ - Kernel dependencies
|
|
581
582
|
* @param {boolean} useSearch - Whether to use the search function
|
|
582
583
|
* @returns {{ html: HTMLElement, header: HTMLElement, titleArea: HTMLElement, tagArea: HTMLElement, body: HTMLElement, list: HTMLElement, side: HTMLElement, wrapper: HTMLElement, _loading: HTMLElement }} HTML
|
|
583
584
|
*/
|
|
@@ -637,7 +638,8 @@ function CreateHTMLInfos($, useSearch) {
|
|
|
637
638
|
/**
|
|
638
639
|
* @this {{ thumbnail: ((...args: *) => *), props: Array<*> }}
|
|
639
640
|
* @description Define the HTML of the item to be put in `div.se-file-item-column`.
|
|
640
|
-
* - Format:
|
|
641
|
+
* - Format:
|
|
642
|
+
* - `[ { src: "image src", name: "name(@option)", alt: "image alt(@option)", tag: "tag name(@option)" } ]`
|
|
641
643
|
* @param {BrowserFile} item Item of the response data's array
|
|
642
644
|
*/
|
|
643
645
|
function DrawItems(item) {
|
|
@@ -549,7 +549,7 @@ class ModalAnchorEditor {
|
|
|
549
549
|
}
|
|
550
550
|
|
|
551
551
|
/**
|
|
552
|
-
* @param {SunEditor.Deps} $ -
|
|
552
|
+
* @param {SunEditor.Deps} $ - Kernel dependencies
|
|
553
553
|
* @param {ModalAnchorEditorParams} params - ModalAnchorEditor options
|
|
554
554
|
* @param {Array<string>} relList - REL attribute list
|
|
555
555
|
* @returns {HTMLElement} - Modal form element
|
|
@@ -19,7 +19,7 @@ class AudioGallery extends PluginBrowser {
|
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* @constructor
|
|
22
|
-
* @param {SunEditor.Kernel} kernel - The
|
|
22
|
+
* @param {SunEditor.Kernel} kernel - The Kernel instance
|
|
23
23
|
* @param {AudioGalleryPluginOptions} pluginOptions
|
|
24
24
|
*/
|
|
25
25
|
constructor(kernel, pluginOptions) {
|
|
@@ -20,12 +20,12 @@ class FileBrowser extends PluginBrowser {
|
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* @constructor
|
|
23
|
-
* @param {SunEditor.Kernel}
|
|
23
|
+
* @param {SunEditor.Kernel} kernel - The Kernel instance
|
|
24
24
|
* @param {FileBrowserPluginOptions} pluginOptions
|
|
25
25
|
*/
|
|
26
|
-
constructor(
|
|
26
|
+
constructor(kernel, pluginOptions) {
|
|
27
27
|
// plugin bisic properties
|
|
28
|
-
super(
|
|
28
|
+
super(kernel);
|
|
29
29
|
this.title = this.$.lang.fileBrowser;
|
|
30
30
|
this.icon = 'file_browser';
|
|
31
31
|
|
|
@@ -19,12 +19,12 @@ class FileGallery extends PluginBrowser {
|
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* @constructor
|
|
22
|
-
* @param {SunEditor.Kernel}
|
|
22
|
+
* @param {SunEditor.Kernel} kernel - The Kernel instance
|
|
23
23
|
* @param {FileGalleryPluginOptions} pluginOptions
|
|
24
24
|
*/
|
|
25
|
-
constructor(
|
|
25
|
+
constructor(kernel, pluginOptions) {
|
|
26
26
|
// plugin bisic properties
|
|
27
|
-
super(
|
|
27
|
+
super(kernel);
|
|
28
28
|
this.title = this.$.lang.fileGallery;
|
|
29
29
|
this.icon = 'file_gallery';
|
|
30
30
|
|
|
@@ -18,12 +18,12 @@ class ImageGallery extends PluginBrowser {
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* @constructor
|
|
21
|
-
* @param {SunEditor.Kernel}
|
|
21
|
+
* @param {SunEditor.Kernel} kernel - The Kernel instance
|
|
22
22
|
* @param {ImageGalleryPluginOptions} pluginOptions
|
|
23
23
|
*/
|
|
24
|
-
constructor(
|
|
24
|
+
constructor(kernel, pluginOptions) {
|
|
25
25
|
// plugin bisic properties
|
|
26
|
-
super(
|
|
26
|
+
super(kernel);
|
|
27
27
|
this.title = this.$.lang.imageGallery;
|
|
28
28
|
this.icon = 'image_gallery';
|
|
29
29
|
|
|
@@ -19,12 +19,12 @@ class VideoGallery extends PluginBrowser {
|
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* @constructor
|
|
22
|
-
* @param {SunEditor.Kernel}
|
|
22
|
+
* @param {SunEditor.Kernel} kernel - The Kernel instance
|
|
23
23
|
* @param {VideoGalleryPluginOptions} pluginOptions
|
|
24
24
|
*/
|
|
25
|
-
constructor(
|
|
25
|
+
constructor(kernel, pluginOptions) {
|
|
26
26
|
// plugin bisic properties
|
|
27
|
-
super(
|
|
27
|
+
super(kernel);
|
|
28
28
|
this.title = this.$.lang.videoGallery;
|
|
29
29
|
this.icon = 'video_gallery';
|
|
30
30
|
|
|
@@ -11,10 +11,10 @@ class Blockquote extends PluginCommand {
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @constructor
|
|
14
|
-
* @param {SunEditor.Kernel}
|
|
14
|
+
* @param {SunEditor.Kernel} kernel - The Kernel instance
|
|
15
15
|
*/
|
|
16
|
-
constructor(
|
|
17
|
-
super(
|
|
16
|
+
constructor(kernel) {
|
|
17
|
+
super(kernel);
|
|
18
18
|
// plugin basic properties
|
|
19
19
|
this.title = this.$.lang.tag_blockquote;
|
|
20
20
|
this.icon = 'blockquote';
|
|
@@ -20,11 +20,11 @@ class ExportPDF extends PluginCommand {
|
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* @constructor
|
|
23
|
-
* @param {SunEditor.Kernel}
|
|
23
|
+
* @param {SunEditor.Kernel} kernel - The Kernel instance
|
|
24
24
|
* @param {ExportPDFPluginOptions} pluginOptions - plugin options
|
|
25
25
|
*/
|
|
26
|
-
constructor(
|
|
27
|
-
super(
|
|
26
|
+
constructor(kernel, pluginOptions) {
|
|
27
|
+
super(kernel);
|
|
28
28
|
// plugin basic properties
|
|
29
29
|
this.title = this.$.lang.exportPDF;
|
|
30
30
|
this.icon = 'PDF';
|