Skip to content

Blocks: Cleanup after Interactivity moves #1750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 4, 2025
Merged

Conversation

obenland
Copy link
Member

With the move to the Interactivity API, there's a bit more cleanup we can do, once #1747 is merged:

Proposed changes:

  • Limit _activityPubOptions to being enqueued in the Editor only.
  • Rearrange register_block_type_from_metadata() calls to be in order of folder definition.
  • Use useOptions() in editor-plugin instead of accessing _activityPubOptions directly.
  • Move wp_block post type check in editor-plugin to the top of the function.

Testing instructions:

@obenland obenland requested review from pfefferle and Copilot May 29, 2025 19:26
@obenland obenland self-assigned this May 29, 2025
@obenland obenland added the Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. label May 29, 2025
@github-actions github-actions bot added [Block] Post settings [Focus] Editor Changes to the ActivityPub experience in the block editor labels May 29, 2025
Copy link

@Copilot 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

Refactors block initialization after migrating to the Interactivity API, centralizing option handling and cleaning up legacy script injection.

  • Move _activityPubOptions enqueuing into the block editor and remove standalone injection.
  • Refactor the editor plugin to use a shared useOptions() hook and early-return for wp_block.
  • Reorder register_block_type_from_metadata() calls to match directory structure.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/editor-plugin/plugin.js Swapped hook order, added useOptions(), and moved the wp_block check above hooks.
includes/class-blocks.php Removed legacy injections, added wp_localize_script() for editor assets, and reordered block registrations.
build/editor-plugin/plugin.js Rebuilt minified editor plugin bundle.
build/editor-plugin/plugin.asset.php Updated asset version hash.

@pfefferle
Copy link
Member

@obenland there are some conflicts!

@obenland obenland merged commit 1d58b15 into trunk Jun 4, 2025
11 checks passed
@obenland obenland deleted the update/editor-scripts branch June 4, 2025 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post settings [Focus] Editor Changes to the ActivityPub experience in the block editor Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants