-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mentions plugin #1703
Comments
While thinking about a SDK sample for mentions I played a bit with emojis, just to figure out that it's demoing more |
It's important that we keep configuration as simple as possible. For instance we have already autocomplete plugin, which can provide mentions capability, but it requires a lot of code to actually instantiate it and it provides some low level data (ranges) which are not needed for the mentions plugin. |
I've been thinking about ways to configure the mentions plugin. As mentioned above, it should be operable by setting config alone, there should be no need to add CKEditor I have come with few use cases, and a config schemma that fits them all. Simple caseDev simply provides a simple list of user names, mentions plugin will use synchronous data feed. config.mentions = {
// User names.
feed: [ 'andrew', 'bobby', 'james', 'julian', 'kate' ],
marker: `@`,
minChars: 0
}; Complex caseDev uses mentions plugin for three different feeds, two of which use the same marker.
config.mentions = [ {
// User names.
feed: [ 'andrew', 'bobby', 'james', 'julian', 'kate' ],
marker: `@`
}, {
// Groups.
feed: [ 'admins', 'mods', 'users' ],
marker: '@',
// Entries have a group HTML class, so that it could feature a customized icon that differs it from users in the dropdown.
template: '<li data-id="{id}" class="group"><a href="#">{name}</a></li>'
}, {
// Ticket references.
feed: [ '1234', '1235', '1236' ],
marker: '#'
} ]; AsynchronousIn this case dev is requesting backend URL to get the list of users. Assuming that GET query to [ {
"id": 1,
"name": "andrew81",
"firstName": "Andrew",
"lastName": "Doe"
}, {
"id": 2,
"name": "bob__",
"firstName": "Bob",
"lastName": "Doe"
}, {
"id": 3,
"name": "jane88",
"firstName": "Jane",
"lastName": "Doe"
} ] config.mentions = {
// User names.
feed: '/user-controller/get-list/{encodedQuery}',
template: '<li data-id="{id}" class="group"><a href="#">{firstName} {lastName} ({name})</a></li>'-
}; Or a more "explicit" version: config.mentions = {
// User names.
feed: function( query, callback ) {
callMyBackend( function( results ) {
callback( results );
} );
},
template: '<li data-id="{id}" class="group"><a href="#">{firstName} {lastName} ({name})</a></li>'-
}; SummaryTo sum it up, config mentions object should support following properties:
|
Currently mentions are case sensitive for the feed passed as an array (simple case). |
Are you reporting a feature request or a bug?
Feature request
Provide detailed reproduction steps (if any)
It has been requested for some time to ship a Mentions/Autocomplete feature for CKEditor 4.
The idea is that as you type part of certain text, CKEditor displays a panel suggesting you some suggested values, so that you don't have to write it on your own, but use autocomplete instead.
It should support both synchronous and asynchronous entires lists (feeds).
Multiple Feeds
The feature should also support multiple feeds at the same time.
For instance, you're using
@
to mention users, while#
to mention ticket numbers.Differences from the Autocomplete plugin
While Mentions feature is built on top of the Autocomplete feature, it's purpose is to expose as stupid simple and minimal API. It should be ready basically by providing list of users (entries) and be ready to use.
Autocomplete in contrast provides much more possibilities to control what's and how being matched, but at a cost of more complex API.
Preview
Users interested in seeing how the feature looks today can preview it on our Mentions feature branch preview.
Browser Support
Same as for the Autocomplete plugin.
Related Issues
The text was updated successfully, but these errors were encountered: