@ckeditor/ckeditor5-mention 40.0.0 → 40.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +10 -10
- package/LICENSE.md +3 -3
- package/package.json +2 -2
- package/src/augmentation.d.ts +23 -23
- package/src/augmentation.js +5 -5
- package/src/index.d.ts +13 -13
- package/src/index.js +11 -11
- package/src/mention.d.ts +77 -77
- package/src/mention.js +33 -33
- package/src/mentioncommand.d.ts +77 -77
- package/src/mentioncommand.js +145 -145
- package/src/mentionconfig.d.ts +265 -265
- package/src/mentionconfig.js +5 -5
- package/src/mentionediting.d.ts +43 -43
- package/src/mentionediting.js +231 -231
- package/src/mentionui.d.ts +102 -102
- package/src/mentionui.js +618 -618
- package/src/ui/domwrapperview.d.ts +41 -41
- package/src/ui/domwrapperview.js +57 -57
- package/src/ui/mentionlistitemview.d.ts +15 -15
- package/src/ui/mentionlistitemview.js +18 -18
- package/src/ui/mentionsview.d.ts +60 -60
- package/src/ui/mentionsview.js +104 -104
- package/build/mention.js.map +0 -1
package/CHANGELOG.md
CHANGED
@@ -5,7 +5,7 @@ All changes in the package are documented in the main repository. See: https://g
|
|
5
5
|
|
6
6
|
Changes for the past releases are available below.
|
7
7
|
|
8
|
-
## [19.0.0](https://github.com/ckeditor/ckeditor5-mention/compare/v18.0.0...v19.0.0) (2020
|
8
|
+
## [19.0.0](https://github.com/ckeditor/ckeditor5-mention/compare/v18.0.0...v19.0.0) (April 29, 2020)
|
9
9
|
|
10
10
|
### Bug fixes
|
11
11
|
|
@@ -13,24 +13,24 @@ Changes for the past releases are available below.
|
|
13
13
|
* Mentions can now be matched by any character typed. Closes [ckeditor/ckeditor5#6398](https://github.com/ckeditor/ckeditor5/issues/6398). ([aa7d04d](https://github.com/ckeditor/ckeditor5-mention/commit/aa7d04d))
|
14
14
|
|
15
15
|
|
16
|
-
## [18.0.0](https://github.com/ckeditor/ckeditor5-mention/compare/v17.0.0...v18.0.0) (2020
|
16
|
+
## [18.0.0](https://github.com/ckeditor/ckeditor5-mention/compare/v17.0.0...v18.0.0) (March 19, 2020)
|
17
17
|
|
18
18
|
Internal changes only (updated dependencies, documentation, etc.).
|
19
19
|
|
20
20
|
|
21
|
-
## [17.0.0](https://github.com/ckeditor/ckeditor5-mention/compare/v16.0.0...v17.0.0) (2020
|
21
|
+
## [17.0.0](https://github.com/ckeditor/ckeditor5-mention/compare/v16.0.0...v17.0.0) (February 19, 2020)
|
22
22
|
|
23
23
|
### Features
|
24
24
|
|
25
25
|
* Implemented debounced mechanism for requesting a mention feed. Closes [ckeditor/ckeditor5#4619](https://github.com/ckeditor/ckeditor5/issues/4619). ([f50db9c](https://github.com/ckeditor/ckeditor5-mention/commit/f50db9c))
|
26
26
|
|
27
27
|
|
28
|
-
## [16.0.0](https://github.com/ckeditor/ckeditor5-mention/compare/v15.0.0...v16.0.0) (2019
|
28
|
+
## [16.0.0](https://github.com/ckeditor/ckeditor5-mention/compare/v15.0.0...v16.0.0) (December 4, 2019)
|
29
29
|
|
30
30
|
Internal changes only (updated dependencies, documentation, etc.).
|
31
31
|
|
32
32
|
|
33
|
-
## [15.0.0](https://github.com/ckeditor/ckeditor5-mention/compare/v13.0.0...v15.0.0) (2019
|
33
|
+
## [15.0.0](https://github.com/ckeditor/ckeditor5-mention/compare/v13.0.0...v15.0.0) (October 23, 2019)
|
34
34
|
|
35
35
|
### Other changes
|
36
36
|
|
@@ -39,7 +39,7 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
39
39
|
Thanks [@oliverguenther](https://github.com/oliverguenther) for the contribution!
|
40
40
|
|
41
41
|
|
42
|
-
## [13.0.0](https://github.com/ckeditor/ckeditor5-mention/compare/v12.0.1...v13.0.0) (2019
|
42
|
+
## [13.0.0](https://github.com/ckeditor/ckeditor5-mention/compare/v12.0.1...v13.0.0) (August 26, 2019)
|
43
43
|
|
44
44
|
### Other changes
|
45
45
|
|
@@ -51,12 +51,12 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
51
51
|
* The `mention/featuredetection` namespace is removed. Please use `env.features` from ckeditor5-utils instead.
|
52
52
|
|
53
53
|
|
54
|
-
## [12.0.1](https://github.com/ckeditor/ckeditor5-mention/compare/v12.0.0...v12.0.1) (2019
|
54
|
+
## [12.0.1](https://github.com/ckeditor/ckeditor5-mention/compare/v12.0.0...v12.0.1) (July 10, 2019)
|
55
55
|
|
56
56
|
Internal changes only (updated dependencies, documentation, etc.).
|
57
57
|
|
58
58
|
|
59
|
-
## [12.0.0](https://github.com/ckeditor/ckeditor5-mention/compare/v11.0.0...v12.0.0) (2019
|
59
|
+
## [12.0.0](https://github.com/ckeditor/ckeditor5-mention/compare/v11.0.0...v12.0.0) (July 4, 2019)
|
60
60
|
|
61
61
|
### Bug fixes
|
62
62
|
|
@@ -73,7 +73,7 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
73
73
|
* The `TextWatcher` util was moved to `@ckeditor/ckeditor5-typing`.
|
74
74
|
|
75
75
|
|
76
|
-
## [11.0.0](https://github.com/ckeditor/ckeditor5-mention/compare/v10.0.0...v11.0.0) (2019
|
76
|
+
## [11.0.0](https://github.com/ckeditor/ckeditor5-mention/compare/v10.0.0...v11.0.0) (June 6, 2019)
|
77
77
|
|
78
78
|
### Bug fixes
|
79
79
|
|
@@ -92,6 +92,6 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
92
92
|
* The `MentionUI#panelView` property is removed. The mention feature now uses the `ContextualBalloon` plugin.
|
93
93
|
|
94
94
|
|
95
|
-
## [10.0.0](https://github.com/ckeditor/ckeditor5-mention/tree/v10.0.0) (2019
|
95
|
+
## [10.0.0](https://github.com/ckeditor/ckeditor5-mention/tree/v10.0.0) (April 4, 2019)
|
96
96
|
|
97
97
|
The initial release.
|
package/LICENSE.md
CHANGED
@@ -2,7 +2,7 @@ Software License Agreement
|
|
2
2
|
==========================
|
3
3
|
|
4
4
|
**CKEditor 5 mention feature** – https://github.com/ckeditor/ckeditor5-mention <br>
|
5
|
-
Copyright (c) 2003
|
5
|
+
Copyright (c) 2003–2023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
|
6
6
|
|
7
7
|
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
|
8
8
|
|
@@ -13,9 +13,9 @@ Where not otherwise indicated, all CKEditor content is authored by CKSource engi
|
|
13
13
|
|
14
14
|
The following libraries are included in CKEditor under the [MIT license](https://opensource.org/licenses/MIT):
|
15
15
|
|
16
|
-
*
|
16
|
+
* Lodash - Copyright (c) JS Foundation and other contributors https://js.foundation/. Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors http://underscorejs.org/.
|
17
17
|
|
18
18
|
Trademarks
|
19
19
|
----------
|
20
20
|
|
21
|
-
**CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
|
21
|
+
**CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks, or service marks of their respective holders.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-mention",
|
3
|
-
"version": "40.
|
3
|
+
"version": "40.2.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": "40.
|
15
|
+
"ckeditor5": "40.2.0",
|
16
16
|
"lodash-es": "4.17.21"
|
17
17
|
},
|
18
18
|
"author": "CKSource (http://cksource.com/)",
|
package/src/augmentation.d.ts
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
import type { MentionConfig, Mention, MentionEditing, MentionUI, MentionCommand } from './index';
|
6
|
-
declare module '@ckeditor/ckeditor5-core' {
|
7
|
-
interface EditorConfig {
|
8
|
-
/**
|
9
|
-
* The configuration of the {@link module:mention/mention~Mention} feature.
|
10
|
-
*
|
11
|
-
* Read more in {@link module:mention/mentionconfig~MentionConfig}.
|
12
|
-
*/
|
13
|
-
mention?: MentionConfig;
|
14
|
-
}
|
15
|
-
interface PluginsMap {
|
16
|
-
[Mention.pluginName]: Mention;
|
17
|
-
[MentionEditing.pluginName]: MentionEditing;
|
18
|
-
[MentionUI.pluginName]: MentionUI;
|
19
|
-
}
|
20
|
-
interface CommandsMap {
|
21
|
-
mention: MentionCommand;
|
22
|
-
}
|
23
|
-
}
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
import type { MentionConfig, Mention, MentionEditing, MentionUI, MentionCommand } from './index';
|
6
|
+
declare module '@ckeditor/ckeditor5-core' {
|
7
|
+
interface EditorConfig {
|
8
|
+
/**
|
9
|
+
* The configuration of the {@link module:mention/mention~Mention} feature.
|
10
|
+
*
|
11
|
+
* Read more in {@link module:mention/mentionconfig~MentionConfig}.
|
12
|
+
*/
|
13
|
+
mention?: MentionConfig;
|
14
|
+
}
|
15
|
+
interface PluginsMap {
|
16
|
+
[Mention.pluginName]: Mention;
|
17
|
+
[MentionEditing.pluginName]: MentionEditing;
|
18
|
+
[MentionUI.pluginName]: MentionUI;
|
19
|
+
}
|
20
|
+
interface CommandsMap {
|
21
|
+
mention: MentionCommand;
|
22
|
+
}
|
23
|
+
}
|
package/src/augmentation.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
export {};
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
export {};
|
package/src/index.d.ts
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* @module mention
|
7
|
-
*/
|
8
|
-
export { default as Mention } from './mention';
|
9
|
-
export { default as MentionEditing } from './mentionediting';
|
10
|
-
export { default as MentionUI } from './mentionui';
|
11
|
-
export type { MentionConfig, MentionFeed, ItemRenderer } from './mentionconfig';
|
12
|
-
export type { default as MentionCommand } from './mentioncommand';
|
13
|
-
import './augmentation';
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @module mention
|
7
|
+
*/
|
8
|
+
export { default as Mention } from './mention';
|
9
|
+
export { default as MentionEditing } from './mentionediting';
|
10
|
+
export { default as MentionUI } from './mentionui';
|
11
|
+
export type { MentionConfig, MentionFeed, ItemRenderer } from './mentionconfig';
|
12
|
+
export type { default as MentionCommand } from './mentioncommand';
|
13
|
+
import './augmentation';
|
package/src/index.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* @module mention
|
7
|
-
*/
|
8
|
-
export { default as Mention } from './mention';
|
9
|
-
export { default as MentionEditing } from './mentionediting';
|
10
|
-
export { default as MentionUI } from './mentionui';
|
11
|
-
import './augmentation';
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @module mention
|
7
|
+
*/
|
8
|
+
export { default as Mention } from './mention';
|
9
|
+
export { default as MentionEditing } from './mentionediting';
|
10
|
+
export { default as MentionUI } from './mentionui';
|
11
|
+
import './augmentation';
|
package/src/mention.d.ts
CHANGED
@@ -1,77 +1,77 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* @module mention/mention
|
7
|
-
*/
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
9
|
-
import type { Element } from 'ckeditor5/src/engine';
|
10
|
-
import MentionEditing from './mentionediting';
|
11
|
-
import MentionUI from './mentionui';
|
12
|
-
import '../theme/mention.css';
|
13
|
-
/**
|
14
|
-
* The mention plugin.
|
15
|
-
*
|
16
|
-
* For a detailed overview, check the {@glink features/mentions Mention feature} guide.
|
17
|
-
*/
|
18
|
-
export default class Mention extends Plugin {
|
19
|
-
/**
|
20
|
-
* Creates a mention attribute value from the provided view element and additional data.
|
21
|
-
*
|
22
|
-
* ```ts
|
23
|
-
* editor.plugins.get( 'Mention' ).toMentionAttribute( viewElement, { userId: '1234' } );
|
24
|
-
*
|
25
|
-
* // For a view element: <span data-mention="@joe">@John Doe</span>
|
26
|
-
* // it will return:
|
27
|
-
* // { id: '@joe', userId: '1234', uid: '7a7bc7...', _text: '@John Doe' }
|
28
|
-
* ```
|
29
|
-
*
|
30
|
-
* @param data Additional data to be stored in the mention attribute.
|
31
|
-
*/
|
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;
|
45
|
-
/**
|
46
|
-
* @inheritDoc
|
47
|
-
*/
|
48
|
-
static get pluginName(): "Mention";
|
49
|
-
/**
|
50
|
-
* @inheritDoc
|
51
|
-
*/
|
52
|
-
static get requires(): readonly [typeof MentionEditing, typeof MentionUI];
|
53
|
-
}
|
54
|
-
/**
|
55
|
-
* Represents a mention in the model.
|
56
|
-
*
|
57
|
-
* See {@link module:mention/mention~Mention#toMentionAttribute `Mention#toMentionAttribute()`}.
|
58
|
-
*/
|
59
|
-
export type MentionAttribute = {
|
60
|
-
/**
|
61
|
-
* The ID of a mention. It identifies the mention item in the mention feed. There can be multiple mentions
|
62
|
-
* in the document with the same ID (e.g. the same hashtag being mentioned).
|
63
|
-
*/
|
64
|
-
id: string;
|
65
|
-
/**
|
66
|
-
* A unique ID of this mention instance. Should be passed as an `option.id` when using
|
67
|
-
* {@link module:engine/view/downcastwriter~DowncastWriter#createAttributeElement writer.createAttributeElement()}.
|
68
|
-
*/
|
69
|
-
uid: string;
|
70
|
-
/**
|
71
|
-
* Helper property that stores the text of the inserted mention. Used for detecting a broken mention
|
72
|
-
* in the editing area.
|
73
|
-
*
|
74
|
-
* @internal
|
75
|
-
*/
|
76
|
-
_text: string;
|
77
|
-
};
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @module mention/mention
|
7
|
+
*/
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
9
|
+
import type { Element } from 'ckeditor5/src/engine';
|
10
|
+
import MentionEditing from './mentionediting';
|
11
|
+
import MentionUI from './mentionui';
|
12
|
+
import '../theme/mention.css';
|
13
|
+
/**
|
14
|
+
* The mention plugin.
|
15
|
+
*
|
16
|
+
* For a detailed overview, check the {@glink features/mentions Mention feature} guide.
|
17
|
+
*/
|
18
|
+
export default class Mention extends Plugin {
|
19
|
+
/**
|
20
|
+
* Creates a mention attribute value from the provided view element and additional data.
|
21
|
+
*
|
22
|
+
* ```ts
|
23
|
+
* editor.plugins.get( 'Mention' ).toMentionAttribute( viewElement, { userId: '1234' } );
|
24
|
+
*
|
25
|
+
* // For a view element: <span data-mention="@joe">@John Doe</span>
|
26
|
+
* // it will return:
|
27
|
+
* // { id: '@joe', userId: '1234', uid: '7a7bc7...', _text: '@John Doe' }
|
28
|
+
* ```
|
29
|
+
*
|
30
|
+
* @param data Additional data to be stored in the mention attribute.
|
31
|
+
*/
|
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;
|
45
|
+
/**
|
46
|
+
* @inheritDoc
|
47
|
+
*/
|
48
|
+
static get pluginName(): "Mention";
|
49
|
+
/**
|
50
|
+
* @inheritDoc
|
51
|
+
*/
|
52
|
+
static get requires(): readonly [typeof MentionEditing, typeof MentionUI];
|
53
|
+
}
|
54
|
+
/**
|
55
|
+
* Represents a mention in the model.
|
56
|
+
*
|
57
|
+
* See {@link module:mention/mention~Mention#toMentionAttribute `Mention#toMentionAttribute()`}.
|
58
|
+
*/
|
59
|
+
export type MentionAttribute = {
|
60
|
+
/**
|
61
|
+
* The ID of a mention. It identifies the mention item in the mention feed. There can be multiple mentions
|
62
|
+
* in the document with the same ID (e.g. the same hashtag being mentioned).
|
63
|
+
*/
|
64
|
+
id: string;
|
65
|
+
/**
|
66
|
+
* A unique ID of this mention instance. Should be passed as an `option.id` when using
|
67
|
+
* {@link module:engine/view/downcastwriter~DowncastWriter#createAttributeElement writer.createAttributeElement()}.
|
68
|
+
*/
|
69
|
+
uid: string;
|
70
|
+
/**
|
71
|
+
* Helper property that stores the text of the inserted mention. Used for detecting a broken mention
|
72
|
+
* in the editing area.
|
73
|
+
*
|
74
|
+
* @internal
|
75
|
+
*/
|
76
|
+
_text: string;
|
77
|
+
};
|
package/src/mention.js
CHANGED
@@ -1,33 +1,33 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* @module mention/mention
|
7
|
-
*/
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
9
|
-
import MentionEditing, { _toMentionAttribute } from './mentionediting';
|
10
|
-
import MentionUI from './mentionui';
|
11
|
-
import '../theme/mention.css';
|
12
|
-
/**
|
13
|
-
* The mention plugin.
|
14
|
-
*
|
15
|
-
* For a detailed overview, check the {@glink features/mentions Mention feature} guide.
|
16
|
-
*/
|
17
|
-
export default class Mention extends Plugin {
|
18
|
-
toMentionAttribute(viewElement, data) {
|
19
|
-
return _toMentionAttribute(viewElement, data);
|
20
|
-
}
|
21
|
-
/**
|
22
|
-
* @inheritDoc
|
23
|
-
*/
|
24
|
-
static get pluginName() {
|
25
|
-
return 'Mention';
|
26
|
-
}
|
27
|
-
/**
|
28
|
-
* @inheritDoc
|
29
|
-
*/
|
30
|
-
static get requires() {
|
31
|
-
return [MentionEditing, MentionUI];
|
32
|
-
}
|
33
|
-
}
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @module mention/mention
|
7
|
+
*/
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
9
|
+
import MentionEditing, { _toMentionAttribute } from './mentionediting';
|
10
|
+
import MentionUI from './mentionui';
|
11
|
+
import '../theme/mention.css';
|
12
|
+
/**
|
13
|
+
* The mention plugin.
|
14
|
+
*
|
15
|
+
* For a detailed overview, check the {@glink features/mentions Mention feature} guide.
|
16
|
+
*/
|
17
|
+
export default class Mention extends Plugin {
|
18
|
+
toMentionAttribute(viewElement, data) {
|
19
|
+
return _toMentionAttribute(viewElement, data);
|
20
|
+
}
|
21
|
+
/**
|
22
|
+
* @inheritDoc
|
23
|
+
*/
|
24
|
+
static get pluginName() {
|
25
|
+
return 'Mention';
|
26
|
+
}
|
27
|
+
/**
|
28
|
+
* @inheritDoc
|
29
|
+
*/
|
30
|
+
static get requires() {
|
31
|
+
return [MentionEditing, MentionUI];
|
32
|
+
}
|
33
|
+
}
|
package/src/mentioncommand.d.ts
CHANGED
@@ -1,77 +1,77 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* @module mention/mentioncommand
|
7
|
-
*/
|
8
|
-
import { Command, type Editor } from 'ckeditor5/src/core';
|
9
|
-
import type { Range } from 'ckeditor5/src/engine';
|
10
|
-
/**
|
11
|
-
* The mention command.
|
12
|
-
*
|
13
|
-
* The command is registered by {@link module:mention/mentionediting~MentionEditing} as `'mention'`.
|
14
|
-
*
|
15
|
-
* To insert a mention into a range, execute the command and specify a mention object with a range to replace:
|
16
|
-
*
|
17
|
-
* ```ts
|
18
|
-
* const focus = editor.model.document.selection.focus;
|
19
|
-
*
|
20
|
-
* // It will replace one character before the selection focus with the '#1234' text
|
21
|
-
* // with the mention attribute filled with passed attributes.
|
22
|
-
* editor.execute( 'mention', {
|
23
|
-
* marker: '#',
|
24
|
-
* mention: {
|
25
|
-
* id: '#1234',
|
26
|
-
* name: 'Foo',
|
27
|
-
* title: 'Big Foo'
|
28
|
-
* },
|
29
|
-
* range: editor.model.createRange( focus.getShiftedBy( -1 ), focus )
|
30
|
-
* } );
|
31
|
-
*
|
32
|
-
* // It will replace one character before the selection focus with the 'The "Big Foo"' text
|
33
|
-
* // with the mention attribute filled with passed attributes.
|
34
|
-
* editor.execute( 'mention', {
|
35
|
-
* marker: '#',
|
36
|
-
* mention: {
|
37
|
-
* id: '#1234',
|
38
|
-
* name: 'Foo',
|
39
|
-
* title: 'Big Foo'
|
40
|
-
* },
|
41
|
-
* text: 'The "Big Foo"',
|
42
|
-
* range: editor.model.createRange( focus.getShiftedBy( -1 ), focus )
|
43
|
-
* } );
|
44
|
-
* ```
|
45
|
-
*/
|
46
|
-
export default class MentionCommand extends Command {
|
47
|
-
/**
|
48
|
-
* @inheritDoc
|
49
|
-
*/
|
50
|
-
constructor(editor: Editor);
|
51
|
-
/**
|
52
|
-
* @inheritDoc
|
53
|
-
*/
|
54
|
-
refresh(): void;
|
55
|
-
/**
|
56
|
-
* Executes the command.
|
57
|
-
*
|
58
|
-
* @param options Options for the executed command.
|
59
|
-
* @param options.mention The mention object to insert. When a string is passed, it will be used to create a plain
|
60
|
-
* object with the name attribute that equals the passed string.
|
61
|
-
* @param options.marker The marker character (e.g. `'@'`).
|
62
|
-
* @param options.text The text of the inserted mention. Defaults to the full mention string composed from `marker` and
|
63
|
-
* `mention` string or `mention.id` if an object is passed.
|
64
|
-
* @param options.range The range to replace.
|
65
|
-
* Note that the replaced range might be shorter than the inserted text with the mention attribute.
|
66
|
-
* @fires execute
|
67
|
-
*/
|
68
|
-
execute(options: {
|
69
|
-
mention: string | {
|
70
|
-
id: string;
|
71
|
-
[key: string]: unknown;
|
72
|
-
};
|
73
|
-
marker: string;
|
74
|
-
text?: string;
|
75
|
-
range?: Range;
|
76
|
-
}): void;
|
77
|
-
}
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @module mention/mentioncommand
|
7
|
+
*/
|
8
|
+
import { Command, type Editor } from 'ckeditor5/src/core';
|
9
|
+
import type { Range } from 'ckeditor5/src/engine';
|
10
|
+
/**
|
11
|
+
* The mention command.
|
12
|
+
*
|
13
|
+
* The command is registered by {@link module:mention/mentionediting~MentionEditing} as `'mention'`.
|
14
|
+
*
|
15
|
+
* To insert a mention into a range, execute the command and specify a mention object with a range to replace:
|
16
|
+
*
|
17
|
+
* ```ts
|
18
|
+
* const focus = editor.model.document.selection.focus;
|
19
|
+
*
|
20
|
+
* // It will replace one character before the selection focus with the '#1234' text
|
21
|
+
* // with the mention attribute filled with passed attributes.
|
22
|
+
* editor.execute( 'mention', {
|
23
|
+
* marker: '#',
|
24
|
+
* mention: {
|
25
|
+
* id: '#1234',
|
26
|
+
* name: 'Foo',
|
27
|
+
* title: 'Big Foo'
|
28
|
+
* },
|
29
|
+
* range: editor.model.createRange( focus.getShiftedBy( -1 ), focus )
|
30
|
+
* } );
|
31
|
+
*
|
32
|
+
* // It will replace one character before the selection focus with the 'The "Big Foo"' text
|
33
|
+
* // with the mention attribute filled with passed attributes.
|
34
|
+
* editor.execute( 'mention', {
|
35
|
+
* marker: '#',
|
36
|
+
* mention: {
|
37
|
+
* id: '#1234',
|
38
|
+
* name: 'Foo',
|
39
|
+
* title: 'Big Foo'
|
40
|
+
* },
|
41
|
+
* text: 'The "Big Foo"',
|
42
|
+
* range: editor.model.createRange( focus.getShiftedBy( -1 ), focus )
|
43
|
+
* } );
|
44
|
+
* ```
|
45
|
+
*/
|
46
|
+
export default class MentionCommand extends Command {
|
47
|
+
/**
|
48
|
+
* @inheritDoc
|
49
|
+
*/
|
50
|
+
constructor(editor: Editor);
|
51
|
+
/**
|
52
|
+
* @inheritDoc
|
53
|
+
*/
|
54
|
+
refresh(): void;
|
55
|
+
/**
|
56
|
+
* Executes the command.
|
57
|
+
*
|
58
|
+
* @param options Options for the executed command.
|
59
|
+
* @param options.mention The mention object to insert. When a string is passed, it will be used to create a plain
|
60
|
+
* object with the name attribute that equals the passed string.
|
61
|
+
* @param options.marker The marker character (e.g. `'@'`).
|
62
|
+
* @param options.text The text of the inserted mention. Defaults to the full mention string composed from `marker` and
|
63
|
+
* `mention` string or `mention.id` if an object is passed.
|
64
|
+
* @param options.range The range to replace.
|
65
|
+
* Note that the replaced range might be shorter than the inserted text with the mention attribute.
|
66
|
+
* @fires execute
|
67
|
+
*/
|
68
|
+
execute(options: {
|
69
|
+
mention: string | {
|
70
|
+
id: string;
|
71
|
+
[key: string]: unknown;
|
72
|
+
};
|
73
|
+
marker: string;
|
74
|
+
text?: string;
|
75
|
+
range?: Range;
|
76
|
+
}): void;
|
77
|
+
}
|