feat: complex content exploration#2707
Draft
nperez0111 wants to merge 1 commit intomainfrom
Draft
Conversation
Introduce ContentType abstraction and POJO combinator API (`c.inline`, `c.none`, `c.record`, `c.list`, `c.blocks`, `c.props`) for declaring arbitrary block content shapes — multi-slot records, variable-length lists, regions of editor blocks, and typed per-item props. Block JSON shapes are derived directly from the schema. Phase 1 rebuilds the table block on top of the new ContentType primitive with no observable behaviour or JSON-shape change. Phase 3 ships the combinator surface, widens createReactBlockSpec to accept ContentType, and adds 4 runnable examples (multi-slot alert, FAQ, callout, tab group) plus end-to-end tests for the React render path and the data layer. Also fixes textCursorPosition's parent walk-up to traverse multiple non-bnBlock layers, which combinator slot chains can introduce. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR explores the possibility of introducing more complex custom content types.
Summary
Taking a table as an example:
[ { "id": "abc", "type": "table", "content": { "type": "tableContent", "rows": [ { "cells": [ { "type": "tableCell", "content": [ { "type": "text", "text": "a", "styles": {} } ] } ] }, { "cells": [ { "type": "tableCell", "content": [ { "type": "text", "text": "b", "styles": {} } ] } ] } ] }, "children": [] } ]What would happen if we decided to make this pattern more generic & exposed to the end developer? It could maybe look something like this:
This sort of a structure would allow for representing arbitrarily complex relationships and enables multiple "slots" for content to be inserted within.
This is very powerful, but presents several challenges:
Rationale
I explored a few different approaches for this, and none were satisfying to me. It felt like we were simple re-packaging what ProseMirror can represent, and drifting away from the benefits that BlockNote touts.
Some more exploration would be needed for this to actually be considered a viable solution for BlockNote. It simply is largely in contradiction of the goals of BlockNote.