Skip to content

Detect Mention Deleting #5072

Discussion options

You must be logged in to vote

If you're using node views you can know when a specific mention is being deleted through the React/Vue component life cycle.

By extending the Mention extension you can add a node view and customize the parse and render html:

import { default as MentionExtension } from "@tiptap/extension-mention";
import { ReactNodeViewRenderer, mergeAttributes } from "@tiptap/react";
import { Mention } from "../components/Mention";

export const CustomMention = MentionExtension.extend({
  addNodeView() {
    return ReactNodeViewRenderer(Mention);
  },
  parseHTML() {
    return [
      {
        tag: "mention-component",
      },
    ];
  },
  renderHTML({ HTMLAttributes }) {
    return ["mention-component",

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@pekanboy
Comment options

Comment options

You must be logged in to vote
1 reply
@fdb75017
Comment options

Answer selected by nperez0111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants