super_editor icon indicating copy to clipboard operation
super_editor copied to clipboard

Slack-like mention plugin

Open BazinC opened this issue 2 years ago • 1 comments

User Behavior User should be able to use whitespace to search another user to mention. See example below on Slack:

search_with_whitespace.webm

Feature Value In apps like Slack, whitespace can be utilized to search for users by both first name and last name. This feature is particularly helpful in workspaces with many users, especially when several users have the same first name.

Additional context Super Editor offers StableTagPlugin but I don't think it can support the use case above. I naively tried to implement it by tweaking the user TagRule, using double whitespace as escape character instead of single whitespace.

TagRule(trigger: '@', excludedCharacters: {" ", "."})

It looked initially promising. However, it has created an issue where it's now unclear whether the user intends to mention someone or is just typing in the middle of a sentence.

See below, using UserTagsFeatureDemo with modified TagRule:

super_editor_user_tag_with_whitespace.webm

More specs we can observe from Slack It seems in Slack the composing tag area is always between the trigger user entered and text user tapped after the trigger. It keeps track of what text user typed after tapping the trigger.

On the other hand, current implementation of tags in SuperEditor uses TagFinder.findTagAroundPosition which looks for a tag around the cursor, starting with the tagrule trigger and ending with tagrule excluded characters. No matter if the text was typed by user or not.

Furthermore, on slack, you can see that if the composing tag value doesn't match any user, the app decides to commit it in an "unknown state" (with dots and question mark around). This way when the cursor goes back in this tag, the search can continue.

https://github.com/superlistapp/super_editor/assets/6229343/3aa53d38-4882-45c1-95c4-95f6ec06ea71

I'll be happy to continue discussing the feasibility of this feature. I'm wondering if in order to accomplish it we need to mimic all specs from slack search.

BazinC avatar Apr 22 '24 17:04 BazinC

@BazinC - I broke this ticket down into the following:

#1986 #1987 #1988

matthew-carroll avatar May 07 '24 02:05 matthew-carroll