@ckeditor/ckeditor5-mention 48.2.0 → 48.3.0-alpha.1
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/augmentation.d.ts +21 -21
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +16 -16
- package/dist/index.js +1030 -1149
- package/dist/index.js.map +1 -1
- package/dist/mention.d.ts +73 -73
- package/dist/mentioncommand.d.ts +72 -72
- package/dist/mentionconfig.d.ts +249 -249
- package/dist/mentionediting.d.ts +37 -37
- package/dist/mentionui.d.ts +101 -101
- package/dist/ui/domwrapperview.d.ts +36 -36
- package/dist/ui/mentionlistitemview.d.ts +11 -11
- package/dist/ui/mentionsview.d.ts +55 -55
- package/package.json +6 -6
package/dist/mentionconfig.d.ts
CHANGED
|
@@ -1,265 +1,265 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* @module mention/mentionconfig
|
|
7
|
+
*/
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
* The configuration of the mention feature.
|
|
10
|
+
*
|
|
11
|
+
* Read more about {@glink features/mentions#configuration configuring the mention feature}.
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* ClassicEditor
|
|
15
|
+
* .create( {
|
|
16
|
+
* mention: ... // Mention feature options.
|
|
17
|
+
* } )
|
|
18
|
+
* .then( ... )
|
|
19
|
+
* .catch( ... );
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
23
|
+
*/
|
|
24
24
|
export interface MentionConfig {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
25
|
+
/**
|
|
26
|
+
* The list of mention feeds supported by the editor.
|
|
27
|
+
*
|
|
28
|
+
* ```ts
|
|
29
|
+
* ClassicEditor
|
|
30
|
+
* .create( {
|
|
31
|
+
* plugins: [ Mention, ... ],
|
|
32
|
+
* mention: {
|
|
33
|
+
* feeds: [
|
|
34
|
+
* {
|
|
35
|
+
* marker: '@',
|
|
36
|
+
* feed: [ '@Barney', '@Lily', '@Marshall', '@Robin', '@Ted' ]
|
|
37
|
+
* },
|
|
38
|
+
* ...
|
|
39
|
+
* ]
|
|
40
|
+
* }
|
|
41
|
+
* } )
|
|
42
|
+
* .then( ... )
|
|
43
|
+
* .catch( ... );
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* You can provide many mention feeds but they must use different `marker`s.
|
|
47
|
+
* For example, you can use `'@'` to autocomplete people and `'#'` to autocomplete tags.
|
|
48
|
+
*/
|
|
49
|
+
feeds: Array<MentionFeed>;
|
|
50
|
+
/**
|
|
51
|
+
* The configuration of the custom commit keys supported by the editor.
|
|
52
|
+
*
|
|
53
|
+
* ```ts
|
|
54
|
+
* ClassicEditor
|
|
55
|
+
* .create( {
|
|
56
|
+
* plugins: [ Mention, ... ],
|
|
57
|
+
* mention: {
|
|
58
|
+
* // [ Enter, Space ]
|
|
59
|
+
* commitKeys: [ 13, 32 ]
|
|
60
|
+
* feeds: [
|
|
61
|
+
* { ... }
|
|
62
|
+
* ...
|
|
63
|
+
* ]
|
|
64
|
+
* }
|
|
65
|
+
* } )
|
|
66
|
+
* .then( ... )
|
|
67
|
+
* .catch( ... );
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* Custom commit keys configuration allows you to customize how users will confirm the selection of mentions from the dropdown list.
|
|
71
|
+
* You can add as many mention commit keys as you need. For instance, in the snippet above new mentions will be committed by pressing
|
|
72
|
+
* either <kbd>Enter</kbd> or <kbd>Space</kbd> (13 and 32 key codes respectively).
|
|
73
|
+
*
|
|
74
|
+
* @default [ 13, 9 ] // [ Enter, Tab ]
|
|
75
|
+
*/
|
|
76
|
+
commitKeys?: Array<number>;
|
|
77
|
+
/**
|
|
78
|
+
* The configuration of the custom number of visible mentions.
|
|
79
|
+
*
|
|
80
|
+
* Customizing the number of visible mentions allows you to specify how many available elements will the users be able to see
|
|
81
|
+
* in the dropdown list. You can specify any number you see fit. For example, in the snippets below you will find the
|
|
82
|
+
* dropdownLimit set to `20` and `Infinity` (the latter will result in showing all available mentions).
|
|
83
|
+
*
|
|
84
|
+
* ```ts
|
|
85
|
+
* ClassicEditor
|
|
86
|
+
* .create( {
|
|
87
|
+
* plugins: [ Mention, ... ],
|
|
88
|
+
* mention: {
|
|
89
|
+
* dropdownLimit: 20,
|
|
90
|
+
* feeds: [
|
|
91
|
+
* { ... }
|
|
92
|
+
* ...
|
|
93
|
+
* ]
|
|
94
|
+
* }
|
|
95
|
+
* } )
|
|
96
|
+
* .then( ... )
|
|
97
|
+
* .catch( ... );
|
|
98
|
+
*
|
|
99
|
+
* ClassicEditor
|
|
100
|
+
* .create( {
|
|
101
|
+
* plugins: [ Mention, ... ],
|
|
102
|
+
* mention: {
|
|
103
|
+
* dropdownLimit: Infinity,
|
|
104
|
+
* feeds: [
|
|
105
|
+
* { ... }
|
|
106
|
+
* ...
|
|
107
|
+
* ]
|
|
108
|
+
* }
|
|
109
|
+
* } )
|
|
110
|
+
* .then( ... )
|
|
111
|
+
* .catch( ... );
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* @default 10
|
|
115
|
+
*/
|
|
116
|
+
dropdownLimit?: number;
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
119
|
+
* The mention feed descriptor. Used in {@link module:mention/mentionconfig~MentionConfig `config.mention`}.
|
|
120
|
+
*
|
|
121
|
+
* See {@link module:mention/mentionconfig~MentionConfig} to learn more.
|
|
122
|
+
*
|
|
123
|
+
* ```ts
|
|
124
|
+
* // Static configuration.
|
|
125
|
+
* const mentionFeedPeople = {
|
|
126
|
+
* marker: '@',
|
|
127
|
+
* feed: [ '@Alice', '@Bob', ... ],
|
|
128
|
+
* minimumCharacters: 2
|
|
129
|
+
* };
|
|
130
|
+
*
|
|
131
|
+
* // Simple synchronous callback.
|
|
132
|
+
* const mentionFeedTags = {
|
|
133
|
+
* marker: '#',
|
|
134
|
+
* feed: ( searchString: string ) => {
|
|
135
|
+
* return tags
|
|
136
|
+
* // Filter the tags list.
|
|
137
|
+
* .filter( tag => {
|
|
138
|
+
* return tag.toLowerCase().includes( queryText.toLowerCase() );
|
|
139
|
+
* } )
|
|
140
|
+
* }
|
|
141
|
+
* };
|
|
142
|
+
*
|
|
143
|
+
* const tags = [ 'wysiwyg', 'rte', 'rich-text-edior', 'collaboration', 'real-time', ... ];
|
|
144
|
+
*
|
|
145
|
+
* // Asynchronous callback.
|
|
146
|
+
* const mentionFeedPlaceholders = {
|
|
147
|
+
* marker: '$',
|
|
148
|
+
* feed: ( searchString: string ) => {
|
|
149
|
+
* return getMatchingPlaceholders( searchString );
|
|
150
|
+
* }
|
|
151
|
+
* };
|
|
152
|
+
*
|
|
153
|
+
* function getMatchingPlaceholders( searchString: string ) {
|
|
154
|
+
* return new Promise<Array<MentionFeedItem>>( resolve => {
|
|
155
|
+
* doSomeXHRQuery( result => {
|
|
156
|
+
* // console.log( result );
|
|
157
|
+
* // -> [ '$name', '$surname', '$postal', ... ]
|
|
158
|
+
*
|
|
159
|
+
* resolve( result );
|
|
160
|
+
* } );
|
|
161
|
+
* } );
|
|
162
|
+
* }
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
165
|
export interface MentionFeed {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
166
|
+
/**
|
|
167
|
+
* The character which triggers autocompletion for mention. It must be a single character.
|
|
168
|
+
*/
|
|
169
|
+
marker: string;
|
|
170
|
+
/**
|
|
171
|
+
* Autocomplete items. Provide an array for
|
|
172
|
+
* a static configuration (the mention feature will show matching items automatically) or a function which returns an array of
|
|
173
|
+
* matching items (directly, or via a promise). If a function is passed, it is executed in the context of the editor instance.
|
|
174
|
+
*/
|
|
175
|
+
feed: Array<MentionFeedItem> | MentionFeedbackCallback;
|
|
176
|
+
/**
|
|
177
|
+
* Specifies after how many characters the autocomplete panel should be shown.
|
|
178
|
+
*
|
|
179
|
+
* @default 0
|
|
180
|
+
*/
|
|
181
|
+
minimumCharacters?: number;
|
|
182
|
+
/**
|
|
183
|
+
* A function that renders a {@link module:mention/mentionconfig~MentionFeedItem}
|
|
184
|
+
* to the autocomplete panel.
|
|
185
|
+
*/
|
|
186
|
+
itemRenderer?: MentionItemRenderer;
|
|
187
|
+
/**
|
|
188
|
+
* Specify how many available elements per feeds will the users be able to see in the dropdown list.
|
|
189
|
+
* If it not set, limit is inherited from {@link module:mention/mentionconfig~MentionConfig#dropdownLimit MentionConfig}.
|
|
190
|
+
*/
|
|
191
|
+
dropdownLimit?: number;
|
|
192
192
|
}
|
|
193
193
|
/**
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
* Function that renders an array of {@link module:mention/mentionconfig~MentionFeedItem} based on string input.
|
|
195
|
+
*/
|
|
196
196
|
export type MentionFeedbackCallback = (searchString: string) => Array<MentionFeedItem> | Promise<Array<MentionFeedItem>>;
|
|
197
197
|
/**
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
* Function that takes renders a {@link module:mention/mentionconfig~MentionFeedObjectItem} as HTMLElement.
|
|
199
|
+
*/
|
|
200
200
|
export type MentionItemRenderer = (item: MentionFeedObjectItem) => HTMLElement | string;
|
|
201
201
|
/**
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
202
|
+
* The mention feed item. It may be defined as a string or a plain object.
|
|
203
|
+
*
|
|
204
|
+
* When defining a feed item as a plain object, the `id` property is obligatory. Additional properties
|
|
205
|
+
* can be used when customizing the mention feature bahavior
|
|
206
|
+
* (see {@glink features/mentions#customizing-the-autocomplete-list "Customizing the autocomplete list"}
|
|
207
|
+
* and {@glink features/mentions#customizing-the-output "Customizing the output"} sections).
|
|
208
|
+
*
|
|
209
|
+
* ```ts
|
|
210
|
+
* ClassicEditor
|
|
211
|
+
* .create( {
|
|
212
|
+
* plugins: [ Mention, ... ],
|
|
213
|
+
* mention: {
|
|
214
|
+
* feeds: [
|
|
215
|
+
* // Feed items as objects.
|
|
216
|
+
* {
|
|
217
|
+
* marker: '@',
|
|
218
|
+
* feed: [
|
|
219
|
+
* {
|
|
220
|
+
* id: '@Barney',
|
|
221
|
+
* fullName: 'Barney Bloom'
|
|
222
|
+
* },
|
|
223
|
+
* {
|
|
224
|
+
* id: '@Lily',
|
|
225
|
+
* fullName: 'Lily Smith'
|
|
226
|
+
* },
|
|
227
|
+
* {
|
|
228
|
+
* id: '@Marshall',
|
|
229
|
+
* fullName: 'Marshall McDonald'
|
|
230
|
+
* },
|
|
231
|
+
* {
|
|
232
|
+
* id: '@Robin',
|
|
233
|
+
* fullName: 'Robin Hood'
|
|
234
|
+
* },
|
|
235
|
+
* {
|
|
236
|
+
* id: '@Ted',
|
|
237
|
+
* fullName: 'Ted Cruze'
|
|
238
|
+
* },
|
|
239
|
+
* // ...
|
|
240
|
+
* ]
|
|
241
|
+
* },
|
|
242
|
+
*
|
|
243
|
+
* // Feed items as plain strings.
|
|
244
|
+
* {
|
|
245
|
+
* marker: '#',
|
|
246
|
+
* feed: [ 'wysiwyg', 'rte', 'rich-text-edior', 'collaboration', 'real-time', ... ]
|
|
247
|
+
* },
|
|
248
|
+
* ]
|
|
249
|
+
* }
|
|
250
|
+
* } )
|
|
251
|
+
* .then( ... )
|
|
252
|
+
* .catch( ... );
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
255
255
|
export type MentionFeedItem = string | MentionFeedObjectItem;
|
|
256
256
|
export type MentionFeedObjectItem = {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
257
|
+
/**
|
|
258
|
+
* A unique ID of the mention. It must start with the marker character.
|
|
259
|
+
*/
|
|
260
|
+
id: string;
|
|
261
|
+
/**
|
|
262
|
+
* Text inserted into the editor when creating a mention.
|
|
263
|
+
*/
|
|
264
|
+
text?: string;
|
|
265
265
|
};
|
package/dist/mentionediting.d.ts
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { Plugin } from
|
|
9
|
-
import type { ModelElement } from
|
|
10
|
-
import type { MentionAttribute } from
|
|
6
|
+
* @module mention/mentionediting
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from "@ckeditor/ckeditor5-core";
|
|
9
|
+
import type { ModelElement } from "@ckeditor/ckeditor5-engine";
|
|
10
|
+
import type { MentionAttribute } from "./mention.js";
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
* The mention editing feature.
|
|
13
|
+
*
|
|
14
|
+
* It introduces the {@link module:mention/mentioncommand~MentionCommand command} and the `mention`
|
|
15
|
+
* attribute in the {@link module:engine/model/model~Model model} which renders in the {@link module:engine/view/view view}
|
|
16
|
+
* as a `<span class="mention" data-mention="@mention">`.
|
|
17
|
+
*/
|
|
18
18
|
export declare class MentionEditing extends Plugin {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
static get pluginName(): "MentionEditing";
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/
|
|
26
|
+
static override get isOfficialPlugin(): true;
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
init(): void;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
35
|
export declare function _addMentionAttributes(baseMentionData: {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
id: string;
|
|
37
|
+
_text: string;
|
|
38
38
|
}, data?: Record<string, unknown>): MentionAttribute;
|
|
39
39
|
/**
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
* Creates a mention attribute value from the provided view element and optional data.
|
|
41
|
+
*
|
|
42
|
+
* This function is exposed as
|
|
43
|
+
* {@link module:mention/mention~Mention#toMentionAttribute `editor.plugins.get( 'Mention' ).toMentionAttribute()`}.
|
|
44
|
+
*
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
47
|
export declare function _toMentionAttribute(viewElementOrMention: ModelElement, data?: Record<string, unknown>): MentionAttribute | undefined;
|