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.
- package/CONTRIBUTING.md +8 -8
- package/README.md +44 -49
- package/dist/suneditor.min.css +1 -1
- package/dist/suneditor.min.js +1 -1
- package/package.json +95 -53
- package/src/assets/design/color.css +2 -2
- package/src/assets/design/size.css +2 -0
- package/src/assets/icons/defaultIcons.js +16 -1
- package/src/assets/suneditor-contents.css +9 -8
- package/src/assets/suneditor.css +29 -26
- package/src/core/{section → base}/actives.js +20 -12
- package/src/core/base/history.js +4 -4
- package/src/core/class/char.js +10 -10
- package/src/core/class/component.js +146 -57
- package/src/core/class/format.js +94 -2458
- package/src/core/class/html.js +187 -129
- package/src/core/class/inline.js +1853 -0
- package/src/core/class/listFormat.js +582 -0
- package/src/core/class/menu.js +14 -3
- package/src/core/class/nodeTransform.js +9 -14
- package/src/core/class/offset.js +162 -197
- package/src/core/class/selection.js +137 -34
- package/src/core/class/toolbar.js +73 -52
- package/src/core/class/ui.js +11 -11
- package/src/core/class/viewer.js +56 -55
- package/src/core/config/context.js +122 -0
- package/src/core/config/frameContext.js +204 -0
- package/src/core/config/options.js +639 -0
- package/src/core/editor.js +181 -108
- package/src/core/event/actions/index.js +229 -0
- package/src/core/event/effects/common.registry.js +60 -0
- package/src/core/event/effects/keydown.registry.js +551 -0
- package/src/core/event/effects/ruleHelpers.js +145 -0
- package/src/core/{base → event}/eventManager.js +119 -201
- package/src/core/event/executor.js +21 -0
- package/src/core/{base/eventHandlers → event/handlers}/handler_toolbar.js +4 -4
- package/src/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.js +2 -2
- package/src/core/event/handlers/handler_ww_input.js +77 -0
- package/src/core/event/handlers/handler_ww_key.js +228 -0
- package/src/core/{base/eventHandlers → event/handlers}/handler_ww_mouse.js +3 -3
- package/src/core/event/ports.js +211 -0
- package/src/core/event/reducers/keydown.reducer.js +89 -0
- package/src/core/event/rules/keydown.rule.arrow.js +54 -0
- package/src/core/event/rules/keydown.rule.backspace.js +202 -0
- package/src/core/event/rules/keydown.rule.delete.js +126 -0
- package/src/core/event/rules/keydown.rule.enter.js +144 -0
- package/src/core/event/rules/keydown.rule.tab.js +29 -0
- package/src/core/section/constructor.js +79 -388
- package/src/core/section/documentType.js +47 -26
- package/src/core/util/instanceCheck.js +59 -0
- package/src/editorInjector/_classes.js +4 -0
- package/src/editorInjector/_core.js +17 -7
- package/src/editorInjector/index.js +10 -2
- package/src/events.js +6 -0
- package/src/helper/clipboard.js +24 -10
- package/src/helper/converter.js +17 -12
- package/src/helper/dom/domCheck.js +22 -3
- package/src/helper/dom/domQuery.js +91 -45
- package/src/helper/dom/domUtils.js +93 -19
- package/src/helper/dom/index.js +4 -0
- package/src/helper/env.js +11 -7
- package/src/helper/keyCodeMap.js +4 -3
- package/src/langs/ckb.js +1 -1
- package/src/langs/cs.js +1 -1
- package/src/langs/da.js +1 -1
- package/src/langs/de.js +1 -1
- package/src/langs/en.js +1 -1
- package/src/langs/es.js +1 -1
- package/src/langs/fa.js +1 -1
- package/src/langs/fr.js +1 -1
- package/src/langs/he.js +1 -1
- package/src/langs/hu.js +1 -1
- package/src/langs/it.js +1 -1
- package/src/langs/ja.js +1 -1
- package/src/langs/km.js +1 -1
- package/src/langs/ko.js +1 -1
- package/src/langs/lv.js +1 -1
- package/src/langs/nl.js +1 -1
- package/src/langs/pl.js +1 -1
- package/src/langs/pt_br.js +10 -10
- package/src/langs/ro.js +1 -1
- package/src/langs/ru.js +1 -1
- package/src/langs/se.js +1 -1
- package/src/langs/tr.js +1 -1
- package/src/langs/uk.js +1 -1
- package/src/langs/ur.js +1 -1
- package/src/langs/zh_cn.js +1 -1
- package/src/modules/ApiManager.js +25 -18
- package/src/modules/Browser.js +52 -61
- package/src/modules/ColorPicker.js +37 -38
- package/src/modules/Controller.js +85 -79
- package/src/modules/Figure.js +275 -187
- package/src/modules/FileManager.js +86 -92
- package/src/modules/HueSlider.js +67 -35
- package/src/modules/Modal.js +84 -77
- package/src/modules/ModalAnchorEditor.js +62 -79
- package/src/modules/SelectMenu.js +89 -86
- package/src/plugins/browser/audioGallery.js +9 -5
- package/src/plugins/browser/fileBrowser.js +10 -6
- package/src/plugins/browser/fileGallery.js +9 -5
- package/src/plugins/browser/imageGallery.js +9 -5
- package/src/plugins/browser/videoGallery.js +11 -6
- package/src/plugins/command/blockquote.js +1 -0
- package/src/plugins/command/exportPDF.js +11 -8
- package/src/plugins/command/fileUpload.js +41 -29
- package/src/plugins/command/list_bulleted.js +2 -1
- package/src/plugins/command/list_numbered.js +2 -1
- package/src/plugins/dropdown/align.js +8 -2
- package/src/plugins/dropdown/backgroundColor.js +19 -11
- package/src/plugins/dropdown/font.js +15 -9
- package/src/plugins/dropdown/fontColor.js +19 -11
- package/src/plugins/dropdown/formatBlock.js +7 -2
- package/src/plugins/dropdown/hr.js +7 -3
- package/src/plugins/dropdown/layout.js +6 -2
- package/src/plugins/dropdown/lineHeight.js +8 -3
- package/src/plugins/dropdown/list.js +2 -1
- package/src/plugins/dropdown/paragraphStyle.js +15 -11
- package/src/plugins/dropdown/{table.js → table/index.js} +514 -362
- package/src/plugins/dropdown/template.js +6 -2
- package/src/plugins/dropdown/textStyle.js +7 -3
- package/src/plugins/field/mention.js +33 -27
- package/src/plugins/input/fontSize.js +44 -37
- package/src/plugins/input/pageNavigator.js +3 -2
- package/src/plugins/modal/audio.js +90 -85
- package/src/plugins/modal/drawing.js +58 -66
- package/src/plugins/modal/embed.js +193 -180
- package/src/plugins/modal/image.js +441 -439
- package/src/plugins/modal/link.js +31 -8
- package/src/plugins/modal/math.js +23 -22
- package/src/plugins/modal/video.js +233 -230
- package/src/plugins/popup/anchor.js +24 -18
- package/src/suneditor.js +69 -24
- package/src/typedef.js +42 -19
- package/types/assets/icons/defaultIcons.d.ts +8 -0
- package/types/core/class/char.d.ts +1 -1
- package/types/core/class/component.d.ts +29 -7
- package/types/core/class/format.d.ts +4 -354
- package/types/core/class/html.d.ts +13 -4
- package/types/core/class/inline.d.ts +263 -0
- package/types/core/class/listFormat.d.ts +135 -0
- package/types/core/class/menu.d.ts +10 -2
- package/types/core/class/offset.d.ts +24 -26
- package/types/core/class/selection.d.ts +2 -0
- package/types/core/class/toolbar.d.ts +24 -11
- package/types/core/class/ui.d.ts +1 -1
- package/types/core/class/viewer.d.ts +1 -1
- package/types/core/config/context.d.ts +157 -0
- package/types/core/config/frameContext.d.ts +367 -0
- package/types/core/config/options.d.ts +1119 -0
- package/types/core/editor.d.ts +101 -66
- package/types/core/event/actions/index.d.ts +47 -0
- package/types/core/event/effects/common.registry.d.ts +50 -0
- package/types/core/event/effects/keydown.registry.d.ts +73 -0
- package/types/core/event/effects/ruleHelpers.d.ts +31 -0
- package/types/core/{base → event}/eventManager.d.ts +15 -46
- package/types/core/event/executor.d.ts +6 -0
- package/types/core/event/handlers/handler_ww_input.d.ts +41 -0
- package/types/core/{base/eventHandlers/handler_ww_key_input.d.ts → event/handlers/handler_ww_key.d.ts} +4 -6
- package/types/core/event/ports.d.ts +255 -0
- package/types/core/event/reducers/keydown.reducer.d.ts +75 -0
- package/types/core/event/rules/keydown.rule.arrow.d.ts +8 -0
- package/types/core/event/rules/keydown.rule.backspace.d.ts +9 -0
- package/types/core/event/rules/keydown.rule.delete.d.ts +9 -0
- package/types/core/event/rules/keydown.rule.enter.d.ts +9 -0
- package/types/core/event/rules/keydown.rule.tab.d.ts +9 -0
- package/types/core/section/constructor.d.ts +101 -631
- package/types/core/section/documentType.d.ts +14 -4
- package/types/core/util/instanceCheck.d.ts +50 -0
- package/types/editorInjector/_classes.d.ts +4 -0
- package/types/editorInjector/_core.d.ts +17 -7
- package/types/editorInjector/index.d.ts +10 -2
- package/types/events.d.ts +1 -0
- package/types/helper/clipboard.d.ts +2 -2
- package/types/helper/converter.d.ts +6 -9
- package/types/helper/dom/domCheck.d.ts +7 -0
- package/types/helper/dom/domQuery.d.ts +19 -8
- package/types/helper/dom/domUtils.d.ts +24 -2
- package/types/helper/dom/index.d.ts +86 -1
- package/types/helper/env.d.ts +6 -1
- package/types/helper/index.d.ts +7 -1
- package/types/helper/keyCodeMap.d.ts +3 -3
- package/types/index.d.ts +23 -117
- package/types/langs/index.d.ts +2 -2
- package/types/modules/ApiManager.d.ts +1 -8
- package/types/modules/Browser.d.ts +4 -62
- package/types/modules/ColorPicker.d.ts +4 -21
- package/types/modules/Controller.d.ts +8 -64
- package/types/modules/Figure.d.ts +54 -50
- package/types/modules/FileManager.d.ts +1 -13
- package/types/modules/HueSlider.d.ts +13 -3
- package/types/modules/Modal.d.ts +0 -43
- package/types/modules/ModalAnchorEditor.d.ts +0 -73
- package/types/modules/SelectMenu.d.ts +0 -85
- package/types/modules/index.d.ts +3 -3
- package/types/plugins/browser/audioGallery.d.ts +29 -18
- package/types/plugins/browser/fileBrowser.d.ts +38 -27
- package/types/plugins/browser/fileGallery.d.ts +29 -18
- package/types/plugins/browser/imageGallery.d.ts +24 -16
- package/types/plugins/browser/videoGallery.d.ts +29 -18
- package/types/plugins/command/blockquote.d.ts +1 -0
- package/types/plugins/command/exportPDF.d.ts +18 -18
- package/types/plugins/command/fileUpload.d.ts +65 -45
- package/types/plugins/command/list_bulleted.d.ts +1 -0
- package/types/plugins/command/list_numbered.d.ts +1 -0
- package/types/plugins/dropdown/align.d.ts +13 -8
- package/types/plugins/dropdown/backgroundColor.d.ts +30 -19
- package/types/plugins/dropdown/font.d.ts +13 -12
- package/types/plugins/dropdown/fontColor.d.ts +30 -19
- package/types/plugins/dropdown/formatBlock.d.ts +13 -8
- package/types/plugins/dropdown/hr.d.ts +15 -11
- package/types/plugins/dropdown/layout.d.ts +15 -11
- package/types/plugins/dropdown/lineHeight.d.ts +16 -11
- package/types/plugins/dropdown/list.d.ts +1 -0
- package/types/plugins/dropdown/paragraphStyle.d.ts +31 -27
- package/types/plugins/dropdown/table/index.d.ts +582 -0
- package/types/plugins/dropdown/table.d.ts +41 -86
- package/types/plugins/dropdown/template.d.ts +15 -11
- package/types/plugins/dropdown/textStyle.d.ts +19 -11
- package/types/plugins/field/mention.d.ts +58 -56
- package/types/plugins/index.d.ts +38 -38
- package/types/plugins/input/fontSize.d.ts +46 -50
- package/types/plugins/modal/audio.d.ts +26 -56
- package/types/plugins/modal/drawing.d.ts +0 -85
- package/types/plugins/modal/embed.d.ts +15 -79
- package/types/plugins/modal/image.d.ts +24 -136
- package/types/plugins/modal/link.d.ts +34 -15
- package/types/plugins/modal/math.d.ts +0 -16
- package/types/plugins/modal/video.d.ts +17 -86
- package/types/plugins/popup/anchor.d.ts +1 -8
- package/types/suneditor.d.ts +70 -19
- package/types/typedef.d.ts +60 -46
- package/src/core/base/eventHandlers/handler_ww_key_input.js +0 -1200
- package/src/core/section/context.js +0 -102
- package/types/core/section/context.d.ts +0 -45
- package/types/langs/_Lang.d.ts +0 -194
- /package/src/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.js +0 -0
- /package/types/core/{section → base}/actives.d.ts +0 -0
- /package/types/core/{base/eventHandlers → event/handlers}/handler_toolbar.d.ts +0 -0
- /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.d.ts +0 -0
- /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.d.ts +0 -0
- /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_mouse.d.ts +0 -0
|
@@ -0,0 +1,1119 @@
|
|
|
1
|
+
/** --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */
|
|
2
|
+
/**
|
|
3
|
+
* ================================================================================================================================
|
|
4
|
+
* === UTILITIES : Manage Option Map ⭐️
|
|
5
|
+
* =================================================================================================================================
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {Object} BaseOptionsMap
|
|
9
|
+
* @description A Map containing all processed editor base options.
|
|
10
|
+
* - This Map contains all keys from {@link AllBaseOptions}, where:
|
|
11
|
+
* - Keys are option names (string)
|
|
12
|
+
* - Values depend on the specific option (see {@link AllBaseOptions} for details)
|
|
13
|
+
*
|
|
14
|
+
* @property {(k: keyof AllBaseOptions) => *} get - Retrieves the value of a specific option.
|
|
15
|
+
* @property {(k: keyof AllBaseOptions, v: *) => void} set - Sets the value of a specific option.
|
|
16
|
+
* @property {(k: keyof AllBaseOptions) => boolean} has - Checks if a specific option exists.
|
|
17
|
+
* @property {() => Object<keyof AllBaseOptions, *>} getAll - Retrieves all options as an object.
|
|
18
|
+
* @property {(options: Object<keyof AllBaseOptions, *>) => void} setMany - Sets multiple options at once.
|
|
19
|
+
* @property {(newMap: Map<string, *>) => void} reset - Replaces all options with a new Map.
|
|
20
|
+
* @property {() => void} clear - Clears all stored options.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* @typedef {Object} FrameOptionsMap
|
|
24
|
+
* @description A Map containing all processed frame-level options.
|
|
25
|
+
* - This Map contains all keys from {@link AllFrameOptions}, where:
|
|
26
|
+
* - Keys are option names (string)
|
|
27
|
+
* - Values depend on the specific option (see {@link AllFrameOptions} for details)
|
|
28
|
+
*
|
|
29
|
+
* @property {(k: keyof AllFrameOptions) => *} get - Retrieves the value of a specific option.
|
|
30
|
+
* @property {(k: keyof AllFrameOptions, v: *) => void} set - Sets the value of a specific option.
|
|
31
|
+
* @property {(k: keyof AllFrameOptions) => boolean} has - Checks if a specific option exists.
|
|
32
|
+
* @property {() => Object<keyof AllFrameOptions, *>} getAll - Retrieves all options as an object.
|
|
33
|
+
* @property {(options: Object<keyof AllFrameOptions, *>) => void} setMany - Sets multiple options at once.
|
|
34
|
+
* @property {(newMap: Map<string, *>) => void} reset - Replaces all options with a new Map.
|
|
35
|
+
* @property {() => void} clear - Clears all stored options.
|
|
36
|
+
*/
|
|
37
|
+
/** ================================================================================================================================= */
|
|
38
|
+
/** ================================================================================================================================= */
|
|
39
|
+
/**
|
|
40
|
+
* @description Creates a utility wrapper for editor frame options.
|
|
41
|
+
* Provides get, set, has, getAll, and setMany methods with internal Map support.
|
|
42
|
+
* @param {*} editor - The editor instance
|
|
43
|
+
* @returns {FrameOptionsMap}
|
|
44
|
+
*/
|
|
45
|
+
export function FrameOptionsMap(editor: any): FrameOptionsMap;
|
|
46
|
+
export type FrameOptionsMap = any;
|
|
47
|
+
/**
|
|
48
|
+
* @description Creates a utility wrapper for editor base options.
|
|
49
|
+
* - Provides get, set, has, getAll, and setMany methods with internal Map support.
|
|
50
|
+
* @param {*} editor - The editor instance
|
|
51
|
+
* @returns {BaseOptionsMap}
|
|
52
|
+
*/
|
|
53
|
+
export function BaseOptionsMap(editor: any): BaseOptionsMap;
|
|
54
|
+
export type BaseOptionsMap = any;
|
|
55
|
+
export namespace DEFAULTS {
|
|
56
|
+
let BUTTON_LIST: (string | string[])[];
|
|
57
|
+
let REQUIRED_FORMAT_LINE: string;
|
|
58
|
+
let REQUIRED_ELEMENT_WHITELIST: string;
|
|
59
|
+
let ELEMENT_WHITELIST: string;
|
|
60
|
+
let TEXT_STYLE_TAGS: string;
|
|
61
|
+
let SCOPE_SELECTION_TAGS: string[];
|
|
62
|
+
let ATTRIBUTE_WHITELIST: string;
|
|
63
|
+
let FORMAT_LINE: string;
|
|
64
|
+
let FORMAT_BR_LINE: string;
|
|
65
|
+
let FORMAT_CLOSURE_BR_LINE: string;
|
|
66
|
+
let FORMAT_BLOCK: string;
|
|
67
|
+
let FORMAT_CLOSURE_BLOCK: string;
|
|
68
|
+
let ALLOWED_EMPTY_NODE_LIST: string;
|
|
69
|
+
let SIZE_UNITS: string[];
|
|
70
|
+
let CLASS_NAME: string;
|
|
71
|
+
let CLASS_MJX: string;
|
|
72
|
+
let EXTRA_TAG_MAP: {
|
|
73
|
+
script: boolean;
|
|
74
|
+
style: boolean;
|
|
75
|
+
meta: boolean;
|
|
76
|
+
link: boolean;
|
|
77
|
+
'[a-z]+:[a-z]+': boolean;
|
|
78
|
+
};
|
|
79
|
+
let CONTENT_STYLES: string;
|
|
80
|
+
let TAG_STYLES: {
|
|
81
|
+
'table|th|td': string;
|
|
82
|
+
'table|td': string;
|
|
83
|
+
tr: string;
|
|
84
|
+
col: string;
|
|
85
|
+
caption: string;
|
|
86
|
+
'ol|ul': string;
|
|
87
|
+
figure: string;
|
|
88
|
+
figcaption: string;
|
|
89
|
+
'img|video|iframe': string;
|
|
90
|
+
hr: string;
|
|
91
|
+
};
|
|
92
|
+
let SPAN_STYLES: string;
|
|
93
|
+
let LINE_STYLES: string;
|
|
94
|
+
let RETAIN_STYLE_MODE: string[];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* ================================================================================================================================
|
|
98
|
+
* === OPTIONS TYPES : Frame
|
|
99
|
+
* =================================================================================================================================
|
|
100
|
+
*/
|
|
101
|
+
/**
|
|
102
|
+
* ================================================================================================================================
|
|
103
|
+
* @typedef {Object} EditorFrameOptions
|
|
104
|
+
*
|
|
105
|
+
* **Frame-level editable area options**
|
|
106
|
+
* -----------------
|
|
107
|
+
*
|
|
108
|
+
* === Content & Editing ===
|
|
109
|
+
* @property {string} [value=""] - Initial value for the editor.
|
|
110
|
+
* @property {string} [placeholder=""] - Placeholder text.
|
|
111
|
+
* @property {Object<string, string>} [editableFrameAttributes={spellcheck: "false"}] - Attributes for the editable frame[.sun-editor-editable]. (e.g. [key]: value)
|
|
112
|
+
*
|
|
113
|
+
* === Layout & Sizing ===
|
|
114
|
+
* @property {string} [width="100%"] - Width for the editor.
|
|
115
|
+
* @property {string} [minWidth=""] - Min width for the editor.
|
|
116
|
+
* @property {string} [maxWidth=""] - Max width for the editor.
|
|
117
|
+
* @property {string} [height="auto"] - Height for the editor.
|
|
118
|
+
* @property {string} [minHeight=""] - Min height for the editor.
|
|
119
|
+
* @property {string} [maxHeight=""] - Max height for the editor.
|
|
120
|
+
* @property {string} [editorStyle=""] - Style string of the top frame of the editor. (e.g. "border: 1px solid #ccc;").
|
|
121
|
+
*
|
|
122
|
+
* === Iframe Mode ===
|
|
123
|
+
* @property {boolean} [iframe=false] - Content will be placed in an iframe and isolated from the rest of the page.
|
|
124
|
+
* @property {boolean} [iframe_fullPage=false] - Allows the usage of HTML, HEAD, BODY tags and DOCTYPE declaration on the "iframe".
|
|
125
|
+
* @property {Object<string, string>} [iframe_attributes={}] - Attributes of the "iframe". (e.g. {'scrolling': 'no'})
|
|
126
|
+
* @property {string} [iframe_cssFileName="suneditor"] - Name or Array of the CSS file to apply inside the iframe.
|
|
127
|
+
* - You can also use regular expressions.
|
|
128
|
+
* - Applied by searching by filename in the link tag of document,
|
|
129
|
+
* - or put the URL value (".css" can be omitted).
|
|
130
|
+
*
|
|
131
|
+
* === Statusbar & Character Counter ===
|
|
132
|
+
* @property {boolean} [statusbar=true] - Enables the status bar.
|
|
133
|
+
* @property {boolean} [statusbar_showPathLabel=true] - Displays the current node structure to status bar.
|
|
134
|
+
* @property {boolean} [statusbar_resizeEnable=true] - Enables resize function of bottom status bar
|
|
135
|
+
* @property {boolean} [charCounter=false] - Shows the number of characters in the editor.
|
|
136
|
+
* - If the maxCharCount option has a value, it becomes true.
|
|
137
|
+
* @property {number} [charCounter_max=null] - The maximum number of characters allowed to be inserted into the editor.
|
|
138
|
+
* @property {string} [charCounter_label=null] - Text to be displayed in the "charCounter" area of the bottom bar. (e.g. "Characters : 20/200")
|
|
139
|
+
* @property {"char"|"byte"|"byte-html"} [charCounter_type="char"] - Defines the calculation method of the "charCounter" option.
|
|
140
|
+
* - 'char': Characters length.
|
|
141
|
+
* - 'byte': Binary data size of characters.
|
|
142
|
+
* - 'byte-html': Binary data size of the full HTML string.
|
|
143
|
+
*
|
|
144
|
+
* === Advanced ===
|
|
145
|
+
* @property {Object} [__statusbarEvent] - Status bar event configuration.
|
|
146
|
+
* ================================================================================================================================
|
|
147
|
+
*/
|
|
148
|
+
/**
|
|
149
|
+
* @typedef {Object} OptionStyleResult
|
|
150
|
+
* @property {string} top - Styles applied to the top container (e.g. width, z-index, etc).
|
|
151
|
+
* @property {string} frame - Styles applied to the iframe container (e.g. height, min-height).
|
|
152
|
+
* @property {string} editor - Styles applied to the editable content area.
|
|
153
|
+
*/
|
|
154
|
+
/**
|
|
155
|
+
* ================================================================================================================================
|
|
156
|
+
* @typedef {Object} InternalFrameOptions
|
|
157
|
+
* **Runtime-only frame options (computed internally, cannot be set by users)**
|
|
158
|
+
* @property {OptionStyleResult} [_defaultStyles] - Enables fixed positioning for the editor frame.
|
|
159
|
+
* ================================================================================================================================
|
|
160
|
+
*/
|
|
161
|
+
/**
|
|
162
|
+
* @typedef {EditorFrameOptions & InternalFrameOptions} AllFrameOptions
|
|
163
|
+
*/
|
|
164
|
+
/** --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */
|
|
165
|
+
/**
|
|
166
|
+
* ================================================================================================================================
|
|
167
|
+
* === OPTIONS TYPES : Base
|
|
168
|
+
* =================================================================================================================================
|
|
169
|
+
*/
|
|
170
|
+
/**
|
|
171
|
+
* ================================================================================================================================
|
|
172
|
+
* @typedef {Object} PrivateBaseOptions
|
|
173
|
+
*
|
|
174
|
+
* **Advanced internal options (user-configurable, prefixed with `__`)**
|
|
175
|
+
* -----------------
|
|
176
|
+
*
|
|
177
|
+
* === Defaults & Whitelists ===
|
|
178
|
+
* @property {string} [__textStyleTags=CONSTANTS.TEXT_STYLE_TAGS] - The basic tags that serves as the base for "textStyleTags"
|
|
179
|
+
* - The default follows {@link DEFAULTS.TEXT_STYLE_TAGS}
|
|
180
|
+
* @property {Object<string, string>} [__tagStyles=CONSTANTS.TAG_STYLES] - The basic tags that serves as the base for "tagStyles"
|
|
181
|
+
* - The default follows {@link DEFAULTS.TAG_STYLES}
|
|
182
|
+
* @property {string} [__defaultElementWhitelist] - A custom string used to construct a list of HTML elements to allow.
|
|
183
|
+
* - The final list of allowed elements (regex pattern) is dynamically generated according to the following rules:
|
|
184
|
+
* - A list of required elements, {@link DEFAULTS.REQUIRED_ELEMENT_WHITELIST}, is always included.
|
|
185
|
+
* - If a string value is provided for this option (`__defaultElementWhitelist`):** That string value is used.
|
|
186
|
+
* - If this option is not provided or is not a string: The default constant {@link DEFAULTS.ELEMENT_WHITELIST} is used.
|
|
187
|
+
* - 1. If no options are given, the final pattern is:
|
|
188
|
+
* - 'a|img|p|div|...' (REQUIRED + DEFAULT)
|
|
189
|
+
* - 2. If options are given directly, the final pattern is:
|
|
190
|
+
* - 'a|img|custom|tags' (REQUIRED + options.__defaultElementWhitelist)
|
|
191
|
+
* @property {string} [__defaultAttributeWhitelist=CONSTANTS.ATTRIBUTE_WHITELIST] - A complete list of attributes that are allowed by default on all tags. Delimiter: "|" (e.g. "href|target").
|
|
192
|
+
* - The default follows {@link DEFAULTS.ATTRIBUTE_WHITELIST}
|
|
193
|
+
*
|
|
194
|
+
* === Formatting ===
|
|
195
|
+
* @property {string} [__defaultFormatLine=CONSTANTS.FORMAT_LINE] - Specifies the tag to be used as the editor's default "line" element.
|
|
196
|
+
* - The default follows {@link DEFAULTS.FORMAT_LINE}
|
|
197
|
+
* @property {string} [__defaultFormatBrLine=CONSTANTS.FORMAT_BR_LINE] - Specifies the tag to be used as the editor's default "brLine" element.
|
|
198
|
+
* - The default follows {@link DEFAULTS.FORMAT_BR_LINE}
|
|
199
|
+
* @property {string} [__defaultFormatClosureBrLine=CONSTANTS.FORMAT_CLOSURE_BR_LINE] - Specifies the tag to be used as the editor's default "closureBrLine" element.
|
|
200
|
+
* - The default follows {@link DEFAULTS.FORMAT_CLOSURE_BR_LINE}
|
|
201
|
+
* @property {string} [__defaultFormatBlock=CONSTANTS.FORMAT_BLOCK] - Specifies the tag to be used as the editor's default "block" element.
|
|
202
|
+
* - The default follows {@link DEFAULTS.FORMAT_BLOCK}
|
|
203
|
+
* @property {string} [__defaultFormatClosureBlock=CONSTANTS.FORMAT_CLOSURE_BLOCK] - Specifies the tag to be used as the editor's default "closureBlock" element.
|
|
204
|
+
* - The default follows {@link DEFAULTS.FORMAT_CLOSURE_BLOCK}
|
|
205
|
+
*
|
|
206
|
+
* === Filters & Behavior ===
|
|
207
|
+
* @property {boolean} [__lineFormatFilter=true] - Line format filter configuration.
|
|
208
|
+
* @property {Array<string>} [__listCommonStyle=["fontSize", "color", "fontFamily", "fontWeight", "fontStyle"]] - Defines the list of styles that are applied directly to the `<li>` element
|
|
209
|
+
* - when a text style is applied to the entire list item.
|
|
210
|
+
* - For example, when changing the font size or color of a list item (`<li>`),
|
|
211
|
+
* - these styles will be applied to the `<li>` tag instead of wrapping the content inside additional tags.
|
|
212
|
+
* @property {{pluginName: string, we: boolean}|boolean} [__pluginRetainFilter=true] - Plugin retain filter configuration. (Internal use primarily)
|
|
213
|
+
* - You can turn it off/on globally with true/false or set it per plugin. (e.g. { table: false })
|
|
214
|
+
* @property {boolean} [__allowedScriptTag=false] - Allows the `<script>` tag to be used in the editor.
|
|
215
|
+
* ================================================================================================================================
|
|
216
|
+
*/
|
|
217
|
+
/**
|
|
218
|
+
* ================================================================================================================================
|
|
219
|
+
* @typedef {Object} EditorBaseOptions
|
|
220
|
+
*
|
|
221
|
+
* **Top-level editor configuration**
|
|
222
|
+
* -----------------
|
|
223
|
+
*
|
|
224
|
+
* === Plugins & Toolbar ===
|
|
225
|
+
* @property {Object<string, *>|Array<Object<string, *>>} [plugins] - Plugin configuration.
|
|
226
|
+
* @property {Array<string>} [excludedPlugins=[]] - Plugin configuration.
|
|
227
|
+
* @property {Array<string[]|string>} [buttonList=CONSTANTS.BUTTON_LIST] - List of toolbar buttons, grouped by sub-arrays.
|
|
228
|
+
* - The default follows {@link DEFAULTS.BUTTON_LIST}
|
|
229
|
+
*
|
|
230
|
+
* === Modes & Themes ===
|
|
231
|
+
* @property {boolean} [v2Migration=false] - Enables migration mode for SunEditor v2.
|
|
232
|
+
* @property {"classic"|"inline"|"balloon"|"balloon-always"} [mode="classic"] - Toolbar mode: "classic", "inline", "balloon", "balloon-always".
|
|
233
|
+
* @property {string} [type=""] - Editor type: "document:header,page".
|
|
234
|
+
* @property {string} [theme=""] - Editor theme.
|
|
235
|
+
* @property {Object<string, string>} [lang] - Language configuration. default : EN
|
|
236
|
+
* @property {Object<string, string>} [icons] - Overrides the default icons.
|
|
237
|
+
* @property {string} [textDirection="ltr"] - Text direction: "ltr" or "rtl".
|
|
238
|
+
* @property {Array<string>} [reverseButtons=['indent-outdent']] - An array of command pairs whose shortcut icons should be opposite each other, depending on the "textDirection" mode.
|
|
239
|
+
*
|
|
240
|
+
* === Strict & Advanced Filtering ===
|
|
241
|
+
* @property {boolean | {
|
|
242
|
+
* tagFilter: boolean,
|
|
243
|
+
* formatFilter: boolean,
|
|
244
|
+
* classFilter: boolean,
|
|
245
|
+
* textStyleTagFilter: boolean,
|
|
246
|
+
* attrFilter: boolean,
|
|
247
|
+
* styleFilter: boolean
|
|
248
|
+
* }} [strictMode=true] - Enables strict filtering of tags, attributes, and styles.
|
|
249
|
+
* @property {Array<string>} [scopeSelectionTags=CONSTANTS.SCOPE_SELECTION_TAGS] - Tags treated as whole units when selecting all content.
|
|
250
|
+
* - The default follows {@link DEFAULTS.SCOPE_SELECTION_TAGS}
|
|
251
|
+
*
|
|
252
|
+
* === Content Filtering & Formatting ===
|
|
253
|
+
* ==
|
|
254
|
+
* #### 1) Tag & Element Control
|
|
255
|
+
* @property {string} [elementWhitelist=""] - Specifies HTML elements to additionally allow beyond the 'default' allow list. Delimiter: "|" (e.g. "p|div", "*").
|
|
256
|
+
* - The value entered here will be added to the end of the default list determined by the {@link PrivateBaseOptions.__defaultElementWhitelist} logic above.
|
|
257
|
+
* @property {string} [elementBlacklist=""] - Filters by specifying HTML elements that should not be used. Delimiter: "|" (e.g. "script|style").
|
|
258
|
+
* - Tags specified here will eventually be removed, even if they are included in other whitelists.
|
|
259
|
+
* @property {string} [allowedEmptyTags=CONSTANTS.ALLOWED_EMPTY_NODE_LIST] - A list of tags that are allowed to be kept even if their values are empty.
|
|
260
|
+
* - The default follows {@link DEFAULTS.ALLOWED_EMPTY_NODE_LIST}
|
|
261
|
+
* - It is concatenated with the value of "ALLOWED_EMPTY_NODE_LIST" to form the final 'allowedEmptyTags' list.
|
|
262
|
+
* @property {string} [allowedClassName=""] - Allowed class names.
|
|
263
|
+
* - Added the default value {@link DEFAULTS.CLASS_NAME}
|
|
264
|
+
*
|
|
265
|
+
* #### 2) Attribute Control
|
|
266
|
+
* @property {Object<string, string>} [attributeWhitelist=null] - Specifies additional attributes to allow for each tag. (e.g. {a: "href|target", img: "src|alt", "*": "id"}).
|
|
267
|
+
* - Rules for objects specified here will be merged into the {@link PrivateBaseOptions.__defaultAttributeWhitelist}.
|
|
268
|
+
* @property {Object<string, string>} [attributeBlacklist=null] - Filter by specifying attributes to disallow by tag. (e.g. {a: "href|target", img: "src|alt", "*": "name"}).
|
|
269
|
+
* - Attributes specified here will eventually be removed even if they are allowed by other settings.
|
|
270
|
+
* - A list of required elements, {@link DEFAULTS.REQUIRED_FORMAT_LINE}, is always included.
|
|
271
|
+
*
|
|
272
|
+
* #### 3) Text & Inline Style Control
|
|
273
|
+
* @property {string} [textStyleTags=__textStyleTags] - Additional text style tags.
|
|
274
|
+
* - The default follows {@link PrivateBaseOptions.__textStyleTags}
|
|
275
|
+
* @property {Object<string, string>} [convertTextTags={bold: "strong", underline: "u", italic: "em", strike: "del", subscript: "sub", superscript: "sup"}] - Maps text styles to specific HTML tags.
|
|
276
|
+
* @property {string} [allUsedStyles] - Specifies additional styles to the list of allowed styles. Delimiter: "|" (e.g. "color|background-color").
|
|
277
|
+
* @property {Object<string, string>} [tagStyles={}] - Specifies allowed styles for HTML tags.
|
|
278
|
+
* @property {string} [spanStyles=CONSTANTS.SPAN_STYLES] - Specifies allowed styles for the "span" tag.
|
|
279
|
+
* - The default follows {@link DEFAULTS.SPAN_STYLES}
|
|
280
|
+
* @property {string} [lineStyles=CONSTANTS.LINE_STYLES] - Specifies allowed styles for the "line" element (p..).
|
|
281
|
+
* - The default follows {@link DEFAULTS.LINE_STYLES}
|
|
282
|
+
* @property {Array<string>} [fontSizeUnits=CONSTANTS.SIZE_UNITS] - Allowed font size units.
|
|
283
|
+
* - The default follows {@link DEFAULTS.SIZE_UNITS}
|
|
284
|
+
* @property {"repeat"|"always"|"none"} [retainStyleMode="repeat"] - This option determines how inline elements (such as <span>, <strong>, etc.) are handled when deleting text.
|
|
285
|
+
* - "repeat": Inline styles are retained unless the backspace key is repeatedly pressed. If the user continuously presses backspace, the styles will eventually be removed.
|
|
286
|
+
* - "none": Inline styles are not retained at all. When deleting text, the associated inline elements are immediately removed along with it.
|
|
287
|
+
* - "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.
|
|
288
|
+
*
|
|
289
|
+
* #### 4) Line & Block Formatting
|
|
290
|
+
* @property {string} [defaultLine="p"] - Default line element when inserting new lines.
|
|
291
|
+
* @property {"line"|"br"} [defaultLineBreakFormat="line"] - Specifies the default line break format.
|
|
292
|
+
* - [Recommended] "line" : is a line break that is divided into general tags.
|
|
293
|
+
* - [Not recommended] "br" : Line breaks are treated as <br> on the same line. (like shift+enter)
|
|
294
|
+
* - Line breaks are handled as <br> within "line".
|
|
295
|
+
* - You can create a new "line" by entering a line break twice in a row.
|
|
296
|
+
* - Formats that include "line", such as "Quote", still operate on a "line" basis.
|
|
297
|
+
* - ● suneditor processes work in "line" units.
|
|
298
|
+
* - ● When set to "br", performance may decrease when editing a lot of data.
|
|
299
|
+
* @property {string} [lineAttrReset=""] - Line properties that should be reset when changing lines (e.g. "id|name").
|
|
300
|
+
* @property {string} [formatLine=__defaultFormatLine] - Additionally allowed "line" elements beyond the default. Delimiter: "|" (e.g. "p|div").
|
|
301
|
+
* It is concatenated with the value of {@link PrivateBaseOptions.__defaultFormatLine} to form the final 'line' element list.
|
|
302
|
+
* - "line" element also contain "brLine" element
|
|
303
|
+
* @property {string} [formatBrLine=__defaultFormatBrLine] - Additionally allowed "brLine" elements beyond the default. (e.g. "PRE").
|
|
304
|
+
* - It is concatenated with the value of {@link PrivateBaseOptions.__defaultFormatBrLine} to form the final 'brLine' element list.
|
|
305
|
+
* - "brLine" elements is included in the "line" element.
|
|
306
|
+
* - "brLine" elements's line break is "BR" tag.
|
|
307
|
+
* ※ Entering the Enter key in the space on the last line ends "brLine" and appends "line".
|
|
308
|
+
* @property {string} [formatClosureBrLine=__defaultFormatClosureBrLine] - Additionally allowed "closureBrLine" elements beyond the default.
|
|
309
|
+
* - It is concatenated with the value of {@link PrivateBaseOptions.__defaultFormatClosureBrLine} to form the final 'closureBrLine' element list.
|
|
310
|
+
* - "closureBrLine" elements is included in the "brLine".
|
|
311
|
+
* - "closureBrLine" elements's line break is "BR" tag.
|
|
312
|
+
* - ※ You cannot exit this format with the Enter key or Backspace key.
|
|
313
|
+
* - ※ Use it only in special cases. ([ex] format of table cells)
|
|
314
|
+
* @property {string} [formatBlock=__defaultFormatBlock] - Additionally allowed "block" elements beyond the default.
|
|
315
|
+
* - It is concatenated with the value of {@link PrivateBaseOptions.__defaultFormatBlock} to form the final 'block' element list.
|
|
316
|
+
* - "block" is wrap the "line" and "component"
|
|
317
|
+
* @property {string} [formatClosureBlock=__defaultFormatClosureBlock] - Additionally allowed "closureBlock" elements beyond the default.
|
|
318
|
+
* - It is concatenated with the value of {@link PrivateBaseOptions.__defaultFormatClosureBlock} to form the final 'closureBlock' element list.
|
|
319
|
+
* - "closureBlock" elements is included in the "block".
|
|
320
|
+
* - "closureBlock" element is wrap the "line" and "component"
|
|
321
|
+
* - ※ You cannot exit this format with the Enter key or Backspace key.
|
|
322
|
+
* - ※ Use it only in special cases. (e.g. format of table cells)
|
|
323
|
+
*
|
|
324
|
+
* === UI & Interaction ===
|
|
325
|
+
* @property {boolean} [closeModalOutsideClick=false] - Closes modals when clicking outside.
|
|
326
|
+
* @property {boolean} [syncTabIndent=true] - Synchronizes tab indent with spaces.
|
|
327
|
+
* @property {boolean} [tabDisable=false] - Disables tab key input.
|
|
328
|
+
* @property {number|string} [toolbar_width="auto"] - Toolbar width.
|
|
329
|
+
* @property {Element|string} [toolbar_container] - Container element for the toolbar.
|
|
330
|
+
* @property {number} [toolbar_sticky=0] - Enables sticky toolbar with optional offset.
|
|
331
|
+
* @property {boolean} [toolbar_hide=false] - Hides toolbar initially.
|
|
332
|
+
* @property {Object} [subToolbar={}] - Sub-toolbar configuration.
|
|
333
|
+
* @property {Array<Array<string>>} [subToolbar.buttonList] - List of Sub-toolbar buttons, grouped by sub-arrays.
|
|
334
|
+
* @property {"balloon"|"balloon-always"} [subToolbar.mode="balloon"] - Sub-toolbar mode: "balloon", "balloon-always".
|
|
335
|
+
* @property {number|string} [subToolbar.width="auto"] - Sub-toolbar width.
|
|
336
|
+
* @property {Element|string} [statusbar_container] - Container element for the status bar.
|
|
337
|
+
* @property {boolean} [shortcutsHint=true] - Displays shortcut hints in tooltips.
|
|
338
|
+
* @property {boolean} [shortcutsDisable=false] - Disables keyboard shortcuts.
|
|
339
|
+
* @property {Object<string, Array<string>>} [shortcuts={}] - Custom keyboard shortcuts.
|
|
340
|
+
*
|
|
341
|
+
* === Advanced Features ===
|
|
342
|
+
* @property {boolean} [copyFormatKeepOn=false] - Keeps the format of the copied content.
|
|
343
|
+
* @property {boolean} [autoLinkify] - Automatically converts URLs into hyperlinks. ("Link" plugin required)
|
|
344
|
+
* - Default value is determined dynamically based on whether the 'link' plugin is enabled. (default : Boolean(plugins.link))
|
|
345
|
+
* @property {Array<string>} [autoStyleify=["bold", "underline", "italic", "strike"]] - Styles applied automatically on text input.
|
|
346
|
+
* @property {number} [historyStackDelayTime=400] - Delay time for history stack updates (ms).
|
|
347
|
+
* @property {string} [printClass=""] - Class name for printing.
|
|
348
|
+
* @property {number} [fullScreenOffset=0] - Offset applied when entering fullscreen mode.
|
|
349
|
+
* @property {string} [previewTemplate=null] - Custom template for preview mode.
|
|
350
|
+
* @property {string} [printTemplate=null] - Custom template for print mode.
|
|
351
|
+
* @property {__se__ComponentInsertBehaviorType} [componentInsertBehavior="auto"] - Enables automatic selection of inserted components.
|
|
352
|
+
* - For inline components: places the cursor near the inserted component or selects it if no nearby range is available.
|
|
353
|
+
* - For block components: executes behavior based on `selectMode`:
|
|
354
|
+
* - `auto`: Move cursor to the next line if possible, otherwise select the component.
|
|
355
|
+
* - `select`: Always select the inserted component.
|
|
356
|
+
* - `line`: Move cursor to the next line if possible, or create a new line and move there.
|
|
357
|
+
* - `none`: Do nothing.
|
|
358
|
+
* @property {string} [defaultUrlProtocol=null] - Default URL protocol for links.
|
|
359
|
+
* @property {Object<"copy", number>} [toastMessageTime={copy: 1500}] - {"copy": 1500} - Duration for displaying toast messages.
|
|
360
|
+
* @property {string} [freeCodeViewMode=false] - Enables free code view mode.
|
|
361
|
+
*
|
|
362
|
+
* === Dynamic Options ===
|
|
363
|
+
* @property {Object<string, *>} [externalLibs] - External libraries like CodeMirror or MathJax.
|
|
364
|
+
* @property {Object<string, (...args: *) => *>} [events={}] - Custom event handlers.
|
|
365
|
+
* @property {Object<string, boolean>} [allowedExtraTags=CONSTANTS.EXTRA_TAG_MAP] - Specifies extra allowed or disallowed tags.
|
|
366
|
+
* - The default follows {@link DEFAULTS.EXTRA_TAG_MAP}
|
|
367
|
+
*
|
|
368
|
+
* === Dynamic Plugin Options ===
|
|
369
|
+
* @property {Object<string, *>} [Dynamic_pluginOptions] - Dynamic plugin options, where the key is the plugin name and the value is its configuration.
|
|
370
|
+
* ================================================================================================================================
|
|
371
|
+
*/
|
|
372
|
+
/**
|
|
373
|
+
* ================================================================================================================================
|
|
374
|
+
* @typedef {Object} InternalBaseOptions
|
|
375
|
+
* -----------------
|
|
376
|
+
* **Runtime-only base options (computed internally, cannot be set by users)**
|
|
377
|
+
*
|
|
378
|
+
* @property {string} [_themeClass] - Computed className for the selected theme (e.g., 'se-theme-default').
|
|
379
|
+
* @property {string} [_type_options] - Additional sub-type string from the `type` option (after `:`).
|
|
380
|
+
* @property {string} [_allowedExtraTag] - Preprocessed allowed tag string for RegExp (e.g., "mark|figure").
|
|
381
|
+
* @property {string} [_disallowedExtraTag] - Preprocessed disallowed tag string.
|
|
382
|
+
* @property {string} [_editableClass] - Final computed editable class (used in editor wrapper).
|
|
383
|
+
* @property {boolean} [_rtl] - Whether text direction is RTL.
|
|
384
|
+
* @property {string[]} [_reverseCommandArray] - Internal key shortcut matcher for reverse commands.
|
|
385
|
+
* @property {string} [_subMode] - Sub toolbar mode (e.g., 'balloon').
|
|
386
|
+
* @property {Set<string>} [_textStyleTags] - Tag names used for text styling, plus span/li.
|
|
387
|
+
* @property {RegExp} [_textStylesRegExp] - Regex to match inline styles (e.g., fontSize, color).
|
|
388
|
+
* @property {RegExp} [_lineStylesRegExp] - Regex to match line styles (e.g., text-align, padding).
|
|
389
|
+
* @property {Object<string, string>} [_defaultStyleTagMap] - Mapping HTML tag => standard tag.
|
|
390
|
+
* @property {Object<string, string>} [_styleCommandMap] - Mapping HTML tag => command (e.g., bold, underline).
|
|
391
|
+
* @property {Object<string, string>} [_defaultTagCommand] - Mapping command => preferred tag.
|
|
392
|
+
* @property {string} [_editorElementWhitelist] - Element whitelist regex pattern for the editor.
|
|
393
|
+
*
|
|
394
|
+
* @property {Set} [buttons] - List of currently used toolbar buttons
|
|
395
|
+
* @property {Set} [buttons_sub] - List of currently used sub-toolbar buttons
|
|
396
|
+
* @property {string} [toolbar_sub_width] - Sub-toolbar width.
|
|
397
|
+
*
|
|
398
|
+
* @property {boolean} [hasCodeMirror] - Uses CodeMirror for code view.
|
|
399
|
+
* @property {*} [codeMirror5Editor] - CodeMirror5 support.
|
|
400
|
+
* @property {*} [codeMirror6Editor] - CodeMirror6 support.
|
|
401
|
+
* ================================================================================================================================
|
|
402
|
+
*/
|
|
403
|
+
/**
|
|
404
|
+
* @typedef {EditorBaseOptions & PrivateBaseOptions & EditorFrameOptions} EditorInitOptions
|
|
405
|
+
*/
|
|
406
|
+
/**
|
|
407
|
+
* @typedef {EditorBaseOptions & PrivateBaseOptions & InternalBaseOptions} AllBaseOptions
|
|
408
|
+
*/
|
|
409
|
+
/** --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */
|
|
410
|
+
/**
|
|
411
|
+
* ================================================================================================================================
|
|
412
|
+
* === OPTION FLAGS : Fixed / Resettable
|
|
413
|
+
* =================================================================================================================================
|
|
414
|
+
*/
|
|
415
|
+
/**
|
|
416
|
+
* @description For all EditorInitOptions keys, only boolean | null values are allowed.
|
|
417
|
+
* - 'fixed' → Immutable / null → Resettable.
|
|
418
|
+
* @type {Partial<Object<keyof EditorInitOptions, "fixed" | true>>}
|
|
419
|
+
*/
|
|
420
|
+
export const OPTION_FRAME_FIXED_FLAG: Partial<any>;
|
|
421
|
+
/**
|
|
422
|
+
* @description For all EditorInitOptions keys, only boolean | null values are allowed.
|
|
423
|
+
* - 'fixed' → Immutable / null → Resettable.
|
|
424
|
+
* @type {Partial<Object<keyof EditorInitOptions, "fixed" | true>>}
|
|
425
|
+
*/
|
|
426
|
+
export const OPTION_FIXED_FLAG: Partial<any>;
|
|
427
|
+
/**
|
|
428
|
+
* **Frame-level editable area options**
|
|
429
|
+
* -----------------
|
|
430
|
+
*
|
|
431
|
+
* === Content & Editing ===
|
|
432
|
+
*/
|
|
433
|
+
export type EditorFrameOptions = {
|
|
434
|
+
/**
|
|
435
|
+
* - Initial value for the editor.
|
|
436
|
+
*/
|
|
437
|
+
value?: string;
|
|
438
|
+
/**
|
|
439
|
+
* - Placeholder text.
|
|
440
|
+
*/
|
|
441
|
+
placeholder?: string;
|
|
442
|
+
/**
|
|
443
|
+
* - Attributes for the editable frame[.sun-editor-editable]. (e.g. [key]: value)
|
|
444
|
+
*
|
|
445
|
+
* === Layout & Sizing ===
|
|
446
|
+
*/
|
|
447
|
+
editableFrameAttributes?: {
|
|
448
|
+
[x: string]: string;
|
|
449
|
+
};
|
|
450
|
+
/**
|
|
451
|
+
* - Width for the editor.
|
|
452
|
+
*/
|
|
453
|
+
width?: string;
|
|
454
|
+
/**
|
|
455
|
+
* - Min width for the editor.
|
|
456
|
+
*/
|
|
457
|
+
minWidth?: string;
|
|
458
|
+
/**
|
|
459
|
+
* - Max width for the editor.
|
|
460
|
+
*/
|
|
461
|
+
maxWidth?: string;
|
|
462
|
+
/**
|
|
463
|
+
* - Height for the editor.
|
|
464
|
+
*/
|
|
465
|
+
height?: string;
|
|
466
|
+
/**
|
|
467
|
+
* - Min height for the editor.
|
|
468
|
+
*/
|
|
469
|
+
minHeight?: string;
|
|
470
|
+
/**
|
|
471
|
+
* - Max height for the editor.
|
|
472
|
+
*/
|
|
473
|
+
maxHeight?: string;
|
|
474
|
+
/**
|
|
475
|
+
* - Style string of the top frame of the editor. (e.g. "border: 1px solid #ccc;").
|
|
476
|
+
*
|
|
477
|
+
* === Iframe Mode ===
|
|
478
|
+
*/
|
|
479
|
+
editorStyle?: string;
|
|
480
|
+
/**
|
|
481
|
+
* - Content will be placed in an iframe and isolated from the rest of the page.
|
|
482
|
+
*/
|
|
483
|
+
iframe?: boolean;
|
|
484
|
+
/**
|
|
485
|
+
* - Allows the usage of HTML, HEAD, BODY tags and DOCTYPE declaration on the "iframe".
|
|
486
|
+
*/
|
|
487
|
+
iframe_fullPage?: boolean;
|
|
488
|
+
/**
|
|
489
|
+
* - Attributes of the "iframe". (e.g. {'scrolling': 'no'})
|
|
490
|
+
*/
|
|
491
|
+
iframe_attributes?: {
|
|
492
|
+
[x: string]: string;
|
|
493
|
+
};
|
|
494
|
+
/**
|
|
495
|
+
* - Name or Array of the CSS file to apply inside the iframe.
|
|
496
|
+
* - You can also use regular expressions.
|
|
497
|
+
* - Applied by searching by filename in the link tag of document,
|
|
498
|
+
* - or put the URL value (".css" can be omitted).
|
|
499
|
+
*
|
|
500
|
+
* === Statusbar & Character Counter ===
|
|
501
|
+
*/
|
|
502
|
+
iframe_cssFileName?: string;
|
|
503
|
+
/**
|
|
504
|
+
* - Enables the status bar.
|
|
505
|
+
*/
|
|
506
|
+
statusbar?: boolean;
|
|
507
|
+
/**
|
|
508
|
+
* - Displays the current node structure to status bar.
|
|
509
|
+
*/
|
|
510
|
+
statusbar_showPathLabel?: boolean;
|
|
511
|
+
/**
|
|
512
|
+
* - Enables resize function of bottom status bar
|
|
513
|
+
*/
|
|
514
|
+
statusbar_resizeEnable?: boolean;
|
|
515
|
+
/**
|
|
516
|
+
* - Shows the number of characters in the editor.
|
|
517
|
+
* - If the maxCharCount option has a value, it becomes true.
|
|
518
|
+
*/
|
|
519
|
+
charCounter?: boolean;
|
|
520
|
+
/**
|
|
521
|
+
* - The maximum number of characters allowed to be inserted into the editor.
|
|
522
|
+
*/
|
|
523
|
+
charCounter_max?: number;
|
|
524
|
+
/**
|
|
525
|
+
* - Text to be displayed in the "charCounter" area of the bottom bar. (e.g. "Characters : 20/200")
|
|
526
|
+
*/
|
|
527
|
+
charCounter_label?: string;
|
|
528
|
+
/**
|
|
529
|
+
* - Defines the calculation method of the "charCounter" option.
|
|
530
|
+
* - 'char': Characters length.
|
|
531
|
+
* - 'byte': Binary data size of characters.
|
|
532
|
+
* - 'byte-html': Binary data size of the full HTML string.
|
|
533
|
+
*
|
|
534
|
+
* === Advanced ===
|
|
535
|
+
*/
|
|
536
|
+
charCounter_type?: 'char' | 'byte' | 'byte-html';
|
|
537
|
+
/**
|
|
538
|
+
* - Status bar event configuration.
|
|
539
|
+
* ================================================================================================================================
|
|
540
|
+
*/
|
|
541
|
+
__statusbarEvent?: any;
|
|
542
|
+
};
|
|
543
|
+
export type OptionStyleResult = {
|
|
544
|
+
/**
|
|
545
|
+
* - Styles applied to the top container (e.g. width, z-index, etc).
|
|
546
|
+
*/
|
|
547
|
+
top: string;
|
|
548
|
+
/**
|
|
549
|
+
* - Styles applied to the iframe container (e.g. height, min-height).
|
|
550
|
+
*/
|
|
551
|
+
frame: string;
|
|
552
|
+
/**
|
|
553
|
+
* - Styles applied to the editable content area.
|
|
554
|
+
*/
|
|
555
|
+
editor: string;
|
|
556
|
+
};
|
|
557
|
+
/**
|
|
558
|
+
* **Runtime-only frame options (computed internally, cannot be set by users)**
|
|
559
|
+
*/
|
|
560
|
+
export type InternalFrameOptions = {
|
|
561
|
+
/**
|
|
562
|
+
* - Enables fixed positioning for the editor frame.
|
|
563
|
+
* ================================================================================================================================
|
|
564
|
+
*/
|
|
565
|
+
_defaultStyles?: OptionStyleResult;
|
|
566
|
+
};
|
|
567
|
+
export type AllFrameOptions = EditorFrameOptions & InternalFrameOptions;
|
|
568
|
+
/**
|
|
569
|
+
* **Advanced internal options (user-configurable, prefixed with `__`)**
|
|
570
|
+
* -----------------
|
|
571
|
+
*
|
|
572
|
+
* === Defaults & Whitelists ===
|
|
573
|
+
*/
|
|
574
|
+
export type PrivateBaseOptions = {
|
|
575
|
+
/**
|
|
576
|
+
* - The basic tags that serves as the base for "textStyleTags"
|
|
577
|
+
* - The default follows {@link DEFAULTS.TEXT_STYLE_TAGS}
|
|
578
|
+
*/
|
|
579
|
+
__textStyleTags?: string;
|
|
580
|
+
/**
|
|
581
|
+
* - The basic tags that serves as the base for "tagStyles"
|
|
582
|
+
* - The default follows {@link DEFAULTS.TAG_STYLES}
|
|
583
|
+
*/
|
|
584
|
+
__tagStyles?: {
|
|
585
|
+
[x: string]: string;
|
|
586
|
+
};
|
|
587
|
+
/**
|
|
588
|
+
* - A custom string used to construct a list of HTML elements to allow.
|
|
589
|
+
* - The final list of allowed elements (regex pattern) is dynamically generated according to the following rules:
|
|
590
|
+
* - A list of required elements, {@link DEFAULTS.REQUIRED_ELEMENT_WHITELIST}, is always included.
|
|
591
|
+
* - If a string value is provided for this option (`__defaultElementWhitelist`):** That string value is used.
|
|
592
|
+
* - If this option is not provided or is not a string: The default constant {@link DEFAULTS.ELEMENT_WHITELIST} is used.
|
|
593
|
+
* - 1. If no options are given, the final pattern is:
|
|
594
|
+
* - 'a|img|p|div|...' (REQUIRED + DEFAULT)
|
|
595
|
+
* - 2. If options are given directly, the final pattern is:
|
|
596
|
+
* - 'a|img|custom|tags' (REQUIRED + options.__defaultElementWhitelist)
|
|
597
|
+
*/
|
|
598
|
+
__defaultElementWhitelist?: string;
|
|
599
|
+
/**
|
|
600
|
+
* - A complete list of attributes that are allowed by default on all tags. Delimiter: "|" (e.g. "href|target").
|
|
601
|
+
* - The default follows {@link DEFAULTS.ATTRIBUTE_WHITELIST}=== Formatting ===
|
|
602
|
+
*/
|
|
603
|
+
__defaultAttributeWhitelist?: string;
|
|
604
|
+
/**
|
|
605
|
+
* - Specifies the tag to be used as the editor's default "line" element.
|
|
606
|
+
* - The default follows {@link DEFAULTS.FORMAT_LINE}
|
|
607
|
+
*/
|
|
608
|
+
__defaultFormatLine?: string;
|
|
609
|
+
/**
|
|
610
|
+
* - Specifies the tag to be used as the editor's default "brLine" element.
|
|
611
|
+
* - The default follows {@link DEFAULTS.FORMAT_BR_LINE}
|
|
612
|
+
*/
|
|
613
|
+
__defaultFormatBrLine?: string;
|
|
614
|
+
/**
|
|
615
|
+
* - Specifies the tag to be used as the editor's default "closureBrLine" element.
|
|
616
|
+
* - The default follows {@link DEFAULTS.FORMAT_CLOSURE_BR_LINE}
|
|
617
|
+
*/
|
|
618
|
+
__defaultFormatClosureBrLine?: string;
|
|
619
|
+
/**
|
|
620
|
+
* - Specifies the tag to be used as the editor's default "block" element.
|
|
621
|
+
* - The default follows {@link DEFAULTS.FORMAT_BLOCK}
|
|
622
|
+
*/
|
|
623
|
+
__defaultFormatBlock?: string;
|
|
624
|
+
/**
|
|
625
|
+
* - Specifies the tag to be used as the editor's default "closureBlock" element.
|
|
626
|
+
* - The default follows {@link DEFAULTS.FORMAT_CLOSURE_BLOCK}=== Filters & Behavior ===
|
|
627
|
+
*/
|
|
628
|
+
__defaultFormatClosureBlock?: string;
|
|
629
|
+
/**
|
|
630
|
+
* - Line format filter configuration.
|
|
631
|
+
*/
|
|
632
|
+
__lineFormatFilter?: boolean;
|
|
633
|
+
/**
|
|
634
|
+
* - Defines the list of styles that are applied directly to the `<li>` element
|
|
635
|
+
* - when a text style is applied to the entire list item.
|
|
636
|
+
* - For example, when changing the font size or color of a list item (`<li>`),
|
|
637
|
+
* - these styles will be applied to the `<li>` tag instead of wrapping the content inside additional tags.
|
|
638
|
+
*/
|
|
639
|
+
__listCommonStyle?: Array<string>;
|
|
640
|
+
/**
|
|
641
|
+
* - Plugin retain filter configuration. (Internal use primarily)
|
|
642
|
+
* - You can turn it off/on globally with true/false or set it per plugin. (e.g. { table: false })
|
|
643
|
+
*/
|
|
644
|
+
__pluginRetainFilter?:
|
|
645
|
+
| {
|
|
646
|
+
pluginName: string;
|
|
647
|
+
we: boolean;
|
|
648
|
+
}
|
|
649
|
+
| boolean;
|
|
650
|
+
/**
|
|
651
|
+
* - Allows the `<script>` tag to be used in the editor.
|
|
652
|
+
* ================================================================================================================================
|
|
653
|
+
*/
|
|
654
|
+
__allowedScriptTag?: boolean;
|
|
655
|
+
};
|
|
656
|
+
/**
|
|
657
|
+
* **Top-level editor configuration**
|
|
658
|
+
* -----------------
|
|
659
|
+
*
|
|
660
|
+
* === Plugins & Toolbar ===
|
|
661
|
+
*/
|
|
662
|
+
export type EditorBaseOptions = {
|
|
663
|
+
/**
|
|
664
|
+
* - Plugin configuration.
|
|
665
|
+
*/
|
|
666
|
+
plugins?:
|
|
667
|
+
| {
|
|
668
|
+
[x: string]: any;
|
|
669
|
+
}
|
|
670
|
+
| Array<{
|
|
671
|
+
[x: string]: any;
|
|
672
|
+
}>;
|
|
673
|
+
/**
|
|
674
|
+
* - Plugin configuration.
|
|
675
|
+
*/
|
|
676
|
+
excludedPlugins?: Array<string>;
|
|
677
|
+
/**
|
|
678
|
+
* - List of toolbar buttons, grouped by sub-arrays.
|
|
679
|
+
* - The default follows {@link DEFAULTS.BUTTON_LIST}=== Modes & Themes ===
|
|
680
|
+
*/
|
|
681
|
+
buttonList?: Array<string[] | string>;
|
|
682
|
+
/**
|
|
683
|
+
* - Enables migration mode for SunEditor v2.
|
|
684
|
+
*/
|
|
685
|
+
v2Migration?: boolean;
|
|
686
|
+
/**
|
|
687
|
+
* - Toolbar mode: "classic", "inline", "balloon", "balloon-always".
|
|
688
|
+
*/
|
|
689
|
+
mode?: 'classic' | 'inline' | 'balloon' | 'balloon-always';
|
|
690
|
+
/**
|
|
691
|
+
* - Editor type: "document:header,page".
|
|
692
|
+
*/
|
|
693
|
+
type?: string;
|
|
694
|
+
/**
|
|
695
|
+
* - Editor theme.
|
|
696
|
+
*/
|
|
697
|
+
theme?: string;
|
|
698
|
+
/**
|
|
699
|
+
* - Language configuration. default : EN
|
|
700
|
+
*/
|
|
701
|
+
lang?: {
|
|
702
|
+
[x: string]: string;
|
|
703
|
+
};
|
|
704
|
+
/**
|
|
705
|
+
* - Overrides the default icons.
|
|
706
|
+
*/
|
|
707
|
+
icons?: {
|
|
708
|
+
[x: string]: string;
|
|
709
|
+
};
|
|
710
|
+
/**
|
|
711
|
+
* - Text direction: "ltr" or "rtl".
|
|
712
|
+
*/
|
|
713
|
+
textDirection?: string;
|
|
714
|
+
/**
|
|
715
|
+
* - An array of command pairs whose shortcut icons should be opposite each other, depending on the "textDirection" mode.
|
|
716
|
+
*
|
|
717
|
+
* === Strict & Advanced Filtering ===
|
|
718
|
+
*/
|
|
719
|
+
reverseButtons?: Array<string>;
|
|
720
|
+
/**
|
|
721
|
+
* - Enables strict filtering of tags, attributes, and styles.
|
|
722
|
+
*/
|
|
723
|
+
strictMode?:
|
|
724
|
+
| boolean
|
|
725
|
+
| {
|
|
726
|
+
tagFilter: boolean;
|
|
727
|
+
formatFilter: boolean;
|
|
728
|
+
classFilter: boolean;
|
|
729
|
+
textStyleTagFilter: boolean;
|
|
730
|
+
attrFilter: boolean;
|
|
731
|
+
styleFilter: boolean;
|
|
732
|
+
};
|
|
733
|
+
/**
|
|
734
|
+
* - Tags treated as whole units when selecting all content.
|
|
735
|
+
* - The default follows {@link DEFAULTS.SCOPE_SELECTION_TAGS}=== Content Filtering & Formatting ===
|
|
736
|
+
* ==
|
|
737
|
+
* #### 1) Tag & Element Control
|
|
738
|
+
*/
|
|
739
|
+
scopeSelectionTags?: Array<string>;
|
|
740
|
+
/**
|
|
741
|
+
* - Specifies HTML elements to additionally allow beyond the 'default' allow list. Delimiter: "|" (e.g. "p|div", "*").
|
|
742
|
+
* - The value entered here will be added to the end of the default list determined by the {@link PrivateBaseOptions.__defaultElementWhitelist} logic above.
|
|
743
|
+
*/
|
|
744
|
+
elementWhitelist?: string;
|
|
745
|
+
/**
|
|
746
|
+
* - Filters by specifying HTML elements that should not be used. Delimiter: "|" (e.g. "script|style").
|
|
747
|
+
* - Tags specified here will eventually be removed, even if they are included in other whitelists.
|
|
748
|
+
*/
|
|
749
|
+
elementBlacklist?: string;
|
|
750
|
+
/**
|
|
751
|
+
* - A list of tags that are allowed to be kept even if their values are empty.
|
|
752
|
+
* - The default follows {@link DEFAULTS.ALLOWED_EMPTY_NODE_LIST}- It is concatenated with the value of "ALLOWED_EMPTY_NODE_LIST" to form the final 'allowedEmptyTags' list.
|
|
753
|
+
*/
|
|
754
|
+
allowedEmptyTags?: string;
|
|
755
|
+
/**
|
|
756
|
+
* - Allowed class names.
|
|
757
|
+
* - Added the default value {@link DEFAULTS.CLASS_NAME}#### 2) Attribute Control
|
|
758
|
+
*/
|
|
759
|
+
allowedClassName?: string;
|
|
760
|
+
/**
|
|
761
|
+
* - Specifies additional attributes to allow for each tag. (e.g. {a: "href|target", img: "src|alt", "*": "id"}).
|
|
762
|
+
* - Rules for objects specified here will be merged into the {@link PrivateBaseOptions.__defaultAttributeWhitelist}.
|
|
763
|
+
*/
|
|
764
|
+
attributeWhitelist?: {
|
|
765
|
+
[x: string]: string;
|
|
766
|
+
};
|
|
767
|
+
/**
|
|
768
|
+
* - Filter by specifying attributes to disallow by tag. (e.g. {a: "href|target", img: "src|alt", "*": "name"}).
|
|
769
|
+
* - Attributes specified here will eventually be removed even if they are allowed by other settings.
|
|
770
|
+
* - A list of required elements, {@link DEFAULTS.REQUIRED_FORMAT_LINE}, is always included.
|
|
771
|
+
*
|
|
772
|
+
* #### 3) Text & Inline Style Control
|
|
773
|
+
*/
|
|
774
|
+
attributeBlacklist?: {
|
|
775
|
+
[x: string]: string;
|
|
776
|
+
};
|
|
777
|
+
/**
|
|
778
|
+
* - Additional text style tags.
|
|
779
|
+
* - The default follows {@link PrivateBaseOptions.__textStyleTags}
|
|
780
|
+
*/
|
|
781
|
+
textStyleTags?: string;
|
|
782
|
+
/**
|
|
783
|
+
* - Maps text styles to specific HTML tags.
|
|
784
|
+
*/
|
|
785
|
+
convertTextTags?: {
|
|
786
|
+
[x: string]: string;
|
|
787
|
+
};
|
|
788
|
+
/**
|
|
789
|
+
* - Specifies additional styles to the list of allowed styles. Delimiter: "|" (e.g. "color|background-color").
|
|
790
|
+
*/
|
|
791
|
+
allUsedStyles?: string;
|
|
792
|
+
/**
|
|
793
|
+
* - Specifies allowed styles for HTML tags.
|
|
794
|
+
*/
|
|
795
|
+
tagStyles?: {
|
|
796
|
+
[x: string]: string;
|
|
797
|
+
};
|
|
798
|
+
/**
|
|
799
|
+
* - Specifies allowed styles for the "span" tag.
|
|
800
|
+
* - The default follows {@link DEFAULTS.SPAN_STYLES}
|
|
801
|
+
*/
|
|
802
|
+
spanStyles?: string;
|
|
803
|
+
/**
|
|
804
|
+
* - Specifies allowed styles for the "line" element (p..).
|
|
805
|
+
* - The default follows {@link DEFAULTS.LINE_STYLES}
|
|
806
|
+
*/
|
|
807
|
+
lineStyles?: string;
|
|
808
|
+
/**
|
|
809
|
+
* - Allowed font size units.
|
|
810
|
+
* - The default follows {@link DEFAULTS.SIZE_UNITS}
|
|
811
|
+
*/
|
|
812
|
+
fontSizeUnits?: Array<string>;
|
|
813
|
+
/**
|
|
814
|
+
* - This option determines how inline elements (such as <span>, <strong>, etc.) are handled when deleting text.
|
|
815
|
+
* - "repeat": Inline styles are retained unless the backspace key is repeatedly pressed. If the user continuously presses backspace, the styles will eventually be removed.
|
|
816
|
+
* - "none": Inline styles are not retained at all. When deleting text, the associated inline elements are immediately removed along with it.
|
|
817
|
+
* - "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.
|
|
818
|
+
*
|
|
819
|
+
* #### 4) Line & Block Formatting
|
|
820
|
+
*/
|
|
821
|
+
retainStyleMode?: 'repeat' | 'always' | 'none';
|
|
822
|
+
/**
|
|
823
|
+
* - Default line element when inserting new lines.
|
|
824
|
+
*/
|
|
825
|
+
defaultLine?: string;
|
|
826
|
+
/**
|
|
827
|
+
* - Specifies the default line break format.
|
|
828
|
+
* - [Recommended] "line" : is a line break that is divided into general tags.
|
|
829
|
+
* - [Not recommended] "br" : Line breaks are treated as <br> on the same line. (like shift+enter)
|
|
830
|
+
* - Line breaks are handled as <br> within "line".
|
|
831
|
+
* - You can create a new "line" by entering a line break twice in a row.
|
|
832
|
+
* - Formats that include "line", such as "Quote", still operate on a "line" basis.
|
|
833
|
+
* - ● suneditor processes work in "line" units.
|
|
834
|
+
* - ● When set to "br", performance may decrease when editing a lot of data.
|
|
835
|
+
*/
|
|
836
|
+
defaultLineBreakFormat?: 'line' | 'br';
|
|
837
|
+
/**
|
|
838
|
+
* - Line properties that should be reset when changing lines (e.g. "id|name").
|
|
839
|
+
*/
|
|
840
|
+
lineAttrReset?: string;
|
|
841
|
+
/**
|
|
842
|
+
* - Additionally allowed "line" elements beyond the default. Delimiter: "|" (e.g. "p|div").
|
|
843
|
+
* It is concatenated with the value of {@link PrivateBaseOptions.__defaultFormatLine} to form the final 'line' element list.
|
|
844
|
+
* - "line" element also contain "brLine" element
|
|
845
|
+
*/
|
|
846
|
+
formatLine?: string;
|
|
847
|
+
/**
|
|
848
|
+
* - Additionally allowed "brLine" elements beyond the default. (e.g. "PRE").
|
|
849
|
+
* - It is concatenated with the value of {@link PrivateBaseOptions.__defaultFormatBrLine} to form the final 'brLine' element list.
|
|
850
|
+
* - "brLine" elements is included in the "line" element.
|
|
851
|
+
* - "brLine" elements's line break is "BR" tag.
|
|
852
|
+
* ※ Entering the Enter key in the space on the last line ends "brLine" and appends "line".
|
|
853
|
+
*/
|
|
854
|
+
formatBrLine?: string;
|
|
855
|
+
/**
|
|
856
|
+
* - Additionally allowed "closureBrLine" elements beyond the default.
|
|
857
|
+
* - It is concatenated with the value of {@link PrivateBaseOptions.__defaultFormatClosureBrLine} to form the final 'closureBrLine' element list.
|
|
858
|
+
* - "closureBrLine" elements is included in the "brLine".
|
|
859
|
+
* - "closureBrLine" elements's line break is "BR" tag.
|
|
860
|
+
* - ※ You cannot exit this format with the Enter key or Backspace key.
|
|
861
|
+
* - ※ Use it only in special cases. ([ex] format of table cells)
|
|
862
|
+
*/
|
|
863
|
+
formatClosureBrLine?: string;
|
|
864
|
+
/**
|
|
865
|
+
* - Additionally allowed "block" elements beyond the default.
|
|
866
|
+
* - It is concatenated with the value of {@link PrivateBaseOptions.__defaultFormatBlock} to form the final 'block' element list.
|
|
867
|
+
* - "block" is wrap the "line" and "component"
|
|
868
|
+
*/
|
|
869
|
+
formatBlock?: string;
|
|
870
|
+
/**
|
|
871
|
+
* - Additionally allowed "closureBlock" elements beyond the default.
|
|
872
|
+
* - It is concatenated with the value of {@link PrivateBaseOptions.__defaultFormatClosureBlock} to form the final 'closureBlock' element list.
|
|
873
|
+
* - "closureBlock" elements is included in the "block".
|
|
874
|
+
* - "closureBlock" element is wrap the "line" and "component"
|
|
875
|
+
* - ※ You cannot exit this format with the Enter key or Backspace key.
|
|
876
|
+
* - ※ Use it only in special cases. (e.g. format of table cells)
|
|
877
|
+
*
|
|
878
|
+
* === UI & Interaction ===
|
|
879
|
+
*/
|
|
880
|
+
formatClosureBlock?: string;
|
|
881
|
+
/**
|
|
882
|
+
* - Closes modals when clicking outside.
|
|
883
|
+
*/
|
|
884
|
+
closeModalOutsideClick?: boolean;
|
|
885
|
+
/**
|
|
886
|
+
* - Synchronizes tab indent with spaces.
|
|
887
|
+
*/
|
|
888
|
+
syncTabIndent?: boolean;
|
|
889
|
+
/**
|
|
890
|
+
* - Disables tab key input.
|
|
891
|
+
*/
|
|
892
|
+
tabDisable?: boolean;
|
|
893
|
+
/**
|
|
894
|
+
* - Toolbar width.
|
|
895
|
+
*/
|
|
896
|
+
toolbar_width?: number | string;
|
|
897
|
+
/**
|
|
898
|
+
* - Container element for the toolbar.
|
|
899
|
+
*/
|
|
900
|
+
toolbar_container?: Element | string;
|
|
901
|
+
/**
|
|
902
|
+
* - Enables sticky toolbar with optional offset.
|
|
903
|
+
*/
|
|
904
|
+
toolbar_sticky?: number;
|
|
905
|
+
/**
|
|
906
|
+
* - Hides toolbar initially.
|
|
907
|
+
*/
|
|
908
|
+
toolbar_hide?: boolean;
|
|
909
|
+
/**
|
|
910
|
+
* - Sub-toolbar configuration.
|
|
911
|
+
*/
|
|
912
|
+
subToolbar?: {
|
|
913
|
+
buttonList?: Array<Array<string>>;
|
|
914
|
+
mode?: 'balloon' | 'balloon-always';
|
|
915
|
+
width?: number | string;
|
|
916
|
+
};
|
|
917
|
+
/**
|
|
918
|
+
* - Container element for the status bar.
|
|
919
|
+
*/
|
|
920
|
+
statusbar_container?: Element | string;
|
|
921
|
+
/**
|
|
922
|
+
* - Displays shortcut hints in tooltips.
|
|
923
|
+
*/
|
|
924
|
+
shortcutsHint?: boolean;
|
|
925
|
+
/**
|
|
926
|
+
* - Disables keyboard shortcuts.
|
|
927
|
+
*/
|
|
928
|
+
shortcutsDisable?: boolean;
|
|
929
|
+
/**
|
|
930
|
+
* - Custom keyboard shortcuts.
|
|
931
|
+
*
|
|
932
|
+
* === Advanced Features ===
|
|
933
|
+
*/
|
|
934
|
+
shortcuts?: {
|
|
935
|
+
[x: string]: string[];
|
|
936
|
+
};
|
|
937
|
+
/**
|
|
938
|
+
* - Keeps the format of the copied content.
|
|
939
|
+
*/
|
|
940
|
+
copyFormatKeepOn?: boolean;
|
|
941
|
+
/**
|
|
942
|
+
* - Automatically converts URLs into hyperlinks. ("Link" plugin required)
|
|
943
|
+
* - Default value is determined dynamically based on whether the 'link' plugin is enabled. (default : Boolean(plugins.link))
|
|
944
|
+
*/
|
|
945
|
+
autoLinkify?: boolean;
|
|
946
|
+
/**
|
|
947
|
+
* - Styles applied automatically on text input.
|
|
948
|
+
*/
|
|
949
|
+
autoStyleify?: Array<string>;
|
|
950
|
+
/**
|
|
951
|
+
* - Delay time for history stack updates (ms).
|
|
952
|
+
*/
|
|
953
|
+
historyStackDelayTime?: number;
|
|
954
|
+
/**
|
|
955
|
+
* - Class name for printing.
|
|
956
|
+
*/
|
|
957
|
+
printClass?: string;
|
|
958
|
+
/**
|
|
959
|
+
* - Offset applied when entering fullscreen mode.
|
|
960
|
+
*/
|
|
961
|
+
fullScreenOffset?: number;
|
|
962
|
+
/**
|
|
963
|
+
* - Custom template for preview mode.
|
|
964
|
+
*/
|
|
965
|
+
previewTemplate?: string;
|
|
966
|
+
/**
|
|
967
|
+
* - Custom template for print mode.
|
|
968
|
+
*/
|
|
969
|
+
printTemplate?: string;
|
|
970
|
+
/**
|
|
971
|
+
* - Enables automatic selection of inserted components.
|
|
972
|
+
* - For inline components: places the cursor near the inserted component or selects it if no nearby range is available.
|
|
973
|
+
* - For block components: executes behavior based on `selectMode`:
|
|
974
|
+
* - `auto`: Move cursor to the next line if possible, otherwise select the component.
|
|
975
|
+
* - `select`: Always select the inserted component.
|
|
976
|
+
* - `line`: Move cursor to the next line if possible, or create a new line and move there.
|
|
977
|
+
* - `none`: Do nothing.
|
|
978
|
+
*/
|
|
979
|
+
componentInsertBehavior?: __se__ComponentInsertBehaviorType;
|
|
980
|
+
/**
|
|
981
|
+
* - Default URL protocol for links.
|
|
982
|
+
*/
|
|
983
|
+
defaultUrlProtocol?: string;
|
|
984
|
+
/**
|
|
985
|
+
* - {"copy": 1500} - Duration for displaying toast messages.
|
|
986
|
+
*/
|
|
987
|
+
toastMessageTime?: any;
|
|
988
|
+
/**
|
|
989
|
+
* - Enables free code view mode.
|
|
990
|
+
*
|
|
991
|
+
* === Dynamic Options ===
|
|
992
|
+
*/
|
|
993
|
+
freeCodeViewMode?: string;
|
|
994
|
+
/**
|
|
995
|
+
* - External libraries like CodeMirror or MathJax.
|
|
996
|
+
*/
|
|
997
|
+
externalLibs?: {
|
|
998
|
+
[x: string]: any;
|
|
999
|
+
};
|
|
1000
|
+
/**
|
|
1001
|
+
* - Custom event handlers.
|
|
1002
|
+
*/
|
|
1003
|
+
events?: {
|
|
1004
|
+
[x: string]: (...args: any) => any;
|
|
1005
|
+
};
|
|
1006
|
+
/**
|
|
1007
|
+
* - Specifies extra allowed or disallowed tags.
|
|
1008
|
+
* - The default follows {@link DEFAULTS.EXTRA_TAG_MAP}=== Dynamic Plugin Options ===
|
|
1009
|
+
*/
|
|
1010
|
+
allowedExtraTags?: {
|
|
1011
|
+
[x: string]: boolean;
|
|
1012
|
+
};
|
|
1013
|
+
/**
|
|
1014
|
+
* - Dynamic plugin options, where the key is the plugin name and the value is its configuration.
|
|
1015
|
+
* ================================================================================================================================
|
|
1016
|
+
*/
|
|
1017
|
+
Dynamic_pluginOptions?: {
|
|
1018
|
+
[x: string]: any;
|
|
1019
|
+
};
|
|
1020
|
+
};
|
|
1021
|
+
/**
|
|
1022
|
+
* -----------------
|
|
1023
|
+
* **Runtime-only base options (computed internally, cannot be set by users)**
|
|
1024
|
+
*/
|
|
1025
|
+
export type InternalBaseOptions = {
|
|
1026
|
+
/**
|
|
1027
|
+
* - Computed className for the selected theme (e.g., 'se-theme-default').
|
|
1028
|
+
*/
|
|
1029
|
+
_themeClass?: string;
|
|
1030
|
+
/**
|
|
1031
|
+
* - Additional sub-type string from the `type` option (after `:`).
|
|
1032
|
+
*/
|
|
1033
|
+
_type_options?: string;
|
|
1034
|
+
/**
|
|
1035
|
+
* - Preprocessed allowed tag string for RegExp (e.g., "mark|figure").
|
|
1036
|
+
*/
|
|
1037
|
+
_allowedExtraTag?: string;
|
|
1038
|
+
/**
|
|
1039
|
+
* - Preprocessed disallowed tag string.
|
|
1040
|
+
*/
|
|
1041
|
+
_disallowedExtraTag?: string;
|
|
1042
|
+
/**
|
|
1043
|
+
* - Final computed editable class (used in editor wrapper).
|
|
1044
|
+
*/
|
|
1045
|
+
_editableClass?: string;
|
|
1046
|
+
/**
|
|
1047
|
+
* - Whether text direction is RTL.
|
|
1048
|
+
*/
|
|
1049
|
+
_rtl?: boolean;
|
|
1050
|
+
/**
|
|
1051
|
+
* - Internal key shortcut matcher for reverse commands.
|
|
1052
|
+
*/
|
|
1053
|
+
_reverseCommandArray?: string[];
|
|
1054
|
+
/**
|
|
1055
|
+
* - Sub toolbar mode (e.g., 'balloon').
|
|
1056
|
+
*/
|
|
1057
|
+
_subMode?: string;
|
|
1058
|
+
/**
|
|
1059
|
+
* - Tag names used for text styling, plus span/li.
|
|
1060
|
+
*/
|
|
1061
|
+
_textStyleTags?: Set<string>;
|
|
1062
|
+
/**
|
|
1063
|
+
* - Regex to match inline styles (e.g., fontSize, color).
|
|
1064
|
+
*/
|
|
1065
|
+
_textStylesRegExp?: RegExp;
|
|
1066
|
+
/**
|
|
1067
|
+
* - Regex to match line styles (e.g., text-align, padding).
|
|
1068
|
+
*/
|
|
1069
|
+
_lineStylesRegExp?: RegExp;
|
|
1070
|
+
/**
|
|
1071
|
+
* - Mapping HTML tag => standard tag.
|
|
1072
|
+
*/
|
|
1073
|
+
_defaultStyleTagMap?: {
|
|
1074
|
+
[x: string]: string;
|
|
1075
|
+
};
|
|
1076
|
+
/**
|
|
1077
|
+
* - Mapping HTML tag => command (e.g., bold, underline).
|
|
1078
|
+
*/
|
|
1079
|
+
_styleCommandMap?: {
|
|
1080
|
+
[x: string]: string;
|
|
1081
|
+
};
|
|
1082
|
+
/**
|
|
1083
|
+
* - Mapping command => preferred tag.
|
|
1084
|
+
*/
|
|
1085
|
+
_defaultTagCommand?: {
|
|
1086
|
+
[x: string]: string;
|
|
1087
|
+
};
|
|
1088
|
+
/**
|
|
1089
|
+
* - Element whitelist regex pattern for the editor.
|
|
1090
|
+
*/
|
|
1091
|
+
_editorElementWhitelist?: string;
|
|
1092
|
+
/**
|
|
1093
|
+
* - List of currently used toolbar buttons
|
|
1094
|
+
*/
|
|
1095
|
+
buttons?: Set<any>;
|
|
1096
|
+
/**
|
|
1097
|
+
* - List of currently used sub-toolbar buttons
|
|
1098
|
+
*/
|
|
1099
|
+
buttons_sub?: Set<any>;
|
|
1100
|
+
/**
|
|
1101
|
+
* - Sub-toolbar width.
|
|
1102
|
+
*/
|
|
1103
|
+
toolbar_sub_width?: string;
|
|
1104
|
+
/**
|
|
1105
|
+
* - Uses CodeMirror for code view.
|
|
1106
|
+
*/
|
|
1107
|
+
hasCodeMirror?: boolean;
|
|
1108
|
+
/**
|
|
1109
|
+
* - CodeMirror5 support.
|
|
1110
|
+
*/
|
|
1111
|
+
codeMirror5Editor?: any;
|
|
1112
|
+
/**
|
|
1113
|
+
* - CodeMirror6 support.
|
|
1114
|
+
* ================================================================================================================================
|
|
1115
|
+
*/
|
|
1116
|
+
codeMirror6Editor?: any;
|
|
1117
|
+
};
|
|
1118
|
+
export type EditorInitOptions = EditorBaseOptions & PrivateBaseOptions & EditorFrameOptions;
|
|
1119
|
+
export type AllBaseOptions = EditorBaseOptions & PrivateBaseOptions & InternalBaseOptions;
|