Skip to content

Conversation

@alecgeatches
Copy link

@alecgeatches alecgeatches commented Aug 28, 2025

WIP. Improve consistency of types stored in the Yjs synced document:

  1. Change block types to Y.Map. Previously this was true for root blocks, but not for inner blocks.
  2. Change innerBlocks use the Y.Array type to match root blocks. They were previously a Block[], which was different that the root blocks type (Y.Array< YBlock >).
  3. Change rich-text types to use Y.Text. We'll probably need more logic to ensure relative position changes bind correctly to text updates, but this is a good start.

All of the consistency updates make parsing blocks more straightforward, and simplify types. This is an important step to implementing relative cursors, and typing within the same rich text block.

We've also improved the mergeCrdtBlocks() function to recurse and merge innerBlocks with the same strategy as root blocks.

@alecgeatches alecgeatches self-assigned this Aug 28, 2025
@alecgeatches alecgeatches requested a review from nerrad as a code owner August 28, 2025 21:32
@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: alecgeatches <[email protected]>
Co-authored-by: chriszarate <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Type-related labels to choose from: [Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Technical Prototype, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket, Backport from WordPress Core, Gutenberg Plugin, New Block.
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@alecgeatches alecgeatches merged commit ac0ffa2 into add/experimental-collaborative-editing Aug 28, 2025
50 of 71 checks passed
@alecgeatches alecgeatches deleted the improve/yjs-document-types branch August 28, 2025 22:54
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.

3 participants