Repository navigation
Notes: Store the blocks a note was added to, so a note stays attached when the post isn't saved - #15828
Draft
adamsilverstein wants to merge 2 commits into
Draft
Notes: Store the blocks a note was added to, so a note stays attached when the post isn't saved#15828adamsilverstein wants to merge 2 commits into
adamsilverstein wants to merge 2 commits into
Conversation
A note's link to its block lives in the post content and only persists when the post is saved, so a note added to a post that isn't saved afterwards is orphaned. Register `_wp_note_anchor` comment meta so the editor can store a snapshot of the note's blocks and re-attach the note on load, and delete the snapshot once a saved post links to the note. Claude-Session: https://claude.ai/code/session_018vwYjS8MTZ2CfXecy2yRiU
The snapshot is block markup stored by any user who can edit the note, and editors read it back over REST. Run it through KSES for users without `unfiltered_html`, the same as post content, and drop malformed entries. Claude-Session: https://claude.ai/code/session_018vwYjS8MTZ2CfXecy2yRiU
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
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.
Backport of WordPress/gutenberg#86471, which keeps a new note attached to its block when the post isn't saved afterwards.
Claude ported the PHP from the Gutenberg PR and wrote up the changes:
Trac ticket: TBD
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Claude ported the code from the Gutenberg PR, wrote the tests, and drafted this description. I will review and test.
🤖 Generated with Claude Code
https://claude.ai/code/session_018vwYjS8MTZ2CfXecy2yRiU
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.