Draft: Issue #3576654: Add block-level commenting (Notes) submodule
Summary
Adds a new gutenberg_notes submodule that bridges WordPress 6.9's Notes feature to Drupal's comment system, enabling block-level feedback directly in the Gutenberg editor.
Editors can select any block and leave a contextual note. Notes support threading (replies), resolution, and reopening — all stored as Drupal Comment entities.
How it works
The upstream @wordpress/editor collab-sidebar component handles the entire UI. This module provides the Drupal backend:
-
Comment type — A
gutenberg_notecomment type is installed with the module -
Field lifecycle — A
gutenberg_notescomment field is automatically added/removed on node bundles when Gutenberg is enabled/disabled for a content type -
Controller —
NotesControllerexposes four JSON endpoints that return data in WordPress REST comment format, so the upstream UI works unmodified -
api-fetch.js — Route handlers intercept
/wp/v2/commentsrequests and proxy them to the Drupal controller (added in the parent branch)
Depends on
- Branch
3445654-update-gutenbergwhich adds the api-fetch.js comment route handlers,editor.notessupport flag, and TextareaAutosize interop fix
Routes
| Method | Path | Description |
|---|---|---|
| GET | /editor/notes/{entity_type}/{entity_id} |
List all notes |
| POST | /editor/notes/{entity_type}/{entity_id} |
Create a note |
| PUT | /editor/notes/{comment_id} |
Update a note |
| DELETE | /editor/notes/{comment_id} |
Delete a note + replies |
Data model
- Notes stored as standard Comment entities (
comment_type: gutenberg_note) - Threading via
pid(parent ID) - Status: unpublished = unresolved, published = resolved
-
subjectfield stores block type name ("Note on Paragraph") and resolution metadata ([resolved]/[reopen]) - Permission:
use gutenberg notes
Test plan
- Enable
gutenberg_notesmodule - Grant "Use Gutenberg notes" permission
- Edit a Gutenberg-enabled node → Notes sidebar appears
- Select a block → Add Note → verify it persists after save/reload
- Reply, resolve, reopen, delete notes
- Disable Gutenberg on a content type → verify field and comments removed
- Uninstall module → verify clean removal of all config and data