Skip to content

Commit

Permalink
Interactivity API: Add block supports for clientNavigation and `i…
Browse files Browse the repository at this point in the history
…nteractive` properties on `block.json` schema. (#58132)

* Add interactivity schemas

* Update all blocks with clientNavigation support

* Update non compatible with client side navigation blocks

* Add clientNavigation conditional to Query block

* Update changelog

* Add interactivty enabled

* Update with new schema

* Update with new schema

* Still not working, but updates on query

* Hard reset of query PHP part, tests should pass

* Update supports version and query code, tests still failing

* Remove comment template interactivity

* Simplify query

* Simplify query

* Remove not needed interactive false

* Revert duplicated interactivity

* Update supports

* Update schema

* Update docs

* Fix query php render

* Improve comment

* Add consistency to the render query

* Avoid not needed serialization

* Revert "Avoid not needed serialization"

This reverts commit 78daef1185373c7153f060f580427d0331caa57e.

* Improve `interactive` descriptions

---------

Co-authored-by: c4rl0sbr4v0 <cbravobernal@git.wordpress.org>
Co-authored-by: luisherranz <luisherranz@git.wordpress.org>
Co-authored-by: sirreal <jonsurrell@git.wordpress.org>
  • Loading branch information
4 people authored Feb 2, 2024
1 parent 51f59e6 commit f6e9fcc
Show file tree
Hide file tree
Showing 92 changed files with 445 additions and 116 deletions.
170 changes: 85 additions & 85 deletions docs/reference-guides/core-blocks.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ function wp_interactivity_process_directives_of_interactive_blocks( $parsed_bloc
$block_name = $parsed_block['blockName'];
$block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block_name );

if ( isset( $block_name ) && isset( $block_type->supports['interactivity'] ) && $block_type->supports['interactivity'] ) {
if (
isset( $block_name ) &&
( ( isset( $block_type->supports['interactivity'] ) && true === $block_type->supports['interactivity'] ) ||
( isset( $block_type->supports['interactivity']['interactive'] ) && true === $block_type->supports['interactivity']['interactive'] ) )
) {
// Annotates the root interactive block for processing.
$root_interactive_block = array( $block_name, md5( serialize( $parsed_block ) ) );

Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/archives/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
"__experimentalDefaultControls": {
"fontSize": true
}
},
"interactivity": {
"clientNavigation": true
}
},
"editorStyle": "wp-block-archives-editor"
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/audio/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
"margin": false,
"padding": false
}
},
"interactivity": {
"clientNavigation": true
}
},
"editorStyle": "wp-block-audio-editor",
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/avatar/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
"text": false,
"background": false,
"__experimentalDuotone": "img"
},
"interactivity": {
"clientNavigation": true
}
},
"selectors": {
Expand Down
5 changes: 4 additions & 1 deletion packages/block-library/src/block/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
"customClassName": false,
"html": false,
"inserter": false,
"renaming": false
"renaming": false,
"interactivity": {
"clientNavigation": true
}
}
}
5 changes: 4 additions & 1 deletion packages/block-library/src/button/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@
"width": true
}
},
"__experimentalSelector": ".wp-block-button .wp-block-button__link"
"__experimentalSelector": ".wp-block-button .wp-block-button__link",
"interactivity": {
"clientNavigation": true
}
},
"styles": [
{ "name": "fill", "label": "Fill", "isDefault": true },
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/buttons/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
"default": {
"type": "flex"
}
},
"interactivity": {
"clientNavigation": true
}
},
"editorStyle": "wp-block-buttons-editor",
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/calendar/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
"__experimentalDefaultControls": {
"fontSize": true
}
},
"interactivity": {
"clientNavigation": true
}
},
"style": "wp-block-calendar"
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/categories/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
"__experimentalDefaultControls": {
"fontSize": true
}
},
"interactivity": {
"clientNavigation": true
}
},
"editorStyle": "wp-block-categories-editor",
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/code/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
"background": true,
"text": true
}
},
"interactivity": {
"clientNavigation": true
}
},
"style": "wp-block-code"
Expand Down
5 changes: 4 additions & 1 deletion packages/block-library/src/column/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
"fontSize": true
}
},
"layout": true
"layout": true,
"interactivity": {
"clientNavigation": true
}
}
}
3 changes: 3 additions & 0 deletions packages/block-library/src/columns/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
"__experimentalDefaultControls": {
"fontSize": true
}
},
"interactivity": {
"clientNavigation": true
}
},
"editorStyle": "wp-block-columns-editor",
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/comment-author-avatar/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
"__experimentalSkipSerialization": true,
"margin": true,
"padding": true
},
"interactivity": {
"clientNavigation": true
}
}
}
3 changes: 3 additions & 0 deletions packages/block-library/src/comment-author-name/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
"__experimentalDefaultControls": {
"fontSize": true
}
},
"interactivity": {
"clientNavigation": true
}
}
}
3 changes: 3 additions & 0 deletions packages/block-library/src/comment-date/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
"__experimentalDefaultControls": {
"fontSize": true
}
},
"interactivity": {
"clientNavigation": true
}
}
}
3 changes: 3 additions & 0 deletions packages/block-library/src/comment-edit-link/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
"__experimentalDefaultControls": {
"fontSize": true
}
},
"interactivity": {
"clientNavigation": true
}
}
}
3 changes: 3 additions & 0 deletions packages/block-library/src/comment-template/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"__experimentalDefaultControls": {
"fontSize": true
}
},
"interactivity": {
"clientNavigation": true
}
},
"style": "wp-block-comment-template"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
"__experimentalDefaultControls": {
"fontSize": true
}
},
"interactivity": {
"clientNavigation": true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
"__experimentalDefaultControls": {
"fontSize": true
}
},
"interactivity": {
"clientNavigation": true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
"__experimentalDefaultControls": {
"fontSize": true
}
},
"interactivity": {
"clientNavigation": true
}
}
}
3 changes: 3 additions & 0 deletions packages/block-library/src/comments-pagination/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
"__experimentalDefaultControls": {
"fontSize": true
}
},
"interactivity": {
"clientNavigation": true
}
},
"editorStyle": "wp-block-comments-pagination-editor",
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/comments-title/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
"__experimentalFontStyle": true,
"__experimentalFontWeight": true
}
},
"interactivity": {
"clientNavigation": true
}
}
}
3 changes: 3 additions & 0 deletions packages/block-library/src/cover/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@
},
"layout": {
"allowJustification": false
},
"interactivity": {
"clientNavigation": true
}
},
"editorStyle": "wp-block-cover-editor",
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/details/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
},
"layout": {
"allowEditing": false
},
"interactivity": {
"clientNavigation": true
}
},
"editorStyle": "wp-block-details-editor",
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/embed/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
"align": true,
"spacing": {
"margin": true
},
"interactivity": {
"clientNavigation": true
}
},
"editorStyle": "wp-block-embed-editor",
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/footnotes/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
"__experimentalDefaultControls": {
"fontSize": true
}
},
"interactivity": {
"clientNavigation": true
}
},
"style": "wp-block-footnotes"
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/gallery/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@
"default": {
"type": "flex"
}
},
"interactivity": {
"clientNavigation": true
}
},
"editorStyle": "wp-block-gallery-editor",
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/group/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@
},
"layout": {
"allowSizingOnChildren": true
},
"interactivity": {
"clientNavigation": true
}
},
"editorStyle": "wp-block-group-editor",
Expand Down
5 changes: 4 additions & 1 deletion packages/block-library/src/heading/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@
}
},
"__unstablePasteTextInline": true,
"__experimentalSlashInserter": true
"__experimentalSlashInserter": true,
"interactivity": {
"clientNavigation": true
}
},
"editorStyle": "wp-block-heading-editor",
"style": "wp-block-heading"
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/home-link/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
"__experimentalDefaultControls": {
"fontSize": true
}
},
"interactivity": {
"clientNavigation": true
}
},
"editorStyle": "wp-block-home-link-editor",
Expand Down
5 changes: 4 additions & 1 deletion packages/block-library/src/html/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
"supports": {
"customClassName": false,
"className": false,
"html": false
"html": false,
"interactivity": {
"clientNavigation": true
}
},
"editorStyle": "wp-block-html-editor"
}
3 changes: 3 additions & 0 deletions packages/block-library/src/latest-comments/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
"__experimentalDefaultControls": {
"fontSize": true
}
},
"interactivity": {
"clientNavigation": true
}
},
"editorStyle": "wp-block-latest-comments-editor",
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/latest-posts/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@
"__experimentalDefaultControls": {
"fontSize": true
}
},
"interactivity": {
"clientNavigation": true
}
},
"editorStyle": "wp-block-latest-posts-editor",
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/list-item/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
"__experimentalDefaultControls": {
"fontSize": true
}
},
"interactivity": {
"clientNavigation": true
}
}
}
5 changes: 4 additions & 1 deletion packages/block-library/src/list/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@
"__unstablePasteTextInline": true,
"__experimentalSelector": "ol,ul",
"__experimentalOnMerge": true,
"__experimentalSlashInserter": true
"__experimentalSlashInserter": true,
"interactivity": {
"clientNavigation": true
}
},
"editorStyle": "wp-block-list-editor",
"style": "wp-block-list"
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/loginout/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
"__experimentalDefaultControls": {
"fontSize": true
}
},
"interactivity": {
"clientNavigation": true
}
}
}
3 changes: 3 additions & 0 deletions packages/block-library/src/media-text/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
"__experimentalDefaultControls": {
"fontSize": true
}
},
"interactivity": {
"clientNavigation": true
}
},
"editorStyle": "wp-block-media-text-editor",
Expand Down
5 changes: 4 additions & 1 deletion packages/block-library/src/missing/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
"customClassName": false,
"inserter": false,
"html": false,
"reusable": false
"reusable": false,
"interactivity": {
"clientNavigation": true
}
}
}
Loading

0 comments on commit f6e9fcc

Please sign in to comment.