@ckeditor/ckeditor5-mention 0.0.0-nightly-20230906.0 → 0.0.0-nightly-20230907.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +2 -2
- package/src/mention.d.ts +16 -5
- package/src/mention.js +0 -14
- package/src/mentioncommand.d.ts +4 -2
- package/src/mentionediting.d.ts +5 -2
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-mention",
|
3
|
-
"version": "0.0.0-nightly-
|
3
|
+
"version": "0.0.0-nightly-20230907.0",
|
4
4
|
"description": "Mention feature for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -12,7 +12,7 @@
|
|
12
12
|
],
|
13
13
|
"main": "src/index.js",
|
14
14
|
"dependencies": {
|
15
|
-
"ckeditor5": "0.0.0-nightly-
|
15
|
+
"ckeditor5": "0.0.0-nightly-20230907.0",
|
16
16
|
"lodash-es": "4.17.21"
|
17
17
|
},
|
18
18
|
"author": "CKSource (http://cksource.com/)",
|
package/src/mention.d.ts
CHANGED
@@ -17,7 +17,7 @@ import '../theme/mention.css';
|
|
17
17
|
*/
|
18
18
|
export default class Mention extends Plugin {
|
19
19
|
/**
|
20
|
-
* Creates a mention attribute value from the provided view element and
|
20
|
+
* Creates a mention attribute value from the provided view element and additional data.
|
21
21
|
*
|
22
22
|
* ```ts
|
23
23
|
* editor.plugins.get( 'Mention' ).toMentionAttribute( viewElement, { userId: '1234' } );
|
@@ -27,10 +27,21 @@ export default class Mention extends Plugin {
|
|
27
27
|
* // { id: '@joe', userId: '1234', uid: '7a7bc7...', _text: '@John Doe' }
|
28
28
|
* ```
|
29
29
|
*
|
30
|
-
* @param viewElement
|
31
30
|
* @param data Additional data to be stored in the mention attribute.
|
32
31
|
*/
|
33
|
-
toMentionAttribute(viewElement: Element, data
|
32
|
+
toMentionAttribute<MentionData extends Record<string, unknown>>(viewElement: Element, data: MentionData): (MentionAttribute & MentionData) | undefined;
|
33
|
+
/**
|
34
|
+
* Creates a mention attribute value from the provided view element.
|
35
|
+
*
|
36
|
+
* ```ts
|
37
|
+
* editor.plugins.get( 'Mention' ).toMentionAttribute( viewElement );
|
38
|
+
*
|
39
|
+
* // For a view element: <span data-mention="@joe">@John Doe</span>
|
40
|
+
* // it will return:
|
41
|
+
* // { id: '@joe', uid: '7a7bc7...', _text: '@John Doe' }
|
42
|
+
* ```
|
43
|
+
*/
|
44
|
+
toMentionAttribute(viewElement: Element): MentionAttribute | undefined;
|
34
45
|
/**
|
35
46
|
* @inheritDoc
|
36
47
|
*/
|
@@ -55,12 +66,12 @@ export type MentionAttribute = {
|
|
55
66
|
* A unique ID of this mention instance. Should be passed as an `option.id` when using
|
56
67
|
* {@link module:engine/view/downcastwriter~DowncastWriter#createAttributeElement writer.createAttributeElement()}.
|
57
68
|
*/
|
58
|
-
uid
|
69
|
+
uid: string;
|
59
70
|
/**
|
60
71
|
* Helper property that stores the text of the inserted mention. Used for detecting a broken mention
|
61
72
|
* in the editing area.
|
62
73
|
*
|
63
74
|
* @internal
|
64
75
|
*/
|
65
|
-
_text
|
76
|
+
_text: string;
|
66
77
|
};
|
package/src/mention.js
CHANGED
@@ -15,20 +15,6 @@ import '../theme/mention.css';
|
|
15
15
|
* For a detailed overview, check the {@glink features/mentions Mention feature} guide.
|
16
16
|
*/
|
17
17
|
export default class Mention extends Plugin {
|
18
|
-
/**
|
19
|
-
* Creates a mention attribute value from the provided view element and optional data.
|
20
|
-
*
|
21
|
-
* ```ts
|
22
|
-
* editor.plugins.get( 'Mention' ).toMentionAttribute( viewElement, { userId: '1234' } );
|
23
|
-
*
|
24
|
-
* // For a view element: <span data-mention="@joe">@John Doe</span>
|
25
|
-
* // it will return:
|
26
|
-
* // { id: '@joe', userId: '1234', uid: '7a7bc7...', _text: '@John Doe' }
|
27
|
-
* ```
|
28
|
-
*
|
29
|
-
* @param viewElement
|
30
|
-
* @param data Additional data to be stored in the mention attribute.
|
31
|
-
*/
|
32
18
|
toMentionAttribute(viewElement, data) {
|
33
19
|
return _toMentionAttribute(viewElement, data);
|
34
20
|
}
|
package/src/mentioncommand.d.ts
CHANGED
@@ -7,7 +7,6 @@
|
|
7
7
|
*/
|
8
8
|
import { Command, type Editor } from 'ckeditor5/src/core';
|
9
9
|
import type { Range } from 'ckeditor5/src/engine';
|
10
|
-
import type { MentionAttribute } from './mention';
|
11
10
|
/**
|
12
11
|
* The mention command.
|
13
12
|
*
|
@@ -67,7 +66,10 @@ export default class MentionCommand extends Command {
|
|
67
66
|
* @fires execute
|
68
67
|
*/
|
69
68
|
execute(options: {
|
70
|
-
mention: string |
|
69
|
+
mention: string | {
|
70
|
+
id: string;
|
71
|
+
[key: string]: unknown;
|
72
|
+
};
|
71
73
|
marker: string;
|
72
74
|
text?: string;
|
73
75
|
range?: Range;
|
package/src/mentionediting.d.ts
CHANGED
@@ -28,7 +28,10 @@ export default class MentionEditing extends Plugin {
|
|
28
28
|
/**
|
29
29
|
* @internal
|
30
30
|
*/
|
31
|
-
export declare function _addMentionAttributes(baseMentionData:
|
31
|
+
export declare function _addMentionAttributes(baseMentionData: {
|
32
|
+
id: string;
|
33
|
+
_text: string;
|
34
|
+
}, data?: Record<string, unknown>): MentionAttribute;
|
32
35
|
/**
|
33
36
|
* Creates a mention attribute value from the provided view element and optional data.
|
34
37
|
*
|
@@ -37,4 +40,4 @@ export declare function _addMentionAttributes(baseMentionData: MentionAttribute,
|
|
37
40
|
*
|
38
41
|
* @internal
|
39
42
|
*/
|
40
|
-
export declare function _toMentionAttribute(viewElementOrMention: Element, data?:
|
43
|
+
export declare function _toMentionAttribute(viewElementOrMention: Element, data?: Record<string, unknown>): MentionAttribute | undefined;
|