suneditor 3.0.5 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/suneditor.min.css +1 -1
  2. package/dist/suneditor.min.js +1 -1
  3. package/package.json +1 -1
  4. package/src/assets/suneditor.css +53 -5
  5. package/src/core/editor.js +20 -3
  6. package/src/core/event/eventOrchestrator.js +2 -1
  7. package/src/core/event/handlers/handler_ww_key.js +2 -2
  8. package/src/core/logic/dom/html.js +23 -1
  9. package/src/core/logic/dom/offset.js +24 -1
  10. package/src/core/logic/panel/viewer.js +6 -4
  11. package/src/core/logic/shell/_commandExecutor.js +38 -1
  12. package/src/core/logic/shell/shortcuts.js +1 -1
  13. package/src/core/schema/options.js +1 -1
  14. package/src/core/section/constructor.js +3 -3
  15. package/src/helper/index.js +3 -0
  16. package/src/helper/msOffice.js +849 -0
  17. package/src/interfaces/plugins.js +1 -1
  18. package/src/langs/ckb.js +1 -0
  19. package/src/langs/cs.js +1 -0
  20. package/src/langs/da.js +1 -0
  21. package/src/langs/de.js +1 -0
  22. package/src/langs/en.js +1 -1
  23. package/src/langs/es.js +1 -0
  24. package/src/langs/fa.js +1 -0
  25. package/src/langs/fr.js +1 -0
  26. package/src/langs/he.js +1 -0
  27. package/src/langs/hu.js +1 -0
  28. package/src/langs/it.js +1 -0
  29. package/src/langs/ja.js +1 -0
  30. package/src/langs/km.js +1 -0
  31. package/src/langs/ko.js +1 -0
  32. package/src/langs/lv.js +1 -0
  33. package/src/langs/nl.js +1 -0
  34. package/src/langs/pl.js +1 -0
  35. package/src/langs/pt_br.js +1 -0
  36. package/src/langs/ro.js +1 -0
  37. package/src/langs/ru.js +1 -0
  38. package/src/langs/se.js +1 -0
  39. package/src/langs/tr.js +1 -0
  40. package/src/langs/uk.js +1 -0
  41. package/src/langs/ur.js +1 -0
  42. package/src/langs/zh_cn.js +1 -0
  43. package/src/modules/contract/Browser.js +99 -10
  44. package/src/modules/ui/ModalAnchorEditor.js +16 -1
  45. package/src/plugins/browser/audioGallery.js +13 -0
  46. package/src/plugins/browser/fileBrowser.js +22 -0
  47. package/src/plugins/browser/fileGallery.js +14 -0
  48. package/src/plugins/browser/imageGallery.js +14 -0
  49. package/src/plugins/browser/videoGallery.js +14 -0
  50. package/src/plugins/command/fileUpload.js +12 -0
  51. package/src/plugins/dropdown/layout.js +1 -1
  52. package/src/plugins/dropdown/template.js +2 -1
  53. package/src/plugins/field/autocomplete.js +346 -0
  54. package/src/plugins/index.js +3 -3
  55. package/src/plugins/modal/audio.js +12 -0
  56. package/src/plugins/modal/embed.js +12 -0
  57. package/src/plugins/modal/image/index.js +12 -0
  58. package/src/plugins/modal/link.js +12 -0
  59. package/src/plugins/modal/video/index.js +12 -0
  60. package/src/typedef.js +1 -1
  61. package/types/core/logic/shell/shortcuts.d.ts +2 -2
  62. package/types/core/schema/options.d.ts +2 -2
  63. package/types/helper/index.d.ts +4 -0
  64. package/types/helper/msOffice.d.ts +11 -0
  65. package/types/interfaces/plugins.d.ts +1 -1
  66. package/types/langs/_Lang.d.ts +1 -1
  67. package/types/modules/contract/Browser.d.ts +32 -0
  68. package/types/modules/ui/ModalAnchorEditor.d.ts +32 -2
  69. package/types/plugins/browser/audioGallery.d.ts +26 -0
  70. package/types/plugins/browser/fileBrowser.d.ts +45 -0
  71. package/types/plugins/browser/fileGallery.d.ts +28 -0
  72. package/types/plugins/browser/imageGallery.d.ts +28 -0
  73. package/types/plugins/browser/videoGallery.d.ts +28 -0
  74. package/types/plugins/command/fileUpload.d.ts +24 -0
  75. package/types/plugins/field/autocomplete.d.ts +177 -0
  76. package/types/plugins/index.d.ts +3 -3
  77. package/types/plugins/modal/audio.d.ts +24 -0
  78. package/types/plugins/modal/embed.d.ts +24 -0
  79. package/types/plugins/modal/image/index.d.ts +24 -0
  80. package/types/plugins/modal/link.d.ts +28 -1
  81. package/types/plugins/modal/video/index.d.ts +24 -0
  82. package/types/typedef.d.ts +1 -1
  83. package/src/plugins/field/mention.js +0 -251
  84. package/types/plugins/field/mention.d.ts +0 -104
@@ -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
- * { relList: ['nofollow', 'noreferrer', 'noopener'], defaultRel: { default: 'noopener', check_new_window: 'noreferrer' } }
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
- * { relList: ['nofollow', 'noreferrer', 'noopener'], defaultRel: { default: 'noopener', check_new_window: 'noreferrer' } }
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
@@ -0,0 +1,177 @@
1
+ import type {} from '../../typedef';
2
+ export default Autocomplete;
3
+ export type AutocompleteTriggerConfig = {
4
+ /**
5
+ * - Static data array. Each item must have a `key` field. Mutually exclusive with `apiUrl`.
6
+ * ```js
7
+ * // data
8
+ * [{ key: 'john', name: 'John Doe', url: '/users/john' }]
9
+ * ```
10
+ */
11
+ data?: Array<{
12
+ key: string;
13
+ [x: string]: any;
14
+ }>;
15
+ /**
16
+ * - API endpoint URL. Supports `{key}` and `{limitSize}` placeholders. Mutually exclusive with `data`.
17
+ */
18
+ apiUrl?: string;
19
+ /**
20
+ * - HTTP headers for the API request.
21
+ */
22
+ apiHeaders?: {
23
+ [x: string]: string;
24
+ };
25
+ /**
26
+ * - Transforms parsed JSON response into an array of data items.
27
+ */
28
+ transformResponse?: (
29
+ arg0: any,
30
+ arg1: XMLHttpRequest,
31
+ ) => Array<{
32
+ key: string;
33
+ }>;
34
+ /**
35
+ * - Override global `limitSize` for this trigger.
36
+ */
37
+ limitSize?: number;
38
+ /**
39
+ * - Override global `searchStartLength` for this trigger.
40
+ */
41
+ searchStartLength?: number;
42
+ /**
43
+ * - Override global `useCachingData` for this trigger.
44
+ */
45
+ useCachingData?: boolean;
46
+ /**
47
+ * - Override global `useCachingFieldData` for this trigger.
48
+ */
49
+ useCachingFieldData?: boolean;
50
+ /**
51
+ * - Custom dropdown item renderer. Receives `(item, triggerText)`, returns HTML string.
52
+ */
53
+ renderItem?: (
54
+ arg0: {
55
+ key: string;
56
+ [x: string]: any;
57
+ },
58
+ arg1: string,
59
+ ) => string;
60
+ /**
61
+ * - Custom selection handler. Returns:
62
+ * - `string`: inserted as text node
63
+ * - `Element`: inserted as-is
64
+ * - `{tag, attrs, text}`: creates element via `dom.utils.createElement`
65
+ */
66
+ onSelect?: (
67
+ arg0: {
68
+ key: string;
69
+ [x: string]: any;
70
+ },
71
+ arg1: string,
72
+ ) =>
73
+ | string
74
+ | Element
75
+ | {
76
+ tag: string;
77
+ attrs?: any;
78
+ text?: string;
79
+ };
80
+ };
81
+ export type AutocompletePluginOptions = {
82
+ /**
83
+ * - Debounce delay in ms before processing input.
84
+ */
85
+ delayTime?: number;
86
+ /**
87
+ * - Maximum number of items to display in the dropdown.
88
+ */
89
+ limitSize?: number;
90
+ /**
91
+ * - Minimum input length before triggering search.
92
+ */
93
+ searchStartLength?: number;
94
+ /**
95
+ * - Whether to cache query responses per trigger.
96
+ */
97
+ useCachingData?: boolean;
98
+ /**
99
+ * - Whether to cache selected items for priority display.
100
+ */
101
+ useCachingFieldData?: boolean;
102
+ /**
103
+ * - Per-trigger configurations keyed by trigger character.
104
+ * ```js
105
+ * // triggers
106
+ * {
107
+ * '@': { data: [...], renderItem: (item) => `...` },
108
+ * '#': { apiUrl: '/api/tags?q={key}' }
109
+ * }
110
+ * ```
111
+ */
112
+ triggers: {
113
+ [x: string]: AutocompleteTriggerConfig;
114
+ };
115
+ };
116
+ /**
117
+ * @typedef {Object} AutocompleteTriggerConfig
118
+ * @property {Array<{key: string, [x: string]: any}>} [data] - Static data array. Each item must have a `key` field. Mutually exclusive with `apiUrl`.
119
+ * ```js
120
+ * // data
121
+ * [{ key: 'john', name: 'John Doe', url: '/users/john' }]
122
+ * ```
123
+ * @property {string} [apiUrl] - API endpoint URL. Supports `{key}` and `{limitSize}` placeholders. Mutually exclusive with `data`.
124
+ * @property {Object<string, string>} [apiHeaders] - HTTP headers for the API request.
125
+ * @property {function(Object, XMLHttpRequest): Array<{key: string}>} [transformResponse] - Transforms parsed JSON response into an array of data items.
126
+ * @property {number} [limitSize] - Override global `limitSize` for this trigger.
127
+ * @property {number} [searchStartLength] - Override global `searchStartLength` for this trigger.
128
+ * @property {boolean} [useCachingData] - Override global `useCachingData` for this trigger.
129
+ * @property {boolean} [useCachingFieldData] - Override global `useCachingFieldData` for this trigger.
130
+ * @property {function({key: string, [x: string]: any}, string): string} [renderItem] - Custom dropdown item renderer. Receives `(item, triggerText)`, returns HTML string.
131
+ * @property {function({key: string, [x: string]: any}, string): (string|Element|{tag: string, attrs?: Object, text?: string})} [onSelect] - Custom selection handler. Returns:
132
+ * - `string`: inserted as text node
133
+ * - `Element`: inserted as-is
134
+ * - `{tag, attrs, text}`: creates element via `dom.utils.createElement`
135
+ */
136
+ /**
137
+ * @typedef {Object} AutocompletePluginOptions
138
+ * @property {number} [delayTime=120] - Debounce delay in ms before processing input.
139
+ * @property {number} [limitSize=5] - Maximum number of items to display in the dropdown.
140
+ * @property {number} [searchStartLength=0] - Minimum input length before triggering search.
141
+ * @property {boolean} [useCachingData=true] - Whether to cache query responses per trigger.
142
+ * @property {boolean} [useCachingFieldData=true] - Whether to cache selected items for priority display.
143
+ * @property {Object<string, AutocompleteTriggerConfig>} triggers - Per-trigger configurations keyed by trigger character.
144
+ * ```js
145
+ * // triggers
146
+ * {
147
+ * '@': { data: [...], renderItem: (item) => `...` },
148
+ * '#': { apiUrl: '/api/tags?q={key}' }
149
+ * }
150
+ * ```
151
+ */
152
+ /**
153
+ * @class
154
+ * @description Autocomplete Plugin
155
+ * - A generic autocomplete plugin supporting multiple trigger characters.
156
+ * - Each trigger can have its own data source, rendering, and selection behavior.
157
+ * - Supports static data arrays and API-based data fetching.
158
+ * - Uses per-trigger caching for optimized performance.
159
+ */
160
+ declare class Autocomplete extends PluginField {
161
+ /**
162
+ * @constructor
163
+ * @param {SunEditor.Kernel} kernel - The Kernel instance
164
+ * @param {AutocompletePluginOptions} pluginOptions
165
+ */
166
+ constructor(kernel: SunEditor.Kernel, pluginOptions: AutocompletePluginOptions);
167
+ title: any;
168
+ triggerContexts: Map<any, any>;
169
+ sortedTriggers: any[];
170
+ selectMenu: SelectMenu;
171
+ controller: Controller;
172
+ onInput(params: SunEditor.HookParams.InputWithData): Promise<void>;
173
+ #private;
174
+ }
175
+ import { PluginField } from '../../interfaces';
176
+ import { Controller } from '../../modules/contract';
177
+ import { SelectMenu } from '../../modules/ui';
@@ -6,7 +6,7 @@ declare namespace _default {
6
6
  export { fileUpload };
7
7
  export { list_bulleted };
8
8
  export { list_numbered };
9
- export { mention };
9
+ export { autocomplete };
10
10
  export { align };
11
11
  export { font };
12
12
  export { fontColor };
@@ -61,7 +61,7 @@ import paragraphStyle from './dropdown/paragraphStyle';
61
61
  import table from './dropdown/table';
62
62
  import template from './dropdown/template';
63
63
  import textStyle from './dropdown/textStyle';
64
- import mention from './field/mention';
64
+ import autocomplete from './field/autocomplete';
65
65
  import fontSize from './input/fontSize';
66
66
  import pageNavigator from './input/pageNavigator';
67
67
  import audio from './modal/audio';
@@ -77,6 +77,7 @@ export {
77
77
  anchor,
78
78
  audio,
79
79
  audioGallery,
80
+ autocomplete,
80
81
  backgroundColor,
81
82
  blockquote,
82
83
  blockStyle,
@@ -100,7 +101,6 @@ export {
100
101
  list_bulleted,
101
102
  list_numbered,
102
103
  math,
103
- mention,
104
104
  pageNavigator,
105
105
  paragraphStyle,
106
106
  table,
@@ -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.
@@ -32,6 +32,18 @@ export type ImagePluginOptions = {
32
32
  createUrlInput?: boolean;
33
33
  /**
34
34
  * - The URL endpoint for image file uploads.
35
+ * - The server must return:
36
+ * ```js
37
+ * {
38
+ * "result": [
39
+ * {
40
+ * "url": "https://example.com/image.jpg",
41
+ * "name": "image.jpg",
42
+ * "size": 123456
43
+ * }
44
+ * ]
45
+ * }
46
+ * ```
35
47
  */
36
48
  uploadUrl?: string;
37
49
  /**
@@ -116,6 +128,18 @@ export type ImageState = {
116
128
  * @property {boolean} [createUrlInput] - Whether to create a URL input element for image insertion.
117
129
  * - Defaults to `true`. Always `true` when `createFileInput` is `false`.
118
130
  * @property {string} [uploadUrl] - The URL endpoint for image file uploads.
131
+ * - The server must return:
132
+ * ```js
133
+ * {
134
+ * "result": [
135
+ * {
136
+ * "url": "https://example.com/image.jpg",
137
+ * "name": "image.jpg",
138
+ * "size": 123456
139
+ * }
140
+ * ]
141
+ * }
142
+ * ```
119
143
  * @property {Object<string, string>} [uploadHeaders] - Additional headers to include in the file upload request.
120
144
  * ```js
121
145
  * { uploadUrl: '/api/upload/image', uploadHeaders: { Authorization: 'Bearer token' } }