suneditor 3.0.4 → 3.0.6
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/dist/suneditor.min.css +1 -1
- package/dist/suneditor.min.js +1 -1
- package/package.json +1 -1
- package/src/assets/suneditor.css +51 -3
- package/src/core/logic/panel/viewer.js +9 -5
- package/src/core/logic/shell/_commandExecutor.js +38 -1
- package/src/core/section/constructor.js +1 -1
- package/src/helper/markdown.js +18 -3
- package/src/modules/contract/Browser.js +98 -10
- package/src/modules/contract/Controller.js +1 -2
- package/src/modules/contract/Figure.js +1 -1
- package/src/modules/ui/ModalAnchorEditor.js +16 -1
- package/src/plugins/browser/audioGallery.js +13 -0
- package/src/plugins/browser/fileBrowser.js +22 -0
- package/src/plugins/browser/fileGallery.js +14 -0
- package/src/plugins/browser/imageGallery.js +14 -0
- package/src/plugins/browser/videoGallery.js +14 -0
- package/src/plugins/command/codeBlock.js +1 -1
- package/src/plugins/command/fileUpload.js +12 -0
- package/src/plugins/command/list_bulleted.js +1 -1
- package/src/plugins/command/list_numbered.js +1 -1
- package/src/plugins/field/mention.js +2 -2
- package/src/plugins/input/fontSize.js +4 -4
- package/src/plugins/modal/audio.js +12 -0
- package/src/plugins/modal/embed.js +12 -0
- package/src/plugins/modal/image/index.js +12 -0
- package/src/plugins/modal/link.js +12 -0
- package/src/plugins/modal/video/index.js +12 -0
- package/types/langs/_Lang.d.ts +1 -0
- package/types/modules/contract/Browser.d.ts +32 -0
- package/types/modules/ui/ModalAnchorEditor.d.ts +32 -2
- package/types/plugins/browser/audioGallery.d.ts +26 -0
- package/types/plugins/browser/fileBrowser.d.ts +45 -0
- package/types/plugins/browser/fileGallery.d.ts +28 -0
- package/types/plugins/browser/imageGallery.d.ts +28 -0
- package/types/plugins/browser/videoGallery.d.ts +28 -0
- package/types/plugins/command/fileUpload.d.ts +24 -0
- package/types/plugins/field/mention.d.ts +1 -1
- package/types/plugins/modal/audio.d.ts +24 -0
- package/types/plugins/modal/embed.d.ts +24 -0
- package/types/plugins/modal/image/index.d.ts +24 -0
- package/types/plugins/modal/link.d.ts +28 -1
- package/types/plugins/modal/video/index.d.ts +24 -0
|
@@ -27,7 +27,7 @@ class List_bulleted extends PluginCommand {
|
|
|
27
27
|
this.icon = 'list_bulleted';
|
|
28
28
|
this.afterItem = dom.utils.createElement(
|
|
29
29
|
'button',
|
|
30
|
-
{ class: 'se-btn se-tooltip se-sub-arrow-btn', 'data-command': List_bulleted.key, 'data-type': 'dropdown' },
|
|
30
|
+
{ class: 'se-btn se-tooltip se-sub-arrow-btn', type: 'button', 'data-command': List_bulleted.key, 'data-type': 'dropdown' },
|
|
31
31
|
`${this.$.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.bulletedList}</span></span>`,
|
|
32
32
|
);
|
|
33
33
|
|
|
@@ -27,7 +27,7 @@ class List_numbered extends PluginCommand {
|
|
|
27
27
|
this.icon = 'list_numbered';
|
|
28
28
|
this.afterItem = dom.utils.createElement(
|
|
29
29
|
'button',
|
|
30
|
-
{ class: 'se-btn se-tooltip se-sub-arrow-btn', 'data-command': List_numbered.key, 'data-type': 'dropdown' },
|
|
30
|
+
{ class: 'se-btn se-tooltip se-sub-arrow-btn', type: 'button', 'data-command': List_numbered.key, 'data-type': 'dropdown' },
|
|
31
31
|
`${this.$.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.numberedList}</span></span>`,
|
|
32
32
|
);
|
|
33
33
|
|
|
@@ -11,7 +11,7 @@ const { debounce } = converter;
|
|
|
11
11
|
* @property {string} [triggerText="@"] - The character that triggers the mention list.
|
|
12
12
|
* @property {number} [limitSize=5] - The number of items to display in the mention list
|
|
13
13
|
* @property {number} [searchStartLength=0] - The number of characters to start searching for the mention list
|
|
14
|
-
* @property {number} [delayTime=
|
|
14
|
+
* @property {number} [delayTime=120] - The time to wait before displaying the mention list
|
|
15
15
|
* @property {Array<{key: string, name: string, url: string}>} [data] - Static mention data (used instead of API).
|
|
16
16
|
* ```js
|
|
17
17
|
* // data
|
|
@@ -54,7 +54,7 @@ class Mention extends PluginField {
|
|
|
54
54
|
this.triggerText = pluginOptions.triggerText || '@';
|
|
55
55
|
this.limitSize = pluginOptions.limitSize || 5;
|
|
56
56
|
this.searchStartLength = pluginOptions.searchStartLength || 0;
|
|
57
|
-
this.delayTime = typeof pluginOptions.delayTime === 'number' ? pluginOptions.delayTime :
|
|
57
|
+
this.delayTime = typeof pluginOptions.delayTime === 'number' ? pluginOptions.delayTime : 120;
|
|
58
58
|
this.directData = pluginOptions.data;
|
|
59
59
|
this.apiUrl = pluginOptions.apiUrl?.replace(/\s/g, '').replace(/\{limitSize\}/i, String(this.limitSize)) || '';
|
|
60
60
|
// members - api, caching
|
|
@@ -152,25 +152,25 @@ class FontSize extends PluginInput {
|
|
|
152
152
|
if (showIncDec) {
|
|
153
153
|
this.beforeItem = dom.utils.createElement(
|
|
154
154
|
'button',
|
|
155
|
-
{ class: 'se-btn se-tooltip se-sub-btn', 'data-command': FontSize.key, 'data-type': 'command', 'data-value': 'dec' },
|
|
155
|
+
{ class: 'se-btn se-tooltip se-sub-btn', type: 'button', 'data-command': FontSize.key, 'data-type': 'command', 'data-value': 'dec' },
|
|
156
156
|
`${this.$.icons.minus}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.decrease}</span></span>`,
|
|
157
157
|
);
|
|
158
158
|
this.afterItem = dom.utils.createElement(
|
|
159
159
|
'button',
|
|
160
|
-
{ class: 'se-btn se-tooltip se-sub-btn', 'data-command': FontSize.key, 'data-type': 'command', 'data-value': 'inc' },
|
|
160
|
+
{ class: 'se-btn se-tooltip se-sub-btn', type: 'button', 'data-command': FontSize.key, 'data-type': 'command', 'data-value': 'inc' },
|
|
161
161
|
`${this.$.icons.plus}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.increase}</span></span>`,
|
|
162
162
|
);
|
|
163
163
|
} else if (!disableInput) {
|
|
164
164
|
this.afterItem = dom.utils.createElement(
|
|
165
165
|
'button',
|
|
166
|
-
{ class: 'se-btn se-tooltip se-sub-arrow-btn', 'data-command': FontSize.key, 'data-type': 'dropdown' },
|
|
166
|
+
{ class: 'se-btn se-tooltip se-sub-arrow-btn', type: 'button', 'data-command': FontSize.key, 'data-type': 'dropdown' },
|
|
167
167
|
`${this.$.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.fontSize}</span></span>`,
|
|
168
168
|
);
|
|
169
169
|
this.$.menu.initDropdownTarget({ key: FontSize.key, type: 'dropdown' }, menu);
|
|
170
170
|
} else if (disableInput && !showIncDec) {
|
|
171
171
|
this.replaceButton = dom.utils.createElement(
|
|
172
172
|
'button',
|
|
173
|
-
{ class: 'se-btn se-tooltip se-btn-select se-btn-tool-font-size', 'data-command': FontSize.key, 'data-type': 'dropdown' },
|
|
173
|
+
{ class: 'se-btn se-tooltip se-btn-select se-btn-tool-font-size', type: 'button', 'data-command': FontSize.key, 'data-type': 'dropdown' },
|
|
174
174
|
`<span class="se-txt __se__font_size">${this.$.lang.fontSize}</span>${this.$.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.fontSize}</span></span>`,
|
|
175
175
|
);
|
|
176
176
|
this.$.menu.initDropdownTarget({ key: FontSize.key, type: 'dropdown' }, menu);
|
|
@@ -13,6 +13,18 @@ const { NO_EVENT, ON_OVER_COMPONENT } = env;
|
|
|
13
13
|
* @property {boolean} [createUrlInput] - Whether to create a URL input element.
|
|
14
14
|
* - Defaults to `true`. Always `true` when `createFileInput` is `false`.
|
|
15
15
|
* @property {string} [uploadUrl] - The URL to which files will be uploaded.
|
|
16
|
+
* - The server must return:
|
|
17
|
+
* ```js
|
|
18
|
+
* {
|
|
19
|
+
* "result": [
|
|
20
|
+
* {
|
|
21
|
+
* "url": "https://example.com/audio.mp3",
|
|
22
|
+
* "name": "audio.mp3",
|
|
23
|
+
* "size": 3145728
|
|
24
|
+
* }
|
|
25
|
+
* ]
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
16
28
|
* @property {Object<string, string>} [uploadHeaders] - Headers to include in the file upload request.
|
|
17
29
|
* @property {number} [uploadSizeLimit] - The total upload size limit in bytes.
|
|
18
30
|
* @property {number} [uploadSingleSizeLimit] - The single file size limit in bytes.
|
|
@@ -11,6 +11,18 @@ const { _w, NO_EVENT } = env;
|
|
|
11
11
|
* @property {string} [defaultHeight] - The default height of the embed element (numeric value or with unit).
|
|
12
12
|
* @property {boolean} [percentageOnlySize=false] - Whether to allow only percentage-based sizing.
|
|
13
13
|
* @property {string} [uploadUrl] - The URL for file uploads.
|
|
14
|
+
* - The server must return:
|
|
15
|
+
* ```js
|
|
16
|
+
* {
|
|
17
|
+
* "result": [
|
|
18
|
+
* {
|
|
19
|
+
* "url": "https://example.com/embed.html",
|
|
20
|
+
* "name": "embed.html",
|
|
21
|
+
* "size": 2048
|
|
22
|
+
* }
|
|
23
|
+
* ]
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
14
26
|
* @property {Object<string, string>} [uploadHeaders] - Headers to include in file upload requests.
|
|
15
27
|
* @property {number} [uploadSizeLimit] - The total file upload size limit in bytes.
|
|
16
28
|
* @property {number} [uploadSingleSizeLimit] - The single file upload size limit in bytes.
|
|
@@ -22,6 +22,18 @@ const { NO_EVENT } = env;
|
|
|
22
22
|
* @property {boolean} [createUrlInput] - Whether to create a URL input element for image insertion.
|
|
23
23
|
* - Defaults to `true`. Always `true` when `createFileInput` is `false`.
|
|
24
24
|
* @property {string} [uploadUrl] - The URL endpoint for image file uploads.
|
|
25
|
+
* - The server must return:
|
|
26
|
+
* ```js
|
|
27
|
+
* {
|
|
28
|
+
* "result": [
|
|
29
|
+
* {
|
|
30
|
+
* "url": "https://example.com/image.jpg",
|
|
31
|
+
* "name": "image.jpg",
|
|
32
|
+
* "size": 123456
|
|
33
|
+
* }
|
|
34
|
+
* ]
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
25
37
|
* @property {Object<string, string>} [uploadHeaders] - Additional headers to include in the file upload request.
|
|
26
38
|
* ```js
|
|
27
39
|
* { uploadUrl: '/api/upload/image', uploadHeaders: { Authorization: 'Bearer token' } }
|
|
@@ -6,6 +6,18 @@ import { dom, numbers } from '../../helper';
|
|
|
6
6
|
/**
|
|
7
7
|
* @typedef {Object} LinkOptions
|
|
8
8
|
* @property {string} [uploadUrl] - The URL endpoint for file uploads.
|
|
9
|
+
* - The server must return:
|
|
10
|
+
* ```js
|
|
11
|
+
* {
|
|
12
|
+
* "result": [
|
|
13
|
+
* {
|
|
14
|
+
* "url": "https://example.com/file.pdf",
|
|
15
|
+
* "name": "file.pdf",
|
|
16
|
+
* "size": 1048576
|
|
17
|
+
* }
|
|
18
|
+
* ]
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
9
21
|
* @property {Object<string, string>} [uploadHeaders] - Additional headers for file upload requests.
|
|
10
22
|
* @property {number} [uploadSizeLimit] - The total file upload size limit in bytes.
|
|
11
23
|
* @property {number} [uploadSingleSizeLimit] - The single file upload size limit in bytes.
|
|
@@ -19,6 +19,18 @@ import { CreateHTML_modal } from './render/video.html';
|
|
|
19
19
|
* @property {boolean} [createUrlInput] - Whether to create a URL input element for video embedding.
|
|
20
20
|
* - Defaults to `true`. Always `true` when `createFileInput` is `false`.
|
|
21
21
|
* @property {string} [uploadUrl] - The URL endpoint for video file uploads.
|
|
22
|
+
* - The server must return:
|
|
23
|
+
* ```js
|
|
24
|
+
* {
|
|
25
|
+
* "result": [
|
|
26
|
+
* {
|
|
27
|
+
* "url": "https://example.com/video.mp4",
|
|
28
|
+
* "name": "video.mp4",
|
|
29
|
+
* "size": 5242880
|
|
30
|
+
* }
|
|
31
|
+
* ]
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
22
34
|
* @property {Object<string, string>} [uploadHeaders] - Additional headers to include in the video upload request.
|
|
23
35
|
* @property {number} [uploadSizeLimit] - The total upload size limit for videos in bytes.
|
|
24
36
|
* @property {number} [uploadSingleSizeLimit] - The single file upload size limit for videos in bytes.
|
package/types/langs/_Lang.d.ts
CHANGED
|
@@ -84,6 +84,19 @@ export type BrowserParams = {
|
|
|
84
84
|
useSearch?: boolean;
|
|
85
85
|
/**
|
|
86
86
|
* - File server search url. Optional. Can be overridden in browser.
|
|
87
|
+
* - Requested as `searchUrl + '?keyword=' + keyword`. The server must return:
|
|
88
|
+
* ```js
|
|
89
|
+
* {
|
|
90
|
+
* "result": [
|
|
91
|
+
* {
|
|
92
|
+
* "src": "https://example.com/file.jpg",
|
|
93
|
+
* "name": "file.jpg",
|
|
94
|
+
* "thumbnail": "https://example.com/file_thumb.jpg",
|
|
95
|
+
* "tag": ["photo"]
|
|
96
|
+
* }
|
|
97
|
+
* ]
|
|
98
|
+
* }
|
|
99
|
+
* ```
|
|
87
100
|
*/
|
|
88
101
|
searchUrl?: string;
|
|
89
102
|
/**
|
|
@@ -113,6 +126,10 @@ export type BrowserParams = {
|
|
|
113
126
|
* - Optional. Can be overridden in browser. Default: 4.
|
|
114
127
|
*/
|
|
115
128
|
columnSize?: number;
|
|
129
|
+
/**
|
|
130
|
+
* - Initial folder expand depth. `1` expands the first level, `Infinity` expands all. Default: `1`.
|
|
131
|
+
*/
|
|
132
|
+
expand?: number;
|
|
116
133
|
/**
|
|
117
134
|
* - Default thumbnail
|
|
118
135
|
*/
|
|
@@ -142,6 +159,19 @@ export type BrowserParams = {
|
|
|
142
159
|
* @property {(target: Node) => void} selectorHandler - Function that actions when an item is clicked. Required. Can be overridden in browser.
|
|
143
160
|
* @property {boolean} [useSearch] - Whether to use the search function. Optional. Default: `true`.
|
|
144
161
|
* @property {string} [searchUrl] - File server search url. Optional. Can be overridden in browser.
|
|
162
|
+
* - Requested as `searchUrl + '?keyword=' + keyword`. The server must return:
|
|
163
|
+
* ```js
|
|
164
|
+
* {
|
|
165
|
+
* "result": [
|
|
166
|
+
* {
|
|
167
|
+
* "src": "https://example.com/file.jpg",
|
|
168
|
+
* "name": "file.jpg",
|
|
169
|
+
* "thumbnail": "https://example.com/file_thumb.jpg",
|
|
170
|
+
* "tag": ["photo"]
|
|
171
|
+
* }
|
|
172
|
+
* ]
|
|
173
|
+
* }
|
|
174
|
+
* ```
|
|
145
175
|
* @property {Object<string, string>} [searchUrlHeader] - File server search http header. Optional. Can be overridden in browser.
|
|
146
176
|
* @property {string} [listClass] - Class name of list div. Required. Can be overridden in browser.
|
|
147
177
|
* @property {(item: BrowserFile) => string} [drawItemHandler] - Function that returns HTML string for rendering each file item. Required. Can be overridden in browser.
|
|
@@ -152,6 +182,7 @@ export type BrowserParams = {
|
|
|
152
182
|
* @property {Array<*>} [props] - `props` argument to `drawItemHandler` function. Optional. Can be overridden in browser.
|
|
153
183
|
* @property {number} [columnSize] - Number of `div.se-file-item-column` to be created.
|
|
154
184
|
* - Optional. Can be overridden in browser. Default: 4.
|
|
185
|
+
* @property {number} [expand=1] - Initial folder expand depth. `1` expands the first level, `Infinity` expands all. Default: `1`.
|
|
155
186
|
* @property {((item: BrowserFile) => string)} [thumbnail] - Default thumbnail
|
|
156
187
|
*/
|
|
157
188
|
/**
|
|
@@ -206,6 +237,7 @@ declare class Browser {
|
|
|
206
237
|
drawItemHandler: any;
|
|
207
238
|
selectorHandler: (target: Node) => void;
|
|
208
239
|
columnSize: number;
|
|
240
|
+
expand: number;
|
|
209
241
|
folderDefaultPath: string;
|
|
210
242
|
closeArrow: any;
|
|
211
243
|
openArrow: any;
|
|
@@ -25,7 +25,10 @@ export type ModalAnchorEditorParams = {
|
|
|
25
25
|
* - Default `rel` values auto-applied by condition.
|
|
26
26
|
* `default` is always applied, `check_new_window` when "Open in new window" is checked, `check_bookmark` for bookmark links.
|
|
27
27
|
* ```js
|
|
28
|
-
* {
|
|
28
|
+
* {
|
|
29
|
+
* relList: ['nofollow', 'noreferrer', 'noopener'],
|
|
30
|
+
* defaultRel: { default: 'noopener', check_new_window: 'noreferrer' }
|
|
31
|
+
* }
|
|
29
32
|
* ```
|
|
30
33
|
*/
|
|
31
34
|
defaultRel?: {
|
|
@@ -35,6 +38,18 @@ export type ModalAnchorEditorParams = {
|
|
|
35
38
|
};
|
|
36
39
|
/**
|
|
37
40
|
* - File upload URL.
|
|
41
|
+
* - The server must return:
|
|
42
|
+
* ```js
|
|
43
|
+
* {
|
|
44
|
+
* "result": [
|
|
45
|
+
* {
|
|
46
|
+
* "url": "https://example.com/file.pdf",
|
|
47
|
+
* "name": "file.pdf",
|
|
48
|
+
* "size": 1048576
|
|
49
|
+
* }
|
|
50
|
+
* ]
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
38
53
|
*/
|
|
39
54
|
uploadUrl?: string;
|
|
40
55
|
/**
|
|
@@ -70,9 +85,24 @@ export type ModalAnchorEditorParams = {
|
|
|
70
85
|
* @property {{default?: string, check_new_window?: string, check_bookmark?: string}} [defaultRel={}] - Default `rel` values auto-applied by condition.
|
|
71
86
|
* `default` is always applied, `check_new_window` when "Open in new window" is checked, `check_bookmark` for bookmark links.
|
|
72
87
|
* ```js
|
|
73
|
-
* {
|
|
88
|
+
* {
|
|
89
|
+
* relList: ['nofollow', 'noreferrer', 'noopener'],
|
|
90
|
+
* defaultRel: { default: 'noopener', check_new_window: 'noreferrer' }
|
|
91
|
+
* }
|
|
74
92
|
* ```
|
|
75
93
|
* @property {string} [uploadUrl] - File upload URL.
|
|
94
|
+
* - The server must return:
|
|
95
|
+
* ```js
|
|
96
|
+
* {
|
|
97
|
+
* "result": [
|
|
98
|
+
* {
|
|
99
|
+
* "url": "https://example.com/file.pdf",
|
|
100
|
+
* "name": "file.pdf",
|
|
101
|
+
* "size": 1048576
|
|
102
|
+
* }
|
|
103
|
+
* ]
|
|
104
|
+
* }
|
|
105
|
+
* ```
|
|
76
106
|
* @property {Object<string, string>} [uploadHeaders] - File upload headers.
|
|
77
107
|
* @property {number} [uploadSizeLimit] - File upload size limit.
|
|
78
108
|
* @property {number} [uploadSingleSizeLimit] - File upload single size limit.
|
|
@@ -7,6 +7,19 @@ export type AudioGalleryPluginOptions = {
|
|
|
7
7
|
data?: Array<SunEditor.Module.Browser.File>;
|
|
8
8
|
/**
|
|
9
9
|
* - Server request URL
|
|
10
|
+
* - The server must return:
|
|
11
|
+
* ```js
|
|
12
|
+
* {
|
|
13
|
+
* "result": [
|
|
14
|
+
* {
|
|
15
|
+
* "src": "https://example.com/audio.mp3",
|
|
16
|
+
* "name": "audio.mp3",
|
|
17
|
+
* "thumbnail": "https://example.com/audio_icon.png",
|
|
18
|
+
* "tag": ["music"]
|
|
19
|
+
* }
|
|
20
|
+
* ]
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
10
23
|
*/
|
|
11
24
|
url?: string;
|
|
12
25
|
/**
|
|
@@ -24,6 +37,19 @@ export type AudioGalleryPluginOptions = {
|
|
|
24
37
|
* @typedef {Object} AudioGalleryPluginOptions
|
|
25
38
|
* @property {Array<SunEditor.Module.Browser.File>} [data] - Direct data without server calls
|
|
26
39
|
* @property {string} [url] - Server request URL
|
|
40
|
+
* - The server must return:
|
|
41
|
+
* ```js
|
|
42
|
+
* {
|
|
43
|
+
* "result": [
|
|
44
|
+
* {
|
|
45
|
+
* "src": "https://example.com/audio.mp3",
|
|
46
|
+
* "name": "audio.mp3",
|
|
47
|
+
* "thumbnail": "https://example.com/audio_icon.png",
|
|
48
|
+
* "tag": ["music"]
|
|
49
|
+
* }
|
|
50
|
+
* ]
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
27
53
|
* @property {Object<string, string>} [headers] - Server request headers
|
|
28
54
|
* @property {string|((item: SunEditor.Module.Browser.File) => string)} [thumbnail] - Default thumbnail
|
|
29
55
|
*/
|
|
@@ -11,6 +11,26 @@ export type FileBrowserPluginOptions = {
|
|
|
11
11
|
| Array<any>;
|
|
12
12
|
/**
|
|
13
13
|
* - Server request URL
|
|
14
|
+
* - The server must return a nested folder structure.
|
|
15
|
+
* - `_data`: array (inline) or string URL (lazy-loaded on folder click).
|
|
16
|
+
* - `"default": true` sets the initially selected folder.
|
|
17
|
+
* ```js
|
|
18
|
+
* {
|
|
19
|
+
* "result": {
|
|
20
|
+
* "root": {
|
|
21
|
+
* "name": "Root",
|
|
22
|
+
* "default": true,
|
|
23
|
+
* "_data": [
|
|
24
|
+
* { "src": "https://example.com/file1.pdf", "name": "file1.pdf" }
|
|
25
|
+
* ],
|
|
26
|
+
* "documents": {
|
|
27
|
+
* "name": "Documents",
|
|
28
|
+
* "_data": "https://api.example.com/files/documents"
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
14
34
|
*/
|
|
15
35
|
url?: string;
|
|
16
36
|
/**
|
|
@@ -23,6 +43,10 @@ export type FileBrowserPluginOptions = {
|
|
|
23
43
|
* - Default thumbnail URL or a function that returns a thumbnail URL per item.
|
|
24
44
|
*/
|
|
25
45
|
thumbnail?: string | ((item: SunEditor.Module.Browser.File) => string);
|
|
46
|
+
/**
|
|
47
|
+
* - Initial folder expand depth. `1` expands the first level, `Infinity` expands all. Default: `1`.
|
|
48
|
+
*/
|
|
49
|
+
expand?: number;
|
|
26
50
|
/**
|
|
27
51
|
* - Additional tag names
|
|
28
52
|
* ```js
|
|
@@ -35,8 +59,29 @@ export type FileBrowserPluginOptions = {
|
|
|
35
59
|
* @typedef {Object} FileBrowserPluginOptions
|
|
36
60
|
* @property {Object<string, *>|Array<*>} [data] - Direct data without server calls (bypasses URL fetch).
|
|
37
61
|
* @property {string} [url] - Server request URL
|
|
62
|
+
* - The server must return a nested folder structure.
|
|
63
|
+
* - `_data`: array (inline) or string URL (lazy-loaded on folder click).
|
|
64
|
+
* - `"default": true` sets the initially selected folder.
|
|
65
|
+
* ```js
|
|
66
|
+
* {
|
|
67
|
+
* "result": {
|
|
68
|
+
* "root": {
|
|
69
|
+
* "name": "Root",
|
|
70
|
+
* "default": true,
|
|
71
|
+
* "_data": [
|
|
72
|
+
* { "src": "https://example.com/file1.pdf", "name": "file1.pdf" }
|
|
73
|
+
* ],
|
|
74
|
+
* "documents": {
|
|
75
|
+
* "name": "Documents",
|
|
76
|
+
* "_data": "https://api.example.com/files/documents"
|
|
77
|
+
* }
|
|
78
|
+
* }
|
|
79
|
+
* }
|
|
80
|
+
* }
|
|
81
|
+
* ```
|
|
38
82
|
* @property {Object<string, string>} [headers] - Server request headers
|
|
39
83
|
* @property {string|((item: SunEditor.Module.Browser.File) => string)} [thumbnail] - Default thumbnail URL or a function that returns a thumbnail URL per item.
|
|
84
|
+
* @property {number} [expand=1] - Initial folder expand depth. `1` expands the first level, `Infinity` expands all. Default: `1`.
|
|
40
85
|
* @property {Array<string>} [props] - Additional tag names
|
|
41
86
|
* ```js
|
|
42
87
|
* { url: '/api/files', headers: { Authorization: 'Bearer token' }, thumbnail: (item) => item.thumbUrl }
|
|
@@ -7,6 +7,20 @@ export type FileGalleryPluginOptions = {
|
|
|
7
7
|
data?: Array<SunEditor.Module.Browser.File>;
|
|
8
8
|
/**
|
|
9
9
|
* - Server request URL
|
|
10
|
+
* - The server must return:
|
|
11
|
+
* ```js
|
|
12
|
+
* {
|
|
13
|
+
* "result": [
|
|
14
|
+
* {
|
|
15
|
+
* "src": "https://example.com/doc.pdf",
|
|
16
|
+
* "name": "doc.pdf",
|
|
17
|
+
* "thumbnail": "https://example.com/pdf_icon.png",
|
|
18
|
+
* "type": "file", // video, image ..[plugin name]
|
|
19
|
+
* "tag": ["document"]
|
|
20
|
+
* }
|
|
21
|
+
* ]
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
10
24
|
*/
|
|
11
25
|
url?: string;
|
|
12
26
|
/**
|
|
@@ -24,6 +38,20 @@ export type FileGalleryPluginOptions = {
|
|
|
24
38
|
* @typedef {Object} FileGalleryPluginOptions
|
|
25
39
|
* @property {Array<SunEditor.Module.Browser.File>} [data] - Direct data without server calls
|
|
26
40
|
* @property {string} [url] - Server request URL
|
|
41
|
+
* - The server must return:
|
|
42
|
+
* ```js
|
|
43
|
+
* {
|
|
44
|
+
* "result": [
|
|
45
|
+
* {
|
|
46
|
+
* "src": "https://example.com/doc.pdf",
|
|
47
|
+
* "name": "doc.pdf",
|
|
48
|
+
* "thumbnail": "https://example.com/pdf_icon.png",
|
|
49
|
+
* "type": "file", // video, image ..[plugin name]
|
|
50
|
+
* "tag": ["document"]
|
|
51
|
+
* }
|
|
52
|
+
* ]
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
27
55
|
* @property {Object<string, string>} [headers] - Server request headers
|
|
28
56
|
* @property {string|((item: SunEditor.Module.Browser.File) => string)} [thumbnail] - Default thumbnail
|
|
29
57
|
*/
|
|
@@ -7,6 +7,20 @@ export type ImageGalleryPluginOptions = {
|
|
|
7
7
|
data?: Array<any>;
|
|
8
8
|
/**
|
|
9
9
|
* - Server request URL
|
|
10
|
+
* - The server must return:
|
|
11
|
+
* ```js
|
|
12
|
+
* {
|
|
13
|
+
* "result": [
|
|
14
|
+
* {
|
|
15
|
+
* "src": "https://example.com/img.jpg",
|
|
16
|
+
* "name": "img.jpg",
|
|
17
|
+
* "thumbnail": "https://example.com/img_thumb.jpg",
|
|
18
|
+
* "alt": "description",
|
|
19
|
+
* "tag": ["nature"]
|
|
20
|
+
* }
|
|
21
|
+
* ]
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
10
24
|
*/
|
|
11
25
|
url?: string;
|
|
12
26
|
/**
|
|
@@ -20,6 +34,20 @@ export type ImageGalleryPluginOptions = {
|
|
|
20
34
|
* @typedef ImageGalleryPluginOptions
|
|
21
35
|
* @property {Array<*>} [data] - Direct data without server calls
|
|
22
36
|
* @property {string} [url] - Server request URL
|
|
37
|
+
* - The server must return:
|
|
38
|
+
* ```js
|
|
39
|
+
* {
|
|
40
|
+
* "result": [
|
|
41
|
+
* {
|
|
42
|
+
* "src": "https://example.com/img.jpg",
|
|
43
|
+
* "name": "img.jpg",
|
|
44
|
+
* "thumbnail": "https://example.com/img_thumb.jpg",
|
|
45
|
+
* "alt": "description",
|
|
46
|
+
* "tag": ["nature"]
|
|
47
|
+
* }
|
|
48
|
+
* ]
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
23
51
|
* @property {Object<string, string>} [headers] - Server request headers
|
|
24
52
|
*/
|
|
25
53
|
/**
|
|
@@ -7,6 +7,20 @@ export type VideoGalleryPluginOptions = {
|
|
|
7
7
|
data?: Array<SunEditor.Module.Browser.File>;
|
|
8
8
|
/**
|
|
9
9
|
* - Server request URL
|
|
10
|
+
* - The server must return:
|
|
11
|
+
* ```js
|
|
12
|
+
* {
|
|
13
|
+
* "result": [
|
|
14
|
+
* {
|
|
15
|
+
* "src": "https://example.com/video.mp4",
|
|
16
|
+
* "name": "video.mp4",
|
|
17
|
+
* "thumbnail": "https://example.com/video_thumb.jpg",
|
|
18
|
+
* "frame": "video",
|
|
19
|
+
* "tag": ["tutorial"]
|
|
20
|
+
* }
|
|
21
|
+
* ]
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
10
24
|
*/
|
|
11
25
|
url?: string;
|
|
12
26
|
/**
|
|
@@ -24,6 +38,20 @@ export type VideoGalleryPluginOptions = {
|
|
|
24
38
|
* @typedef {Object} VideoGalleryPluginOptions
|
|
25
39
|
* @property {Array<SunEditor.Module.Browser.File>} [data] - Direct data without server calls
|
|
26
40
|
* @property {string} [url] - Server request URL
|
|
41
|
+
* - The server must return:
|
|
42
|
+
* ```js
|
|
43
|
+
* {
|
|
44
|
+
* "result": [
|
|
45
|
+
* {
|
|
46
|
+
* "src": "https://example.com/video.mp4",
|
|
47
|
+
* "name": "video.mp4",
|
|
48
|
+
* "thumbnail": "https://example.com/video_thumb.jpg",
|
|
49
|
+
* "frame": "video",
|
|
50
|
+
* "tag": ["tutorial"]
|
|
51
|
+
* }
|
|
52
|
+
* ]
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
27
55
|
* @property {Object<string, string>} [headers] - Server request headers
|
|
28
56
|
* @property {string|((item: SunEditor.Module.Browser.File) => string)} [thumbnail] - Default thumbnail
|
|
29
57
|
*/
|
|
@@ -3,6 +3,18 @@ export default FileUpload;
|
|
|
3
3
|
export type FileUploadPluginOptions = {
|
|
4
4
|
/**
|
|
5
5
|
* - Server request URL for file upload
|
|
6
|
+
* - The server must return:
|
|
7
|
+
* ```js
|
|
8
|
+
* {
|
|
9
|
+
* "result": [
|
|
10
|
+
* {
|
|
11
|
+
* "url": "https://example.com/file.pdf",
|
|
12
|
+
* "name": "file.pdf",
|
|
13
|
+
* "size": 1048576
|
|
14
|
+
* }
|
|
15
|
+
* ]
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
6
18
|
*/
|
|
7
19
|
uploadUrl: string;
|
|
8
20
|
/**
|
|
@@ -51,6 +63,18 @@ export type FileUploadPluginOptions = {
|
|
|
51
63
|
/**
|
|
52
64
|
* @typedef FileUploadPluginOptions
|
|
53
65
|
* @property {string} uploadUrl - Server request URL for file upload
|
|
66
|
+
* - The server must return:
|
|
67
|
+
* ```js
|
|
68
|
+
* {
|
|
69
|
+
* "result": [
|
|
70
|
+
* {
|
|
71
|
+
* "url": "https://example.com/file.pdf",
|
|
72
|
+
* "name": "file.pdf",
|
|
73
|
+
* "size": 1048576
|
|
74
|
+
* }
|
|
75
|
+
* ]
|
|
76
|
+
* }
|
|
77
|
+
* ```
|
|
54
78
|
* @property {Object<string, string>} [uploadHeaders] - Server request headers
|
|
55
79
|
* @property {number} [uploadSizeLimit] - Total upload size limit in bytes
|
|
56
80
|
* @property {number} [uploadSingleSizeLimit] - Single file size limit in bytes
|
|
@@ -53,7 +53,7 @@ export type MentionPluginOptions = {
|
|
|
53
53
|
* @property {string} [triggerText="@"] - The character that triggers the mention list.
|
|
54
54
|
* @property {number} [limitSize=5] - The number of items to display in the mention list
|
|
55
55
|
* @property {number} [searchStartLength=0] - The number of characters to start searching for the mention list
|
|
56
|
-
* @property {number} [delayTime=
|
|
56
|
+
* @property {number} [delayTime=120] - The time to wait before displaying the mention list
|
|
57
57
|
* @property {Array<{key: string, name: string, url: string}>} [data] - Static mention data (used instead of API).
|
|
58
58
|
* ```js
|
|
59
59
|
* // data
|
|
@@ -20,6 +20,18 @@ export type AudioPluginOptions = {
|
|
|
20
20
|
createUrlInput?: boolean;
|
|
21
21
|
/**
|
|
22
22
|
* - The URL to which files will be uploaded.
|
|
23
|
+
* - The server must return:
|
|
24
|
+
* ```js
|
|
25
|
+
* {
|
|
26
|
+
* "result": [
|
|
27
|
+
* {
|
|
28
|
+
* "url": "https://example.com/audio.mp3",
|
|
29
|
+
* "name": "audio.mp3",
|
|
30
|
+
* "size": 3145728
|
|
31
|
+
* }
|
|
32
|
+
* ]
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
23
35
|
*/
|
|
24
36
|
uploadUrl?: string;
|
|
25
37
|
/**
|
|
@@ -71,6 +83,18 @@ export type AudioPluginOptions = {
|
|
|
71
83
|
* @property {boolean} [createUrlInput] - Whether to create a URL input element.
|
|
72
84
|
* - Defaults to `true`. Always `true` when `createFileInput` is `false`.
|
|
73
85
|
* @property {string} [uploadUrl] - The URL to which files will be uploaded.
|
|
86
|
+
* - The server must return:
|
|
87
|
+
* ```js
|
|
88
|
+
* {
|
|
89
|
+
* "result": [
|
|
90
|
+
* {
|
|
91
|
+
* "url": "https://example.com/audio.mp3",
|
|
92
|
+
* "name": "audio.mp3",
|
|
93
|
+
* "size": 3145728
|
|
94
|
+
* }
|
|
95
|
+
* ]
|
|
96
|
+
* }
|
|
97
|
+
* ```
|
|
74
98
|
* @property {Object<string, string>} [uploadHeaders] - Headers to include in the file upload request.
|
|
75
99
|
* @property {number} [uploadSizeLimit] - The total upload size limit in bytes.
|
|
76
100
|
* @property {number} [uploadSingleSizeLimit] - The single file size limit in bytes.
|
|
@@ -23,6 +23,18 @@ export type EmbedPluginOptions = {
|
|
|
23
23
|
percentageOnlySize?: boolean;
|
|
24
24
|
/**
|
|
25
25
|
* - The URL for file uploads.
|
|
26
|
+
* - The server must return:
|
|
27
|
+
* ```js
|
|
28
|
+
* {
|
|
29
|
+
* "result": [
|
|
30
|
+
* {
|
|
31
|
+
* "url": "https://example.com/embed.html",
|
|
32
|
+
* "name": "embed.html",
|
|
33
|
+
* "size": 2048
|
|
34
|
+
* }
|
|
35
|
+
* ]
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
26
38
|
*/
|
|
27
39
|
uploadUrl?: string;
|
|
28
40
|
/**
|
|
@@ -110,6 +122,18 @@ export type EmbedPluginOptions = {
|
|
|
110
122
|
* @property {string} [defaultHeight] - The default height of the embed element (numeric value or with unit).
|
|
111
123
|
* @property {boolean} [percentageOnlySize=false] - Whether to allow only percentage-based sizing.
|
|
112
124
|
* @property {string} [uploadUrl] - The URL for file uploads.
|
|
125
|
+
* - The server must return:
|
|
126
|
+
* ```js
|
|
127
|
+
* {
|
|
128
|
+
* "result": [
|
|
129
|
+
* {
|
|
130
|
+
* "url": "https://example.com/embed.html",
|
|
131
|
+
* "name": "embed.html",
|
|
132
|
+
* "size": 2048
|
|
133
|
+
* }
|
|
134
|
+
* ]
|
|
135
|
+
* }
|
|
136
|
+
* ```
|
|
113
137
|
* @property {Object<string, string>} [uploadHeaders] - Headers to include in file upload requests.
|
|
114
138
|
* @property {number} [uploadSizeLimit] - The total file upload size limit in bytes.
|
|
115
139
|
* @property {number} [uploadSingleSizeLimit] - The single file upload size limit in bytes.
|