Ignoring marks inside a node when coming from outside

Hey! I’m trying to implement an editor with footnotes. The core of the implementation is the footnote demo. However, my implementation has one of the same problems of the demo: when selecting around the footnote reference and toggling a mark, it gets toggled in all of the footnote’s content.

After thinking a lot about it, I think the only approach is to re-implement footnotes with the references being decoupled from the content. I’ve thought about hacks to make it work but it would be way too complex and fragile (and even then, the connection with the inner editor seems fragile too.)

Has anyone done something similar?

Curvenote seems to have the same issue.

Related issue on the demo.

Similarly to the disappointing approach suggested for children nodes, we could define a separate set of marks (e.g. strong and footnote_strong) and only allow those inside footnotes. Then, when detecting we’re focused inside of a footnote, switch to that version. I don’t really want to do that, though.

I’m having the same issue - were you able to find a solution?

Sadly, I’m just detecting if there’s a footnote and disallowing marking if there is. This was the best approach I found.

Thanks - I’ve approached it slightly differently by applying the mark to the rest of the selection but not the footnote. I’m happy to supply my implementation if it’s useful for you - but it is for TipTap instead of raw Prosemirror.

I would love to see it; I ported a lot of stuff from TipTap :slight_smile:

I tried doing that but I failed miserably, and instead of not being sure if it was super buggy and secretly breaking documents I’d rather just show an alert.

Sorry for the delay. Hopefully you can make some sense out of the following: