Update @wordpress packages

Update packages to include these bug fixes from Gutenberg:

- Force remount LinkControl when moving between links within same richtext block
- Site Editor: Change ToolsMoreMenuGroup slot-fill name
- Respect fields param for global styles REST API requests.
- Try ensuring the item after post content clears floats
- Fix submenus not opening on click
- Apply i18n functions to Nav block menu drops when selecting existing Menu
- Gallery: Make sure the mobile warning notice only runs when images are added to a new block
- Prepare navigation php code for core patch
- Address deprecation issues from Buttons flex layout PR.
- Block Library: Fix incorrect attributes definitions
- Fix Navigation accessibility issues

See #54337.


git-svn-id: https://develop.svn.wordpress.org/trunk@52103 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Robert Anderson 2021-11-10 05:59:55 +00:00
parent 6e2472b8c2
commit bef7547231
12 changed files with 146 additions and 202 deletions

114
package-lock.json generated
View File

@ -3436,21 +3436,21 @@
}
},
"@wordpress/block-directory": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/@wordpress/block-directory/-/block-directory-3.0.5.tgz",
"integrity": "sha512-vinSWZJ9MQ4mgQCzKQCrjWi26OCOzKCacqgbQ3qm4DcGA6DkzNviXhJ6EeQrY1YZUlAOduiSFSQO30uboqBmWg==",
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/@wordpress/block-directory/-/block-directory-3.0.6.tgz",
"integrity": "sha512-6FAaUXNKMYXXWSf+glPKK80eTikOpu0v59JrX2zha4DQwVVHXhsxxNmfRDN6/zD3nX7//bPPNTxdCVPLahAWtA==",
"requires": {
"@babel/runtime": "^7.13.10",
"@wordpress/a11y": "^3.2.3",
"@wordpress/api-fetch": "^5.2.5",
"@wordpress/block-editor": "^8.0.0",
"@wordpress/block-editor": "^8.0.1",
"@wordpress/blocks": "^11.1.3",
"@wordpress/components": "^19.0.1",
"@wordpress/compose": "^5.0.5",
"@wordpress/core-data": "^4.0.5",
"@wordpress/data": "^6.1.3",
"@wordpress/edit-post": "^5.0.5",
"@wordpress/editor": "^12.0.2",
"@wordpress/edit-post": "^5.0.6",
"@wordpress/editor": "^12.0.3",
"@wordpress/element": "^4.0.3",
"@wordpress/hooks": "^3.2.1",
"@wordpress/html-entities": "^3.2.2",
@ -3463,9 +3463,9 @@
}
},
"@wordpress/block-editor": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/@wordpress/block-editor/-/block-editor-8.0.0.tgz",
"integrity": "sha512-POzr9e5QXEzBUMMMAqjDYrt+cITG1nRXjsOkh+f7RhEDex8ymiG8bE31WLlnlwQvbB0jFKO4H706TTUzCZ6AmA==",
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/@wordpress/block-editor/-/block-editor-8.0.1.tgz",
"integrity": "sha512-U/NCgbNzpwNOHoQTfGTGHgjHY86a7VqHVlHBIKUrPbevwZg8dlEq5yrQeRskJ5TzHLk9UWUkyLoStdVnb1SUQg==",
"requires": {
"@babel/runtime": "^7.13.10",
"@react-spring/web": "^9.2.4",
@ -3510,16 +3510,16 @@
}
},
"@wordpress/block-library": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/@wordpress/block-library/-/block-library-6.0.3.tgz",
"integrity": "sha512-pnrr8XUtNne+GKAz+XR1VRos1RWuOEOtPfSM/uy/mMyKwM+mD941GGg+JdHIFnIzbgQec9ASJzi7a0kHJgIkJQ==",
"version": "6.0.4",
"resolved": "https://registry.npmjs.org/@wordpress/block-library/-/block-library-6.0.4.tgz",
"integrity": "sha512-Iwoojqo13CCQ+XJZJGAD9QXPtuHGrTYzF3nlbzlyrki1LaCWZnwQ15KWe+ziINp5F6RYws1c6XJ+EfCHKnNHzg==",
"requires": {
"@babel/runtime": "^7.13.10",
"@wordpress/a11y": "^3.2.3",
"@wordpress/api-fetch": "^5.2.5",
"@wordpress/autop": "^3.2.2",
"@wordpress/blob": "^3.2.1",
"@wordpress/block-editor": "^8.0.0",
"@wordpress/block-editor": "^8.0.1",
"@wordpress/blocks": "^11.1.3",
"@wordpress/components": "^19.0.1",
"@wordpress/compose": "^5.0.5",
@ -3539,7 +3539,7 @@
"@wordpress/keycodes": "^3.2.3",
"@wordpress/notices": "^3.2.6",
"@wordpress/primitives": "^3.0.3",
"@wordpress/reusable-blocks": "^3.0.5",
"@wordpress/reusable-blocks": "^3.0.6",
"@wordpress/rich-text": "^5.0.5",
"@wordpress/server-side-render": "^3.0.5",
"@wordpress/url": "^3.3.0",
@ -3692,14 +3692,14 @@
}
},
"@wordpress/customize-widgets": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/@wordpress/customize-widgets/-/customize-widgets-2.0.5.tgz",
"integrity": "sha512-Pk5qDRuN4WBnKRFHXmgfVCqRKqXpCfvrKOGVMEf7fFYofE1URsQJee6R3sUmMWqM7NYYuex0b23Ul6v4bRywXA==",
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/@wordpress/customize-widgets/-/customize-widgets-2.0.6.tgz",
"integrity": "sha512-D2IV+e0uGHrbKafqZg0PI2Ss8fzc3IJEo07LIThdmxqKR2g78sDWnKNs4ywd8NBPO7AD1Ir2+0m1y6sQzt2k7A==",
"requires": {
"@babel/runtime": "^7.11.2",
"@wordpress/a11y": "^3.2.3",
"@wordpress/block-editor": "^8.0.0",
"@wordpress/block-library": "^6.0.3",
"@wordpress/block-editor": "^8.0.1",
"@wordpress/block-library": "^6.0.4",
"@wordpress/blocks": "^11.1.3",
"@wordpress/components": "^19.0.1",
"@wordpress/compose": "^5.0.5",
@ -3715,7 +3715,7 @@
"@wordpress/keyboard-shortcuts": "^3.0.5",
"@wordpress/keycodes": "^3.2.3",
"@wordpress/media-utils": "^3.0.4",
"@wordpress/widgets": "^2.0.5",
"@wordpress/widgets": "^2.0.6",
"classnames": "^2.3.1",
"lodash": "^4.17.21"
}
@ -3844,22 +3844,22 @@
}
},
"@wordpress/edit-post": {
"version": "5.0.5",
"resolved": "https://registry.npmjs.org/@wordpress/edit-post/-/edit-post-5.0.5.tgz",
"integrity": "sha512-DvsRCnI5JaiYVcHExYjdk8LUApQpRD2aBnvHRymvJ0iCRHhej3gi81o2PghkzY4DkmW3QHC2p3h7fV+OEQvdfg==",
"version": "5.0.6",
"resolved": "https://registry.npmjs.org/@wordpress/edit-post/-/edit-post-5.0.6.tgz",
"integrity": "sha512-v3DwBA5snRh0E7pTUt4rhmLw/ZTKMQk2ol0A/Uzsq6dVNZYCuJmkVqgrJV44Hbx+gru9/8GBrCRvHDpq8s8rvg==",
"requires": {
"@babel/runtime": "^7.13.10",
"@wordpress/a11y": "^3.2.3",
"@wordpress/api-fetch": "^5.2.5",
"@wordpress/block-editor": "^8.0.0",
"@wordpress/block-library": "^6.0.3",
"@wordpress/block-editor": "^8.0.1",
"@wordpress/block-library": "^6.0.4",
"@wordpress/blocks": "^11.1.3",
"@wordpress/components": "^19.0.1",
"@wordpress/compose": "^5.0.5",
"@wordpress/core-data": "^4.0.5",
"@wordpress/data": "^6.1.3",
"@wordpress/data-controls": "^2.2.6",
"@wordpress/editor": "^12.0.2",
"@wordpress/editor": "^12.0.3",
"@wordpress/element": "^4.0.3",
"@wordpress/hooks": "^3.2.1",
"@wordpress/i18n": "^4.2.3",
@ -3889,22 +3889,22 @@
}
},
"@wordpress/edit-site": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/@wordpress/edit-site/-/edit-site-3.0.5.tgz",
"integrity": "sha512-FYr6xwZcDaPxiOBsmzHnbaSdGeGD55I2j2flJPtLM4v7jzrIFVOBBaFtGUAUTtl0oagOlVNkQidL+/mVAcbIeQ==",
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/@wordpress/edit-site/-/edit-site-3.0.6.tgz",
"integrity": "sha512-w2F2uFiSgFCG8TdA8RIxNOgR7ZKF5mI0rtf9NIZfkJS/6bPXx5pQAwrnyVFjRnOg2dP5/yWNMt/F87whfv9E2Q==",
"requires": {
"@babel/runtime": "^7.13.10",
"@wordpress/a11y": "^3.2.3",
"@wordpress/api-fetch": "^5.2.5",
"@wordpress/block-editor": "^8.0.0",
"@wordpress/block-library": "^6.0.3",
"@wordpress/block-editor": "^8.0.1",
"@wordpress/block-library": "^6.0.4",
"@wordpress/blocks": "^11.1.3",
"@wordpress/components": "^19.0.1",
"@wordpress/compose": "^5.0.5",
"@wordpress/core-data": "^4.0.5",
"@wordpress/data": "^6.1.3",
"@wordpress/data-controls": "^2.2.6",
"@wordpress/editor": "^12.0.2",
"@wordpress/editor": "^12.0.3",
"@wordpress/element": "^4.0.3",
"@wordpress/hooks": "^3.2.1",
"@wordpress/html-entities": "^3.2.2",
@ -3927,15 +3927,15 @@
}
},
"@wordpress/edit-widgets": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/@wordpress/edit-widgets/-/edit-widgets-3.1.0.tgz",
"integrity": "sha512-lCoogDEpsQLL4xFK3DQBn50vh1ScJoLLqQs+uy+Pje2jxQyEEaZCP7nApuHV5IC4r05ZC3icToV+5+oGCdDDDg==",
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/@wordpress/edit-widgets/-/edit-widgets-3.1.1.tgz",
"integrity": "sha512-VX9IRqFqOJvZEQZ/NqAkNX1bkP8IqnZfenLbZRDutSXUSTyPKoCgZHrt120fymK9RNAW15HBU+2DcTScr8APiQ==",
"requires": {
"@babel/runtime": "^7.13.10",
"@wordpress/a11y": "^3.2.3",
"@wordpress/api-fetch": "^5.2.5",
"@wordpress/block-editor": "^8.0.0",
"@wordpress/block-library": "^6.0.3",
"@wordpress/block-editor": "^8.0.1",
"@wordpress/block-library": "^6.0.4",
"@wordpress/blocks": "^11.1.3",
"@wordpress/components": "^19.0.1",
"@wordpress/compose": "^5.0.5",
@ -3952,10 +3952,10 @@
"@wordpress/media-utils": "^3.0.4",
"@wordpress/notices": "^3.2.6",
"@wordpress/plugins": "^4.0.5",
"@wordpress/reusable-blocks": "^3.0.5",
"@wordpress/reusable-blocks": "^3.0.6",
"@wordpress/server-side-render": "^3.0.5",
"@wordpress/url": "^3.3.0",
"@wordpress/widgets": "^2.0.5",
"@wordpress/widgets": "^2.0.6",
"classnames": "^2.3.1",
"lodash": "^4.17.21",
"rememo": "^3.0.0",
@ -3963,16 +3963,16 @@
}
},
"@wordpress/editor": {
"version": "12.0.2",
"resolved": "https://registry.npmjs.org/@wordpress/editor/-/editor-12.0.2.tgz",
"integrity": "sha512-rKwD+kzsDtytpfrS3nlR+s+IXRsWGsJkYhhRbhbITnyRYIjIQYq/SN8tm9svQJ1+7Ldl3QtxQco9oKZMPfL02w==",
"version": "12.0.3",
"resolved": "https://registry.npmjs.org/@wordpress/editor/-/editor-12.0.3.tgz",
"integrity": "sha512-2NewLZjIfGp9El0Rzkt4g/pQzpVOS4XN0RodHF4dx8Pus5SJ0boUEOVzYa1O4HIJlxPXXheh11KsjLU/D3TJHA==",
"requires": {
"@babel/runtime": "^7.13.10",
"@wordpress/a11y": "^3.2.3",
"@wordpress/api-fetch": "^5.2.5",
"@wordpress/autop": "^3.2.2",
"@wordpress/blob": "^3.2.1",
"@wordpress/block-editor": "^8.0.0",
"@wordpress/block-editor": "^8.0.1",
"@wordpress/blocks": "^11.1.3",
"@wordpress/components": "^19.0.1",
"@wordpress/compose": "^5.0.5",
@ -3991,7 +3991,7 @@
"@wordpress/keycodes": "^3.2.3",
"@wordpress/media-utils": "^3.0.4",
"@wordpress/notices": "^3.2.6",
"@wordpress/reusable-blocks": "^3.0.5",
"@wordpress/reusable-blocks": "^3.0.6",
"@wordpress/rich-text": "^5.0.5",
"@wordpress/server-side-render": "^3.0.5",
"@wordpress/url": "^3.3.0",
@ -4110,13 +4110,13 @@
}
},
"@wordpress/format-library": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/@wordpress/format-library/-/format-library-3.0.5.tgz",
"integrity": "sha512-IxyaySakhNSPUPMwSaGkVV1QIlrxdYW38yu8nz0N4dFO6ZOwTkV1whbzyZJOesd/hxxYgczrYRp++8Ti7c880w==",
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/@wordpress/format-library/-/format-library-3.0.6.tgz",
"integrity": "sha512-6GWogdj5f31WYyug2/QicRoQKfEW49F30RHbKptoh2xIme4qU9+9C3t662H7cSYd9/toI5Mm+vLkNI7aDvAesQ==",
"requires": {
"@babel/runtime": "^7.13.10",
"@wordpress/a11y": "^3.2.3",
"@wordpress/block-editor": "^8.0.0",
"@wordpress/block-editor": "^8.0.1",
"@wordpress/components": "^19.0.1",
"@wordpress/compose": "^5.0.5",
"@wordpress/data": "^6.1.3",
@ -4450,11 +4450,11 @@
}
},
"@wordpress/reusable-blocks": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/@wordpress/reusable-blocks/-/reusable-blocks-3.0.5.tgz",
"integrity": "sha512-VRNMdwKBHU4NO7A23UW7GG2DavPymeHq2ixN3okViXOTvyg5nIY7bayDf/D5pH1SbGxSRXP/1Xl1kT9BtJ59VQ==",
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/@wordpress/reusable-blocks/-/reusable-blocks-3.0.6.tgz",
"integrity": "sha512-qKkRU89+NPvri1Hl7Z2r2YdHnafw4aiR59a/6soElypPANuZuR1LKhvBL5fwHIXX1Pxq/cBk4ptY5KIG+WxpHA==",
"requires": {
"@wordpress/block-editor": "^8.0.0",
"@wordpress/block-editor": "^8.0.1",
"@wordpress/blocks": "^11.1.3",
"@wordpress/components": "^19.0.1",
"@wordpress/compose": "^5.0.5",
@ -5493,13 +5493,13 @@
"integrity": "sha512-iG1Hq56RK3N6AJqAD1sRLWRIJatfYn+NrPyrfqRNZNYXHM8Vj/s7ABNMbIU0Y99vXkBE83rvCdbMkugNoI2jXA=="
},
"@wordpress/widgets": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/@wordpress/widgets/-/widgets-2.0.5.tgz",
"integrity": "sha512-rbi9Bjlz3XeAlkPSY6BZH2g3IzDM4oFCJxrUyaZFkI9NxJaFiQo4Q68aG1q454Mj/36t5tfxpz1xcxfm9IwU5w==",
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/@wordpress/widgets/-/widgets-2.0.6.tgz",
"integrity": "sha512-Rf/VsDqojGVV/jPBVoM9ExkZ8KFUkHDp0bdKoCzAnOn5OmuHX1jyIVSVZ3LugDfF+i1wfi3AyYROVZpAC43Lpw==",
"requires": {
"@babel/runtime": "^7.13.10",
"@wordpress/api-fetch": "^5.2.5",
"@wordpress/block-editor": "^8.0.0",
"@wordpress/block-editor": "^8.0.1",
"@wordpress/blocks": "^11.1.3",
"@wordpress/components": "^19.0.1",
"@wordpress/compose": "^5.0.5",
@ -7476,7 +7476,7 @@
},
"browserify-aes": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
"resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
"integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==",
"dev": true,
"requires": {

View File

@ -83,28 +83,28 @@
"@wordpress/api-fetch": "5.2.5",
"@wordpress/autop": "3.2.2",
"@wordpress/blob": "3.2.1",
"@wordpress/block-directory": "3.0.5",
"@wordpress/block-editor": "8.0.0",
"@wordpress/block-library": "6.0.3",
"@wordpress/block-directory": "3.0.6",
"@wordpress/block-editor": "8.0.1",
"@wordpress/block-library": "6.0.4",
"@wordpress/block-serialization-default-parser": "4.2.2",
"@wordpress/blocks": "11.1.3",
"@wordpress/components": "19.0.1",
"@wordpress/compose": "5.0.5",
"@wordpress/core-data": "4.0.5",
"@wordpress/customize-widgets": "2.0.5",
"@wordpress/customize-widgets": "2.0.6",
"@wordpress/data": "6.1.3",
"@wordpress/data-controls": "2.2.6",
"@wordpress/date": "4.2.2",
"@wordpress/deprecated": "3.2.2",
"@wordpress/dom": "3.2.6",
"@wordpress/dom-ready": "3.2.2",
"@wordpress/edit-post": "5.0.5",
"@wordpress/edit-site": "3.0.5",
"@wordpress/edit-widgets": "3.1.0",
"@wordpress/editor": "12.0.2",
"@wordpress/edit-post": "5.0.6",
"@wordpress/edit-site": "3.0.6",
"@wordpress/edit-widgets": "3.1.1",
"@wordpress/editor": "12.0.3",
"@wordpress/element": "4.0.3",
"@wordpress/escape-html": "2.2.2",
"@wordpress/format-library": "3.0.5",
"@wordpress/format-library": "3.0.6",
"@wordpress/hooks": "3.2.1",
"@wordpress/html-entities": "3.2.2",
"@wordpress/i18n": "4.2.3",
@ -121,7 +121,7 @@
"@wordpress/primitives": "3.0.3",
"@wordpress/priority-queue": "2.2.2",
"@wordpress/redux-routine": "4.2.1",
"@wordpress/reusable-blocks": "3.0.5",
"@wordpress/reusable-blocks": "3.0.6",
"@wordpress/rich-text": "5.0.5",
"@wordpress/server-side-render": "3.0.5",
"@wordpress/shortcode": "3.2.2",
@ -129,7 +129,7 @@
"@wordpress/url": "3.3.0",
"@wordpress/viewport": "4.0.5",
"@wordpress/warning": "2.2.2",
"@wordpress/widgets": "2.0.5",
"@wordpress/widgets": "2.0.6",
"@wordpress/wordcount": "3.2.2",
"backbone": "1.4.0",
"clipboard": "2.0.8",

File diff suppressed because one or more lines are too long

View File

@ -111,14 +111,26 @@ function wp_get_layout_style( $selector, $layout, $has_block_gap_support = false
*/
if ( ! empty( $layout['justifyContent'] ) && array_key_exists( $layout['justifyContent'], $justify_content_options ) ) {
$style .= "justify-content: {$justify_content_options[ $layout['justifyContent'] ]};";
// --justification-setting allows children to inherit the value regardless or row or column direction.
$style .= "--justification-setting: {$justify_content_options[ $layout['justifyContent'] ]};";
if ( ! empty( $layout['setCascadingProperties'] ) && $layout['setCascadingProperties'] ) {
// --layout-justification-setting allows children to inherit the value regardless or row or column direction.
$style .= "--layout-justification-setting: {$justify_content_options[ $layout['justifyContent'] ]};";
$style .= '--layout-direction: row;';
$style .= "--layout-wrap: $flex_wrap;";
$style .= "--layout-justify: {$justify_content_options[ $layout['justifyContent'] ]};";
$style .= '--layout-align: center;';
}
}
} else {
$style .= 'flex-direction: column;';
if ( ! empty( $layout['justifyContent'] ) && array_key_exists( $layout['justifyContent'], $justify_content_options ) ) {
$style .= "align-items: {$justify_content_options[ $layout['justifyContent'] ]};";
$style .= "--justification-setting: {$justify_content_options[ $layout['justifyContent'] ]};";
if ( ! empty( $layout['setCascadingProperties'] ) && $layout['setCascadingProperties'] ) {
// --layout-justification-setting allows children to inherit the value regardless or row or column direction.
$style .= "--layout-justification-setting: {$justify_content_options[ $layout['justifyContent'] ]};";
$style .= '--layout-direction: column;';
$style .= '--layout-justify: initial;';
$style .= "--layout-align: {$justify_content_options[ $layout['justifyContent'] ]};";
}
}
}
$style .= '}';

View File

@ -17,7 +17,7 @@
"type": "array"
},
"templateLock": {
"type": "string",
"type": [ "string", "boolean" ],
"enum": [ "all", "insert", false ]
}
},

View File

@ -67,7 +67,7 @@
"type": "array"
},
"templateLock": {
"type": "string",
"type": [ "string", "boolean" ],
"enum": [ "all", "insert", false ]
}
},

View File

@ -12,7 +12,7 @@
"default": "div"
},
"templateLock": {
"type": "string",
"type": [ "string", "boolean" ],
"enum": [ "all", "insert", false ]
}
},

View File

@ -85,117 +85,6 @@ function block_core_navigation_build_css_font_sizes( $attributes ) {
return $font_sizes;
}
/**
* Returns the menu items for a WordPress menu location.
*
* @param string $location The menu location.
* @return array Menu items for the location.
*/
function gutenberg_get_menu_items_at_location( $location ) {
if ( empty( $location ) ) {
return;
}
// Build menu data. The following approximates the code in
// `wp_nav_menu()` and `gutenberg_output_block_nav_menu`.
// Find the location in the list of locations, returning early if the
// location can't be found.
$locations = get_nav_menu_locations();
if ( ! isset( $locations[ $location ] ) ) {
return;
}
// Get the menu from the location, returning early if there is no
// menu or there was an error.
$menu = wp_get_nav_menu_object( $locations[ $location ] );
if ( ! $menu || is_wp_error( $menu ) ) {
return;
}
$menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) );
_wp_menu_item_classes_by_context( $menu_items );
return $menu_items;
}
/**
* Sorts a standard array of menu items into a nested structure keyed by the
* id of the parent menu.
*
* @param array $menu_items Menu items to sort.
* @return array An array keyed by the id of the parent menu where each element
* is an array of menu items that belong to that parent.
*/
function gutenberg_sort_menu_items_by_parent_id( $menu_items ) {
$sorted_menu_items = array();
foreach ( (array) $menu_items as $menu_item ) {
$sorted_menu_items[ $menu_item->menu_order ] = $menu_item;
}
unset( $menu_items, $menu_item );
$menu_items_by_parent_id = array();
foreach ( $sorted_menu_items as $menu_item ) {
$menu_items_by_parent_id[ $menu_item->menu_item_parent ][] = $menu_item;
}
return $menu_items_by_parent_id;
}
/**
* Turns menu item data into a nested array of parsed blocks
*
* @param array $menu_items An array of menu items that represent
* an individual level of a menu.
* @param array $menu_items_by_parent_id An array keyed by the id of the
* parent menu where each element is an
* array of menu items that belong to
* that parent.
* @return array An array of parsed block data.
*/
function gutenberg_parse_blocks_from_menu_items( $menu_items, $menu_items_by_parent_id ) {
if ( empty( $menu_items ) ) {
return array();
}
$blocks = array();
foreach ( $menu_items as $menu_item ) {
$class_name = ! empty( $menu_item->classes ) ? implode( ' ', (array) $menu_item->classes ) : null;
$id = ( null !== $menu_item->object_id && 'custom' !== $menu_item->object ) ? $menu_item->object_id : null;
$opens_in_new_tab = null !== $menu_item->target && '_blank' === $menu_item->target;
$rel = ( null !== $menu_item->xfn && '' !== $menu_item->xfn ) ? $menu_item->xfn : null;
$kind = null !== $menu_item->type ? str_replace( '_', '-', $menu_item->type ) : 'custom';
$block = array(
'blockName' => 'core/navigation-link',
'attrs' => array(
'className' => $class_name,
'description' => $menu_item->description,
'id' => $id,
'kind' => $kind,
'label' => $menu_item->title,
'opensInNewTab' => $opens_in_new_tab,
'rel' => $rel,
'title' => $menu_item->attr_title,
'type' => $menu_item->object,
'url' => $menu_item->url,
),
);
$block['innerBlocks'] = gutenberg_parse_blocks_from_menu_items(
isset( $menu_items_by_parent_id[ $menu_item->ID ] )
? $menu_items_by_parent_id[ $menu_item->ID ]
: array(),
$menu_items_by_parent_id
);
$blocks[] = $block;
}
return $blocks;
}
/**
* Returns the top-level submenu SVG chevron icon.
*
@ -354,7 +243,7 @@ function render_block_core_navigation( $attributes, $content, $block ) {
$responsive_container_markup = sprintf(
'<button aria-expanded="false" aria-haspopup="true" aria-label="%3$s" class="%6$s" data-micromodal-trigger="modal-%1$s"><svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-hidden="true" focusable="false"><rect x="4" y="7.5" width="16" height="1.5" /><rect x="4" y="15" width="16" height="1.5" /></svg></button>
<div class="%5$s" id="modal-%1$s" aria-hidden="true">
<div class="%5$s" id="modal-%1$s">
<div class="wp-block-navigation__responsive-close" tabindex="-1" data-micromodal-close>
<div class="wp-block-navigation__responsive-dialog" role="dialog" aria-modal="true" aria-labelledby="modal-%1$s-title" >
<button aria-label="%4$s" data-micromodal-close class="wp-block-navigation__responsive-container-close"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" role="img" 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>

View File

@ -114,7 +114,8 @@
"allowSwitching": false,
"allowInheriting": false,
"default": {
"type": "flex"
"type": "flex",
"setCascadingProperties": true
}
}
},

View File

@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '86538493346805d860c94eb70dd1323d');
<?php return array('dependencies' => array(), 'version' => '8591fc81d18e61a0f33b213b1fe35e52');

View File

@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '7b2c5174a07c417dc3db6f1d9a9c3f78');
<?php return array('dependencies' => array(), 'version' => '4942262e50480536aae4cd504a13f19c');

View File

@ -234,18 +234,45 @@ class WP_REST_Global_Styles_Controller extends WP_REST_Controller {
public function prepare_item_for_response( $post, $request ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
$config = json_decode( $post->post_content, true );
$is_global_styles_user_theme_json = isset( $config['isGlobalStylesUserThemeJSON'] ) && true === $config['isGlobalStylesUserThemeJSON'];
$result = array(
'id' => $post->ID,
'settings' => ! empty( $config['settings'] ) && $is_global_styles_user_theme_json ? $config['settings'] : new stdClass(),
'styles' => ! empty( $config['styles'] ) && $is_global_styles_user_theme_json ? $config['styles'] : new stdClass(),
'title' => array(
'raw' => $post->post_title,
'rendered' => get_the_title( $post ),
),
);
$result = $this->add_additional_fields_to_object( $result, $request );
$response = rest_ensure_response( $result );
$links = $this->prepare_links( $post->id );
$fields = $this->get_fields_for_response( $request );
// Base fields for every post.
$data = array();
if ( rest_is_field_included( 'id', $fields ) ) {
$data['id'] = $post->ID;
}
if ( rest_is_field_included( 'title', $fields ) ) {
$data['title'] = array();
}
if ( rest_is_field_included( 'title.raw', $fields ) ) {
$data['title']['raw'] = $post->post_title;
}
if ( rest_is_field_included( 'title.rendered', $fields ) ) {
add_filter( 'protected_title_format', array( $this, 'protected_title_format' ) );
$data['title']['rendered'] = get_the_title( $post->ID );
remove_filter( 'protected_title_format', array( $this, 'protected_title_format' ) );
}
if ( rest_is_field_included( 'settings', $fields ) ) {
$data['settings'] = ! empty( $config['settings'] ) && $is_global_styles_user_theme_json ? $config['settings'] : new stdClass();
}
if ( rest_is_field_included( 'styles', $fields ) ) {
$data['styles'] = ! empty( $config['styles'] ) && $is_global_styles_user_theme_json ? $config['styles'] : new stdClass();
}
$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
$data = $this->add_additional_fields_to_object( $data, $request );
$data = $this->filter_response_by_context( $data, $context );
// Wrap the data in a response object.
$response = rest_ensure_response( $data );
$links = $this->prepare_links( $post->ID );
$response->add_links( $links );
if ( ! empty( $links['self']['href'] ) ) {
$actions = $this->get_available_actions();
@ -300,6 +327,21 @@ class WP_REST_Global_Styles_Controller extends WP_REST_Controller {
return $rels;
}
/**
* Overwrites the default protected title format.
*
* By default, WordPress will show password protected posts with a title of
* "Protected: %s", as the REST API communicates the protected status of a post
* in a machine readable format, we remove the "Protected: " prefix.
*
* @since 5.9.0
*
* @return string Protected title format.
*/
public function protected_title_format() {
return '%s';
}
/**
* Retrieves the query params for the global styles collection.
*