Skip to content

Conversation

@8lurry
Copy link

@8lurry 8lurry commented Nov 16, 2025

This PR introduces improvements to the BlockBlot class, specifically within its constructor and format() method, enabling more flexible and accurate formatting behavior when working inside container blots.

Summary of Changes

Track Parent Container Blots:
The BlockBlot constructor now keeps a record of parent ContainerBlot names.
It does this by iteratively traversing its parent chain and checking each parent’s requiredContainer attribute.

Parent-Aware Format Resolution:
When a format is applied through BlockBlot.format(), the method now checks whether the provided format name matches any of the stored parent container names.
If a match is found, BlockBlot defers formatting to that parent blot’s own format() method—allowing formatting operations to propagate correctly into ContainerBlot structures.

Why This Matters

These modifications enable:
More intuitive formatting behavior when nesting blots within containers
Better alignment with Quill’s hierarchical blot model
Support for formatting rules defined at higher structural levels
Cleaner handling of container-specific formats that previously could not be applied through child blots

Notes

The update is backward-compatible and does not affect unrelated blot behavior. All changes are isolated to how BlockBlot interprets and forwards formatting commands.

Issue Reference

Addresses issue: slab/quill #4750

- Add runtime guard and explicit error when parent.format is missing
- Small clarity fixes in BlockBlot constructor/format logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant