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
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
export default Link;
|
|
2
|
-
export type
|
|
3
|
-
|
|
4
|
-
* - Whether to display the link text.
|
|
5
|
-
*/
|
|
6
|
-
textToDisplay?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* - Whether to display the link title.
|
|
9
|
-
*/
|
|
10
|
-
title?: boolean;
|
|
2
|
+
export type ModalAnchorEditorParams_link = import('../../modules/ModalAnchorEditor').ModalAnchorEditorParams;
|
|
3
|
+
export type LinkOptions = {
|
|
11
4
|
/**
|
|
12
5
|
* - The URL endpoint for file uploads.
|
|
13
6
|
*/
|
|
@@ -31,16 +24,21 @@ export type LinkPluginOptions = {
|
|
|
31
24
|
*/
|
|
32
25
|
acceptedFormats?: string;
|
|
33
26
|
};
|
|
27
|
+
export type LinkPluginOptions = Omit<LinkOptions & ModalAnchorEditorParams_link, ''>;
|
|
28
|
+
/**
|
|
29
|
+
* @typedef {import('../../modules/ModalAnchorEditor').ModalAnchorEditorParams} ModalAnchorEditorParams_link
|
|
30
|
+
*/
|
|
34
31
|
/**
|
|
35
|
-
* @typedef {Object}
|
|
36
|
-
* @property {boolean} [textToDisplay=true] - Whether to display the link text.
|
|
37
|
-
* @property {boolean} [title=true] - Whether to display the link title.
|
|
32
|
+
* @typedef {Object} LinkOptions
|
|
38
33
|
* @property {string} [uploadUrl] - The URL endpoint for file uploads.
|
|
39
34
|
* @property {Object<string, string>} [uploadHeaders] - Additional headers for file upload requests.
|
|
40
35
|
* @property {number} [uploadSizeLimit] - The total file upload size limit in bytes.
|
|
41
36
|
* @property {number} [uploadSingleSizeLimit] - The single file upload size limit in bytes.
|
|
42
37
|
* @property {string} [acceptedFormats] - Accepted file formats for link uploads.
|
|
43
38
|
*/
|
|
39
|
+
/**
|
|
40
|
+
* @typedef {Omit<LinkOptions & ModalAnchorEditorParams_link, ''>} LinkPluginOptions
|
|
41
|
+
*/
|
|
44
42
|
/**
|
|
45
43
|
* @class
|
|
46
44
|
* @description Link plugin.
|
|
@@ -59,24 +57,43 @@ declare class Link extends EditorInjector {
|
|
|
59
57
|
constructor(editor: __se__EditorCore, pluginOptions: LinkPluginOptions);
|
|
60
58
|
title: any;
|
|
61
59
|
icon: string;
|
|
60
|
+
target: HTMLAnchorElement;
|
|
62
61
|
isUpdateState: boolean;
|
|
63
62
|
pluginOptions: {
|
|
64
63
|
uploadUrl: string;
|
|
65
64
|
uploadHeaders: {
|
|
66
65
|
[x: string]: string;
|
|
66
|
+
} & {
|
|
67
|
+
[x: string]: string;
|
|
67
68
|
};
|
|
68
69
|
uploadSizeLimit: number;
|
|
69
70
|
uploadSingleSizeLimit: number;
|
|
70
71
|
acceptedFormats: string;
|
|
71
72
|
enableFileUpload: boolean;
|
|
72
73
|
/**
|
|
73
|
-
* -
|
|
74
|
+
* - Modal title display.
|
|
75
|
+
*/
|
|
76
|
+
title?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* - Create Text to display input.
|
|
74
79
|
*/
|
|
75
80
|
textToDisplay?: boolean;
|
|
76
81
|
/**
|
|
77
|
-
* -
|
|
82
|
+
* - Default checked value of the "Open in new window" checkbox.
|
|
78
83
|
*/
|
|
79
|
-
|
|
84
|
+
openNewWindow?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* - If true, disables the automatic prefixing of the host URL to the value of the link.
|
|
87
|
+
*/
|
|
88
|
+
noAutoPrefix?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* - The "rel" attribute list of anchor tag.
|
|
91
|
+
*/
|
|
92
|
+
relList?: Array<string>;
|
|
93
|
+
/**
|
|
94
|
+
* - Default "rel" attributes of anchor tag.
|
|
95
|
+
*/
|
|
96
|
+
defaultRel?: import('../../modules/ModalAnchorEditor').RELAttr;
|
|
80
97
|
};
|
|
81
98
|
anchor: ModalAnchorEditor;
|
|
82
99
|
modal: Modal;
|
|
@@ -86,6 +103,7 @@ declare class Link extends EditorInjector {
|
|
|
86
103
|
* @description Executes the method that is called whenever the cursor position changes.
|
|
87
104
|
* @param {?HTMLElement=} element - Node element where the cursor is currently located
|
|
88
105
|
* @returns {boolean} - Whether the plugin is active
|
|
106
|
+
* - If it returns "undefined", it will no longer be called in this scope.
|
|
89
107
|
*/
|
|
90
108
|
active(element?: (HTMLElement | null) | undefined): boolean;
|
|
91
109
|
/**
|
|
@@ -121,6 +139,7 @@ declare class Link extends EditorInjector {
|
|
|
121
139
|
* @description This function is called before the "controller" before it is closed.
|
|
122
140
|
*/
|
|
123
141
|
close(): void;
|
|
142
|
+
#private;
|
|
124
143
|
}
|
|
125
144
|
import EditorInjector from '../../editorInjector';
|
|
126
145
|
import { ModalAnchorEditor } from '../../modules';
|
|
@@ -110,7 +110,6 @@ declare class Math_ extends EditorInjector {
|
|
|
110
110
|
/** @type {HTMLSelectElement} */
|
|
111
111
|
fontSizeElement: HTMLSelectElement;
|
|
112
112
|
isUpdateState: boolean;
|
|
113
|
-
_element: HTMLElement;
|
|
114
113
|
/**
|
|
115
114
|
* @editorMethod Editor.component
|
|
116
115
|
* @description Executes the method that is called when a component of a plugin is selected.
|
|
@@ -171,21 +170,6 @@ declare class Math_ extends EditorInjector {
|
|
|
171
170
|
* @param {Node} target Target element
|
|
172
171
|
*/
|
|
173
172
|
destroy(target: Node): void;
|
|
174
|
-
/**
|
|
175
|
-
* @private
|
|
176
|
-
* @description Renders the given math expression using KaTeX or MathJax.
|
|
177
|
-
* @param {string} exp - The math expression to render.
|
|
178
|
-
* @returns {string} - The rendered math expression as HTML.
|
|
179
|
-
*/
|
|
180
|
-
private _renderer;
|
|
181
|
-
/**
|
|
182
|
-
* @private
|
|
183
|
-
* @description Escapes or unescapes backslashes in a given string.
|
|
184
|
-
* @param {string} str - The input string.
|
|
185
|
-
* @param {boolean} decode - If true, decodes escaped backslashes; otherwise, encodes them.
|
|
186
|
-
* @returns {string} - The processed string.
|
|
187
|
-
*/
|
|
188
|
-
private _escapeBackslashes;
|
|
189
173
|
#private;
|
|
190
174
|
}
|
|
191
175
|
import EditorInjector from '../../editorInjector';
|
|
@@ -125,6 +125,14 @@ export type VideoPluginOptions = {
|
|
|
125
125
|
* - Figure controls.
|
|
126
126
|
*/
|
|
127
127
|
controls?: FigureControls_video;
|
|
128
|
+
/**
|
|
129
|
+
* - Component insertion behavior for selection and cursor placement. [default: options.get('componentInsertBehavior')]
|
|
130
|
+
* - `auto`: Move cursor to the next line if possible, otherwise select the component.
|
|
131
|
+
* - `select`: Always select the inserted component.
|
|
132
|
+
* - `line`: Move cursor to the next line if possible, or create a new line and move there.
|
|
133
|
+
* - `none`: Do nothing.
|
|
134
|
+
*/
|
|
135
|
+
insertBehavior?: __se__ComponentInsertBehaviorType;
|
|
128
136
|
};
|
|
129
137
|
/**
|
|
130
138
|
* @typedef {import('../../events').VideoInfo} VideoInfo_video
|
|
@@ -158,6 +166,11 @@ export type VideoPluginOptions = {
|
|
|
158
166
|
* @property {Array<RegExp>} [urlPatterns] - Additional URL patterns for video embedding.
|
|
159
167
|
* @property {Array<string>} [extensions] - Additional file extensions to be recognized for video uploads.
|
|
160
168
|
* @property {FigureControls_video} [controls] - Figure controls.
|
|
169
|
+
* @property {__se__ComponentInsertBehaviorType} [insertBehavior] - Component insertion behavior for selection and cursor placement. [default: options.get('componentInsertBehavior')]
|
|
170
|
+
* - `auto`: Move cursor to the next line if possible, otherwise select the component.
|
|
171
|
+
* - `select`: Always select the inserted component.
|
|
172
|
+
* - `line`: Move cursor to the next line if possible, or create a new line and move there.
|
|
173
|
+
* - `none`: Do nothing.
|
|
161
174
|
*/
|
|
162
175
|
/**
|
|
163
176
|
* @class
|
|
@@ -210,6 +223,7 @@ declare class Video extends EditorInjector {
|
|
|
210
223
|
};
|
|
211
224
|
query_youtube: string;
|
|
212
225
|
query_vimeo: string;
|
|
226
|
+
insertBehavior: __se__ComponentInsertBehaviorType;
|
|
213
227
|
};
|
|
214
228
|
modal: Modal;
|
|
215
229
|
figure: Figure;
|
|
@@ -219,29 +233,11 @@ declare class Video extends EditorInjector {
|
|
|
219
233
|
videoUrlFile: HTMLInputElement;
|
|
220
234
|
focusElement: HTMLInputElement;
|
|
221
235
|
previewSrc: HTMLElement;
|
|
222
|
-
_linkValue: string;
|
|
223
|
-
_align: string;
|
|
224
|
-
_frameRatio: string;
|
|
225
|
-
_defaultRatio: string;
|
|
226
|
-
_defaultSizeX: string;
|
|
227
|
-
_defaultSizeY: string;
|
|
228
236
|
sizeUnit: string;
|
|
229
237
|
proportion: HTMLInputElement;
|
|
230
238
|
frameRatioOption: HTMLSelectElement;
|
|
231
239
|
inputX: HTMLInputElement;
|
|
232
240
|
inputY: HTMLInputElement;
|
|
233
|
-
_element: any;
|
|
234
|
-
_cover: HTMLElement;
|
|
235
|
-
_container: any;
|
|
236
|
-
_ratio: {
|
|
237
|
-
w: number;
|
|
238
|
-
h: number;
|
|
239
|
-
};
|
|
240
|
-
_origin_w: string;
|
|
241
|
-
_origin_h: string;
|
|
242
|
-
_resizing: boolean;
|
|
243
|
-
_onlyPercentage: boolean;
|
|
244
|
-
_nonResizing: boolean;
|
|
245
241
|
query: {
|
|
246
242
|
youtube: {
|
|
247
243
|
pattern: RegExp;
|
|
@@ -314,14 +310,6 @@ declare class Video extends EditorInjector {
|
|
|
314
310
|
* @param {HTMLIFrameElement|HTMLVideoElement} target Target component element
|
|
315
311
|
*/
|
|
316
312
|
select(target: HTMLIFrameElement | HTMLVideoElement): void;
|
|
317
|
-
/**
|
|
318
|
-
* @private
|
|
319
|
-
* @description Prepares the component for selection.
|
|
320
|
-
* - Ensures that the controller is properly positioned and initialized.
|
|
321
|
-
* - Prevents duplicate event handling if the component is already selected.
|
|
322
|
-
* @param {HTMLIFrameElement|HTMLVideoElement} target - The selected element.
|
|
323
|
-
*/
|
|
324
|
-
private _ready;
|
|
325
313
|
/**
|
|
326
314
|
* @editorMethod Editor.Component
|
|
327
315
|
* @description Method to delete a component of a plugin, called by the "FileManager", "Controller" module.
|
|
@@ -379,6 +367,7 @@ declare class Video extends EditorInjector {
|
|
|
379
367
|
* @param {string} align - The alignment to apply to the video element (e.g., 'left', 'center', 'right').
|
|
380
368
|
* @param {boolean} isUpdate - Indicates whether this is an update to an existing component (true) or a new creation (false).
|
|
381
369
|
* @param {{name: string, size: number}} file - File metadata associated with the video
|
|
370
|
+
* @param {boolean} isLast - Indicates whether this is the last file in the batch (used for scroll and insert actions).
|
|
382
371
|
*/
|
|
383
372
|
create(
|
|
384
373
|
oFrame: HTMLIFrameElement | HTMLVideoElement,
|
|
@@ -390,7 +379,8 @@ declare class Video extends EditorInjector {
|
|
|
390
379
|
file: {
|
|
391
380
|
name: string;
|
|
392
381
|
size: number;
|
|
393
|
-
}
|
|
382
|
+
},
|
|
383
|
+
isLast: boolean
|
|
394
384
|
): void;
|
|
395
385
|
/**
|
|
396
386
|
* @description Creates a new iframe element for video embedding.
|
|
@@ -406,19 +396,6 @@ declare class Video extends EditorInjector {
|
|
|
406
396
|
* @returns {HTMLVideoElement} The newly created video element.
|
|
407
397
|
*/
|
|
408
398
|
createVideoTag(props?: { [x: string]: string }): HTMLVideoElement;
|
|
409
|
-
/**
|
|
410
|
-
* @private
|
|
411
|
-
* @description Sets the size of the video element.
|
|
412
|
-
* @param {string|number} w - The width of the video.
|
|
413
|
-
* @param {string|number} h - The height of the video.
|
|
414
|
-
*/
|
|
415
|
-
private _applySize;
|
|
416
|
-
/**
|
|
417
|
-
* @private
|
|
418
|
-
* @description Retrieves video information including size and alignment.
|
|
419
|
-
* @returns {*} Video information object.
|
|
420
|
-
*/
|
|
421
|
-
private _getInfo;
|
|
422
399
|
/**
|
|
423
400
|
* @description Create an "video" component using the provided files.
|
|
424
401
|
* @param {FileList|File[]} fileList File object list
|
|
@@ -431,52 +408,6 @@ declare class Video extends EditorInjector {
|
|
|
431
408
|
* @returns {Promise<boolean>} If return false, the file upload will be canceled
|
|
432
409
|
*/
|
|
433
410
|
submitURL(url: string): Promise<boolean>;
|
|
434
|
-
/**
|
|
435
|
-
* @private
|
|
436
|
-
* @description Updates the video component within the editor.
|
|
437
|
-
* @param {HTMLIFrameElement|HTMLVideoElement} oFrame - The video element to update.
|
|
438
|
-
*/
|
|
439
|
-
private _update;
|
|
440
|
-
/**
|
|
441
|
-
* @private
|
|
442
|
-
* @description Registers the uploaded video in the editor.
|
|
443
|
-
* @param {VideoInfo_video} info - Video information object.
|
|
444
|
-
* @param {Object<string, *>} response - Server response containing video data.
|
|
445
|
-
*/
|
|
446
|
-
private _register;
|
|
447
|
-
/**
|
|
448
|
-
* @private
|
|
449
|
-
* @description Uploads a video to the server using an external upload handler.
|
|
450
|
-
* @param {VideoInfo_video} info - Video information object.
|
|
451
|
-
* @param {FileList} files - The video files to upload.
|
|
452
|
-
*/
|
|
453
|
-
private _serverUpload;
|
|
454
|
-
/**
|
|
455
|
-
* @private
|
|
456
|
-
* @description Sets attributes for the video tag.
|
|
457
|
-
* @param {HTMLVideoElement} element - The video element.
|
|
458
|
-
*/
|
|
459
|
-
private _setTagAttrs;
|
|
460
|
-
/**
|
|
461
|
-
* @private
|
|
462
|
-
* @description Sets attributes for the iframe tag.
|
|
463
|
-
* @param {HTMLIFrameElement} element - The iframe element.
|
|
464
|
-
*/
|
|
465
|
-
private _setIframeAttrs;
|
|
466
|
-
/**
|
|
467
|
-
* @private
|
|
468
|
-
* @description Selects a ratio option in the ratio dropdown.
|
|
469
|
-
* @param {string|number} value - The selected ratio value.
|
|
470
|
-
* @returns {boolean} Returns true if a ratio was selected.
|
|
471
|
-
*/
|
|
472
|
-
private _setRatioSelect;
|
|
473
|
-
/**
|
|
474
|
-
* @private
|
|
475
|
-
* @description Handles video upload errors.
|
|
476
|
-
* @param {Object<string, *>} response - The error response object.
|
|
477
|
-
* @returns {Promise<void>}
|
|
478
|
-
*/
|
|
479
|
-
private _error;
|
|
480
411
|
#private;
|
|
481
412
|
}
|
|
482
413
|
import EditorInjector from '../../editorInjector';
|
|
@@ -17,8 +17,6 @@ declare class Anchor extends EditorInjector {
|
|
|
17
17
|
title: any;
|
|
18
18
|
icon: string;
|
|
19
19
|
bookmarkIcon: HTMLElement;
|
|
20
|
-
_element: HTMLElement;
|
|
21
|
-
_range: Range;
|
|
22
20
|
displayId: Element;
|
|
23
21
|
controllerSelect: Controller;
|
|
24
22
|
inputEl: HTMLInputElement;
|
|
@@ -45,12 +43,7 @@ declare class Anchor extends EditorInjector {
|
|
|
45
43
|
* @param {HTMLButtonElement} target Target button element
|
|
46
44
|
*/
|
|
47
45
|
controllerAction(target: HTMLButtonElement): void;
|
|
48
|
-
|
|
49
|
-
* @private
|
|
50
|
-
* @description Initializes state variables.
|
|
51
|
-
* - called when the popup is closed
|
|
52
|
-
*/
|
|
53
|
-
private _init;
|
|
46
|
+
#private;
|
|
54
47
|
}
|
|
55
48
|
import EditorInjector from '../../editorInjector';
|
|
56
49
|
import { Controller } from '../../modules';
|
package/types/suneditor.d.ts
CHANGED
|
@@ -2,50 +2,101 @@ declare namespace _default {
|
|
|
2
2
|
/**
|
|
3
3
|
* Returns the create function with preset options.
|
|
4
4
|
* If the options overlap, the options of the 'create' function take precedence.
|
|
5
|
-
* @param {
|
|
6
|
-
* @returns {{create: (targets: Element|Object<string, {target: Element, options:
|
|
5
|
+
* @param {SunEditorOptions} init_options - Initialization options
|
|
6
|
+
* @returns {{create: (targets: Element|Object<string, {target: Element, options: SunEditorFrameOptions}>, options: SunEditorOptions) => Editor}}}
|
|
7
7
|
*/
|
|
8
|
-
function init(init_options:
|
|
8
|
+
function init(init_options: SunEditorOptions): {
|
|
9
9
|
create: (
|
|
10
10
|
targets:
|
|
11
11
|
| Element
|
|
12
12
|
| {
|
|
13
13
|
[x: string]: {
|
|
14
14
|
target: Element;
|
|
15
|
-
options:
|
|
15
|
+
options: SunEditorFrameOptions;
|
|
16
16
|
};
|
|
17
17
|
},
|
|
18
|
-
options:
|
|
18
|
+
options: SunEditorOptions
|
|
19
19
|
) => Editor;
|
|
20
20
|
};
|
|
21
21
|
/**
|
|
22
22
|
* Creates a new instance of the SunEditor
|
|
23
|
-
* @param {Element|Object<string, {target: Element, options:
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* @param {Element|string|Object<string, {target: Element, options: SunEditorFrameOptions}>} target
|
|
24
|
+
* - Element: The direct DOM element to initialize the editor on.
|
|
25
|
+
* - string: A CSS selector string. The corresponding element is selected using `document.querySelector`.
|
|
26
|
+
* - Object: For multi-root setup. Each key maps to a config with `{target, options}`.
|
|
27
|
+
* @param {SunEditorOptions} options - Initialization options
|
|
28
|
+
* @param {SunEditorOptions} [_init_options] - Optional preset initialization options
|
|
26
29
|
* @returns {Editor} - Instance of the SunEditor
|
|
27
30
|
* @throws {Error} If the target element is not provided or is invalid
|
|
28
31
|
*/
|
|
29
32
|
function create(
|
|
30
33
|
target:
|
|
31
34
|
| Element
|
|
35
|
+
| string
|
|
32
36
|
| {
|
|
33
37
|
[x: string]: {
|
|
34
38
|
target: Element;
|
|
35
|
-
options:
|
|
39
|
+
options: SunEditorFrameOptions;
|
|
36
40
|
};
|
|
37
41
|
},
|
|
38
|
-
options:
|
|
39
|
-
_init_options?:
|
|
42
|
+
options: SunEditorOptions,
|
|
43
|
+
_init_options?: SunEditorOptions
|
|
40
44
|
): Editor;
|
|
41
45
|
}
|
|
42
46
|
export default _default;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Editor initialization options.
|
|
49
|
+
* Used when creating a new editor instance via `SunEditor.create()`.
|
|
50
|
+
*/
|
|
51
|
+
export type SunEditorOptions = __se__EditorOptions;
|
|
52
|
+
/**
|
|
53
|
+
* Frame-specific options for multi-root editors.
|
|
54
|
+
* Each frame can have its own width, height, placeholder, and other frame-level settings.
|
|
55
|
+
*/
|
|
56
|
+
export type SunEditorFrameOptions = __se__EditorFrameOptions;
|
|
57
|
+
/**
|
|
58
|
+
* Type definition for the SunEditor instance.
|
|
59
|
+
* This is the return type of `SunEditor.create()`.
|
|
60
|
+
*/
|
|
61
|
+
export type SunEditorCore = __se__EditorCore;
|
|
62
|
+
/**
|
|
63
|
+
* Information about a component (image, video, table, etc.) in the editor.
|
|
64
|
+
* Contains properties like target element, plugin name, options, and container references.
|
|
65
|
+
*/
|
|
66
|
+
export type SunEditorComponentInfo = __se__ComponentInfo;
|
|
67
|
+
/**
|
|
68
|
+
* Parameters passed to plugin mouse event handlers.
|
|
69
|
+
* Includes the frame context and the mouse event object.
|
|
70
|
+
*/
|
|
71
|
+
export type SunEditorPluginMouseEvent = __se__PluginMouseEventInfo;
|
|
72
|
+
/**
|
|
73
|
+
* Parameters passed to plugin keyboard event handlers.
|
|
74
|
+
* Includes the frame context, keyboard event, current range, and line element.
|
|
75
|
+
*/
|
|
76
|
+
export type SunEditorPluginKeyEvent = __se__PluginKeyEventInfo;
|
|
77
|
+
/**
|
|
78
|
+
* Parameters passed when a toolbar input value changes.
|
|
79
|
+
* Includes the target input element, event object, and the new value.
|
|
80
|
+
*/
|
|
81
|
+
export type SunEditorPluginToolbarInputChange = __se__PluginToolbarInputChangeEventInfo;
|
|
82
|
+
/**
|
|
83
|
+
* Information passed to shortcut handlers.
|
|
84
|
+
* Includes range, line element, shortcut info, event object, and key code.
|
|
85
|
+
*/
|
|
86
|
+
export type SunEditorPluginShortcut = __se__PluginShortcutInfo;
|
|
87
|
+
/**
|
|
88
|
+
* Parameters passed to plugin paste event handlers.
|
|
89
|
+
* Includes frame context, clipboard event, cleaned HTML data, and parsed document.
|
|
90
|
+
*/
|
|
91
|
+
export type SunEditorPluginPaste = __se__PluginPasteParams;
|
|
92
|
+
/**
|
|
93
|
+
* Parameters passed when copying a component.
|
|
94
|
+
* Includes the clipboard event, cloned container, and component info.
|
|
95
|
+
*/
|
|
96
|
+
export type SunEditorPluginCopyComponent = __se__PluginCopyComponentParams;
|
|
50
97
|
import Editor from './core/editor';
|
|
51
|
-
|
|
98
|
+
import helper from './helper';
|
|
99
|
+
import langs from './langs';
|
|
100
|
+
import modules from './modules';
|
|
101
|
+
import plugins from './plugins';
|
|
102
|
+
export { helper, langs, modules, plugins };
|
package/types/typedef.d.ts
CHANGED
|
@@ -4,7 +4,60 @@ declare global {
|
|
|
4
4
|
type __se__NodeCollection = Array<Node> | HTMLCollection | NodeList;
|
|
5
5
|
type __se__EditorCore = import('./core/editor').default;
|
|
6
6
|
type __se__EditorInjector = import('./editorInjector').default;
|
|
7
|
-
type
|
|
7
|
+
type __se__EditorOptions = import('./core/config/options').EditorInitOptions;
|
|
8
|
+
type __se__EditorFrameOptions = import('./core/config/options').EditorFrameOptions;
|
|
9
|
+
type __se__FrameContext = import('./core/config/frameContext').FrameContextUtil;
|
|
10
|
+
type __se__Context = Map<keyof import('./core/config/context').ContextUtil, any>;
|
|
11
|
+
type __se__EditorStatus = {
|
|
12
|
+
/**
|
|
13
|
+
* Boolean value of whether the editor has focus
|
|
14
|
+
*/
|
|
15
|
+
hasFocus: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Indent size of tab (4)
|
|
18
|
+
*/
|
|
19
|
+
tabSize: number;
|
|
20
|
+
/**
|
|
21
|
+
* Indent size (25)px
|
|
22
|
+
*/
|
|
23
|
+
indentSize: number;
|
|
24
|
+
/**
|
|
25
|
+
* Indent size of Code view mode (2)
|
|
26
|
+
*/
|
|
27
|
+
codeIndentSize: number;
|
|
28
|
+
/**
|
|
29
|
+
* An element array of the current cursor's node structure
|
|
30
|
+
*/
|
|
31
|
+
currentNodes: Array<string>;
|
|
32
|
+
/**
|
|
33
|
+
* An element name array of the current cursor's node structure
|
|
34
|
+
*/
|
|
35
|
+
currentNodesMap: Array<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Current visual viewport height size
|
|
38
|
+
*/
|
|
39
|
+
currentViewportHeight: number;
|
|
40
|
+
/**
|
|
41
|
+
* Height of the initial visual viewport height size
|
|
42
|
+
*/
|
|
43
|
+
initViewportHeight: number;
|
|
44
|
+
/**
|
|
45
|
+
* Boolean value of whether component is selected
|
|
46
|
+
*/
|
|
47
|
+
onSelected: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Current root key
|
|
50
|
+
*/
|
|
51
|
+
rootKey: any;
|
|
52
|
+
/**
|
|
53
|
+
* Current range object
|
|
54
|
+
*/
|
|
55
|
+
_range: Range;
|
|
56
|
+
/**
|
|
57
|
+
* Mouse down event status
|
|
58
|
+
*/
|
|
59
|
+
_onMousedown: boolean;
|
|
60
|
+
};
|
|
8
61
|
type __se__ComponentInfo = {
|
|
9
62
|
/**
|
|
10
63
|
* - The target element associated with the component.
|
|
@@ -49,48 +102,7 @@ declare global {
|
|
|
49
102
|
*/
|
|
50
103
|
isInputType: boolean;
|
|
51
104
|
};
|
|
52
|
-
type
|
|
53
|
-
/**
|
|
54
|
-
* Boolean value of whether the editor has focus
|
|
55
|
-
*/
|
|
56
|
-
hasFocus: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Indent size of tab (4)
|
|
59
|
-
*/
|
|
60
|
-
tabSize: number;
|
|
61
|
-
/**
|
|
62
|
-
* Indent size (25)px
|
|
63
|
-
*/
|
|
64
|
-
indentSize: number;
|
|
65
|
-
/**
|
|
66
|
-
* Indent size of Code view mode (2)
|
|
67
|
-
*/
|
|
68
|
-
codeIndentSize: number;
|
|
69
|
-
/**
|
|
70
|
-
* An element array of the current cursor's node structure
|
|
71
|
-
*/
|
|
72
|
-
currentNodes: Array<string>;
|
|
73
|
-
/**
|
|
74
|
-
* An element name array of the current cursor's node structure
|
|
75
|
-
*/
|
|
76
|
-
currentNodesMap: Array<string>;
|
|
77
|
-
/**
|
|
78
|
-
* Boolean value of whether component is selected
|
|
79
|
-
*/
|
|
80
|
-
onSelected: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Current root key
|
|
83
|
-
*/
|
|
84
|
-
rootKey: number;
|
|
85
|
-
/**
|
|
86
|
-
* Current range object
|
|
87
|
-
*/
|
|
88
|
-
_range: Range;
|
|
89
|
-
/**
|
|
90
|
-
* Mouse down event status
|
|
91
|
-
*/
|
|
92
|
-
_onMousedown: boolean;
|
|
93
|
-
};
|
|
105
|
+
type __se__ComponentInsertBehaviorType = 'auto' | 'select' | 'line' | 'none';
|
|
94
106
|
type __se__EventInfo = {
|
|
95
107
|
/**
|
|
96
108
|
* Target element
|
|
@@ -226,8 +238,10 @@ declare global {
|
|
|
226
238
|
*/
|
|
227
239
|
info: __se__ComponentInfo;
|
|
228
240
|
};
|
|
229
|
-
type __se__FrameOptions =
|
|
230
|
-
type
|
|
231
|
-
type __se__Context = Map<string, any>;
|
|
241
|
+
type __se__FrameOptions = import('./core/config/options').FrameOptionsMap;
|
|
242
|
+
type __se__BaseOptions = import('./core/config/options').BaseOptionsMap;
|
|
232
243
|
type __se__Class_OffsetGlobalInfo = import('./core/class/offset').OffsetGlobalInfo;
|
|
244
|
+
type __se__EventKeydownCtx = import('./core/event/reducers/keydown.reducer').KeydownReducerCtx;
|
|
245
|
+
type __se__EventActions = import('./core/event/actions').Action[];
|
|
246
|
+
type __se__EventPorts = import('./core/event/ports').EventReducerPorts;
|
|
233
247
|
}
|