New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A way for node types to control/restrict their content #220
Comments
Few use cases of mine:
|
@Wes-R Those can all be expressed in the current system (and the new one will definitely keep on supporting them) |
I have the following use case: Creating a "task list" which contains list items that have exactly two children, a checkbox as the first child and a paragraph as the second. Apart from this constraint the task list should behave the same way as a BulletList and ListItems (support nesting, lifting, sinking). |
This sounds as a sanitizer/validator. Note that during editing the tree doesn't necessarily match the grammar. For example, in the above task-list description, the insertion of both child-nodes is probably not an atomic operation. This makes it necessary to either insert missing nodes, or have specific validation moments. |
The idea is to enforce these at every point. Inserting two child nodes can be made an atomic operation. There are some other constraints, such as paragraphs not being empty, that would be better suited for a validator, since it'd be painful to not be able to have empty paragraphs during editing. |
This has landed in ba98389...f6839de. Please open new issues for problems. |
We will need this for various use cases:
Designing a usable and sound way to do this remains a partially open question. Feel free to submit additional use cases. This also ties into #187 since preserving these restrictions during replace is the hardest aspect.
The text was updated successfully, but these errors were encountered: