Skip to content
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

Mention plugin should allow autocomplete with space #9741

Closed
mateuszzagorski opened this issue May 21, 2021 · 3 comments · Fixed by #11017
Closed

Mention plugin should allow autocomplete with space #9741

mateuszzagorski opened this issue May 21, 2021 · 3 comments · Fixed by #11017
Assignees
Labels
package:mention squad:core Issue to be handled by the Core team. support:2 An issue reported by a commercially licensed client. type:feature This issue reports a feature request (an idea for a new functionality or a missing option).

Comments

@mateuszzagorski
Copy link
Contributor

📝 Provide a description of the new feature

Currently, when you press spacebar while using the mention feature it will hide the dropdown and add space after what has been written - this is behaving exactly like mentions on GitHub.

However, it could be a more natural user experience if it would be working in a different way - where you can add space after for example @Barney (following the example from editor 2 - on features/mention page in docs) and still be able to filter the feed to select Barney Stinson from the dropdown.

This issue was already discussed partially here: #7306 - but that issue was created to resolve a slightly different problem, so I'm extracting this as a separate one.

Mentioning @EricPaulson and @robjbrain as you gave the most recent feedback regarding this and might want to leave a 👍 reaction.


If you'd like to see this feature implemented, add a 👍 reaction to this post.

@mateuszzagorski mateuszzagorski added type:feature This issue reports a feature request (an idea for a new functionality or a missing option). package:mention labels May 21, 2021
@jswiderski jswiderski added the support:2 An issue reported by a commercially licensed client. label Oct 26, 2021
@Reinmar Reinmar added the squad:core Issue to be handled by the Core team. label Oct 26, 2021
@CatStrategist CatStrategist self-assigned this Dec 6, 2021
@CatStrategist
Copy link
Contributor

Issue fixed in #11017

Mention plugin didn't allow spaces because of regexp for matching mentions in currently edited text that only allowed visible characters to occur after a mention mark.
At first it seemed as an easy improvement of regexp to just allow a space but a scenario with multiple registered markes complicated it a lot.

Take this case:

aaa @fooo #bar

Regexp allowing space would match @foo as well as #bar. After playing a little bit with regexp to handle that case it quickly got overcomplicated and still had some other edge cases so I had to withdraw from this approach.

Previously regexp to match mention tested entire text node till caret but what we really needed to test is just a text since last valid marker in text. But yet again, case with multiple markers complicated it a little bit. Previously there was a TextWatcher for each marker that tried to match a mention for it's own marker. It run outside of state of mention plugin and executed matched or unmachted events without knowledge of matches for other markers. It could find a match for one marker and tried to show UI, but the other marker fired unmatched event and immediately hid UI. Before going with solution for spaces it had to be fixed. When initializing plugin I've merged watchers to a single one who knows about each marker and runs only one on each text change. Having that in place, I could pass a test function to TextWatcher and find last valid marker in text, trim text since last marker (+1 a character behind to test if marker is in correct place) till caret. Having only that part the rest of the code could stay as usual with just a little change to regexp that now allows any character after marker character instead of just visible characters.

@robjbrain
Copy link

It seems like we're very restricted by the current implementation of the UI.

Would it be better to have an alternative plugin that when typing @ a popup appears with an input and the focus then goes on the input, something similar to the link UI.

This is what it looks like currently:
image

It could instead look something like this:
image

In this example Enter or Esc or using the green and red buttons would close the popup.

Such a plugin could be generic for multiple uses, such as such as # creating a popup of tags where you could search existing tags or create a new one. But could also be used for more advanced mentions that the basic mentions plugin itself can't cater for.

niegowski added a commit that referenced this issue Dec 21, 2021
…on-plugin

Fix (mention): The mention plugin now allows searching mentions that include space characters. Closes #9741.
@Reinmar
Copy link
Member

Reinmar commented Dec 22, 2021

Hi @robjbrain! Thanks for the suggestion. However, this issue is solely about handling mentions with spaces and a quick win we can have there. Your idea goes well beyond this and would need a separate ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:mention squad:core Issue to be handled by the Core team. support:2 An issue reported by a commercially licensed client. type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants