-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Customize keys to accept mention #4665
Comments
It sounds interesting. @jodator, is that hard to make this configurable? |
@Reinmar I think that we could rethink the space key handling. Even considering it a bug. Adding configuration key for this shouldn't be hard - it would only require to read the config and pass it to the 'mention' view. The form of the configuration is another question - only disabling the space or specifying keys to act on. |
The best option here is to allow an Something like that: const config = {
mention: {
commitKeys: keyCodes.enter
}
};
const config = {
mention: {
commitKeys: [ keyCodes.enter, keyCodes.tab ]
}
}; |
From my perspective the "space" issue is severely limiting usefulness of this plugin to only simple use cases - even the standard use case of mentioning somebody by name does not fully work since names contain space between first name and last name. If having this configurable would take too much time then a quickfix could be considered of just allowing space (resp. not treating it as a "commit key") as a more sensible default. |
Not allowing a space to be written after the marker makes for a broken typing experience. It restricts users from being able to simply type marker characters (e.g. #, @) with a space following it. Right now if I wanted to just type "#[space]" the first option will be selected. If I delete those characters to go back to just the #, the feed is shown again. To get past this, the user would have to either:
That's quite the unnatural behavior placed on the user. I'd recommend just updating the default keys to select being ENTER and TAB, as those feel like the more specialized keys for this. To test the ideal scenario -- type a comment on GitHub here down below ... type "#[Space]" and notice how the mention feed appears and then disappears. |
Any update on this one? Is it working and if so then how. |
@jaigupta10 There's PR ckeditor/ckeditor5-mention#92 which fixes the space behavior but unfortunately it wasn't merged yet and has not activity :-( But it's simple enough that you can merge it yourself locally for your project... |
Same here. I am implementing a "page mention" feature for a notetaking app; Notion, Obsidian, Github all allow spaces in mentions, and we need to support this as well. |
Note that this issue focuses on being able to customize the keys used for committing the mention. @zadam @cnickless @neongreen your feature request is valid (ability for mentions to have a space) but that's a separate issue dedicated to handling space in mention value. Please add 👍 reaction there to show your support. Unfortunately mentioned PR ckeditor/ckeditor5-mention#92 (which became #7306 after our repo migration) merely removed space from list of keys that accept a mention. While logic of mention (which were broken by spaces) remained unchanged. |
Feature (mention): Keyboard shortcuts to accept mentions can be customized using the [`config.mention.commitKeys`](https://ckeditor.com/docs/ckeditor5/latest/api/module_mention_mention-MentionConfig.html#member-commitKeys) configuration option. Closes #4665.
Currently, the plugin always select the current item when the user hit Enter, Tab or Space keys. My suggestion is to allow the user to customize these keys. For instance, I may want to disable the "Space key" shortcut, so if the user has the mention box opened and hit Space, the box closes and the editor keeps only the plain text, without mentions.
The text was updated successfully, but these errors were encountered: