Controlling inclusive left/right of MarkTypes

Is there a way to control the way MarkTypes behave when typing at their edges? I know that the MarkedRange class allows setting inclusiveLeft and inclusiveRight options, but I couldn’t find anything on doing the same for MarkTypes.

My use case would be to set inclusiveRight to false for link marks as the current behavior prevents you from writing normal text in a paragraph whose last item is a link (you can only expand the link when typing at the end). The workaround is to create a new paragraph with some text below the paragraph with the link and then join both paragraphs.

Would be great be able to define these options on a schema level.

Not really – you just have the disable the link style, just like you’d do for bold or emphasis.

But yeah, this might be a useful, straightforward feature to add. It will break the ‘enable and then type’ method of inserting links, but I guess I would disable it in the default schema.

Agreed this would be awesome! My current work around has been to hack the marksAt node method to remove links when it detects you are at the end of a link.

I hadn’t thought of that, but in our case we don’t want a menubar or hotkey for links and our setting is similar to the editor on the ProseMirror landing page, which has the same problem.

I think this shouldn’t be too big of a problem for links as enabling them before typing currently opens a modal dialog, which is different from the behavior of bold/emphasis where the ‘enable and then type’ functionality works really great. But either way it would definitely be awesome to have this feature!

Opened #285

1 Like