Prevent adding typed text to the inserted link


is it possible to prevent link insertion command from being “right-inclusive”, i.e. to not include text typed on the right of the cursor of the freshly-styled text ?

Here is what I mean:

  1. Goto
  2. select ‘There is’ text fragment on the beginning of the first paragraph of it and make it a link pointing to the
  3. Text will be selected, so press right and start typing

Expected behavior: typed text is not appended to the link

Actual behavior: text becomes a part of the link

There exists a property inclusiveRight which you can set on MarkTypes to get the behavior you want. You could create a custom LinkMark like that:

import {LinkMark} from "prosemirror/dist/model"

class MyLinkMark extends LinkMark {
  get inclusiveRight() { return false }

Thank you @kiejo! I think that proseMirror have all the functions that we need :slight_smile: