nelsonweze/rich_text_view

Removed Mentions

Closed this issue · 9 comments

How to identify removed mentions (ie @xyz) especially when there are multiple mentions with same display-name ?

@nszenoti I have been trying to solve the same problem, have you made any progress?

Would it be enough to have an id property in the mentions object? You could use this to find particular mentions.

@benjiwagner

@nszenoti I have been trying to solve the same problem, have you made any progress?

No I've not yet came up with any. but I ponder that would need approach based on offset & position (by index) in sentence !

I am not sure I understand the use case here. Could you explain further?

@nelsonweze

Let Data be

final mentions = [
  Mention(title: 'Minato',  ...),
  Mention(title: 'Minato', ...),
  Mention(title: 'Naruto', ...),
];

Now let with that we also pass id in parameters param of each mention

Let say the text prepared is

"Hello @Minato @Naruto @Minato"

now there are 2 mentions with same display name :- Minato

So
While displaying this text (formed via RichTextEditor) in RichTextView, how to recognize individuality of each Minato

QUE : So how to identify which Minato belongs to which id ??

As for my research, you could do it with the offset and length of the display name and map the mentions with this metadata. But this is pretty hard to maintain and usually you want to integrate copy, cut, paste and select options which makes this even harder. Slack, Discord and so on use RichTextEditors like quill. But the Richtexteditors in Flutter are not that well implemented yet. In our case we chose to make the displayname unique because of our limited timeframe.

@benjiwagner
Yes I found the same. For Native android we've some callbacks available that can give this information
But in Flutter such things are not available at moment !

Seems we finally have a fix for this in rich_text_view: ^1.2.0-dev-1
When you tap on a matched text, A Matched object is returned which contains both the start and end indexes. I believe you can do something with this.