Constraining Schemas

Hi,

I am currently trying to build a structured editor on top of prosemirror. Let’s assume I have a BulletList and a CheckmarkList. Both belong the the ‘list’ group.

A paragraph can contain lists. However, dependent on the context of the paragraph I don’t want to allow the instantiation of a CheckmarkList (Although it would be structurally correct, it would make semantically no sense.

My question is now how I can achieve this type of behavior? Is there a hook with which I can filter the allowed concepts in this context? I have seen that the schema language itself is not powerful enough. I have also read, that the order plays a role when instantiating child node, but I have not found the spot in the code.

Any hint is welcome. Thanks in advance! Bernd

That’s atypical (usually lists are siblings of paragraphs), and might get awkward because paragraphs have inline content and lists are typically blocks.

You could have two types of paragraphs for this. Or make your key bindings and other user actions so that it is impossible to create a checkmark list in the wrong context, and use a filterTransaction hook to delete/normalize such lists if they end up in such a context anyway (through pasting, for example).