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:

  1. Comment type — A gutenberg_note comment type is installed with the module
  2. Field lifecycle — A gutenberg_notes comment field is automatically added/removed on node bundles when Gutenberg is enabled/disabled for a content type
  3. ControllerNotesController exposes four JSON endpoints that return data in WordPress REST comment format, so the upstream UI works unmodified
  4. api-fetch.js — Route handlers intercept /wp/v2/comments requests and proxy them to the Drupal controller (added in the parent branch)

Depends on

  • Branch 3445654-update-gutenberg which adds the api-fetch.js comment route handlers, editor.notes support 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
  • subject field stores block type name ("Note on Paragraph") and resolution metadata ([resolved]/[reopen])
  • Permission: use gutenberg notes

Test plan

  1. Enable gutenberg_notes module
  2. Grant "Use Gutenberg notes" permission
  3. Edit a Gutenberg-enabled node → Notes sidebar appears
  4. Select a block → Add Note → verify it persists after save/reload
  5. Reply, resolve, reopen, delete notes
  6. Disable Gutenberg on a content type → verify field and comments removed
  7. Uninstall module → verify clean removal of all config and data

Merge request reports

Loading