Skip to content

Add reaction links and RSVP block editor extensions#568

Open
pfefferle wants to merge 7 commits intomainfrom
add-reaction-links-and-rsvp-formats
Open

Add reaction links and RSVP block editor extensions#568
pfefferle wants to merge 7 commits intomainfrom
add-reaction-links-and-rsvp-formats

Conversation

@pfefferle
Copy link
Copy Markdown
Owner

@pfefferle pfefferle commented Dec 20, 2025

Summary

Adds two new block editor extensions for enhanced microformats2 support:

 Screenshot 2025-12-20 at 22 33 24 Screenshot 2025-12-20 at 22 33 32 Screenshot 2025-12-20 at 22 33 43

Reaction Links

  • Extends the link popover with a "Reaction" dropdown
  • Allows setting microformats2 reaction classes directly on anchor elements:
    • u-in-reply-to (Reply)
    • u-like-of (Like)
    • u-repost-of (Repost)
    • u-bookmark-of (Bookmark)
    • u-tag-of (Tag)

RSVP Format

  • New rich text format for event responses
  • Creates <data class="p-rsvp" value="..."> elements
  • Supports: Yes, No, Maybe, Interested
  • Visual indicator (dotted underline) in editor

Test plan

  • Create a post with a link, open link settings, verify "Reaction" dropdown appears
  • Select a reaction type, verify class is added to anchor in HTML
  • Select text, use RSVP format from toolbar, verify data element is created
  • Verify RSVP text has dotted underline indicator in editor

- Add reaction links extension to set microformats2 classes (u-in-reply-to,
  u-like-of, u-repost-of, u-bookmark-of, u-tag-of) directly on anchor elements
  via the link popover settings
- Add RSVP rich text format for marking event responses with
  <data class="p-rsvp" value="yes|no|maybe|interested">
- Enqueue assets for supported post types via Block class
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds two new block editor extensions to enhance microformats2 support in the WordPress webmention plugin. The additions enable authors to easily mark up links with semantic reaction types and add RSVP responses to event content.

Key Changes:

  • Reaction Links Extension: Extends the WordPress link popover with a dropdown for adding microformats2 reaction classes (u-in-reply-to, u-like-of, u-repost-of, u-bookmark-of, u-tag-of) to anchor elements
  • RSVP Rich Text Format: Adds a new rich text format for creating <data class="p-rsvp" value="..."> elements with Yes/No/Maybe/Interested responses
  • PHP Integration: Updates the Block class to enqueue both extensions with proper asset management

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/rsvp/index.js Implements RSVP rich text format using WordPress format type registration API with popover UI
src/rsvp/editor.scss Styles for RSVP popover and visual indicator (dotted underline) in editor
src/rsvp/block.json Block metadata configuration for RSVP format
src/reaction-links/index.js Implements reaction links extension through DOM manipulation and MutationObserver
src/reaction-links/editor.scss Styles for reaction dropdown in link control settings
src/reaction-links/block.json Block metadata configuration for reaction links
includes/class-block.php Adds asset enqueueing methods for both extensions with file existence checks
build/rsvp/* Compiled JavaScript, CSS, and asset metadata for RSVP format
build/reaction-links/* Compiled JavaScript, CSS, and asset metadata for reaction links

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pfefferle pfefferle marked this pull request as draft December 20, 2025 22:37
- Fix parseReactionClass to use token-based matching to avoid false positives
- Fix getCurrentLinkUrl to get href from anchor element instead of textContent
- Add early return in applyReaction when no targetUrl to prevent modifying all anchors
- Update dropdown to track URL and refresh when context changes
- Replace hardcoded timeout with proper debounce function
- Add MutationObserver cleanup on page unload
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 11 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Add webmention namespace to block.json names
- Extract debounce delay to named constant
- Improve accessibility with proper label/for association on select element
@dshanske
Copy link
Copy Markdown
Collaborator

@pfefferle Not sure I'm the best equipped to do this one.

Uses rich-text selection API and editor DOM selection to precisely identify
which anchor is being edited, fixing issues when multiple links share the
same URL or when URL matching fails.
@pfefferle pfefferle force-pushed the add-reaction-links-and-rsvp-formats branch from f58d1d9 to b04fa6f Compare March 27, 2026 17:17
@pfefferle pfefferle marked this pull request as ready for review March 27, 2026 17:18
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