Add reaction links and RSVP block editor extensions#568
Add reaction links and RSVP block editor extensions#568
Conversation
- 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
There was a problem hiding this comment.
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.
- 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
There was a problem hiding this comment.
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
|
@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.
f58d1d9 to
b04fa6f
Compare
Summary
Adds two new block editor extensions for enhanced microformats2 support:
Reaction Links
u-in-reply-to(Reply)u-like-of(Like)u-repost-of(Repost)u-bookmark-of(Bookmark)u-tag-of(Tag)RSVP Format
<data class="p-rsvp" value="...">elementsTest plan