Client Side Abilities#10
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-patternability 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/abilitiesregistration API. To support this,Admin::enqueue_editor_abilities()was added, which enqueues both the@wordpress/core-abilitiesmodule (which auto-loads server-registered abilities into the editor store) and the newwaygate-editor-abilitiesES module onenqueue_block_editor_assets. A graceful availability check ensures no fatal errors occur on WordPress versions that do not exposewp_enqueue_script_module().Client-Side Ability Registration:
assets/js/abilities.jsas a native ES module that registers thewaygate/insert-patternability via@wordpress/abilities, accepting a requiredslugstring parameter and dispatching acore/patternblock insertion throughcore/block-editor.waygate-editorability 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:
Admin::enqueue_editor_abilities()hooked toenqueue_block_editor_assets, which registers and enqueues the abilities script module withWAYGATE_VERSIONas the cache-busting key and declares@wordpress/abilitiesas a module dependency.wp_enqueue_script_module()is unavailable, ensuring backwards compatibility without throwing fatal errors on older WordPress installations.Documentation and Versioning:
CHANGELOG.mdandREADME.mdupdated to document v0.8.0 additions, including the new ability, its category, and the enqueueing mechanism.WAYGATE_VERSIONand the plugin header inwaygate.phpbumped to0.8.0in accordance with the project's version bump checklist.Files Changed:
CHANGELOG.md(Modified)README.md(Modified)docs/ROADMAP.md(Modified)includes/class-admin.php(Modified)waygate.php(Modified)assets/js/abilities.js(Added)