mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 04:48:25 +01:00
Editor: Update the WordPress packages to Gutenberg 17.7RC1.
This brings the latest and greatest from Gutenberg. The full changelog is available here https://github.com/WordPress/gutenberg/releases/tag/v17.7.0-rc.1 Props youknowriad, get_dave. See #60315. git-svn-id: https://develop.svn.wordpress.org/trunk@57578 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ed1d8460a4
commit
1f8bb9fb33
3977
package-lock.json
generated
3977
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
144
package.json
144
package.json
@ -27,12 +27,12 @@
|
||||
"@lodder/grunt-postcss": "^3.1.1",
|
||||
"@playwright/test": "1.32.0",
|
||||
"@pmmmwh/react-refresh-webpack-plugin": "0.5.5",
|
||||
"@wordpress/babel-preset-default": "7.34.0",
|
||||
"@wordpress/dependency-extraction-webpack-plugin": "5.1.0",
|
||||
"@wordpress/e2e-test-utils": "10.21.0",
|
||||
"@wordpress/e2e-test-utils-playwright": "0.18.0",
|
||||
"@wordpress/prettier-config": "3.7.0",
|
||||
"@wordpress/scripts": "27.1.0",
|
||||
"@wordpress/babel-preset-default": "7.35.0",
|
||||
"@wordpress/dependency-extraction-webpack-plugin": "5.2.0",
|
||||
"@wordpress/e2e-test-utils": "10.22.0",
|
||||
"@wordpress/e2e-test-utils-playwright": "0.19.0",
|
||||
"@wordpress/prettier-config": "3.8.0",
|
||||
"@wordpress/scripts": "27.2.0",
|
||||
"autoprefixer": "10.4.16",
|
||||
"chalk": "5.3.0",
|
||||
"check-node-version": "4.2.1",
|
||||
@ -80,72 +80,72 @@
|
||||
"dependencies": {
|
||||
"@emotion/is-prop-valid": "0.8.8",
|
||||
"@emotion/memoize": "0.7.4",
|
||||
"@wordpress/a11y": "3.50.0",
|
||||
"@wordpress/annotations": "2.50.0",
|
||||
"@wordpress/api-fetch": "6.47.0",
|
||||
"@wordpress/autop": "3.50.0",
|
||||
"@wordpress/blob": "3.50.0",
|
||||
"@wordpress/block-directory": "4.27.2",
|
||||
"@wordpress/block-editor": "12.18.2",
|
||||
"@wordpress/block-library": "8.27.2",
|
||||
"@wordpress/block-serialization-default-parser": "4.50.0",
|
||||
"@wordpress/blocks": "12.27.1",
|
||||
"@wordpress/commands": "0.21.0",
|
||||
"@wordpress/components": "25.16.0",
|
||||
"@wordpress/compose": "6.27.0",
|
||||
"@wordpress/core-commands": "0.19.2",
|
||||
"@wordpress/core-data": "6.27.2",
|
||||
"@wordpress/customize-widgets": "4.27.2",
|
||||
"@wordpress/data": "9.20.0",
|
||||
"@wordpress/data-controls": "3.19.0",
|
||||
"@wordpress/dataviews": "0.4.1",
|
||||
"@wordpress/date": "4.50.0",
|
||||
"@wordpress/deprecated": "3.50.0",
|
||||
"@wordpress/dom": "3.50.0",
|
||||
"@wordpress/dom-ready": "3.50.0",
|
||||
"@wordpress/edit-post": "7.27.2",
|
||||
"@wordpress/edit-site": "5.27.2",
|
||||
"@wordpress/edit-widgets": "5.27.2",
|
||||
"@wordpress/editor": "13.27.2",
|
||||
"@wordpress/element": "5.27.0",
|
||||
"@wordpress/escape-html": "2.50.0",
|
||||
"@wordpress/format-library": "4.27.2",
|
||||
"@wordpress/hooks": "3.50.0",
|
||||
"@wordpress/html-entities": "3.50.0",
|
||||
"@wordpress/i18n": "4.50.0",
|
||||
"@wordpress/icons": "9.41.0",
|
||||
"@wordpress/interactivity": "4.0.1",
|
||||
"@wordpress/interactivity-router": "1.0.1",
|
||||
"@wordpress/interface": "5.27.0",
|
||||
"@wordpress/is-shallow-equal": "4.50.0",
|
||||
"@wordpress/keyboard-shortcuts": "4.27.0",
|
||||
"@wordpress/keycodes": "3.50.0",
|
||||
"@wordpress/list-reusable-blocks": "4.27.0",
|
||||
"@wordpress/media-utils": "4.41.0",
|
||||
"@wordpress/notices": "4.18.0",
|
||||
"@wordpress/nux": "8.12.0",
|
||||
"@wordpress/patterns": "1.11.2",
|
||||
"@wordpress/plugins": "6.18.0",
|
||||
"@wordpress/preferences": "3.27.0",
|
||||
"@wordpress/preferences-persistence": "1.42.0",
|
||||
"@wordpress/primitives": "3.48.0",
|
||||
"@wordpress/priority-queue": "2.50.0",
|
||||
"@wordpress/private-apis": "0.32.0",
|
||||
"@wordpress/redux-routine": "4.50.0",
|
||||
"@wordpress/reusable-blocks": "4.27.2",
|
||||
"@wordpress/rich-text": "6.27.0",
|
||||
"@wordpress/router": "0.19.0",
|
||||
"@wordpress/server-side-render": "4.27.1",
|
||||
"@wordpress/shortcode": "3.50.0",
|
||||
"@wordpress/style-engine": "1.33.1",
|
||||
"@wordpress/sync": "0.12.0",
|
||||
"@wordpress/token-list": "2.50.0",
|
||||
"@wordpress/undo-manager": "0.10.0",
|
||||
"@wordpress/url": "3.51.0",
|
||||
"@wordpress/viewport": "5.27.0",
|
||||
"@wordpress/warning": "2.50.0",
|
||||
"@wordpress/widgets": "3.27.2",
|
||||
"@wordpress/wordcount": "3.50.0",
|
||||
"@wordpress/a11y": "3.51.0",
|
||||
"@wordpress/annotations": "2.51.0",
|
||||
"@wordpress/api-fetch": "6.48.0",
|
||||
"@wordpress/autop": "3.51.0",
|
||||
"@wordpress/blob": "3.51.0",
|
||||
"@wordpress/block-directory": "4.28.0",
|
||||
"@wordpress/block-editor": "12.19.0",
|
||||
"@wordpress/block-library": "8.28.0",
|
||||
"@wordpress/block-serialization-default-parser": "4.51.0",
|
||||
"@wordpress/blocks": "12.28.0",
|
||||
"@wordpress/commands": "0.22.0",
|
||||
"@wordpress/components": "26.0.0",
|
||||
"@wordpress/compose": "6.28.0",
|
||||
"@wordpress/core-commands": "0.20.0",
|
||||
"@wordpress/core-data": "6.28.0",
|
||||
"@wordpress/customize-widgets": "4.28.0",
|
||||
"@wordpress/data": "9.21.0",
|
||||
"@wordpress/data-controls": "3.20.0",
|
||||
"@wordpress/dataviews": "0.5.0",
|
||||
"@wordpress/date": "4.51.0",
|
||||
"@wordpress/deprecated": "3.51.0",
|
||||
"@wordpress/dom": "3.51.0",
|
||||
"@wordpress/dom-ready": "3.51.0",
|
||||
"@wordpress/edit-post": "7.28.0",
|
||||
"@wordpress/edit-site": "5.28.0",
|
||||
"@wordpress/edit-widgets": "5.28.0",
|
||||
"@wordpress/editor": "13.28.0",
|
||||
"@wordpress/element": "5.28.0",
|
||||
"@wordpress/escape-html": "2.51.0",
|
||||
"@wordpress/format-library": "4.28.0",
|
||||
"@wordpress/hooks": "3.51.0",
|
||||
"@wordpress/html-entities": "3.51.0",
|
||||
"@wordpress/i18n": "4.51.0",
|
||||
"@wordpress/icons": "9.42.0",
|
||||
"@wordpress/interactivity": "5.0.0",
|
||||
"@wordpress/interactivity-router": "1.1.0",
|
||||
"@wordpress/interface": "5.28.0",
|
||||
"@wordpress/is-shallow-equal": "4.51.0",
|
||||
"@wordpress/keyboard-shortcuts": "4.28.0",
|
||||
"@wordpress/keycodes": "3.51.0",
|
||||
"@wordpress/list-reusable-blocks": "4.28.0",
|
||||
"@wordpress/media-utils": "4.42.0",
|
||||
"@wordpress/notices": "4.19.0",
|
||||
"@wordpress/nux": "8.13.0",
|
||||
"@wordpress/patterns": "1.12.0",
|
||||
"@wordpress/plugins": "6.19.0",
|
||||
"@wordpress/preferences": "3.28.0",
|
||||
"@wordpress/preferences-persistence": "1.43.0",
|
||||
"@wordpress/primitives": "3.49.0",
|
||||
"@wordpress/priority-queue": "2.51.0",
|
||||
"@wordpress/private-apis": "0.33.0",
|
||||
"@wordpress/redux-routine": "4.51.0",
|
||||
"@wordpress/reusable-blocks": "4.28.0",
|
||||
"@wordpress/rich-text": "6.28.0",
|
||||
"@wordpress/router": "0.20.0",
|
||||
"@wordpress/server-side-render": "4.28.0",
|
||||
"@wordpress/shortcode": "3.51.0",
|
||||
"@wordpress/style-engine": "1.34.0",
|
||||
"@wordpress/sync": "0.13.0",
|
||||
"@wordpress/token-list": "2.51.0",
|
||||
"@wordpress/undo-manager": "0.11.0",
|
||||
"@wordpress/url": "3.52.0",
|
||||
"@wordpress/viewport": "5.28.0",
|
||||
"@wordpress/warning": "2.51.0",
|
||||
"@wordpress/widgets": "3.28.0",
|
||||
"@wordpress/wordcount": "3.51.0",
|
||||
"backbone": "1.5.0",
|
||||
"clipboard": "2.0.11",
|
||||
"core-js-url-browser": "3.6.4",
|
||||
|
@ -833,10 +833,6 @@ $_old_files = array(
|
||||
'wp-includes/blocks/heading/editor.min.css',
|
||||
'wp-includes/blocks/heading/editor-rtl.css',
|
||||
'wp-includes/blocks/heading/editor-rtl.min.css',
|
||||
'wp-includes/blocks/post-content/editor.css',
|
||||
'wp-includes/blocks/post-content/editor.min.css',
|
||||
'wp-includes/blocks/post-content/editor-rtl.css',
|
||||
'wp-includes/blocks/post-content/editor-rtl.min.css',
|
||||
'wp-includes/blocks/query-title/editor.css',
|
||||
'wp-includes/blocks/query-title/editor.min.css',
|
||||
'wp-includes/blocks/query-title/editor-rtl.css',
|
||||
|
File diff suppressed because one or more lines are too long
@ -47,6 +47,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-archives-editor"
|
||||
|
@ -54,6 +54,9 @@
|
||||
"margin": false,
|
||||
"padding": false
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-audio-editor",
|
||||
|
@ -50,6 +50,9 @@
|
||||
"text": false,
|
||||
"background": false,
|
||||
"__experimentalDuotone": "img"
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"selectors": {
|
||||
|
@ -46,7 +46,20 @@ function render_block_core_block( $attributes ) {
|
||||
$content = $wp_embed->run_shortcode( $reusable_block->post_content );
|
||||
$content = $wp_embed->autoembed( $content );
|
||||
|
||||
$has_pattern_overrides = isset( $attributes['overrides'] );
|
||||
// Back compat, the content attribute was previously named overrides and
|
||||
// had a slightly different format. For blocks that have not been migrated,
|
||||
// also convert the format here so that the provided `pattern/overrides`
|
||||
// context is correct.
|
||||
if ( isset( $attributes['overrides'] ) && ! isset( $attributes['content'] ) ) {
|
||||
$migrated_content = array();
|
||||
foreach ( $attributes['overrides'] as $id => $values ) {
|
||||
$migrated_content[ $id ] = array(
|
||||
'values' => $values,
|
||||
);
|
||||
}
|
||||
$attributes['content'] = $migrated_content;
|
||||
}
|
||||
$has_pattern_overrides = isset( $attributes['content'] );
|
||||
|
||||
/**
|
||||
* We set the `pattern/overrides` context through the `render_block_context`
|
||||
@ -55,7 +68,7 @@ function render_block_core_block( $attributes ) {
|
||||
*/
|
||||
if ( $has_pattern_overrides ) {
|
||||
$filter_block_context = static function ( $context ) use ( $attributes ) {
|
||||
$context['pattern/overrides'] = $attributes['overrides'];
|
||||
$context['pattern/overrides'] = $attributes['content'];
|
||||
return $context;
|
||||
};
|
||||
add_filter( 'render_block_context', $filter_block_context, 1 );
|
||||
|
@ -4,14 +4,14 @@
|
||||
"name": "core/block",
|
||||
"title": "Pattern",
|
||||
"category": "reusable",
|
||||
"description": "Create and save content to reuse across your site. Update the pattern, and the changes apply everywhere it’s used.",
|
||||
"description": "Reuse this design across your site.",
|
||||
"keywords": [ "reusable" ],
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
"ref": {
|
||||
"type": "number"
|
||||
},
|
||||
"overrides": {
|
||||
"content": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
@ -19,6 +19,9 @@
|
||||
"customClassName": false,
|
||||
"html": false,
|
||||
"inserter": false,
|
||||
"renaming": false
|
||||
"renaming": false,
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-archives-editor'
|
||||
@ -113,6 +116,9 @@
|
||||
'margin' => false,
|
||||
'padding' => false
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-audio-editor',
|
||||
@ -174,6 +180,9 @@
|
||||
'text' => false,
|
||||
'background' => false,
|
||||
'__experimentalDuotone' => 'img'
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'selectors' => array(
|
||||
@ -188,7 +197,7 @@
|
||||
'name' => 'core/block',
|
||||
'title' => 'Pattern',
|
||||
'category' => 'reusable',
|
||||
'description' => 'Create and save content to reuse across your site. Update the pattern, and the changes apply everywhere it’s used.',
|
||||
'description' => 'Reuse this design across your site.',
|
||||
'keywords' => array(
|
||||
'reusable'
|
||||
),
|
||||
@ -197,7 +206,7 @@
|
||||
'ref' => array(
|
||||
'type' => 'number'
|
||||
),
|
||||
'overrides' => array(
|
||||
'content' => array(
|
||||
'type' => 'object'
|
||||
)
|
||||
),
|
||||
@ -205,7 +214,10 @@
|
||||
'customClassName' => false,
|
||||
'html' => false,
|
||||
'inserter' => false,
|
||||
'renaming' => false
|
||||
'renaming' => false,
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
'button' => array(
|
||||
@ -317,7 +329,9 @@
|
||||
)
|
||||
),
|
||||
'reusable' => false,
|
||||
'shadow' => true,
|
||||
'shadow' => array(
|
||||
'__experimentalSkipSerialization' => true
|
||||
),
|
||||
'spacing' => array(
|
||||
'__experimentalSkipSerialization' => true,
|
||||
'padding' => array(
|
||||
@ -341,7 +355,10 @@
|
||||
'width' => true
|
||||
)
|
||||
),
|
||||
'__experimentalSelector' => '.wp-block-button .wp-block-button__link'
|
||||
'__experimentalSelector' => '.wp-block-button .wp-block-button__link',
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'styles' => array(
|
||||
array(
|
||||
@ -363,6 +380,9 @@
|
||||
'name' => 'core/buttons',
|
||||
'title' => 'Buttons',
|
||||
'category' => 'design',
|
||||
'allowedBlocks' => array(
|
||||
'core/button'
|
||||
),
|
||||
'description' => 'Prompt visitors to take action with a group of button-style links.',
|
||||
'keywords' => array(
|
||||
'link'
|
||||
@ -405,6 +425,9 @@
|
||||
'default' => array(
|
||||
'type' => 'flex'
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-buttons-editor',
|
||||
@ -455,6 +478,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'style' => 'wp-block-calendar'
|
||||
@ -512,6 +538,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-categories-editor',
|
||||
@ -580,6 +609,9 @@
|
||||
'background' => true,
|
||||
'text' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'style' => 'wp-block-code'
|
||||
@ -633,6 +665,7 @@
|
||||
'text' => true
|
||||
)
|
||||
),
|
||||
'shadow' => true,
|
||||
'spacing' => array(
|
||||
'blockGap' => true,
|
||||
'padding' => true,
|
||||
@ -664,7 +697,10 @@
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'layout' => true
|
||||
'layout' => true,
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
'columns' => array(
|
||||
@ -673,6 +709,9 @@
|
||||
'name' => 'core/columns',
|
||||
'title' => 'Columns',
|
||||
'category' => 'design',
|
||||
'allowedBlocks' => array(
|
||||
'core/column'
|
||||
),
|
||||
'description' => 'Display content in multiple columns, with blocks added to each column.',
|
||||
'textdomain' => 'default',
|
||||
'attributes' => array(
|
||||
@ -764,7 +803,11 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
),
|
||||
'shadow' => true
|
||||
),
|
||||
'editorStyle' => 'wp-block-columns-editor',
|
||||
'style' => 'wp-block-columns'
|
||||
@ -823,6 +866,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
@ -929,6 +975,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
@ -982,6 +1031,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
@ -1068,6 +1120,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'style' => 'wp-block-comment-template'
|
||||
@ -1139,6 +1194,11 @@
|
||||
'parent' => array(
|
||||
'core/comments'
|
||||
),
|
||||
'allowedBlocks' => array(
|
||||
'core/comments-pagination-previous',
|
||||
'core/comments-pagination-numbers',
|
||||
'core/comments-pagination-next'
|
||||
),
|
||||
'description' => 'Displays a paginated navigation to next/previous set of comments, when applicable.',
|
||||
'textdomain' => 'default',
|
||||
'attributes' => array(
|
||||
@ -1182,6 +1242,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-comments-pagination-editor',
|
||||
@ -1229,6 +1292,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
@ -1268,6 +1334,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
@ -1313,6 +1382,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
@ -1384,6 +1456,9 @@
|
||||
'__experimentalFontStyle' => true,
|
||||
'__experimentalFontWeight' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
@ -1537,6 +1612,9 @@
|
||||
),
|
||||
'layout' => array(
|
||||
'allowJustification' => false
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-cover-editor',
|
||||
@ -1610,6 +1688,9 @@
|
||||
),
|
||||
'layout' => array(
|
||||
'allowEditing' => false
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-details-editor',
|
||||
@ -1661,6 +1742,9 @@
|
||||
'align' => true,
|
||||
'spacing' => array(
|
||||
'margin' => true
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-embed-editor',
|
||||
@ -1809,6 +1893,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'style' => 'wp-block-footnotes'
|
||||
@ -1840,6 +1927,9 @@
|
||||
'name' => 'core/gallery',
|
||||
'title' => 'Gallery',
|
||||
'category' => 'media',
|
||||
'allowedBlocks' => array(
|
||||
'core/image'
|
||||
),
|
||||
'description' => 'Display multiple images in a rich gallery.',
|
||||
'keywords' => array(
|
||||
'images',
|
||||
@ -1992,6 +2082,9 @@
|
||||
'default' => array(
|
||||
'type' => 'flex'
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-gallery-editor',
|
||||
@ -2105,6 +2198,9 @@
|
||||
),
|
||||
'layout' => array(
|
||||
'allowSizingOnChildren' => true
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-group-editor',
|
||||
@ -2181,7 +2277,10 @@
|
||||
)
|
||||
),
|
||||
'__unstablePasteTextInline' => true,
|
||||
'__experimentalSlashInserter' => true
|
||||
'__experimentalSlashInserter' => true,
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-heading-editor',
|
||||
'style' => 'wp-block-heading'
|
||||
@ -2226,6 +2325,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-home-link-editor',
|
||||
@ -2251,7 +2353,10 @@
|
||||
'supports' => array(
|
||||
'customClassName' => false,
|
||||
'className' => false,
|
||||
'html' => false
|
||||
'html' => false,
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-html-editor'
|
||||
),
|
||||
@ -2384,10 +2489,14 @@
|
||||
'radius' => true,
|
||||
'width' => true
|
||||
)
|
||||
),
|
||||
'shadow' => array(
|
||||
'__experimentalSkipSerialization' => true
|
||||
)
|
||||
),
|
||||
'selectors' => array(
|
||||
'border' => '.wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder',
|
||||
'shadow' => '.wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder',
|
||||
'filter' => array(
|
||||
'duotone' => '.wp-block-image img, .wp-block-image .components-placeholder'
|
||||
)
|
||||
@ -2456,6 +2565,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-latest-comments-editor',
|
||||
@ -2579,6 +2691,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-latest-posts-editor',
|
||||
@ -2619,6 +2734,9 @@
|
||||
'name' => 'core/list',
|
||||
'title' => 'List',
|
||||
'category' => 'text',
|
||||
'allowedBlocks' => array(
|
||||
'core/list-item'
|
||||
),
|
||||
'description' => 'Create a bulleted or numbered list.',
|
||||
'keywords' => array(
|
||||
'bullet list',
|
||||
@ -2692,7 +2810,10 @@
|
||||
'__unstablePasteTextInline' => true,
|
||||
'__experimentalSelector' => 'ol,ul',
|
||||
'__experimentalOnMerge' => true,
|
||||
'__experimentalSlashInserter' => true
|
||||
'__experimentalSlashInserter' => true,
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-list-editor',
|
||||
'style' => 'wp-block-list'
|
||||
@ -2706,6 +2827,9 @@
|
||||
'parent' => array(
|
||||
'core/list'
|
||||
),
|
||||
'allowedBlocks' => array(
|
||||
'core/list'
|
||||
),
|
||||
'description' => 'Create a list item.',
|
||||
'textdomain' => 'default',
|
||||
'attributes' => array(
|
||||
@ -2742,6 +2866,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
@ -2790,6 +2917,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
@ -2924,6 +3054,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-media-text-editor',
|
||||
@ -2954,7 +3087,10 @@
|
||||
'customClassName' => false,
|
||||
'inserter' => false,
|
||||
'html' => false,
|
||||
'reusable' => false
|
||||
'reusable' => false,
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
'more' => array(
|
||||
@ -2981,7 +3117,10 @@
|
||||
'customClassName' => false,
|
||||
'className' => false,
|
||||
'html' => false,
|
||||
'multiple' => false
|
||||
'multiple' => false,
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-more-editor'
|
||||
),
|
||||
@ -2991,6 +3130,19 @@
|
||||
'name' => 'core/navigation',
|
||||
'title' => 'Navigation',
|
||||
'category' => 'theme',
|
||||
'allowedBlocks' => array(
|
||||
'core/navigation-link',
|
||||
'core/search',
|
||||
'core/social-links',
|
||||
'core/page-list',
|
||||
'core/spacer',
|
||||
'core/home-link',
|
||||
'core/site-title',
|
||||
'core/site-logo',
|
||||
'core/navigation-submenu',
|
||||
'core/loginout',
|
||||
'core/buttons'
|
||||
),
|
||||
'description' => 'A collection of blocks that allow visitors to get around your site.',
|
||||
'keywords' => array(
|
||||
'menu',
|
||||
@ -3158,6 +3310,11 @@
|
||||
'parent' => array(
|
||||
'core/navigation'
|
||||
),
|
||||
'allowedBlocks' => array(
|
||||
'core/navigation-link',
|
||||
'core/navigation-submenu',
|
||||
'core/page-list'
|
||||
),
|
||||
'description' => 'Add a page, link, or another item to your navigation.',
|
||||
'textdomain' => 'default',
|
||||
'attributes' => array(
|
||||
@ -3225,7 +3382,10 @@
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'renaming' => false
|
||||
'renaming' => false,
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-navigation-link-editor',
|
||||
'style' => 'wp-block-navigation-link'
|
||||
@ -3292,7 +3452,10 @@
|
||||
),
|
||||
'supports' => array(
|
||||
'reusable' => false,
|
||||
'html' => false
|
||||
'html' => false,
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-navigation-submenu-editor',
|
||||
'style' => 'wp-block-navigation-submenu'
|
||||
@ -3315,7 +3478,10 @@
|
||||
'supports' => array(
|
||||
'customClassName' => false,
|
||||
'className' => false,
|
||||
'html' => false
|
||||
'html' => false,
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-nextpage-editor'
|
||||
),
|
||||
@ -3325,6 +3491,9 @@
|
||||
'name' => 'core/page-list',
|
||||
'title' => 'Page List',
|
||||
'category' => 'widgets',
|
||||
'allowedBlocks' => array(
|
||||
'core/page-list-item'
|
||||
),
|
||||
'description' => 'Display a list of all pages.',
|
||||
'keywords' => array(
|
||||
'menu',
|
||||
@ -3371,6 +3540,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-page-list-editor',
|
||||
@ -3429,7 +3601,10 @@
|
||||
'html' => false,
|
||||
'lock' => false,
|
||||
'inserter' => false,
|
||||
'__experimentalToolbar' => false
|
||||
'__experimentalToolbar' => false,
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-page-list-editor',
|
||||
'style' => 'wp-block-page-list'
|
||||
@ -3508,7 +3683,10 @@
|
||||
)
|
||||
),
|
||||
'__experimentalSelector' => 'p',
|
||||
'__unstablePasteTextInline' => true
|
||||
'__unstablePasteTextInline' => true,
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-paragraph-editor',
|
||||
'style' => 'wp-block-paragraph'
|
||||
@ -3523,7 +3701,10 @@
|
||||
'supports' => array(
|
||||
'html' => false,
|
||||
'inserter' => false,
|
||||
'renaming' => false
|
||||
'renaming' => false,
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'textdomain' => 'default',
|
||||
'attributes' => array(
|
||||
@ -3599,6 +3780,9 @@
|
||||
'background' => true,
|
||||
'text' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'style' => 'wp-block-post-author'
|
||||
@ -3645,6 +3829,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
@ -3700,6 +3887,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
@ -3860,6 +4050,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
@ -3919,6 +4112,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-post-excerpt-editor',
|
||||
@ -4017,6 +4213,9 @@
|
||||
'spacing' => array(
|
||||
'margin' => true,
|
||||
'padding' => true
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-post-featured-image-editor',
|
||||
@ -4053,9 +4252,6 @@
|
||||
'type' => 'string',
|
||||
'default' => 'none'
|
||||
),
|
||||
'inSameTerm' => array(
|
||||
'type' => 'boolean'
|
||||
),
|
||||
'taxonomy' => array(
|
||||
'type' => 'string',
|
||||
'default' => ''
|
||||
@ -4083,6 +4279,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'style' => 'wp-block-post-navigation-link'
|
||||
@ -4142,6 +4341,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'blockGap' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'style' => 'wp-block-post-template',
|
||||
@ -4206,6 +4408,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'style' => 'wp-block-post-terms'
|
||||
@ -4276,6 +4481,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'style' => 'wp-block-post-title'
|
||||
@ -4322,6 +4530,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'style' => 'wp-block-preformatted'
|
||||
@ -4402,6 +4613,9 @@
|
||||
'fontSize' => '1.5em',
|
||||
'lineHeight' => '1.6'
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-pullquote-editor',
|
||||
@ -4465,10 +4679,10 @@
|
||||
'full'
|
||||
),
|
||||
'html' => false,
|
||||
'layout' => true
|
||||
'layout' => true,
|
||||
'interactivity' => true
|
||||
),
|
||||
'editorStyle' => 'wp-block-query-editor',
|
||||
'style' => 'wp-block-query'
|
||||
'editorStyle' => 'wp-block-query-editor'
|
||||
),
|
||||
'query-no-results' => array(
|
||||
'$schema' => 'https://schemas.wp.org/trunk/block.json',
|
||||
@ -4505,6 +4719,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
@ -4514,9 +4731,14 @@
|
||||
'name' => 'core/query-pagination',
|
||||
'title' => 'Pagination',
|
||||
'category' => 'theme',
|
||||
'parent' => array(
|
||||
'ancestor' => array(
|
||||
'core/query'
|
||||
),
|
||||
'allowedBlocks' => array(
|
||||
'core/query-pagination-previous',
|
||||
'core/query-pagination-numbers',
|
||||
'core/query-pagination-next'
|
||||
),
|
||||
'description' => 'Displays a paginated navigation to next/previous set of posts, when applicable.',
|
||||
'textdomain' => 'default',
|
||||
'attributes' => array(
|
||||
@ -4569,6 +4791,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-query-pagination-editor',
|
||||
@ -4619,6 +4844,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
@ -4666,6 +4894,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-query-pagination-numbers-editor'
|
||||
@ -4715,6 +4946,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
@ -4775,6 +5009,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'style' => 'wp-block-query-title'
|
||||
@ -4842,6 +5079,9 @@
|
||||
),
|
||||
'spacing' => array(
|
||||
'blockGap' => true
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'styles' => array(
|
||||
@ -4915,6 +5155,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'width' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'style' => 'wp-block-read-more'
|
||||
@ -4967,7 +5210,10 @@
|
||||
),
|
||||
'supports' => array(
|
||||
'align' => true,
|
||||
'html' => false
|
||||
'html' => false,
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-rss-editor',
|
||||
'style' => 'wp-block-rss'
|
||||
@ -5113,6 +5359,9 @@
|
||||
'top',
|
||||
'bottom'
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'styles' => array(
|
||||
@ -5201,6 +5450,9 @@
|
||||
'margin' => false,
|
||||
'padding' => false
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'styles' => array(
|
||||
@ -5269,6 +5521,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-site-tagline-editor'
|
||||
@ -5336,6 +5591,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-site-title-editor',
|
||||
@ -5376,7 +5634,10 @@
|
||||
),
|
||||
'supports' => array(
|
||||
'reusable' => false,
|
||||
'html' => false
|
||||
'html' => false,
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-social-link-editor'
|
||||
),
|
||||
@ -5386,6 +5647,9 @@
|
||||
'name' => 'core/social-links',
|
||||
'title' => 'Social Icons',
|
||||
'category' => 'widgets',
|
||||
'allowedBlocks' => array(
|
||||
'core/social-link'
|
||||
),
|
||||
'description' => 'Display icons linking to your social media profiles or sites.',
|
||||
'keywords' => array(
|
||||
'links'
|
||||
@ -5474,6 +5738,9 @@
|
||||
'margin' => true,
|
||||
'padding' => false
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'styles' => array(
|
||||
@ -5524,6 +5791,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'margin' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-spacer-editor',
|
||||
@ -5738,7 +6008,10 @@
|
||||
'width' => true
|
||||
)
|
||||
),
|
||||
'__experimentalSelector' => '.wp-block-table > table'
|
||||
'__experimentalSelector' => '.wp-block-table > table',
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'styles' => array(
|
||||
array(
|
||||
@ -5811,6 +6084,9 @@
|
||||
'__experimentalFontStyle' => true,
|
||||
'__experimentalTextTransform' => true,
|
||||
'__experimentalLetterSpacing' => true
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-tag-cloud-editor'
|
||||
@ -5841,7 +6117,10 @@
|
||||
'align' => true,
|
||||
'html' => false,
|
||||
'reusable' => false,
|
||||
'renaming' => false
|
||||
'renaming' => false,
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-template-part-editor'
|
||||
),
|
||||
@ -5887,6 +6166,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
@ -5928,7 +6210,10 @@
|
||||
)
|
||||
),
|
||||
'supports' => array(
|
||||
'inserter' => false
|
||||
'inserter' => false,
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-text-columns-editor',
|
||||
'style' => 'wp-block-text-columns'
|
||||
@ -5993,6 +6278,9 @@
|
||||
'width' => true,
|
||||
'color' => true,
|
||||
'style' => true
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'style' => 'wp-block-verse',
|
||||
@ -6092,6 +6380,9 @@
|
||||
'margin' => false,
|
||||
'padding' => false
|
||||
)
|
||||
),
|
||||
'interactivity' => array(
|
||||
'clientNavigation' => true
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-video-editor',
|
||||
|
@ -98,7 +98,9 @@
|
||||
}
|
||||
},
|
||||
"reusable": false,
|
||||
"shadow": true,
|
||||
"shadow": {
|
||||
"__experimentalSkipSerialization": true
|
||||
},
|
||||
"spacing": {
|
||||
"__experimentalSkipSerialization": true,
|
||||
"padding": [ "horizontal", "vertical" ],
|
||||
@ -119,7 +121,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 },
|
||||
|
@ -4,6 +4,7 @@
|
||||
"name": "core/buttons",
|
||||
"title": "Buttons",
|
||||
"category": "design",
|
||||
"allowedBlocks": [ "core/button" ],
|
||||
"description": "Prompt visitors to take action with a group of button-style links.",
|
||||
"keywords": [ "link" ],
|
||||
"textdomain": "default",
|
||||
@ -38,6 +39,9 @@
|
||||
"default": {
|
||||
"type": "flex"
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-buttons-editor",
|
||||
|
@ -37,6 +37,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"style": "wp-block-calendar"
|
||||
|
@ -51,6 +51,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-categories-editor",
|
||||
|
@ -56,6 +56,9 @@
|
||||
"background": true,
|
||||
"text": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"style": "wp-block-code"
|
||||
|
@ -37,6 +37,7 @@
|
||||
"text": true
|
||||
}
|
||||
},
|
||||
"shadow": true,
|
||||
"spacing": {
|
||||
"blockGap": true,
|
||||
"padding": true,
|
||||
@ -68,6 +69,9 @@
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"layout": true
|
||||
"layout": true,
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
"name": "core/columns",
|
||||
"title": "Columns",
|
||||
"category": "design",
|
||||
"allowedBlocks": [ "core/column" ],
|
||||
"description": "Display content in multiple columns, with blocks added to each column.",
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
@ -78,7 +79,11 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
},
|
||||
"shadow": true
|
||||
},
|
||||
"editorStyle": "wp-block-columns-editor",
|
||||
"style": "wp-block-columns"
|
||||
|
@ -48,6 +48,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"style": "wp-block-comment-template"
|
||||
|
@ -35,6 +35,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,11 @@
|
||||
"title": "Comments Pagination",
|
||||
"category": "theme",
|
||||
"parent": [ "core/comments" ],
|
||||
"allowedBlocks": [
|
||||
"core/comments-pagination-previous",
|
||||
"core/comments-pagination-numbers",
|
||||
"core/comments-pagination-next"
|
||||
],
|
||||
"description": "Displays a paginated navigation to next/previous set of comments, when applicable.",
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
@ -48,6 +53,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-comments-pagination-editor",
|
||||
|
@ -61,6 +61,9 @@
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalFontWeight": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -132,6 +132,9 @@
|
||||
},
|
||||
"layout": {
|
||||
"allowJustification": false
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-cover-editor",
|
||||
|
@ -58,6 +58,9 @@
|
||||
},
|
||||
"layout": {
|
||||
"allowEditing": false
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-details-editor",
|
||||
|
@ -44,6 +44,9 @@
|
||||
"align": true,
|
||||
"spacing": {
|
||||
"margin": true
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-embed-editor",
|
||||
|
@ -38,6 +38,17 @@ function render_block_core_file( $attributes, $content ) {
|
||||
|
||||
// If it's interactive, enqueue the script module and add the directives.
|
||||
if ( ! empty( $attributes['displayPreview'] ) ) {
|
||||
$suffix = wp_scripts_get_suffix();
|
||||
if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
|
||||
$module_url = gutenberg_url( '/build/interactivity/file.min.js' );
|
||||
}
|
||||
|
||||
wp_register_script_module(
|
||||
'@wordpress/block-library/file',
|
||||
isset( $module_url ) ? $module_url : includes_url( "blocks/file/view{$suffix}.js" ),
|
||||
array( '@wordpress/interactivity' ),
|
||||
defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' )
|
||||
);
|
||||
wp_enqueue_script_module( '@wordpress/block-library/file' );
|
||||
|
||||
$processor = new WP_HTML_Tag_Processor( $content );
|
||||
@ -62,12 +73,5 @@ function register_block_core_file() {
|
||||
'render_callback' => 'render_block_core_file',
|
||||
)
|
||||
);
|
||||
|
||||
wp_register_script_module(
|
||||
'@wordpress/block-library/file',
|
||||
defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ? gutenberg_url( '/build/interactivity/file.min.js' ) : includes_url( 'blocks/file/view.min.js' ),
|
||||
array( '@wordpress/interactivity' ),
|
||||
defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' )
|
||||
);
|
||||
}
|
||||
add_action( 'init', 'register_block_core_file' );
|
||||
|
@ -55,6 +55,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"style": "wp-block-footnotes"
|
||||
|
@ -33,32 +33,18 @@ function block_core_gallery_data_id_backcompatibility( $parsed_block ) {
|
||||
add_filter( 'render_block_data', 'block_core_gallery_data_id_backcompatibility' );
|
||||
|
||||
/**
|
||||
* Filter to randomize the order of image blocks.
|
||||
*
|
||||
* @param array $parsed_block The block being rendered.
|
||||
* @return array The block object with randomized order of image blocks.
|
||||
*/
|
||||
function block_core_gallery_random_order( $parsed_block ) {
|
||||
if ( 'core/gallery' === $parsed_block['blockName'] && ! empty( $parsed_block['attrs']['randomOrder'] ) ) {
|
||||
shuffle( $parsed_block['innerBlocks'] );
|
||||
}
|
||||
return $parsed_block;
|
||||
}
|
||||
|
||||
add_filter( 'render_block_data', 'block_core_gallery_random_order' );
|
||||
|
||||
/**
|
||||
* Adds a style tag for the --wp--style--unstable-gallery-gap var.
|
||||
*
|
||||
* The Gallery block needs to recalculate Image block width based on
|
||||
* the current gap setting in order to maintain the number of flex columns
|
||||
* so a css var is added to allow this.
|
||||
* Renders the `core/gallery` block on the server.
|
||||
*
|
||||
* @param array $attributes Attributes of the block being rendered.
|
||||
* @param string $content Content of the block being rendered.
|
||||
* @return string The content of the block being rendered.
|
||||
*/
|
||||
function block_core_gallery_render( $attributes, $content ) {
|
||||
// Adds a style tag for the --wp--style--unstable-gallery-gap var.
|
||||
// The Gallery block needs to recalculate Image block width based on
|
||||
// the current gap setting in order to maintain the number of flex columns
|
||||
// so a css var is added to allow this.
|
||||
|
||||
$gap = $attributes['style']['spacing']['blockGap'] ?? null;
|
||||
// Skip if gap value contains unsupported characters.
|
||||
// Regex for CSS value borrowed from `safecss_filter_attr`, and used here
|
||||
@ -130,7 +116,51 @@ function block_core_gallery_render( $attributes, $content ) {
|
||||
'context' => 'block-supports',
|
||||
)
|
||||
);
|
||||
return (string) $processed_content;
|
||||
|
||||
// The WP_HTML_Tag_Processor class calls get_updated_html() internally
|
||||
// when the instance is treated as a string, but here we explicitly
|
||||
// convert it to a string.
|
||||
$updated_content = $processed_content->get_updated_html();
|
||||
|
||||
/*
|
||||
* Randomize the order of image blocks. Ideally we should shuffle
|
||||
* the `$parsed_block['innerBlocks']` via the `render_block_data` hook.
|
||||
* However, this hook doesn't apply inner block updates when blocks are
|
||||
* nested.
|
||||
* @todo: In the future, if this hook supports updating innerBlocks in
|
||||
* nested blocks, it should be refactored.
|
||||
*
|
||||
* @see: https://github.com/WordPress/gutenberg/pull/58733
|
||||
*/
|
||||
if ( empty( $attributes['randomOrder'] ) ) {
|
||||
return $updated_content;
|
||||
}
|
||||
|
||||
// This pattern matches figure elements with the `wp-block-image` class to
|
||||
// avoid the gallery's wrapping `figure` element and extract images only.
|
||||
$pattern = '/<figure[^>]*\bwp-block-image\b[^>]*>.*?<\/figure>/';
|
||||
|
||||
// Find all Image blocks.
|
||||
preg_match_all( $pattern, $updated_content, $matches );
|
||||
if ( ! $matches ) {
|
||||
return $updated_content;
|
||||
}
|
||||
$image_blocks = $matches[0];
|
||||
|
||||
// Randomize the order of Image blocks.
|
||||
shuffle( $image_blocks );
|
||||
$i = 0;
|
||||
$content = preg_replace_callback(
|
||||
$pattern,
|
||||
static function () use ( $image_blocks, &$i ) {
|
||||
$new_image_block = $image_blocks[ $i ];
|
||||
++$i;
|
||||
return $new_image_block;
|
||||
},
|
||||
$updated_content
|
||||
);
|
||||
|
||||
return $content;
|
||||
}
|
||||
/**
|
||||
* Registers the `core/gallery` block on server.
|
||||
|
@ -4,6 +4,7 @@
|
||||
"name": "core/gallery",
|
||||
"title": "Gallery",
|
||||
"category": "media",
|
||||
"allowedBlocks": [ "core/image" ],
|
||||
"description": "Display multiple images in a rich gallery.",
|
||||
"keywords": [ "images", "photos" ],
|
||||
"textdomain": "default",
|
||||
@ -136,6 +137,9 @@
|
||||
"default": {
|
||||
"type": "flex"
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-gallery-editor",
|
||||
|
@ -87,6 +87,9 @@
|
||||
},
|
||||
"layout": {
|
||||
"allowSizingOnChildren": true
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-group-editor",
|
||||
|
@ -61,7 +61,10 @@
|
||||
}
|
||||
},
|
||||
"__unstablePasteTextInline": true,
|
||||
"__experimentalSlashInserter": true
|
||||
"__experimentalSlashInserter": true,
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-heading-editor",
|
||||
"style": "wp-block-heading"
|
||||
|
@ -129,7 +129,10 @@ function block_core_home_link_build_li_wrapper_attributes( $context ) {
|
||||
*/
|
||||
function render_block_core_home_link( $attributes, $content, $block ) {
|
||||
if ( empty( $attributes['label'] ) ) {
|
||||
return '';
|
||||
// Using a fallback for the label attribute allows rendering the block even if no attributes have been set,
|
||||
// e.g. when using the block as a hooked block.
|
||||
// Note that the fallback value needs to be kept in sync with the one set in `edit.js` (upon first loading the block in the editor).
|
||||
$attributes['label'] = __( 'Home' );
|
||||
}
|
||||
$aria_current = '';
|
||||
|
||||
|
@ -36,6 +36,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-home-link-editor",
|
||||
|
@ -16,7 +16,10 @@
|
||||
"supports": {
|
||||
"customClassName": false,
|
||||
"className": false,
|
||||
"html": false
|
||||
"html": false,
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-html-editor"
|
||||
}
|
||||
|
@ -20,26 +20,26 @@ function render_block_core_image( $attributes, $content, $block ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$processor = new WP_HTML_Tag_Processor( $content );
|
||||
$p = new WP_HTML_Tag_Processor( $content );
|
||||
|
||||
if ( ! $processor->next_tag( 'img' ) || null === $processor->get_attribute( 'src' ) ) {
|
||||
if ( ! $p->next_tag( 'img' ) || null === $p->get_attribute( 'src' ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( isset( $attributes['data-id'] ) ) {
|
||||
// Add the data-id="$id" attribute to the img element
|
||||
// to provide backwards compatibility for the Gallery Block,
|
||||
// which now wraps Image Blocks within innerBlocks.
|
||||
// The data-id attribute is added in a core/gallery `render_block_data` hook.
|
||||
$processor->set_attribute( 'data-id', $attributes['data-id'] );
|
||||
// Adds the data-id="$id" attribute to the img element to provide backwards
|
||||
// compatibility for the Gallery Block, which now wraps Image Blocks within
|
||||
// innerBlocks. The data-id attribute is added in a core/gallery
|
||||
// `render_block_data` hook.
|
||||
$p->set_attribute( 'data-id', $attributes['data-id'] );
|
||||
}
|
||||
|
||||
$link_destination = isset( $attributes['linkDestination'] ) ? $attributes['linkDestination'] : 'none';
|
||||
$lightbox_settings = block_core_image_get_lightbox_settings( $block->parsed_block );
|
||||
|
||||
/*
|
||||
* If the lightbox is enabled and the image is not linked, add the filter
|
||||
* and the JavaScript view file.
|
||||
* If the lightbox is enabled and the image is not linked, adds the filter and
|
||||
* the JavaScript view file.
|
||||
*/
|
||||
if (
|
||||
isset( $lightbox_settings ) &&
|
||||
@ -47,15 +47,27 @@ function render_block_core_image( $attributes, $content, $block ) {
|
||||
isset( $lightbox_settings['enabled'] ) &&
|
||||
true === $lightbox_settings['enabled']
|
||||
) {
|
||||
$suffix = wp_scripts_get_suffix();
|
||||
if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
|
||||
$module_url = gutenberg_url( '/build/interactivity/image.min.js' );
|
||||
}
|
||||
|
||||
wp_register_script_module(
|
||||
'@wordpress/block-library/image',
|
||||
isset( $module_url ) ? $module_url : includes_url( "blocks/image/view{$suffix}.js" ),
|
||||
array( '@wordpress/interactivity' ),
|
||||
defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' )
|
||||
);
|
||||
|
||||
wp_enqueue_script_module( '@wordpress/block-library/image' );
|
||||
|
||||
/*
|
||||
* This render needs to happen in a filter with priority 15 to ensure that
|
||||
* it runs after the duotone filter and that duotone styles are applied to
|
||||
* the image in the lightbox. Lightbox has to work with any plugins that
|
||||
* might use filters as well. Removing this can be considered in the
|
||||
* future if the way the blocks are rendered changes, or if a
|
||||
* new kind of filter is introduced.
|
||||
* might use filters as well. Removing this can be considered in the future
|
||||
* if the way the blocks are rendered changes, or if a new kind of filter is
|
||||
* introduced.
|
||||
*/
|
||||
add_filter( 'render_block_core/image', 'block_core_image_render_lightbox', 15, 2 );
|
||||
} else {
|
||||
@ -65,7 +77,7 @@ function render_block_core_image( $attributes, $content, $block ) {
|
||||
remove_filter( 'render_block_core/image', 'block_core_image_render_lightbox', 15 );
|
||||
}
|
||||
|
||||
return $processor->get_updated_html();
|
||||
return $p->get_updated_html();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,7 +90,7 @@ function render_block_core_image( $attributes, $content, $block ) {
|
||||
* @return array Filtered block data.
|
||||
*/
|
||||
function block_core_image_get_lightbox_settings( $block ) {
|
||||
// Get the lightbox setting from the block attributes.
|
||||
// Gets the lightbox setting from the block attributes.
|
||||
if ( isset( $block['attrs']['lightbox'] ) ) {
|
||||
$lightbox_settings = $block['attrs']['lightbox'];
|
||||
}
|
||||
@ -89,9 +101,9 @@ function block_core_image_get_lightbox_settings( $block ) {
|
||||
// If not present in global settings, check the top-level global settings.
|
||||
//
|
||||
// NOTE: If no block-level settings are found, the previous call to
|
||||
// `wp_get_global_settings` will return the whole `theme.json`
|
||||
// structure in which case we can check if the "lightbox" key is present at
|
||||
// the top-level of the global settings and use its value.
|
||||
// `wp_get_global_settings` will return the whole `theme.json` structure in
|
||||
// which case we can check if the "lightbox" key is present at the top-level
|
||||
// of the global settings and use its value.
|
||||
if ( isset( $lightbox_settings['lightbox'] ) ) {
|
||||
$lightbox_settings = wp_get_global_settings( array( 'lightbox' ) );
|
||||
}
|
||||
@ -110,103 +122,76 @@ function block_core_image_get_lightbox_settings( $block ) {
|
||||
*/
|
||||
function block_core_image_render_lightbox( $block_content, $block ) {
|
||||
/*
|
||||
* If it's not possible that an IMG element exists then return the given
|
||||
* block content as-is. It may be that there's no actual image in the block
|
||||
* or it could be that another plugin already modified this HTML.
|
||||
* If there's no IMG tag in the block then return the given block content
|
||||
* as-is. There's nothing that this code can knowingly modify to add the
|
||||
* lightbox behavior.
|
||||
*/
|
||||
if ( false === stripos( $block_content, '<img' ) ) {
|
||||
$p = new WP_HTML_Tag_Processor( $block_content );
|
||||
if ( $p->next_tag( 'figure' ) ) {
|
||||
$p->set_bookmark( 'figure' );
|
||||
}
|
||||
if ( ! $p->next_tag( 'img' ) ) {
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
$processor = new WP_HTML_Tag_Processor( $block_content );
|
||||
$alt = $p->get_attribute( 'alt' );
|
||||
$img_uploaded_src = $p->get_attribute( 'src' );
|
||||
$img_class_names = $p->get_attribute( 'class' );
|
||||
$img_styles = $p->get_attribute( 'style' );
|
||||
$img_width = 'none';
|
||||
$img_height = 'none';
|
||||
$aria_label = __( 'Enlarge image' );
|
||||
|
||||
$aria_label = __( 'Enlarge image' );
|
||||
|
||||
/*
|
||||
* If there's definitely no IMG element in the block then return the given
|
||||
* block content as-is. There's nothing that this code can knowingly modify
|
||||
* to add the lightbox behavior.
|
||||
*/
|
||||
if ( ! $processor->next_tag( 'img' ) ) {
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
$alt_attribute = $processor->get_attribute( 'alt' );
|
||||
|
||||
// An empty alt attribute `alt=""` is valid for decorative images.
|
||||
if ( is_string( $alt_attribute ) ) {
|
||||
$alt_attribute = trim( $alt_attribute );
|
||||
}
|
||||
|
||||
// It only makes sense to append the alt text to the button aria-label when the alt text is non-empty.
|
||||
if ( $alt_attribute ) {
|
||||
if ( $alt ) {
|
||||
/* translators: %s: Image alt text. */
|
||||
$aria_label = sprintf( __( 'Enlarge image: %s' ), $alt_attribute );
|
||||
$aria_label = sprintf( __( 'Enlarge image: %s' ), $alt );
|
||||
}
|
||||
|
||||
// Currently, we are only enabling the zoom animation.
|
||||
$lightbox_animation = 'zoom';
|
||||
|
||||
// Note: We want to store the `src` in the context so we
|
||||
// can set it dynamically when the lightbox is opened.
|
||||
if ( isset( $block['attrs']['id'] ) ) {
|
||||
$img_uploaded_src = wp_get_attachment_url( $block['attrs']['id'] );
|
||||
$img_metadata = wp_get_attachment_metadata( $block['attrs']['id'] );
|
||||
$img_width = $img_metadata['width'] ?? 'none';
|
||||
$img_height = $img_metadata['height'] ?? 'none';
|
||||
} else {
|
||||
$img_uploaded_src = $processor->get_attribute( 'src' );
|
||||
$img_width = 'none';
|
||||
$img_height = 'none';
|
||||
}
|
||||
|
||||
if ( isset( $block['attrs']['scale'] ) ) {
|
||||
$scale_attr = $block['attrs']['scale'];
|
||||
} else {
|
||||
$scale_attr = false;
|
||||
}
|
||||
|
||||
$w = new WP_HTML_Tag_Processor( $block_content );
|
||||
$w->next_tag( 'figure' );
|
||||
$w->add_class( 'wp-lightbox-container' );
|
||||
$w->set_attribute( 'data-wp-interactive', '{"namespace":"core/image"}' );
|
||||
|
||||
$w->set_attribute(
|
||||
// Figure.
|
||||
$p->seek( 'figure' );
|
||||
$figure_class_names = $p->get_attribute( 'class' );
|
||||
$figure_styles = $p->get_attribute( 'style' );
|
||||
$p->add_class( 'wp-lightbox-container' );
|
||||
$p->set_attribute( 'data-wp-interactive', '{"namespace":"core/image"}' );
|
||||
$p->set_attribute(
|
||||
'data-wp-context',
|
||||
sprintf(
|
||||
'{ "imageLoaded": false,
|
||||
"initialized": false,
|
||||
"lightboxEnabled": false,
|
||||
"hideAnimationEnabled": false,
|
||||
"preloadInitialized": false,
|
||||
"lightboxAnimation": "%s",
|
||||
"imageUploadedSrc": "%s",
|
||||
"imageCurrentSrc": "",
|
||||
"targetWidth": "%s",
|
||||
"targetHeight": "%s",
|
||||
"scaleAttr": "%s",
|
||||
"dialogLabel": "%s"
|
||||
}',
|
||||
$lightbox_animation,
|
||||
$img_uploaded_src,
|
||||
$img_width,
|
||||
$img_height,
|
||||
$scale_attr,
|
||||
__( 'Enlarged image' )
|
||||
wp_json_encode(
|
||||
array(
|
||||
'uploadedSrc' => $img_uploaded_src,
|
||||
'figureClassNames' => $figure_class_names,
|
||||
'figureStyles' => $figure_styles,
|
||||
'imgClassNames' => $img_class_names,
|
||||
'imgStyles' => $img_styles,
|
||||
'targetWidth' => $img_width,
|
||||
'targetHeight' => $img_height,
|
||||
'scaleAttr' => $block['attrs']['scale'] ?? false,
|
||||
'ariaLabel' => $aria_label,
|
||||
'alt' => $alt,
|
||||
),
|
||||
JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP
|
||||
)
|
||||
);
|
||||
$w->next_tag( 'img' );
|
||||
$w->set_attribute( 'data-wp-init', 'callbacks.initOriginImage' );
|
||||
$w->set_attribute( 'data-wp-on--load', 'actions.handleLoad' );
|
||||
$w->set_attribute( 'data-wp-watch', 'callbacks.setButtonStyles' );
|
||||
// We need to set an event callback on the `img` specifically
|
||||
// because the `figure` element can also contain a caption, and
|
||||
// we don't want to trigger the lightbox when the caption is clicked.
|
||||
$w->set_attribute( 'data-wp-on--click', 'actions.showLightbox' );
|
||||
$w->set_attribute( 'data-wp-watch--setStylesOnResize', 'callbacks.setStylesOnResize' );
|
||||
$body_content = $w->get_updated_html();
|
||||
|
||||
// Add a button alongside image in the body content.
|
||||
// Image.
|
||||
$p->next_tag( 'img' );
|
||||
$p->set_attribute( 'data-wp-init', 'callbacks.setButtonStyles' );
|
||||
$p->set_attribute( 'data-wp-on--load', 'callbacks.setButtonStyles' );
|
||||
$p->set_attribute( 'data-wp-on-window--resize', 'callbacks.setButtonStyles' );
|
||||
// Sets an event callback on the `img` because the `figure` element can also
|
||||
// contain a caption, and we don't want to trigger the lightbox when the
|
||||
// caption is clicked.
|
||||
$p->set_attribute( 'data-wp-on--click', 'actions.showLightbox' );
|
||||
|
||||
$body_content = $p->get_updated_html();
|
||||
|
||||
// Adds a button alongside image in the body content.
|
||||
$img = null;
|
||||
preg_match( '/<img[^>]+>/', $body_content, $img );
|
||||
|
||||
@ -229,46 +214,17 @@ function block_core_image_render_lightbox( $block_content, $block ) {
|
||||
|
||||
$body_content = preg_replace( '/<img[^>]+>/', $button, $body_content );
|
||||
|
||||
// We need both a responsive image and an enlarged image to animate
|
||||
// the zoom seamlessly on slow internet connections; the responsive
|
||||
// image is a copy of the one in the body, which animates immediately
|
||||
// as the lightbox is opened, while the enlarged one is a full-sized
|
||||
// version that will likely still be loading as the animation begins.
|
||||
$m = new WP_HTML_Tag_Processor( $block_content );
|
||||
$m->next_tag( 'figure' );
|
||||
$m->add_class( 'responsive-image' );
|
||||
$m->next_tag( 'img' );
|
||||
// We want to set the 'src' attribute to an empty string in the responsive image
|
||||
// because otherwise, as of this writing, the wp_filter_content_tags() function in
|
||||
// WordPress will automatically add a 'srcset' attribute to the image, which will at
|
||||
// times cause the incorrectly sized image to be loaded in the lightbox on Firefox.
|
||||
// Because of this, we bind the 'src' attribute explicitly the current src to reliably
|
||||
// use the exact same image as in the content when the lightbox is first opened while
|
||||
// we wait for the larger image to load.
|
||||
$m->set_attribute( 'src', '' );
|
||||
$m->set_attribute( 'data-wp-bind--src', 'context.imageCurrentSrc' );
|
||||
$m->set_attribute( 'data-wp-style--object-fit', 'state.lightboxObjectFit' );
|
||||
$initial_image_content = $m->get_updated_html();
|
||||
add_action( 'wp_footer', 'block_core_image_print_lightbox_overlay' );
|
||||
|
||||
$q = new WP_HTML_Tag_Processor( $block_content );
|
||||
$q->next_tag( 'figure' );
|
||||
$q->add_class( 'enlarged-image' );
|
||||
$q->next_tag( 'img' );
|
||||
return $body_content;
|
||||
}
|
||||
|
||||
// We set the 'src' attribute to an empty string to prevent the browser from loading the image
|
||||
// on initial page load, then bind the attribute to a selector that returns the full-sized image src when
|
||||
// the lightbox is opened. We could use 'loading=lazy' in combination with the 'hidden' attribute to
|
||||
// accomplish the same behavior, but that approach breaks progressive loading of the image in Safari
|
||||
// and Chrome (see https://github.com/WordPress/gutenberg/pull/52765#issuecomment-1674008151). Until that
|
||||
// is resolved, manually setting the 'src' seems to be the best solution to load the large image on demand.
|
||||
$q->set_attribute( 'src', '' );
|
||||
$q->set_attribute( 'data-wp-bind--src', 'state.enlargedImgSrc' );
|
||||
$q->set_attribute( 'data-wp-style--object-fit', 'state.lightboxObjectFit' );
|
||||
$enlarged_image_content = $q->get_updated_html();
|
||||
function block_core_image_print_lightbox_overlay() {
|
||||
$close_button_label = esc_attr__( 'Close' );
|
||||
|
||||
// If the current theme does NOT have a `theme.json`, or the colors are not defined,
|
||||
// we need to set the background color & close button color to some default values
|
||||
// because we can't get them from the Global Styles.
|
||||
// If the current theme does NOT have a `theme.json`, or the colors are not
|
||||
// defined, it needs to set the background color & close button color to some
|
||||
// default values because it can't get them from the Global Styles.
|
||||
$background_color = '#fff';
|
||||
$close_button_color = '#000';
|
||||
if ( wp_theme_has_theme_json() ) {
|
||||
@ -281,35 +237,43 @@ function block_core_image_render_lightbox( $block_content, $block ) {
|
||||
}
|
||||
}
|
||||
|
||||
$close_button_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" focusable="false"><path d="M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"></path></svg>';
|
||||
$close_button_label = esc_attr__( 'Close' );
|
||||
|
||||
$lightbox_html = <<<HTML
|
||||
<div data-wp-body="" class="wp-lightbox-overlay $lightbox_animation"
|
||||
data-wp-bind--role="state.roleAttribute"
|
||||
data-wp-bind--aria-label="state.dialogLabel"
|
||||
data-wp-class--initialized="context.initialized"
|
||||
data-wp-class--active="context.lightboxEnabled"
|
||||
data-wp-class--hideAnimationEnabled="context.hideAnimationEnabled"
|
||||
data-wp-bind--aria-modal="state.ariaModal"
|
||||
data-wp-watch="callbacks.initLightbox"
|
||||
data-wp-on--keydown="actions.handleKeydown"
|
||||
data-wp-on--touchstart="actions.handleTouchStart"
|
||||
data-wp-on--touchmove="actions.handleTouchMove"
|
||||
data-wp-on--touchend="actions.handleTouchEnd"
|
||||
data-wp-on--click="actions.hideLightbox"
|
||||
tabindex="-1"
|
||||
>
|
||||
<button type="button" aria-label="$close_button_label" style="fill: $close_button_color" class="close-button" data-wp-on--click="actions.hideLightbox">
|
||||
$close_button_icon
|
||||
</button>
|
||||
<div class="lightbox-image-container">$initial_image_content</div>
|
||||
<div class="lightbox-image-container">$enlarged_image_content</div>
|
||||
<div class="scrim" style="background-color: $background_color" aria-hidden="true"></div>
|
||||
</div>
|
||||
echo <<<HTML
|
||||
<div
|
||||
class="wp-lightbox-overlay zoom"
|
||||
data-wp-interactive='{"namespace":"core/image"}'
|
||||
data-wp-context='{}'
|
||||
data-wp-bind--role="state.roleAttribute"
|
||||
data-wp-bind--aria-label="state.currentImage.ariaLabel"
|
||||
data-wp-bind--aria-modal="state.ariaModal"
|
||||
data-wp-class--active="state.overlayEnabled"
|
||||
data-wp-class--show-closing-animation="state.showClosingAnimation"
|
||||
data-wp-watch="callbacks.setOverlayFocus"
|
||||
data-wp-on--keydown="actions.handleKeydown"
|
||||
data-wp-on--touchstart="actions.handleTouchStart"
|
||||
data-wp-on--touchmove="actions.handleTouchMove"
|
||||
data-wp-on--touchend="actions.handleTouchEnd"
|
||||
data-wp-on--click="actions.hideLightbox"
|
||||
data-wp-on-window--resize="callbacks.setOverlayStyles"
|
||||
data-wp-on-window--scroll="actions.handleScroll"
|
||||
tabindex="-1"
|
||||
>
|
||||
<button type="button" aria-label="$close_button_label" style="fill: $close_button_color" class="close-button">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" focusable="false"><path d="M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"></path></svg>
|
||||
</button>
|
||||
<div class="lightbox-image-container">
|
||||
<figure data-wp-bind--class="state.currentImage.figureClassNames" data-wp-bind--style="state.currentImage.figureStyles">
|
||||
<img data-wp-bind--alt="state.currentImage.alt" data-wp-bind--class="state.currentImage.imgClassNames" data-wp-bind--style="state.imgStyles" data-wp-bind--src="state.currentImage.currentSrc">
|
||||
</figure>
|
||||
</div>
|
||||
<div class="lightbox-image-container">
|
||||
<figure data-wp-bind--class="state.currentImage.figureClassNames" data-wp-bind--style="state.currentImage.figureStyles">
|
||||
<img data-wp-bind--alt="state.currentImage.alt" data-wp-bind--class="state.currentImage.imgClassNames" data-wp-bind--style="state.imgStyles" data-wp-bind--src="state.enlargedSrc">
|
||||
</figure>
|
||||
</div>
|
||||
<div class="scrim" style="background-color: $background_color" aria-hidden="true"></div>
|
||||
<style data-wp-text="state.overlayStyles"></style>
|
||||
</div>
|
||||
HTML;
|
||||
|
||||
return str_replace( '</figure>', $lightbox_html . '</figure>', $body_content );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -322,12 +286,5 @@ function register_block_core_image() {
|
||||
'render_callback' => 'render_block_core_image',
|
||||
)
|
||||
);
|
||||
|
||||
wp_register_script_module(
|
||||
'@wordpress/block-library/image',
|
||||
defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ? gutenberg_url( '/build/interactivity/image.min.js' ) : includes_url( 'blocks/image/view.min.js' ),
|
||||
array( '@wordpress/interactivity' ),
|
||||
defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' )
|
||||
);
|
||||
}
|
||||
add_action( 'init', 'register_block_core_image' );
|
||||
|
@ -117,10 +117,14 @@
|
||||
"radius": true,
|
||||
"width": true
|
||||
}
|
||||
},
|
||||
"shadow": {
|
||||
"__experimentalSkipSerialization": true
|
||||
}
|
||||
},
|
||||
"selectors": {
|
||||
"border": ".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder",
|
||||
"shadow": ".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder",
|
||||
"filter": {
|
||||
"duotone": ".wp-block-image img, .wp-block-image .components-placeholder"
|
||||
}
|
||||
|
@ -46,6 +46,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-latest-comments-editor",
|
||||
|
@ -110,6 +110,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-latest-posts-editor",
|
||||
|
@ -5,6 +5,7 @@
|
||||
"title": "List item",
|
||||
"category": "text",
|
||||
"parent": [ "core/list" ],
|
||||
"allowedBlocks": [ "core/list" ],
|
||||
"description": "Create a list item.",
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
@ -41,6 +42,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
"name": "core/list",
|
||||
"title": "List",
|
||||
"category": "text",
|
||||
"allowedBlocks": [ "core/list-item" ],
|
||||
"description": "Create a bulleted or numbered list.",
|
||||
"keywords": [ "bullet list", "ordered list", "numbered list" ],
|
||||
"textdomain": "default",
|
||||
@ -70,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"
|
||||
|
@ -39,6 +39,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,6 +123,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-media-text-editor",
|
||||
|
@ -23,6 +23,9 @@
|
||||
"customClassName": false,
|
||||
"inserter": false,
|
||||
"html": false,
|
||||
"reusable": false
|
||||
"reusable": false,
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,10 @@
|
||||
"customClassName": false,
|
||||
"className": false,
|
||||
"html": false,
|
||||
"multiple": false
|
||||
"multiple": false,
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-more-editor"
|
||||
}
|
||||
|
@ -132,6 +132,10 @@ function block_core_navigation_link_maybe_urldecode( $url ) {
|
||||
$query_params = wp_parse_args( $query );
|
||||
|
||||
foreach ( $query_params as $query_param ) {
|
||||
$can_query_param_be_encoded = is_string( $query_param ) && ! empty( $query_param );
|
||||
if ( ! $can_query_param_be_encoded ) {
|
||||
continue;
|
||||
}
|
||||
if ( rawurldecode( $query_param ) !== $query_param ) {
|
||||
$is_url_encoded = true;
|
||||
break;
|
||||
@ -323,70 +327,40 @@ function build_variation_for_navigation_link( $entity, $kind ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a variation for a post type / taxonomy for the navigation link block.
|
||||
* Filters the registered variations for a block type.
|
||||
* Returns the dynamically built variations for all post-types and taxonomies.
|
||||
*
|
||||
* @param array $variation Variation array from build_variation_for_navigation_link.
|
||||
* @return void
|
||||
* @since 6.5.0
|
||||
*
|
||||
* @param array $variations Array of registered variations for a block type.
|
||||
* @param WP_Block_Type $block_type The full block type object.
|
||||
*/
|
||||
function block_core_navigation_link_register_variation( $variation ) {
|
||||
// Directly set the variations on the registered block type
|
||||
// because there's no server side registration for variations (see #47170).
|
||||
$navigation_block_type = WP_Block_Type_Registry::get_instance()->get_registered( 'core/navigation-link' );
|
||||
// If the block is not registered yet, bail early.
|
||||
// Variation will be registered in register_block_core_navigation_link then.
|
||||
if ( ! $navigation_block_type ) {
|
||||
return;
|
||||
function block_core_navigation_link_filter_variations( $variations, $block_type ) {
|
||||
if ( 'core/navigation-link' !== $block_type->name ) {
|
||||
return $variations;
|
||||
}
|
||||
|
||||
$navigation_block_type->variations = array_merge(
|
||||
$navigation_block_type->variations,
|
||||
array( $variation )
|
||||
);
|
||||
$generated_variations = block_core_navigation_link_build_variations();
|
||||
return array_merge( $variations, $generated_variations );
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister a variation for a post type / taxonomy for the navigation link block.
|
||||
*
|
||||
* @param string $name Name of the post type / taxonomy (which was used as variation name).
|
||||
* @return void
|
||||
*/
|
||||
function block_core_navigation_link_unregister_variation( $name ) {
|
||||
// Directly get the variations from the registered block type
|
||||
// because there's no server side (un)registration for variations (see #47170).
|
||||
$navigation_block_type = WP_Block_Type_Registry::get_instance()->get_registered( 'core/navigation-link' );
|
||||
// If the block is not registered (yet), there's no need to remove a variation.
|
||||
if ( ! $navigation_block_type || empty( $navigation_block_type->variations ) ) {
|
||||
return;
|
||||
}
|
||||
$variations = $navigation_block_type->variations;
|
||||
// Search for the variation and remove it from the array.
|
||||
foreach ( $variations as $i => $variation ) {
|
||||
if ( $variation['name'] === $name ) {
|
||||
unset( $variations[ $i ] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Reindex array after removing one variation.
|
||||
$navigation_block_type->variations = array_values( $variations );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the navigation link block.
|
||||
* Returns an array of variations for the navigation link block.
|
||||
*
|
||||
* @since 6.5.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function build_navigation_link_block_variations() {
|
||||
// This will only handle post types and taxonomies registered until this point (init on priority 9).
|
||||
// See action hooks below for other post types and taxonomies.
|
||||
// See https://github.com/WordPress/gutenberg/issues/53826 for details.
|
||||
function block_core_navigation_link_build_variations() {
|
||||
$post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'objects' );
|
||||
$taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'objects' );
|
||||
|
||||
// Use two separate arrays as a way to order the variations in the UI.
|
||||
// Known variations (like Post Link and Page Link) are added to the
|
||||
// `built_ins` array. Variations for custom post types and taxonomies are
|
||||
// added to the `variations` array and will always appear after `built-ins.
|
||||
/*
|
||||
* Use two separate arrays as a way to order the variations in the UI.
|
||||
* Known variations (like Post Link and Page Link) are added to the
|
||||
* `built_ins` array. Variations for custom post types and taxonomies are
|
||||
* added to the `variations` array and will always appear after `built-ins.
|
||||
*/
|
||||
$built_ins = array();
|
||||
$variations = array();
|
||||
|
||||
@ -415,76 +389,23 @@ function build_navigation_link_block_variations() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the navigation link block.
|
||||
* Registers the navigation link block.
|
||||
*
|
||||
* @uses render_block_core_navigation()
|
||||
* @uses render_block_core_navigation_link()
|
||||
* @uses build_navigation_link_block_variations()
|
||||
* @throws WP_Error An WP_Error exception parsing the block definition.
|
||||
*/
|
||||
function register_block_core_navigation_link() {
|
||||
register_block_type_from_metadata(
|
||||
__DIR__ . '/navigation-link',
|
||||
array(
|
||||
'render_callback' => 'render_block_core_navigation_link',
|
||||
'variation_callback' => 'build_navigation_link_block_variations',
|
||||
'render_callback' => 'render_block_core_navigation_link',
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'init', 'register_block_core_navigation_link' );
|
||||
// Register actions for all post types and taxonomies, to add variations when they are registered.
|
||||
// All post types/taxonomies registered before register_block_core_navigation_link, will be handled by that function.
|
||||
add_action( 'registered_post_type', 'block_core_navigation_link_register_post_type_variation', 10, 2 );
|
||||
add_action( 'registered_taxonomy', 'block_core_navigation_link_register_taxonomy_variation', 10, 3 );
|
||||
// Handle unregistering of post types and taxonomies and remove the variations.
|
||||
add_action( 'unregistered_post_type', 'block_core_navigation_link_unregister_post_type_variation' );
|
||||
add_action( 'unregistered_taxonomy', 'block_core_navigation_link_unregister_taxonomy_variation' );
|
||||
|
||||
/**
|
||||
* Register custom post type variations for navigation link on post type registration
|
||||
* Handles all post types registered after the block is registered in register_navigation_link_post_type_variations
|
||||
*
|
||||
* @param string $post_type The post type name passed from registered_post_type action hook.
|
||||
* @param WP_Post_Type $post_type_object The post type object passed from registered_post_type.
|
||||
* @return void
|
||||
* Creates all variations for post types / taxonomies dynamically (= each time when variations are requested).
|
||||
* Do not use variation_callback, to also account for unregistering post types/taxonomies later on.
|
||||
*/
|
||||
function block_core_navigation_link_register_post_type_variation( $post_type, $post_type_object ) {
|
||||
if ( $post_type_object->show_in_nav_menus ) {
|
||||
$variation = build_variation_for_navigation_link( $post_type_object, 'post-type' );
|
||||
block_core_navigation_link_register_variation( $variation );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a custom taxonomy variation for navigation link on taxonomy registration
|
||||
* Handles all taxonomies registered after the block is registered in register_navigation_link_post_type_variations
|
||||
*
|
||||
* @param string $taxonomy Taxonomy slug.
|
||||
* @param array|string $object_type Object type or array of object types.
|
||||
* @param array $args Array of taxonomy registration arguments.
|
||||
* @return void
|
||||
*/
|
||||
function block_core_navigation_link_register_taxonomy_variation( $taxonomy, $object_type, $args ) {
|
||||
if ( isset( $args['show_in_nav_menus'] ) && $args['show_in_nav_menus'] ) {
|
||||
$variation = build_variation_for_navigation_link( (object) $args, 'post-type' );
|
||||
block_core_navigation_link_register_variation( $variation );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters a custom post type variation for navigation link on post type unregistration.
|
||||
*
|
||||
* @param string $post_type The post type name passed from unregistered_post_type action hook.
|
||||
* @return void
|
||||
*/
|
||||
function block_core_navigation_link_unregister_post_type_variation( $post_type ) {
|
||||
block_core_navigation_link_unregister_variation( $post_type );
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters a custom taxonomy variation for navigation link on taxonomy unregistration.
|
||||
*
|
||||
* @param string $taxonomy The taxonomy name passed from unregistered_taxonomy action hook.
|
||||
* @return void
|
||||
*/
|
||||
function block_core_navigation_link_unregister_taxonomy_variation( $taxonomy ) {
|
||||
block_core_navigation_link_unregister_variation( $taxonomy );
|
||||
}
|
||||
add_action( 'get_block_type_variations', 'block_core_navigation_link_filter_variations', 10, 2 );
|
||||
|
@ -5,6 +5,11 @@
|
||||
"title": "Custom Link",
|
||||
"category": "design",
|
||||
"parent": [ "core/navigation" ],
|
||||
"allowedBlocks": [
|
||||
"core/navigation-link",
|
||||
"core/navigation-submenu",
|
||||
"core/page-list"
|
||||
],
|
||||
"description": "Add a page, link, or another item to your navigation.",
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
@ -72,7 +77,10 @@
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"renaming": false
|
||||
"renaming": false,
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-navigation-link-editor",
|
||||
"style": "wp-block-navigation-link"
|
||||
|
@ -58,7 +58,10 @@
|
||||
],
|
||||
"supports": {
|
||||
"reusable": false,
|
||||
"html": false
|
||||
"html": false,
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-navigation-submenu-editor",
|
||||
"style": "wp-block-navigation-submenu"
|
||||
|
@ -9,18 +9,11 @@
|
||||
* Helper functions used to render the navigation block.
|
||||
*/
|
||||
class WP_Navigation_Block_Renderer {
|
||||
|
||||
/**
|
||||
* Used to determine which blocks are wrapped in an <li>.
|
||||
*
|
||||
* @var array
|
||||
* Used to determine whether or not a navigation has submenus.
|
||||
*/
|
||||
private static $nav_blocks_wrapped_in_list_item = array(
|
||||
'core/navigation-link',
|
||||
'core/home-link',
|
||||
'core/site-title',
|
||||
'core/site-logo',
|
||||
'core/navigation-submenu',
|
||||
);
|
||||
private static $has_submenus = false;
|
||||
|
||||
/**
|
||||
* Used to determine which blocks need an <li> wrapper.
|
||||
@ -58,22 +51,37 @@ class WP_Navigation_Block_Renderer {
|
||||
* Returns whether or not a navigation has a submenu.
|
||||
*
|
||||
* @param WP_Block_List $inner_blocks The list of inner blocks.
|
||||
* @return bool Returns whether or not a navigation has a submenu.
|
||||
* @return bool Returns whether or not a navigation has a submenu and also sets the member variable.
|
||||
*/
|
||||
private static function has_submenus( $inner_blocks ) {
|
||||
if ( true === static::$has_submenus ) {
|
||||
return static::$has_submenus;
|
||||
}
|
||||
|
||||
foreach ( $inner_blocks as $inner_block ) {
|
||||
$inner_block_content = $inner_block->render();
|
||||
$p = new WP_HTML_Tag_Processor( $inner_block_content );
|
||||
if ( $p->next_tag(
|
||||
array(
|
||||
'name' => 'LI',
|
||||
'class_name' => 'has-child',
|
||||
)
|
||||
) ) {
|
||||
return true;
|
||||
// If this is a page list then work out if any of the pages have children.
|
||||
if ( 'core/page-list' === $inner_block->name ) {
|
||||
$all_pages = get_pages(
|
||||
array(
|
||||
'sort_column' => 'menu_order,post_title',
|
||||
'order' => 'asc',
|
||||
)
|
||||
);
|
||||
foreach ( (array) $all_pages as $page ) {
|
||||
if ( $page->post_parent ) {
|
||||
static::$has_submenus = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If this is a navigation submenu then we know we have submenus.
|
||||
if ( 'core/navigation-submenu' === $inner_block->name ) {
|
||||
static::$has_submenus = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
return static::$has_submenus;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -96,7 +104,23 @@ class WP_Navigation_Block_Renderer {
|
||||
* @return bool Returns whether or not a block needs a list item wrapper.
|
||||
*/
|
||||
private static function does_block_need_a_list_item_wrapper( $block ) {
|
||||
return in_array( $block->name, static::$needs_list_item_wrapper, true );
|
||||
|
||||
/**
|
||||
* Filter the list of blocks that need a list item wrapper.
|
||||
*
|
||||
* Affords the ability to customize which blocks need a list item wrapper when rendered
|
||||
* within a core/navigation block.
|
||||
* This is useful for blocks that are not list items but should be wrapped in a list
|
||||
* item when used as a child of a navigation block.
|
||||
*
|
||||
* @since 6.5.0
|
||||
*
|
||||
* @param array $needs_list_item_wrapper The list of blocks that need a list item wrapper.
|
||||
* @return array The list of blocks that need a list item wrapper.
|
||||
*/
|
||||
$needs_list_item_wrapper = apply_filters( 'block_core_navigation_listable_blocks', static::$needs_list_item_wrapper );
|
||||
|
||||
return in_array( $block->name, $needs_list_item_wrapper, true );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -140,7 +164,9 @@ class WP_Navigation_Block_Renderer {
|
||||
$is_list_open = false;
|
||||
|
||||
foreach ( $inner_blocks as $inner_block ) {
|
||||
$is_list_item = in_array( $inner_block->name, static::$nav_blocks_wrapped_in_list_item, true );
|
||||
$inner_block_markup = static::get_markup_for_inner_block( $inner_block );
|
||||
$p = new WP_HTML_Tag_Processor( $inner_block_markup );
|
||||
$is_list_item = $p->next_tag( 'LI' );
|
||||
|
||||
if ( $is_list_item && ! $is_list_open ) {
|
||||
$is_list_open = true;
|
||||
@ -155,7 +181,7 @@ class WP_Navigation_Block_Renderer {
|
||||
$inner_blocks_html .= '</ul>';
|
||||
}
|
||||
|
||||
$inner_blocks_html .= static::get_markup_for_inner_block( $inner_block );
|
||||
$inner_blocks_html .= $inner_block_markup;
|
||||
}
|
||||
|
||||
if ( $is_list_open ) {
|
||||
@ -567,6 +593,17 @@ class WP_Navigation_Block_Renderer {
|
||||
*/
|
||||
private static function handle_view_script_module_loading( $attributes, $block, $inner_blocks ) {
|
||||
if ( static::is_interactive( $attributes, $inner_blocks ) ) {
|
||||
$suffix = wp_scripts_get_suffix();
|
||||
if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
|
||||
$module_url = gutenberg_url( '/build/interactivity/navigation.min.js' );
|
||||
}
|
||||
|
||||
wp_register_script_module(
|
||||
'@wordpress/block-library/navigation',
|
||||
isset( $module_url ) ? $module_url : includes_url( "blocks/navigation/view{$suffix}.js" ),
|
||||
array( '@wordpress/interactivity' ),
|
||||
defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' )
|
||||
);
|
||||
wp_enqueue_script_module( '@wordpress/block-library/navigation' );
|
||||
}
|
||||
}
|
||||
@ -968,7 +1005,9 @@ function block_core_navigation_block_contains_core_navigation( $inner_blocks ) {
|
||||
function block_core_navigation_get_fallback_blocks() {
|
||||
$page_list_fallback = array(
|
||||
array(
|
||||
'blockName' => 'core/page-list',
|
||||
'blockName' => 'core/page-list',
|
||||
'innerContent' => array(),
|
||||
'attrs' => array(),
|
||||
),
|
||||
);
|
||||
|
||||
@ -976,12 +1015,7 @@ function block_core_navigation_get_fallback_blocks() {
|
||||
|
||||
// If `core/page-list` is not registered then return empty blocks.
|
||||
$fallback_blocks = $registry->is_registered( 'core/page-list' ) ? $page_list_fallback : array();
|
||||
|
||||
if ( class_exists( 'WP_Navigation_Fallback' ) ) {
|
||||
$navigation_post = WP_Navigation_Fallback::get_fallback();
|
||||
} else {
|
||||
$navigation_post = Gutenberg_Navigation_Fallback::get_fallback();
|
||||
}
|
||||
$navigation_post = WP_Navigation_Fallback::get_fallback();
|
||||
|
||||
// Use the first non-empty Navigation as fallback if available.
|
||||
if ( $navigation_post ) {
|
||||
@ -1079,13 +1113,6 @@ function register_block_core_navigation() {
|
||||
'render_callback' => 'render_block_core_navigation',
|
||||
)
|
||||
);
|
||||
|
||||
wp_register_script_module(
|
||||
'@wordpress/block-library/navigation',
|
||||
defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ? gutenberg_url( '/build/interactivity/navigation.min.js' ) : includes_url( 'blocks/navigation/view.min.js' ),
|
||||
array( '@wordpress/interactivity' ),
|
||||
defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' )
|
||||
);
|
||||
}
|
||||
|
||||
add_action( 'init', 'register_block_core_navigation' );
|
||||
@ -1418,9 +1445,14 @@ function block_core_navigation_update_ignore_hooked_blocks_meta( $post ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Before adding our filter, we verify if it's already added in Core.
|
||||
// However, during the build process, Gutenberg automatically prefixes our functions with "gutenberg_".
|
||||
// Therefore, we concatenate the Core's function name to circumvent this prefix for our check.
|
||||
$rest_insert_wp_navigation_core_callback = 'block_core_navigation_' . 'update_ignore_hooked_blocks_meta';
|
||||
|
||||
// Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5
|
||||
// that are not present in Gutenberg's WP 6.5 compatibility layer.
|
||||
if ( function_exists( 'get_hooked_block_markup' ) ) {
|
||||
if ( function_exists( 'get_hooked_block_markup' ) && ! has_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_callback ) ) {
|
||||
add_action( 'rest_insert_wp_navigation', 'block_core_navigation_update_ignore_hooked_blocks_meta', 10, 3 );
|
||||
}
|
||||
|
||||
@ -1450,8 +1482,13 @@ function block_core_navigation_insert_hooked_blocks_into_rest_response( $respons
|
||||
return $response;
|
||||
}
|
||||
|
||||
// Before adding our filter, we verify if it's already added in Core.
|
||||
// However, during the build process, Gutenberg automatically prefixes our functions with "gutenberg_".
|
||||
// Therefore, we concatenate the Core's function name to circumvent this prefix for our check.
|
||||
$rest_prepare_wp_navigation_core_callback = 'block_core_navigation_' . 'insert_hooked_blocks_into_rest_response';
|
||||
|
||||
// Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5
|
||||
// that are not present in Gutenberg's WP 6.5 compatibility layer.
|
||||
if ( function_exists( 'get_hooked_block_markup' ) ) {
|
||||
if ( function_exists( 'get_hooked_block_markup' ) && ! has_filter( 'rest_prepare_wp_navigation', $rest_prepare_wp_navigation_core_callback ) ) {
|
||||
add_filter( 'rest_prepare_wp_navigation', 'block_core_navigation_insert_hooked_blocks_into_rest_response', 10, 3 );
|
||||
}
|
||||
|
@ -4,6 +4,19 @@
|
||||
"name": "core/navigation",
|
||||
"title": "Navigation",
|
||||
"category": "theme",
|
||||
"allowedBlocks": [
|
||||
"core/navigation-link",
|
||||
"core/search",
|
||||
"core/social-links",
|
||||
"core/page-list",
|
||||
"core/spacer",
|
||||
"core/home-link",
|
||||
"core/site-title",
|
||||
"core/site-logo",
|
||||
"core/navigation-submenu",
|
||||
"core/loginout",
|
||||
"core/buttons"
|
||||
],
|
||||
"description": "A collection of blocks that allow visitors to get around your site.",
|
||||
"keywords": [ "menu", "navigation", "links" ],
|
||||
"textdomain": "default",
|
||||
|
@ -11,7 +11,10 @@
|
||||
"supports": {
|
||||
"customClassName": false,
|
||||
"className": false,
|
||||
"html": false
|
||||
"html": false,
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-nextpage-editor"
|
||||
}
|
||||
|
@ -45,7 +45,10 @@
|
||||
"html": false,
|
||||
"lock": false,
|
||||
"inserter": false,
|
||||
"__experimentalToolbar": false
|
||||
"__experimentalToolbar": false,
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-page-list-editor",
|
||||
"style": "wp-block-page-list"
|
||||
|
@ -4,6 +4,7 @@
|
||||
"name": "core/page-list",
|
||||
"title": "Page List",
|
||||
"category": "widgets",
|
||||
"allowedBlocks": [ "core/page-list-item" ],
|
||||
"description": "Display a list of all pages.",
|
||||
"keywords": [ "menu", "navigation" ],
|
||||
"textdomain": "default",
|
||||
@ -47,6 +48,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-page-list-editor",
|
||||
|
@ -64,7 +64,10 @@
|
||||
}
|
||||
},
|
||||
"__experimentalSelector": "p",
|
||||
"__unstablePasteTextInline": true
|
||||
"__unstablePasteTextInline": true,
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-paragraph-editor",
|
||||
"style": "wp-block-paragraph"
|
||||
|
@ -8,7 +8,10 @@
|
||||
"supports": {
|
||||
"html": false,
|
||||
"inserter": false,
|
||||
"renaming": false
|
||||
"renaming": false,
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
|
@ -37,6 +37,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,9 @@
|
||||
"background": true,
|
||||
"text": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"style": "wp-block-post-author"
|
||||
|
@ -50,6 +50,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-post-excerpt-editor",
|
||||
|
@ -81,6 +81,9 @@
|
||||
"spacing": {
|
||||
"margin": true,
|
||||
"padding": true
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-post-featured-image-editor",
|
||||
|
@ -99,9 +99,6 @@ function render_block_core_post_navigation_link( $attributes, $content ) {
|
||||
}
|
||||
}
|
||||
|
||||
$in_same_term = isset( $attributes['inSameTerm'] ) ? $attributes['inSameTerm'] : false;
|
||||
$taxonomy = isset( $attributes['taxonomy'] ) && $in_same_term ? $attributes['taxonomy'] : '';
|
||||
|
||||
/*
|
||||
* The dynamic portion of the function name, `$navigation_type`,
|
||||
* Refers to the type of adjacency, 'next' or 'previous'.
|
||||
@ -111,8 +108,8 @@ function render_block_core_post_navigation_link( $attributes, $content ) {
|
||||
*/
|
||||
$get_link_function = "get_{$navigation_type}_post_link";
|
||||
|
||||
if ( $in_same_term ) {
|
||||
$content = $get_link_function( $format, $link, $in_same_term, '', $taxonomy );
|
||||
if ( ! empty( $attributes['taxonomy'] ) ) {
|
||||
$content = $get_link_function( $format, $link, true, '', $attributes['taxonomy'] );
|
||||
} else {
|
||||
$content = $get_link_function( $format, $link );
|
||||
}
|
||||
|
@ -29,9 +29,6 @@
|
||||
"type": "string",
|
||||
"default": "none"
|
||||
},
|
||||
"inSameTerm": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"taxonomy": {
|
||||
"type": "string",
|
||||
"default": ""
|
||||
@ -57,6 +54,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"style": "wp-block-post-navigation-link"
|
||||
|
@ -48,6 +48,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"blockGap": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"style": "wp-block-post-template",
|
||||
|
@ -63,7 +63,7 @@ function render_block_core_post_terms( $attributes, $content, $block ) {
|
||||
*
|
||||
* @return array The available variations for the block.
|
||||
*/
|
||||
function build_post_term_block_variations() {
|
||||
function block_core_post_terms_build_variations() {
|
||||
$taxonomies = get_taxonomies(
|
||||
array(
|
||||
'publicly_queryable' => true,
|
||||
@ -116,7 +116,7 @@ function register_block_core_post_terms() {
|
||||
__DIR__ . '/post-terms',
|
||||
array(
|
||||
'render_callback' => 'render_block_core_post_terms',
|
||||
'variation_callback' => 'build_post_term_block_variations',
|
||||
'variation_callback' => 'block_core_post_terms_build_variations',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -54,6 +54,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"style": "wp-block-post-terms"
|
||||
|
@ -57,6 +57,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"style": "wp-block-post-title"
|
||||
|
@ -40,6 +40,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"style": "wp-block-preformatted"
|
||||
|
@ -69,6 +69,9 @@
|
||||
"fontSize": "1.5em",
|
||||
"lineHeight": "1.6"
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-pullquote-editor",
|
||||
|
@ -28,6 +28,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-query-pagination-numbers-editor"
|
||||
|
@ -41,6 +41,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,12 @@
|
||||
"name": "core/query-pagination",
|
||||
"title": "Pagination",
|
||||
"category": "theme",
|
||||
"parent": [ "core/query" ],
|
||||
"ancestor": [ "core/query" ],
|
||||
"allowedBlocks": [
|
||||
"core/query-pagination-previous",
|
||||
"core/query-pagination-numbers",
|
||||
"core/query-pagination-next"
|
||||
],
|
||||
"description": "Displays a paginated navigation to next/previous set of posts, when applicable.",
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
@ -54,6 +59,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-query-pagination-editor",
|
||||
|
@ -52,6 +52,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"style": "wp-block-query-title"
|
||||
|
@ -17,11 +17,33 @@
|
||||
* @return string Returns the modified output of the query block.
|
||||
*/
|
||||
function render_block_core_query( $attributes, $content, $block ) {
|
||||
$is_interactive = isset( $attributes['enhancedPagination'] ) && true === $attributes['enhancedPagination'] && isset( $attributes['queryId'] );
|
||||
$is_interactive = isset( $attributes['enhancedPagination'] )
|
||||
&& true === $attributes['enhancedPagination']
|
||||
&& isset( $attributes['queryId'] );
|
||||
|
||||
// Enqueue the script module and add the necessary directives if the block is
|
||||
// interactive.
|
||||
if ( $is_interactive ) {
|
||||
$suffix = wp_scripts_get_suffix();
|
||||
if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
|
||||
$module_url = gutenberg_url( '/build/interactivity/query.min.js' );
|
||||
}
|
||||
|
||||
wp_register_script_module(
|
||||
'@wordpress/block-library/query',
|
||||
isset( $module_url ) ? $module_url : includes_url( "blocks/query/view{$suffix}.js" ),
|
||||
array(
|
||||
array(
|
||||
'id' => '@wordpress/interactivity',
|
||||
'import' => 'static',
|
||||
),
|
||||
array(
|
||||
'id' => '@wordpress/interactivity-router',
|
||||
'import' => 'dynamic',
|
||||
),
|
||||
),
|
||||
defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' )
|
||||
);
|
||||
wp_enqueue_script_module( '@wordpress/block-library/query' );
|
||||
|
||||
$p = new WP_HTML_Tag_Processor( $content );
|
||||
@ -30,43 +52,8 @@ function render_block_core_query( $attributes, $content, $block ) {
|
||||
$p->set_attribute( 'data-wp-interactive', '{"namespace":"core/query"}' );
|
||||
$p->set_attribute( 'data-wp-router-region', 'query-' . $attributes['queryId'] );
|
||||
$p->set_attribute( 'data-wp-init', 'callbacks.setQueryRef' );
|
||||
// Use context to send translated strings.
|
||||
$p->set_attribute(
|
||||
'data-wp-context',
|
||||
wp_json_encode(
|
||||
array(
|
||||
'loadingText' => __( 'Loading page, please wait.' ),
|
||||
'loadedText' => __( 'Page Loaded.' ),
|
||||
),
|
||||
JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP
|
||||
)
|
||||
);
|
||||
$p->set_attribute( 'data-wp-context', '{}' );
|
||||
$content = $p->get_updated_html();
|
||||
|
||||
// Mark the block as interactive.
|
||||
$block->block_type->supports['interactivity'] = true;
|
||||
|
||||
// Add a div to announce messages using `aria-live`.
|
||||
$html_tag = 'div';
|
||||
if ( ! empty( $attributes['tagName'] ) ) {
|
||||
$html_tag = esc_attr( $attributes['tagName'] );
|
||||
}
|
||||
$last_tag_position = strripos( $content, '</' . $html_tag . '>' );
|
||||
$content = substr_replace(
|
||||
$content,
|
||||
'<div
|
||||
class="screen-reader-text"
|
||||
aria-live="polite"
|
||||
data-wp-text="context.message"
|
||||
></div>
|
||||
<div
|
||||
class="wp-block-query__enhanced-pagination-animation"
|
||||
data-wp-class--start-animation="state.startAnimation"
|
||||
data-wp-class--finish-animation="state.finishAnimation"
|
||||
></div>',
|
||||
$last_tag_position,
|
||||
0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,22 +85,6 @@ function register_block_core_query() {
|
||||
'render_callback' => 'render_block_core_query',
|
||||
)
|
||||
);
|
||||
|
||||
wp_register_script_module(
|
||||
'@wordpress/block-library/query',
|
||||
defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ? gutenberg_url( '/build/interactivity/query.min.js' ) : includes_url( 'blocks/query/view.min.js' ),
|
||||
array(
|
||||
array(
|
||||
'id' => '@wordpress/interactivity',
|
||||
'import' => 'static',
|
||||
),
|
||||
array(
|
||||
'id' => '@wordpress/interactivity-router',
|
||||
'import' => 'dynamic',
|
||||
),
|
||||
),
|
||||
defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' )
|
||||
);
|
||||
}
|
||||
add_action( 'init', 'register_block_core_query' );
|
||||
|
||||
@ -133,10 +104,18 @@ function block_core_query_disable_enhanced_pagination( $parsed_block ) {
|
||||
static $dirty_enhanced_queries = array();
|
||||
static $render_query_callback = null;
|
||||
|
||||
$is_interactive = isset( $parsed_block['attrs']['enhancedPagination'] ) && true === $parsed_block['attrs']['enhancedPagination'] && isset( $parsed_block['attrs']['queryId'] );
|
||||
$block_name = $parsed_block['blockName'];
|
||||
$block_name = $parsed_block['blockName'];
|
||||
$block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block_name );
|
||||
$has_enhanced_pagination = isset( $parsed_block['attrs']['enhancedPagination'] ) && true === $parsed_block['attrs']['enhancedPagination'] && isset( $parsed_block['attrs']['queryId'] );
|
||||
/*
|
||||
* Client side navigation can be true in two states:
|
||||
* - supports.interactivity = true;
|
||||
* - supports.interactivity.clientNavigation = true;
|
||||
*/
|
||||
$supports_client_navigation = ( isset( $block_type->supports['interactivity']['clientNavigation'] ) && true === $block_type->supports['interactivity']['clientNavigation'] )
|
||||
|| ( isset( $block_type->supports['interactivity'] ) && true === $block_type->supports['interactivity'] );
|
||||
|
||||
if ( 'core/query' === $block_name && $is_interactive ) {
|
||||
if ( 'core/query' === $block_name && $has_enhanced_pagination ) {
|
||||
$enhanced_query_stack[] = $parsed_block['attrs']['queryId'];
|
||||
|
||||
if ( ! isset( $render_query_callback ) ) {
|
||||
@ -151,18 +130,15 @@ function block_core_query_disable_enhanced_pagination( $parsed_block ) {
|
||||
* @return string Returns the modified output of the query block.
|
||||
*/
|
||||
$render_query_callback = static function ( $content, $block ) use ( &$enhanced_query_stack, &$dirty_enhanced_queries, &$render_query_callback ) {
|
||||
$is_interactive = isset( $block['attrs']['enhancedPagination'] ) && true === $block['attrs']['enhancedPagination'] && isset( $block['attrs']['queryId'] );
|
||||
$has_enhanced_pagination = isset( $block['attrs']['enhancedPagination'] ) && true === $block['attrs']['enhancedPagination'] && isset( $block['attrs']['queryId'] );
|
||||
|
||||
if ( ! $is_interactive ) {
|
||||
if ( ! $has_enhanced_pagination ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
if ( isset( $dirty_enhanced_queries[ $block['attrs']['queryId'] ] ) ) {
|
||||
$p = new WP_HTML_Tag_Processor( $content );
|
||||
if ( $p->next_tag() ) {
|
||||
$p->set_attribute( 'data-wp-navigation-disabled', 'true' );
|
||||
}
|
||||
$content = $p->get_updated_html();
|
||||
// Disable navigation in the router store config.
|
||||
wp_interactivity_config( 'core/router', array( 'clientNavigationDisabled' => true ) );
|
||||
$dirty_enhanced_queries[ $block['attrs']['queryId'] ] = null;
|
||||
}
|
||||
|
||||
@ -181,7 +157,7 @@ function block_core_query_disable_enhanced_pagination( $parsed_block ) {
|
||||
} elseif (
|
||||
! empty( $enhanced_query_stack ) &&
|
||||
isset( $block_name ) &&
|
||||
( ! str_starts_with( $block_name, 'core/' ) || 'core/post-content' === $block_name )
|
||||
( ! $supports_client_navigation )
|
||||
) {
|
||||
foreach ( $enhanced_query_stack as $query_id ) {
|
||||
$dirty_enhanced_queries[ $query_id ] = true;
|
||||
|
@ -49,8 +49,8 @@
|
||||
"supports": {
|
||||
"align": [ "wide", "full" ],
|
||||
"html": false,
|
||||
"layout": true
|
||||
"layout": true,
|
||||
"interactivity": true
|
||||
},
|
||||
"editorStyle": "wp-block-query-editor",
|
||||
"style": "wp-block-query"
|
||||
"editorStyle": "wp-block-query-editor"
|
||||
}
|
||||
|
@ -58,6 +58,9 @@
|
||||
},
|
||||
"spacing": {
|
||||
"blockGap": true
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"styles": [
|
||||
|
@ -50,6 +50,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"width": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"style": "wp-block-read-more"
|
||||
|
@ -43,7 +43,10 @@
|
||||
},
|
||||
"supports": {
|
||||
"align": true,
|
||||
"html": false
|
||||
"html": false,
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-rss-editor",
|
||||
"style": "wp-block-rss"
|
||||
|
@ -80,6 +80,17 @@ function render_block_core_search( $attributes ) {
|
||||
// If it's interactive, enqueue the script module and add the directives.
|
||||
$is_expandable_searchfield = 'button-only' === $button_position;
|
||||
if ( $is_expandable_searchfield ) {
|
||||
$suffix = wp_scripts_get_suffix();
|
||||
if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
|
||||
$module_url = gutenberg_url( '/build/interactivity/search.min.js' );
|
||||
}
|
||||
|
||||
wp_register_script_module(
|
||||
'@wordpress/block-library/search',
|
||||
isset( $module_url ) ? $module_url : includes_url( "blocks/search/view{$suffix}.js" ),
|
||||
array( '@wordpress/interactivity' ),
|
||||
defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' )
|
||||
);
|
||||
wp_enqueue_script_module( '@wordpress/block-library/search' );
|
||||
|
||||
$input->set_attribute( 'data-wp-bind--aria-hidden', '!context.isSearchInputVisible' );
|
||||
@ -196,13 +207,6 @@ function register_block_core_search() {
|
||||
'render_callback' => 'render_block_core_search',
|
||||
)
|
||||
);
|
||||
|
||||
wp_register_script_module(
|
||||
'@wordpress/block-library/search',
|
||||
defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ? gutenberg_url( '/build/interactivity/search.min.js' ) : includes_url( 'blocks/search/view.min.js' ),
|
||||
array( '@wordpress/interactivity' ),
|
||||
defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' )
|
||||
);
|
||||
}
|
||||
add_action( 'init', 'register_block_core_search' );
|
||||
|
||||
|
@ -28,6 +28,9 @@
|
||||
},
|
||||
"spacing": {
|
||||
"margin": [ "top", "bottom" ]
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"styles": [
|
||||
|
@ -45,6 +45,9 @@
|
||||
"margin": false,
|
||||
"padding": false
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"styles": [
|
||||
|
@ -43,6 +43,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-site-tagline-editor"
|
||||
|
@ -58,6 +58,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-site-title-editor",
|
||||
|
@ -228,7 +228,7 @@ function block_core_social_link_services( $service = '', $field = '' ) {
|
||||
),
|
||||
'patreon' => array(
|
||||
'name' => 'Patreon',
|
||||
'icon' => '<svg width="24" height="24" viewBox="0 0 569 546" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><circle cx="363" cy="205" r="205" /><rect width="100" height="546" x="0" y="0" /></svg>',
|
||||
'icon' => '<svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M20 8.40755C19.9969 6.10922 18.2543 4.22555 16.2097 3.54588C13.6708 2.70188 10.3222 2.82421 7.89775 3.99921C4.95932 5.42355 4.03626 8.54355 4.00186 11.6552C3.97363 14.2136 4.2222 20.9517 7.92225 20.9997C10.6715 21.0356 11.0809 17.3967 12.3529 15.6442C13.258 14.3974 14.4233 14.0452 15.8578 13.6806C18.3233 13.0537 20.0036 11.0551 20 8.40755Z" /></svg>',
|
||||
),
|
||||
'pinterest' => array(
|
||||
'name' => 'Pinterest',
|
||||
|
@ -31,7 +31,10 @@
|
||||
],
|
||||
"supports": {
|
||||
"reusable": false,
|
||||
"html": false
|
||||
"html": false,
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-social-link-editor"
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
"name": "core/social-links",
|
||||
"title": "Social Icons",
|
||||
"category": "widgets",
|
||||
"allowedBlocks": [ "core/social-link" ],
|
||||
"description": "Display icons linking to your social media profiles or sites.",
|
||||
"keywords": [ "links" ],
|
||||
"textdomain": "default",
|
||||
@ -77,6 +78,9 @@
|
||||
"margin": true,
|
||||
"padding": false
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"styles": [
|
||||
|
@ -23,6 +23,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"margin": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-spacer-editor",
|
||||
|
@ -195,7 +195,10 @@
|
||||
"width": true
|
||||
}
|
||||
},
|
||||
"__experimentalSelector": ".wp-block-table > table"
|
||||
"__experimentalSelector": ".wp-block-table > table",
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"styles": [
|
||||
{
|
||||
|
@ -48,6 +48,9 @@
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalLetterSpacing": true
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-tag-cloud-editor"
|
||||
|
@ -109,16 +109,16 @@ function render_block_core_template_part( $attributes ) {
|
||||
// is set in `wp_debug_mode()`.
|
||||
$is_debug = WP_DEBUG && WP_DEBUG_DISPLAY;
|
||||
|
||||
if ( is_null( $content ) && $is_debug ) {
|
||||
if ( ! isset( $attributes['slug'] ) ) {
|
||||
// If there is no slug this is a placeholder and we dont want to return any message.
|
||||
return;
|
||||
if ( is_null( $content ) ) {
|
||||
if ( $is_debug && isset( $attributes['slug'] ) ) {
|
||||
return sprintf(
|
||||
/* translators: %s: Template part slug. */
|
||||
__( 'Template part has been deleted or is unavailable: %s' ),
|
||||
$attributes['slug']
|
||||
);
|
||||
}
|
||||
return sprintf(
|
||||
/* translators: %s: Template part slug. */
|
||||
__( 'Template part has been deleted or is unavailable: %s' ),
|
||||
$attributes['slug']
|
||||
);
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( isset( $seen_ids[ $template_part_id ] ) ) {
|
||||
|
@ -24,7 +24,10 @@
|
||||
"align": true,
|
||||
"html": false,
|
||||
"reusable": false,
|
||||
"renaming": false
|
||||
"renaming": false,
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-template-part-editor"
|
||||
}
|
||||
|
@ -37,6 +37,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,10 @@
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
"inserter": false
|
||||
"inserter": false,
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-text-columns-editor",
|
||||
"style": "wp-block-text-columns"
|
||||
|
@ -55,6 +55,9 @@
|
||||
"width": true,
|
||||
"color": true,
|
||||
"style": true
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"style": "wp-block-verse",
|
||||
|
@ -88,6 +88,9 @@
|
||||
"margin": false,
|
||||
"padding": false
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"clientNavigation": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-video-editor",
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user