Skip to content

Client Side Abilities#10

Merged
jasperf merged 3 commits into
mainfrom
client-side-abilities
May 25, 2026
Merged

Client Side Abilities#10
jasperf merged 3 commits into
mainfrom
client-side-abilities

Conversation

@jasperf
Copy link
Copy Markdown
Contributor

@jasperf jasperf commented May 25, 2026

This release (v0.8.0) introduces the first client-side WordPress Ability for Waygate, extending the plugin's pattern-insertion capabilities from the server-side Abilities API into the block editor itself. The new waygate/insert-pattern ability allows an AI agent or editor integration to insert any registered block pattern at the current cursor position directly within Gutenberg, using the standard @wordpress/abilities registration API. To support this, Admin::enqueue_editor_abilities() was added, which enqueues both the @wordpress/core-abilities module (which auto-loads server-registered abilities into the editor store) and the new waygate-editor-abilities ES module on enqueue_block_editor_assets. A graceful availability check ensures no fatal errors occur on WordPress versions that do not expose wp_enqueue_script_module().

Client-Side Ability Registration:

  • Added assets/js/abilities.js as a native ES module that registers the waygate/insert-pattern ability via @wordpress/abilities, accepting a required slug string parameter and dispatching a core/pattern block insertion through core/block-editor.
  • Introduced the waygate-editor ability category to logically group all present and future Waygate block editor abilities, keeping them discoverable and distinct from other registered ability providers.

Admin Class and Asset Enqueueing:

  • Added Admin::enqueue_editor_abilities() hooked to enqueue_block_editor_assets, which registers and enqueues the abilities script module with WAYGATE_VERSION as the cache-busting key and declares @wordpress/abilities as a module dependency.
  • The method guards against environments where wp_enqueue_script_module() is unavailable, ensuring backwards compatibility without throwing fatal errors on older WordPress installations.

Documentation and Versioning:

  • CHANGELOG.md and README.md updated to document v0.8.0 additions, including the new ability, its category, and the enqueueing mechanism.
  • Version constant WAYGATE_VERSION and the plugin header in waygate.php bumped to 0.8.0 in accordance with the project's version bump checklist.

Files Changed:

jasperf added 3 commits May 25, 2026 14:58
Registers a waygate-editor ability category and the waygate/insert-pattern
ability via @wordpress/abilities. The ability inserts a core/pattern block
at the current cursor position in the block editor, accepting a slug param.

Admin::enqueue_editor_abilities() hooks into enqueue_block_editor_assets to
load @wordpress/core-abilities (pulls server abilities into the editor store)
and the waygate-editor-abilities ES module; skips gracefully on WP < 6.5.
@jasperf jasperf merged commit 8422b32 into main May 25, 2026
2 checks passed
@jasperf jasperf deleted the client-side-abilities branch May 25, 2026 08:00
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.

1 participant