tiptap

How to stop tiptap Link from propagating after insertion?


After inserting a link onto selected text in my editor using tiptap, the link propagation continues when I type more text. How do I stop propagation?


Solution

  • The fix is quite simple. You can extend the Link mark when setting up the editor in your code like this:

    this.editor = new Editor({
      element: this.editorRef,
      extensions: [
        //...
        Link.extend({
          inclusive: false,
        })
        //...
      ]
    });
    

    inclusive: false makes sure that links don't include the final position of the cursor.