Skip to content

Capture the removed mention #289

Answered by jamesalways
code-cvc asked this question in Q&A
Discussion options

You must be logged in to vote

I implemented this solution which I hope is worthy for someone.

In my case, I have all the options as mentionOptions and so every time something changes I search for the mentions in the editor using getContents(), get the mention from mentionsOptions, and call a function to update the mentions.

quillEditor.on('text-change', () => {
  if (mentionOptions.length > 0) {
    const mentions = new Set<MentionOption>()
    quillEditor.getContents().ops.forEach(op => {
      if ((op.insert as { mention: DOMStringMap })?.mention instanceof DOMStringMap && (op.insert as { mention: DOMStringMap })?.mention.denotationChar === '@') {
        const mention = mentionOptions.find(mention => mention.value …

Replies: 7 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by csculley
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
7 participants
Converted from issue

This discussion was converted from issue #216 on July 16, 2023 08:07.