mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Update editor related npm packages
The npm packages needed updating for 6.4 to the latest. Props mikachan, mukesdpanchal27, luisherranz, youknowriad, tellthemachines, gziolo, ockham, michalczaplinski Fixes #59411 Built from https://develop.svn.wordpress.org/trunk@56710 git-svn-id: http://core.svn.wordpress.org/trunk@56222 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9bf6faff7c
commit
04f631f232
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -112,12 +112,12 @@ function get_block_core_avatar_border_attributes( $attributes ) {
|
||||
|
||||
// Border color.
|
||||
$preset_color = array_key_exists( 'borderColor', $attributes ) ? "var:preset|color|{$attributes['borderColor']}" : null;
|
||||
$custom_color = _wp_array_get( $attributes, array( 'style', 'border', 'color' ), null );
|
||||
$custom_color = $attributes['style']['border']['color'] ?? null;
|
||||
$border_styles['color'] = $preset_color ? $preset_color : $custom_color;
|
||||
|
||||
// Individual border styles e.g. top, left etc.
|
||||
foreach ( $sides as $side ) {
|
||||
$border = _wp_array_get( $attributes, array( 'style', 'border', $side ), null );
|
||||
$border = $attributes['style']['border'][ $side ] ?? null;
|
||||
$border_styles[ $side ] = array(
|
||||
'color' => isset( $border['color'] ) ? $border['color'] : null,
|
||||
'style' => isset( $border['style'] ) ? $border['style'] : null,
|
||||
|
@ -48,6 +48,9 @@
|
||||
"__experimentalDuotone": "img"
|
||||
}
|
||||
},
|
||||
"selectors": {
|
||||
"border": ".wp-block-avatar img"
|
||||
},
|
||||
"editorStyle": "wp-block-avatar-editor",
|
||||
"style": "wp-block-avatar"
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
"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.",
|
||||
"keywords": [ "reusable" ],
|
||||
"keywords": [ "reusable" ],
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
"ref": {
|
||||
|
@ -172,6 +172,9 @@
|
||||
'__experimentalDuotone' => 'img'
|
||||
)
|
||||
),
|
||||
'selectors' => array(
|
||||
'border' => '.wp-block-avatar img'
|
||||
),
|
||||
'editorStyle' => 'wp-block-avatar-editor',
|
||||
'style' => 'wp-block-avatar'
|
||||
),
|
||||
@ -212,6 +215,18 @@
|
||||
),
|
||||
'textdomain' => 'default',
|
||||
'attributes' => array(
|
||||
'tagName' => array(
|
||||
'type' => 'string',
|
||||
'enum' => array(
|
||||
'a',
|
||||
'button'
|
||||
),
|
||||
'default' => 'a'
|
||||
),
|
||||
'type' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'button'
|
||||
),
|
||||
'textAlign' => array(
|
||||
'type' => 'string'
|
||||
),
|
||||
@ -225,14 +240,14 @@
|
||||
'title' => array(
|
||||
'type' => 'string',
|
||||
'source' => 'attribute',
|
||||
'selector' => 'a',
|
||||
'selector' => 'a,button',
|
||||
'attribute' => 'title',
|
||||
'__experimentalRole' => 'content'
|
||||
),
|
||||
'text' => array(
|
||||
'type' => 'string',
|
||||
'source' => 'html',
|
||||
'selector' => 'a',
|
||||
'selector' => 'a,button',
|
||||
'__experimentalRole' => 'content'
|
||||
),
|
||||
'linkTarget' => array(
|
||||
@ -503,7 +518,8 @@
|
||||
'content' => array(
|
||||
'type' => 'string',
|
||||
'source' => 'html',
|
||||
'selector' => 'code'
|
||||
'selector' => 'code',
|
||||
'__unstablePreserveWhiteSpace' => true
|
||||
)
|
||||
),
|
||||
'supports' => array(
|
||||
@ -592,11 +608,14 @@
|
||||
)
|
||||
),
|
||||
'supports' => array(
|
||||
'__experimentalOnEnter' => true,
|
||||
'anchor' => true,
|
||||
'reusable' => false,
|
||||
'html' => false,
|
||||
'color' => array(
|
||||
'gradients' => true,
|
||||
'heading' => true,
|
||||
'button' => true,
|
||||
'link' => true,
|
||||
'__experimentalDefaultControls' => array(
|
||||
'background' => true,
|
||||
@ -676,6 +695,8 @@
|
||||
'color' => array(
|
||||
'gradients' => true,
|
||||
'link' => true,
|
||||
'heading' => true,
|
||||
'button' => true,
|
||||
'__experimentalDefaultControls' => array(
|
||||
'background' => true,
|
||||
'text' => true
|
||||
@ -1066,6 +1087,7 @@
|
||||
'html' => false,
|
||||
'color' => array(
|
||||
'gradients' => true,
|
||||
'heading' => true,
|
||||
'link' => true,
|
||||
'__experimentalDefaultControls' => array(
|
||||
'background' => true,
|
||||
@ -1478,11 +1500,13 @@
|
||||
),
|
||||
'color' => array(
|
||||
'__experimentalDuotone' => '> .wp-block-cover__image-background, > .wp-block-cover__video-background',
|
||||
'heading' => true,
|
||||
'text' => true,
|
||||
'background' => false,
|
||||
'__experimentalSkipSerialization' => array(
|
||||
'gradients'
|
||||
)
|
||||
),
|
||||
'enableContrastChecker' => false
|
||||
),
|
||||
'typography' => array(
|
||||
'fontSize' => true,
|
||||
@ -1512,9 +1536,10 @@
|
||||
'category' => 'text',
|
||||
'description' => 'Hide and show additional content.',
|
||||
'keywords' => array(
|
||||
'disclosure',
|
||||
'accordion',
|
||||
'summary',
|
||||
'hide'
|
||||
'toggle',
|
||||
'disclosure'
|
||||
),
|
||||
'textdomain' => 'default',
|
||||
'attributes' => array(
|
||||
@ -1523,7 +1548,9 @@
|
||||
'default' => false
|
||||
),
|
||||
'summary' => array(
|
||||
'type' => 'string'
|
||||
'type' => 'string',
|
||||
'source' => 'html',
|
||||
'selector' => 'summary'
|
||||
)
|
||||
),
|
||||
'supports' => array(
|
||||
@ -1548,6 +1575,7 @@
|
||||
'spacing' => array(
|
||||
'margin' => true,
|
||||
'padding' => true,
|
||||
'blockGap' => true,
|
||||
'__experimentalDefaultControls' => array(
|
||||
'margin' => false,
|
||||
'padding' => false
|
||||
@ -1565,6 +1593,9 @@
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
),
|
||||
'layout' => array(
|
||||
'allowEditing' => false
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-details-editor',
|
||||
@ -1684,6 +1715,10 @@
|
||||
'supports' => array(
|
||||
'anchor' => true,
|
||||
'align' => true,
|
||||
'spacing' => array(
|
||||
'margin' => true,
|
||||
'padding' => true
|
||||
),
|
||||
'color' => array(
|
||||
'gradients' => true,
|
||||
'link' => true,
|
||||
@ -1692,7 +1727,8 @@
|
||||
'background' => true,
|
||||
'link' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
'interactivity' => true
|
||||
),
|
||||
'viewScript' => 'file:./view.min.js',
|
||||
'editorStyle' => 'wp-block-file-editor',
|
||||
@ -1714,9 +1750,52 @@
|
||||
'postType'
|
||||
),
|
||||
'supports' => array(
|
||||
'__experimentalBorder' => array(
|
||||
'radius' => true,
|
||||
'color' => true,
|
||||
'width' => true,
|
||||
'style' => true,
|
||||
'__experimentalDefaultControls' => array(
|
||||
'radius' => false,
|
||||
'color' => false,
|
||||
'width' => false,
|
||||
'style' => false
|
||||
)
|
||||
),
|
||||
'color' => array(
|
||||
'background' => true,
|
||||
'link' => true,
|
||||
'text' => true,
|
||||
'__experimentalDefaultControls' => array(
|
||||
'link' => true,
|
||||
'text' => true
|
||||
)
|
||||
),
|
||||
'html' => false,
|
||||
'multiple' => false,
|
||||
'reusable' => false
|
||||
'reusable' => false,
|
||||
'spacing' => array(
|
||||
'margin' => true,
|
||||
'padding' => true,
|
||||
'__experimentalDefaultControls' => array(
|
||||
'margin' => false,
|
||||
'padding' => false
|
||||
)
|
||||
),
|
||||
'typography' => array(
|
||||
'fontSize' => true,
|
||||
'lineHeight' => true,
|
||||
'__experimentalFontFamily' => true,
|
||||
'__experimentalTextDecoration' => true,
|
||||
'__experimentalFontStyle' => true,
|
||||
'__experimentalFontWeight' => true,
|
||||
'__experimentalLetterSpacing' => true,
|
||||
'__experimentalTextTransform' => true,
|
||||
'__experimentalWritingMode' => true,
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
'style' => 'wp-block-footnotes'
|
||||
),
|
||||
@ -1811,11 +1890,11 @@
|
||||
),
|
||||
'shortCodeTransforms' => array(
|
||||
'type' => 'array',
|
||||
'default' => array(
|
||||
|
||||
),
|
||||
'items' => array(
|
||||
'type' => 'object'
|
||||
),
|
||||
'default' => array(
|
||||
|
||||
)
|
||||
),
|
||||
'columns' => array(
|
||||
@ -1937,7 +2016,9 @@
|
||||
),
|
||||
'supports' => array(
|
||||
'__experimentalOnEnter' => true,
|
||||
'__experimentalOnMerge' => true,
|
||||
'__experimentalSettings' => true,
|
||||
'__experimentalMetadata' => true,
|
||||
'align' => array(
|
||||
'wide',
|
||||
'full'
|
||||
@ -1945,8 +2026,13 @@
|
||||
'anchor' => true,
|
||||
'ariaLabel' => true,
|
||||
'html' => false,
|
||||
'background' => array(
|
||||
'backgroundImage' => true
|
||||
),
|
||||
'color' => array(
|
||||
'gradients' => true,
|
||||
'heading' => true,
|
||||
'button' => true,
|
||||
'link' => true,
|
||||
'__experimentalDefaultControls' => array(
|
||||
'background' => true,
|
||||
@ -2066,6 +2152,7 @@
|
||||
'__experimentalLetterSpacing' => true,
|
||||
'__experimentalTextTransform' => true,
|
||||
'__experimentalTextDecoration' => true,
|
||||
'__experimentalWritingMode' => true,
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true,
|
||||
'fontAppearance' => true,
|
||||
@ -2190,6 +2277,12 @@
|
||||
'selector' => 'figcaption',
|
||||
'__experimentalRole' => 'content'
|
||||
),
|
||||
'lightbox' => array(
|
||||
'type' => 'object',
|
||||
'enabled' => array(
|
||||
'type' => 'boolean'
|
||||
)
|
||||
),
|
||||
'title' => array(
|
||||
'type' => 'string',
|
||||
'source' => 'attribute',
|
||||
@ -2247,9 +2340,6 @@
|
||||
),
|
||||
'supports' => array(
|
||||
'anchor' => true,
|
||||
'behaviors' => array(
|
||||
'lightbox' => true
|
||||
),
|
||||
'color' => array(
|
||||
'text' => false,
|
||||
'background' => false
|
||||
@ -2287,7 +2377,8 @@
|
||||
)
|
||||
),
|
||||
'editorStyle' => 'wp-block-image-editor',
|
||||
'style' => 'wp-block-image'
|
||||
'style' => 'wp-block-image',
|
||||
'viewScript' => 'file:./view.min.js'
|
||||
),
|
||||
'latest-comments' => array(
|
||||
'$schema' => 'https://schemas.wp.org/trunk/block.json',
|
||||
@ -2573,6 +2664,7 @@
|
||||
),
|
||||
'__unstablePasteTextInline' => true,
|
||||
'__experimentalSelector' => 'ol,ul',
|
||||
'__experimentalOnMerge' => true,
|
||||
'__experimentalSlashInserter' => true
|
||||
),
|
||||
'editorStyle' => 'wp-block-list-editor',
|
||||
@ -2767,6 +2859,7 @@
|
||||
'html' => false,
|
||||
'color' => array(
|
||||
'gradients' => true,
|
||||
'heading' => true,
|
||||
'link' => true,
|
||||
'__experimentalDefaultControls' => array(
|
||||
'background' => true,
|
||||
@ -2958,6 +3051,7 @@
|
||||
'wide',
|
||||
'full'
|
||||
),
|
||||
'ariaLabel' => true,
|
||||
'html' => false,
|
||||
'inserter' => true,
|
||||
'typography' => array(
|
||||
@ -3006,12 +3100,10 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'viewScript' => array(
|
||||
'file:./view.min.js',
|
||||
'file:./view-modal.min.js'
|
||||
),
|
||||
'interactivity' => true
|
||||
),
|
||||
'viewScript' => 'file:./view.min.js',
|
||||
'editorStyle' => 'wp-block-navigation-editor',
|
||||
'style' => 'wp-block-navigation'
|
||||
),
|
||||
@ -3310,6 +3402,9 @@
|
||||
'text'
|
||||
),
|
||||
'textdomain' => 'default',
|
||||
'usesContext' => array(
|
||||
'postId'
|
||||
),
|
||||
'attributes' => array(
|
||||
'align' => array(
|
||||
'type' => 'string'
|
||||
@ -3347,6 +3442,7 @@
|
||||
'text' => true
|
||||
)
|
||||
),
|
||||
'__experimentalConnections' => true,
|
||||
'spacing' => array(
|
||||
'margin' => true,
|
||||
'padding' => true,
|
||||
@ -3364,6 +3460,7 @@
|
||||
'__experimentalFontWeight' => true,
|
||||
'__experimentalLetterSpacing' => true,
|
||||
'__experimentalTextTransform' => true,
|
||||
'__experimentalWritingMode' => true,
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
@ -3396,7 +3493,7 @@
|
||||
'$schema' => 'https://schemas.wp.org/trunk/block.json',
|
||||
'apiVersion' => 3,
|
||||
'name' => 'core/post-author',
|
||||
'title' => 'Post Author',
|
||||
'title' => 'Author',
|
||||
'category' => 'theme',
|
||||
'description' => 'Display post author details such as name, avatar, and bio.',
|
||||
'textdomain' => 'default',
|
||||
@ -3467,7 +3564,7 @@
|
||||
'$schema' => 'https://schemas.wp.org/trunk/block.json',
|
||||
'apiVersion' => 3,
|
||||
'name' => 'core/post-author-biography',
|
||||
'title' => 'Post Author Biography',
|
||||
'title' => 'Author Biography',
|
||||
'category' => 'theme',
|
||||
'description' => 'The author biography.',
|
||||
'textdomain' => 'default',
|
||||
@ -3512,7 +3609,7 @@
|
||||
'$schema' => 'https://schemas.wp.org/trunk/block.json',
|
||||
'apiVersion' => 3,
|
||||
'name' => 'core/post-author-name',
|
||||
'title' => 'Post Author Name',
|
||||
'title' => 'Author Name',
|
||||
'category' => 'theme',
|
||||
'description' => 'The author name.',
|
||||
'textdomain' => 'default',
|
||||
@ -3567,7 +3664,7 @@
|
||||
'$schema' => 'https://schemas.wp.org/trunk/block.json',
|
||||
'apiVersion' => 3,
|
||||
'name' => 'core/post-comments-form',
|
||||
'title' => 'Post Comments Form',
|
||||
'title' => 'Comments Form',
|
||||
'category' => 'theme',
|
||||
'description' => 'Display a post\'s comments form.',
|
||||
'textdomain' => 'default',
|
||||
@ -3584,6 +3681,7 @@
|
||||
'html' => false,
|
||||
'color' => array(
|
||||
'gradients' => true,
|
||||
'heading' => true,
|
||||
'link' => true,
|
||||
'__experimentalDefaultControls' => array(
|
||||
'background' => true,
|
||||
@ -3617,7 +3715,7 @@
|
||||
'$schema' => 'https://schemas.wp.org/trunk/block.json',
|
||||
'apiVersion' => 3,
|
||||
'name' => 'core/post-content',
|
||||
'title' => 'Post Content',
|
||||
'title' => 'Content',
|
||||
'category' => 'theme',
|
||||
'description' => 'Displays the contents of a post or page.',
|
||||
'textdomain' => 'default',
|
||||
@ -3636,6 +3734,17 @@
|
||||
'dimensions' => array(
|
||||
'minHeight' => true
|
||||
),
|
||||
'spacing' => array(
|
||||
'blockGap' => true
|
||||
),
|
||||
'color' => array(
|
||||
'gradients' => true,
|
||||
'link' => true,
|
||||
'__experimentalDefaultControls' => array(
|
||||
'background' => false,
|
||||
'text' => false
|
||||
)
|
||||
),
|
||||
'typography' => array(
|
||||
'fontSize' => true,
|
||||
'lineHeight' => true,
|
||||
@ -3656,9 +3765,9 @@
|
||||
'$schema' => 'https://schemas.wp.org/trunk/block.json',
|
||||
'apiVersion' => 3,
|
||||
'name' => 'core/post-date',
|
||||
'title' => 'Post Date',
|
||||
'title' => 'Date',
|
||||
'category' => 'theme',
|
||||
'description' => 'Add the date of this post.',
|
||||
'description' => 'Display the publish date for an entry such as a post or page.',
|
||||
'textdomain' => 'default',
|
||||
'attributes' => array(
|
||||
'textAlign' => array(
|
||||
@ -3776,7 +3885,7 @@
|
||||
'$schema' => 'https://schemas.wp.org/trunk/block.json',
|
||||
'apiVersion' => 3,
|
||||
'name' => 'core/post-featured-image',
|
||||
'title' => 'Post Featured Image',
|
||||
'title' => 'Featured Image',
|
||||
'category' => 'theme',
|
||||
'description' => 'Display a post\'s featured image.',
|
||||
'textdomain' => 'default',
|
||||
@ -3913,6 +4022,7 @@
|
||||
'__experimentalTextTransform' => true,
|
||||
'__experimentalTextDecoration' => true,
|
||||
'__experimentalLetterSpacing' => true,
|
||||
'__experimentalWritingMode' => true,
|
||||
'__experimentalDefaultControls' => array(
|
||||
'fontSize' => true
|
||||
)
|
||||
@ -3937,7 +4047,8 @@
|
||||
'queryContext',
|
||||
'displayLayout',
|
||||
'templateSlug',
|
||||
'previewPostType'
|
||||
'previewPostType',
|
||||
'enhancedPagination'
|
||||
),
|
||||
'supports' => array(
|
||||
'reusable' => false,
|
||||
@ -4142,6 +4253,10 @@
|
||||
'text' => true
|
||||
)
|
||||
),
|
||||
'spacing' => array(
|
||||
'padding' => true,
|
||||
'margin' => true
|
||||
),
|
||||
'typography' => array(
|
||||
'fontSize' => true,
|
||||
'lineHeight' => true,
|
||||
@ -4277,12 +4392,17 @@
|
||||
),
|
||||
'namespace' => array(
|
||||
'type' => 'string'
|
||||
),
|
||||
'enhancedPagination' => array(
|
||||
'type' => 'boolean',
|
||||
'default' => false
|
||||
)
|
||||
),
|
||||
'providesContext' => array(
|
||||
'queryId' => 'queryId',
|
||||
'query' => 'query',
|
||||
'displayLayout' => 'displayLayout'
|
||||
'displayLayout' => 'displayLayout',
|
||||
'enhancedPagination' => 'enhancedPagination'
|
||||
),
|
||||
'supports' => array(
|
||||
'align' => array(
|
||||
@ -4292,7 +4412,9 @@
|
||||
'html' => false,
|
||||
'layout' => true
|
||||
),
|
||||
'editorStyle' => 'wp-block-query-editor'
|
||||
'editorStyle' => 'wp-block-query-editor',
|
||||
'style' => 'wp-block-query',
|
||||
'viewScript' => 'file:./view.min.js'
|
||||
),
|
||||
'query-no-results' => array(
|
||||
'$schema' => 'https://schemas.wp.org/trunk/block.json',
|
||||
@ -4418,7 +4540,8 @@
|
||||
'queryId',
|
||||
'query',
|
||||
'paginationArrow',
|
||||
'showLabel'
|
||||
'showLabel',
|
||||
'enhancedPagination'
|
||||
),
|
||||
'supports' => array(
|
||||
'reusable' => false,
|
||||
@ -4456,9 +4579,16 @@
|
||||
),
|
||||
'description' => 'Displays a list of page numbers for pagination',
|
||||
'textdomain' => 'default',
|
||||
'attributes' => array(
|
||||
'midSize' => array(
|
||||
'type' => 'number',
|
||||
'default' => 2
|
||||
)
|
||||
),
|
||||
'usesContext' => array(
|
||||
'queryId',
|
||||
'query'
|
||||
'query',
|
||||
'enhancedPagination'
|
||||
),
|
||||
'supports' => array(
|
||||
'reusable' => false,
|
||||
@ -4506,7 +4636,8 @@
|
||||
'queryId',
|
||||
'query',
|
||||
'paginationArrow',
|
||||
'showLabel'
|
||||
'showLabel',
|
||||
'enhancedPagination'
|
||||
),
|
||||
'supports' => array(
|
||||
'reusable' => false,
|
||||
@ -4632,6 +4763,7 @@
|
||||
'anchor' => true,
|
||||
'html' => false,
|
||||
'__experimentalOnEnter' => true,
|
||||
'__experimentalOnMerge' => true,
|
||||
'typography' => array(
|
||||
'fontSize' => true,
|
||||
'lineHeight' => true,
|
||||
@ -4648,6 +4780,7 @@
|
||||
),
|
||||
'color' => array(
|
||||
'gradients' => true,
|
||||
'heading' => true,
|
||||
'link' => true,
|
||||
'__experimentalDefaultControls' => array(
|
||||
'background' => true,
|
||||
@ -4855,6 +4988,7 @@
|
||||
'text' => true
|
||||
)
|
||||
),
|
||||
'interactivity' => true,
|
||||
'typography' => array(
|
||||
'__experimentalSkipSerialization' => true,
|
||||
'__experimentalSelector' => '.wp-block-search__label, .wp-block-search__input, .wp-block-search__button',
|
||||
|
@ -9,6 +9,15 @@
|
||||
"keywords": [ "link" ],
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
"tagName": {
|
||||
"type": "string",
|
||||
"enum": [ "a", "button" ],
|
||||
"default": "a"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"default": "button"
|
||||
},
|
||||
"textAlign": {
|
||||
"type": "string"
|
||||
},
|
||||
@ -22,14 +31,14 @@
|
||||
"title": {
|
||||
"type": "string",
|
||||
"source": "attribute",
|
||||
"selector": "a",
|
||||
"selector": "a,button",
|
||||
"attribute": "title",
|
||||
"__experimentalRole": "content"
|
||||
},
|
||||
"text": {
|
||||
"type": "string",
|
||||
"source": "html",
|
||||
"selector": "a",
|
||||
"selector": "a,button",
|
||||
"__experimentalRole": "content"
|
||||
},
|
||||
"linkTarget": {
|
||||
|
@ -44,12 +44,12 @@ function render_block_core_calendar( $attributes ) {
|
||||
|
||||
// Text color.
|
||||
$preset_text_color = array_key_exists( 'textColor', $attributes ) ? "var:preset|color|{$attributes['textColor']}" : null;
|
||||
$custom_text_color = _wp_array_get( $attributes, array( 'style', 'color', 'text' ), null );
|
||||
$custom_text_color = $attributes['style']['color']['text'] ?? null;
|
||||
$color_block_styles['text'] = $preset_text_color ? $preset_text_color : $custom_text_color;
|
||||
|
||||
// Background Color.
|
||||
$preset_background_color = array_key_exists( 'backgroundColor', $attributes ) ? "var:preset|color|{$attributes['backgroundColor']}" : null;
|
||||
$custom_background_color = _wp_array_get( $attributes, array( 'style', 'color', 'background' ), null );
|
||||
$custom_background_color = $attributes['style']['color']['background'] ?? null;
|
||||
$color_block_styles['background'] = $preset_background_color ? $preset_background_color : $custom_background_color;
|
||||
|
||||
// Generate color styles and classes.
|
||||
|
@ -10,7 +10,8 @@
|
||||
"content": {
|
||||
"type": "string",
|
||||
"source": "html",
|
||||
"selector": "code"
|
||||
"selector": "code",
|
||||
"__unstablePreserveWhiteSpace": true
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
|
@ -23,11 +23,14 @@
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
"__experimentalOnEnter": true,
|
||||
"anchor": true,
|
||||
"reusable": false,
|
||||
"html": false,
|
||||
"color": {
|
||||
"gradients": true,
|
||||
"heading": true,
|
||||
"button": true,
|
||||
"link": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"background": true,
|
||||
|
@ -26,6 +26,8 @@
|
||||
"color": {
|
||||
"gradients": true,
|
||||
"link": true,
|
||||
"heading": true,
|
||||
"button": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"background": true,
|
||||
"text": true
|
||||
|
@ -66,6 +66,9 @@
|
||||
.wp-block-column.is-vertically-aligned-bottom{
|
||||
align-self:flex-end;
|
||||
}
|
||||
.wp-block-column.is-vertically-aligned-stretch{
|
||||
align-self:stretch;
|
||||
}
|
||||
.wp-block-column.is-vertically-aligned-bottom,.wp-block-column.is-vertically-aligned-center,.wp-block-column.is-vertically-aligned-top{
|
||||
width:100%;
|
||||
}
|
2
wp-includes/blocks/columns/style-rtl.min.css
vendored
2
wp-includes/blocks/columns/style-rtl.min.css
vendored
@ -1 +1 @@
|
||||
.wp-block-columns{align-items:normal!important;box-sizing:border-box;display:flex;flex-wrap:wrap!important}@media (min-width:782px){.wp-block-columns{flex-wrap:nowrap!important}}.wp-block-columns.are-vertically-aligned-top{align-items:flex-start}.wp-block-columns.are-vertically-aligned-center{align-items:center}.wp-block-columns.are-vertically-aligned-bottom{align-items:flex-end}@media (max-width:781px){.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column{flex-basis:100%!important}}@media (min-width:782px){.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column{flex-basis:0;flex-grow:1}.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column[style*=flex-basis]{flex-grow:0}}.wp-block-columns.is-not-stacked-on-mobile{flex-wrap:nowrap!important}.wp-block-columns.is-not-stacked-on-mobile>.wp-block-column{flex-basis:0;flex-grow:1}.wp-block-columns.is-not-stacked-on-mobile>.wp-block-column[style*=flex-basis]{flex-grow:0}:where(.wp-block-columns){margin-bottom:1.75em}:where(.wp-block-columns.has-background){padding:1.25em 2.375em}.wp-block-column{flex-grow:1;min-width:0;overflow-wrap:break-word;word-break:break-word}.wp-block-column.is-vertically-aligned-top{align-self:flex-start}.wp-block-column.is-vertically-aligned-center{align-self:center}.wp-block-column.is-vertically-aligned-bottom{align-self:flex-end}.wp-block-column.is-vertically-aligned-bottom,.wp-block-column.is-vertically-aligned-center,.wp-block-column.is-vertically-aligned-top{width:100%}
|
||||
.wp-block-columns{align-items:normal!important;box-sizing:border-box;display:flex;flex-wrap:wrap!important}@media (min-width:782px){.wp-block-columns{flex-wrap:nowrap!important}}.wp-block-columns.are-vertically-aligned-top{align-items:flex-start}.wp-block-columns.are-vertically-aligned-center{align-items:center}.wp-block-columns.are-vertically-aligned-bottom{align-items:flex-end}@media (max-width:781px){.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column{flex-basis:100%!important}}@media (min-width:782px){.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column{flex-basis:0;flex-grow:1}.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column[style*=flex-basis]{flex-grow:0}}.wp-block-columns.is-not-stacked-on-mobile{flex-wrap:nowrap!important}.wp-block-columns.is-not-stacked-on-mobile>.wp-block-column{flex-basis:0;flex-grow:1}.wp-block-columns.is-not-stacked-on-mobile>.wp-block-column[style*=flex-basis]{flex-grow:0}:where(.wp-block-columns){margin-bottom:1.75em}:where(.wp-block-columns.has-background){padding:1.25em 2.375em}.wp-block-column{flex-grow:1;min-width:0;overflow-wrap:break-word;word-break:break-word}.wp-block-column.is-vertically-aligned-top{align-self:flex-start}.wp-block-column.is-vertically-aligned-center{align-self:center}.wp-block-column.is-vertically-aligned-bottom{align-self:flex-end}.wp-block-column.is-vertically-aligned-stretch{align-self:stretch}.wp-block-column.is-vertically-aligned-bottom,.wp-block-column.is-vertically-aligned-center,.wp-block-column.is-vertically-aligned-top{width:100%}
|
@ -66,6 +66,9 @@
|
||||
.wp-block-column.is-vertically-aligned-bottom{
|
||||
align-self:flex-end;
|
||||
}
|
||||
.wp-block-column.is-vertically-aligned-stretch{
|
||||
align-self:stretch;
|
||||
}
|
||||
.wp-block-column.is-vertically-aligned-bottom,.wp-block-column.is-vertically-aligned-center,.wp-block-column.is-vertically-aligned-top{
|
||||
width:100%;
|
||||
}
|
2
wp-includes/blocks/columns/style.min.css
vendored
2
wp-includes/blocks/columns/style.min.css
vendored
@ -1 +1 @@
|
||||
.wp-block-columns{align-items:normal!important;box-sizing:border-box;display:flex;flex-wrap:wrap!important}@media (min-width:782px){.wp-block-columns{flex-wrap:nowrap!important}}.wp-block-columns.are-vertically-aligned-top{align-items:flex-start}.wp-block-columns.are-vertically-aligned-center{align-items:center}.wp-block-columns.are-vertically-aligned-bottom{align-items:flex-end}@media (max-width:781px){.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column{flex-basis:100%!important}}@media (min-width:782px){.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column{flex-basis:0;flex-grow:1}.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column[style*=flex-basis]{flex-grow:0}}.wp-block-columns.is-not-stacked-on-mobile{flex-wrap:nowrap!important}.wp-block-columns.is-not-stacked-on-mobile>.wp-block-column{flex-basis:0;flex-grow:1}.wp-block-columns.is-not-stacked-on-mobile>.wp-block-column[style*=flex-basis]{flex-grow:0}:where(.wp-block-columns){margin-bottom:1.75em}:where(.wp-block-columns.has-background){padding:1.25em 2.375em}.wp-block-column{flex-grow:1;min-width:0;overflow-wrap:break-word;word-break:break-word}.wp-block-column.is-vertically-aligned-top{align-self:flex-start}.wp-block-column.is-vertically-aligned-center{align-self:center}.wp-block-column.is-vertically-aligned-bottom{align-self:flex-end}.wp-block-column.is-vertically-aligned-bottom,.wp-block-column.is-vertically-aligned-center,.wp-block-column.is-vertically-aligned-top{width:100%}
|
||||
.wp-block-columns{align-items:normal!important;box-sizing:border-box;display:flex;flex-wrap:wrap!important}@media (min-width:782px){.wp-block-columns{flex-wrap:nowrap!important}}.wp-block-columns.are-vertically-aligned-top{align-items:flex-start}.wp-block-columns.are-vertically-aligned-center{align-items:center}.wp-block-columns.are-vertically-aligned-bottom{align-items:flex-end}@media (max-width:781px){.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column{flex-basis:100%!important}}@media (min-width:782px){.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column{flex-basis:0;flex-grow:1}.wp-block-columns:not(.is-not-stacked-on-mobile)>.wp-block-column[style*=flex-basis]{flex-grow:0}}.wp-block-columns.is-not-stacked-on-mobile{flex-wrap:nowrap!important}.wp-block-columns.is-not-stacked-on-mobile>.wp-block-column{flex-basis:0;flex-grow:1}.wp-block-columns.is-not-stacked-on-mobile>.wp-block-column[style*=flex-basis]{flex-grow:0}:where(.wp-block-columns){margin-bottom:1.75em}:where(.wp-block-columns.has-background){padding:1.25em 2.375em}.wp-block-column{flex-grow:1;min-width:0;overflow-wrap:break-word;word-break:break-word}.wp-block-column.is-vertically-aligned-top{align-self:flex-start}.wp-block-column.is-vertically-aligned-center{align-self:center}.wp-block-column.is-vertically-aligned-bottom{align-self:flex-end}.wp-block-column.is-vertically-aligned-stretch{align-self:stretch}.wp-block-column.is-vertically-aligned-bottom,.wp-block-column.is-vertically-aligned-center,.wp-block-column.is-vertically-aligned-top{width:100%}
|
@ -28,7 +28,7 @@ function block_core_comment_template_render_comments( $comments, $block ) {
|
||||
$content = '';
|
||||
foreach ( $comments as $comment ) {
|
||||
$comment_id = $comment->comment_ID;
|
||||
$filter_block_context = static function( $context ) use ( $comment_id ) {
|
||||
$filter_block_context = static function ( $context ) use ( $comment_id ) {
|
||||
$context['commentId'] = $comment_id;
|
||||
return $context;
|
||||
};
|
||||
|
@ -26,7 +26,7 @@ function render_block_core_comments_pagination_next( $attributes, $content, $blo
|
||||
$label = isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ? $attributes['label'] : $default_label;
|
||||
$pagination_arrow = get_comments_pagination_arrow( $block, 'next' );
|
||||
|
||||
$filter_link_attributes = static function() {
|
||||
$filter_link_attributes = static function () {
|
||||
return get_block_wrapper_attributes();
|
||||
};
|
||||
add_filter( 'next_comments_link_attributes', $filter_link_attributes );
|
||||
|
@ -22,7 +22,7 @@ function render_block_core_comments_pagination_previous( $attributes, $content,
|
||||
$label = $pagination_arrow . $label;
|
||||
}
|
||||
|
||||
$filter_link_attributes = static function() {
|
||||
$filter_link_attributes = static function () {
|
||||
return get_block_wrapper_attributes();
|
||||
};
|
||||
add_filter( 'previous_comments_link_attributes', $filter_link_attributes );
|
||||
|
@ -21,6 +21,7 @@
|
||||
"html": false,
|
||||
"color": {
|
||||
"gradients": true,
|
||||
"heading": true,
|
||||
"link": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"background": true,
|
||||
|
@ -108,9 +108,11 @@
|
||||
},
|
||||
"color": {
|
||||
"__experimentalDuotone": "> .wp-block-cover__image-background, > .wp-block-cover__video-background",
|
||||
"heading": true,
|
||||
"text": true,
|
||||
"background": false,
|
||||
"__experimentalSkipSerialization": [ "gradients" ]
|
||||
"__experimentalSkipSerialization": [ "gradients" ],
|
||||
"enableContrastChecker": false
|
||||
},
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
|
@ -156,6 +156,9 @@
|
||||
}
|
||||
.wp-block-cover-image.has-custom-content-position.has-custom-content-position .wp-block-cover__inner-container,.wp-block-cover.has-custom-content-position.has-custom-content-position .wp-block-cover__inner-container{
|
||||
margin:0;
|
||||
}
|
||||
.wp-block-cover-image.has-custom-content-position.has-custom-content-position.is-position-bottom-left .wp-block-cover__inner-container,.wp-block-cover-image.has-custom-content-position.has-custom-content-position.is-position-bottom-right .wp-block-cover__inner-container,.wp-block-cover-image.has-custom-content-position.has-custom-content-position.is-position-center-left .wp-block-cover__inner-container,.wp-block-cover-image.has-custom-content-position.has-custom-content-position.is-position-center-right .wp-block-cover__inner-container,.wp-block-cover-image.has-custom-content-position.has-custom-content-position.is-position-top-left .wp-block-cover__inner-container,.wp-block-cover-image.has-custom-content-position.has-custom-content-position.is-position-top-right .wp-block-cover__inner-container,.wp-block-cover.has-custom-content-position.has-custom-content-position.is-position-bottom-left .wp-block-cover__inner-container,.wp-block-cover.has-custom-content-position.has-custom-content-position.is-position-bottom-right .wp-block-cover__inner-container,.wp-block-cover.has-custom-content-position.has-custom-content-position.is-position-center-left .wp-block-cover__inner-container,.wp-block-cover.has-custom-content-position.has-custom-content-position.is-position-center-right .wp-block-cover__inner-container,.wp-block-cover.has-custom-content-position.has-custom-content-position.is-position-top-left .wp-block-cover__inner-container,.wp-block-cover.has-custom-content-position.has-custom-content-position.is-position-top-right .wp-block-cover__inner-container{
|
||||
margin:0;
|
||||
width:auto;
|
||||
}
|
||||
.wp-block-cover .wp-block-cover__image-background,.wp-block-cover video.wp-block-cover__video-background,.wp-block-cover-image .wp-block-cover__image-background,.wp-block-cover-image video.wp-block-cover__video-background{
|
||||
|
2
wp-includes/blocks/cover/style-rtl.min.css
vendored
2
wp-includes/blocks/cover/style-rtl.min.css
vendored
File diff suppressed because one or more lines are too long
@ -156,6 +156,9 @@
|
||||
}
|
||||
.wp-block-cover-image.has-custom-content-position.has-custom-content-position .wp-block-cover__inner-container,.wp-block-cover.has-custom-content-position.has-custom-content-position .wp-block-cover__inner-container{
|
||||
margin:0;
|
||||
}
|
||||
.wp-block-cover-image.has-custom-content-position.has-custom-content-position.is-position-bottom-left .wp-block-cover__inner-container,.wp-block-cover-image.has-custom-content-position.has-custom-content-position.is-position-bottom-right .wp-block-cover__inner-container,.wp-block-cover-image.has-custom-content-position.has-custom-content-position.is-position-center-left .wp-block-cover__inner-container,.wp-block-cover-image.has-custom-content-position.has-custom-content-position.is-position-center-right .wp-block-cover__inner-container,.wp-block-cover-image.has-custom-content-position.has-custom-content-position.is-position-top-left .wp-block-cover__inner-container,.wp-block-cover-image.has-custom-content-position.has-custom-content-position.is-position-top-right .wp-block-cover__inner-container,.wp-block-cover.has-custom-content-position.has-custom-content-position.is-position-bottom-left .wp-block-cover__inner-container,.wp-block-cover.has-custom-content-position.has-custom-content-position.is-position-bottom-right .wp-block-cover__inner-container,.wp-block-cover.has-custom-content-position.has-custom-content-position.is-position-center-left .wp-block-cover__inner-container,.wp-block-cover.has-custom-content-position.has-custom-content-position.is-position-center-right .wp-block-cover__inner-container,.wp-block-cover.has-custom-content-position.has-custom-content-position.is-position-top-left .wp-block-cover__inner-container,.wp-block-cover.has-custom-content-position.has-custom-content-position.is-position-top-right .wp-block-cover__inner-container{
|
||||
margin:0;
|
||||
width:auto;
|
||||
}
|
||||
.wp-block-cover .wp-block-cover__image-background,.wp-block-cover video.wp-block-cover__video-background,.wp-block-cover-image .wp-block-cover__image-background,.wp-block-cover-image video.wp-block-cover__video-background{
|
||||
|
2
wp-includes/blocks/cover/style.min.css
vendored
2
wp-includes/blocks/cover/style.min.css
vendored
File diff suppressed because one or more lines are too long
@ -5,7 +5,7 @@
|
||||
"title": "Details",
|
||||
"category": "text",
|
||||
"description": "Hide and show additional content.",
|
||||
"keywords": [ "disclosure", "summary", "hide" ],
|
||||
"keywords": [ "accordion", "summary", "toggle", "disclosure" ],
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
"showContent": {
|
||||
@ -13,7 +13,9 @@
|
||||
"default": false
|
||||
},
|
||||
"summary": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"source": "html",
|
||||
"selector": "summary"
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
@ -35,6 +37,7 @@
|
||||
"spacing": {
|
||||
"margin": true,
|
||||
"padding": true,
|
||||
"blockGap": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"margin": false,
|
||||
"padding": false
|
||||
@ -52,6 +55,9 @@
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"layout": {
|
||||
"allowEditing": false
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-details-editor",
|
||||
|
@ -6,12 +6,3 @@
|
||||
.wp-block-details summary{
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.wp-block-details>:not(summary){
|
||||
margin-block-end:0;
|
||||
margin-block-start:var(--wp--style--block-gap);
|
||||
}
|
||||
|
||||
.wp-block-details>:last-child{
|
||||
margin-bottom:0;
|
||||
}
|
2
wp-includes/blocks/details/style-rtl.min.css
vendored
2
wp-includes/blocks/details/style-rtl.min.css
vendored
@ -1 +1 @@
|
||||
.wp-block-details{box-sizing:border-box;overflow:hidden}.wp-block-details summary{cursor:pointer}.wp-block-details>:not(summary){margin-block-end:0;margin-block-start:var(--wp--style--block-gap)}.wp-block-details>:last-child{margin-bottom:0}
|
||||
.wp-block-details{box-sizing:border-box;overflow:hidden}.wp-block-details summary{cursor:pointer}
|
@ -6,12 +6,3 @@
|
||||
.wp-block-details summary{
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.wp-block-details>:not(summary){
|
||||
margin-block-end:0;
|
||||
margin-block-start:var(--wp--style--block-gap);
|
||||
}
|
||||
|
||||
.wp-block-details>:last-child{
|
||||
margin-bottom:0;
|
||||
}
|
2
wp-includes/blocks/details/style.min.css
vendored
2
wp-includes/blocks/details/style.min.css
vendored
@ -1 +1 @@
|
||||
.wp-block-details{box-sizing:border-box;overflow:hidden}.wp-block-details summary{cursor:pointer}.wp-block-details>:not(summary){margin-block-end:0;margin-block-start:var(--wp--style--block-gap)}.wp-block-details>:last-child{margin-bottom:0}
|
||||
.wp-block-details{box-sizing:border-box;overflow:hidden}.wp-block-details summary{cursor:pointer}
|
@ -5,25 +5,8 @@
|
||||
* @package WordPress
|
||||
*/
|
||||
|
||||
if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
|
||||
/**
|
||||
* Replaces view script for the File block with version using Interactivity API.
|
||||
*
|
||||
* @param array $metadata Block metadata as read in via block.json.
|
||||
*
|
||||
* @return array Filtered block type metadata.
|
||||
*/
|
||||
function gutenberg_block_core_file_update_interactive_view_script( $metadata ) {
|
||||
if ( 'core/file' === $metadata['name'] ) {
|
||||
$metadata['viewScript'] = array( 'file:./interactivity.min.js' );
|
||||
}
|
||||
return $metadata;
|
||||
}
|
||||
add_filter( 'block_type_metadata', 'gutenberg_block_core_file_update_interactive_view_script', 10, 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* When the `core/file` block is rendering, check if we need to enqueue the `'wp-block-file-view` script.
|
||||
* When the `core/file` block is rendering, check if we need to enqueue the `wp-block-file-view` script.
|
||||
*
|
||||
* @param array $attributes The block attributes.
|
||||
* @param string $content The block content.
|
||||
@ -71,19 +54,37 @@ function render_block_core_file( $attributes, $content, $block ) {
|
||||
);
|
||||
|
||||
// If it uses the Interactivity API, add the directives.
|
||||
if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN && $should_load_view_script ) {
|
||||
if ( $should_load_view_script ) {
|
||||
$processor = new WP_HTML_Tag_Processor( $content );
|
||||
$processor->next_tag();
|
||||
$processor->set_attribute( 'data-wp-interactive', '' );
|
||||
$processor->next_tag( 'object' );
|
||||
$processor->set_attribute( 'data-wp-bind--hidden', '!selectors.core.file.hasPdfPreview' );
|
||||
$processor->set_attribute( 'hidden', true );
|
||||
$processor->set_attribute( 'data-wp-style--display', 'selectors.core.file.hasPdfPreview' );
|
||||
return $processor->get_updated_html();
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that the view script has the `wp-interactivity` dependency.
|
||||
*
|
||||
* @since 6.4.0
|
||||
*
|
||||
* @global WP_Scripts $wp_scripts
|
||||
*/
|
||||
function block_core_file_ensure_interactivity_dependency() {
|
||||
global $wp_scripts;
|
||||
if (
|
||||
isset( $wp_scripts->registered['wp-block-file-view'] ) &&
|
||||
! in_array( 'wp-interactivity', $wp_scripts->registered['wp-block-file-view']->deps, true )
|
||||
) {
|
||||
$wp_scripts->registered['wp-block-file-view']->deps[] = 'wp-interactivity';
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'wp_print_scripts', 'block_core_file_ensure_interactivity_dependency' );
|
||||
|
||||
/**
|
||||
* Registers the `core/file` block on server.
|
||||
*/
|
||||
|
@ -57,6 +57,10 @@
|
||||
"supports": {
|
||||
"anchor": true,
|
||||
"align": true,
|
||||
"spacing": {
|
||||
"margin": true,
|
||||
"padding": true
|
||||
},
|
||||
"color": {
|
||||
"gradients": true,
|
||||
"link": true,
|
||||
@ -65,7 +69,8 @@
|
||||
"background": true,
|
||||
"link": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"interactivity": true
|
||||
},
|
||||
"viewScript": "file:./view.min.js",
|
||||
"editorStyle": "wp-block-file-editor",
|
||||
|
@ -1,3 +1,6 @@
|
||||
.wp-block-file{
|
||||
box-sizing:border-box;
|
||||
}
|
||||
.wp-block-file:not(.wp-element-button){
|
||||
font-size:.8em;
|
||||
}
|
||||
@ -19,6 +22,11 @@
|
||||
margin-bottom:1em;
|
||||
}
|
||||
|
||||
@media (max-width:768px){
|
||||
.wp-block-file__embed{
|
||||
display:none;
|
||||
}
|
||||
}
|
||||
:where(.wp-block-file__button){
|
||||
border-radius:2em;
|
||||
display:inline-block;
|
||||
|
2
wp-includes/blocks/file/style-rtl.min.css
vendored
2
wp-includes/blocks/file/style-rtl.min.css
vendored
@ -1 +1 @@
|
||||
.wp-block-file:not(.wp-element-button){font-size:.8em}.wp-block-file.aligncenter{text-align:center}.wp-block-file.alignright{text-align:right}.wp-block-file *+.wp-block-file__button{margin-right:.75em}:where(.wp-block-file){margin-bottom:1.5em}.wp-block-file__embed{margin-bottom:1em}:where(.wp-block-file__button){border-radius:2em;display:inline-block;padding:.5em 1em}:where(.wp-block-file__button):is(a):active,:where(.wp-block-file__button):is(a):focus,:where(.wp-block-file__button):is(a):hover,:where(.wp-block-file__button):is(a):visited{box-shadow:none;color:#fff;opacity:.85;text-decoration:none}
|
||||
.wp-block-file{box-sizing:border-box}.wp-block-file:not(.wp-element-button){font-size:.8em}.wp-block-file.aligncenter{text-align:center}.wp-block-file.alignright{text-align:right}.wp-block-file *+.wp-block-file__button{margin-right:.75em}:where(.wp-block-file){margin-bottom:1.5em}.wp-block-file__embed{margin-bottom:1em}@media (max-width:768px){.wp-block-file__embed{display:none}}:where(.wp-block-file__button){border-radius:2em;display:inline-block;padding:.5em 1em}:where(.wp-block-file__button):is(a):active,:where(.wp-block-file__button):is(a):focus,:where(.wp-block-file__button):is(a):hover,:where(.wp-block-file__button):is(a):visited{box-shadow:none;color:#fff;opacity:.85;text-decoration:none}
|
@ -1,3 +1,6 @@
|
||||
.wp-block-file{
|
||||
box-sizing:border-box;
|
||||
}
|
||||
.wp-block-file:not(.wp-element-button){
|
||||
font-size:.8em;
|
||||
}
|
||||
@ -19,6 +22,11 @@
|
||||
margin-bottom:1em;
|
||||
}
|
||||
|
||||
@media (max-width:768px){
|
||||
.wp-block-file__embed{
|
||||
display:none;
|
||||
}
|
||||
}
|
||||
:where(.wp-block-file__button){
|
||||
border-radius:2em;
|
||||
display:inline-block;
|
||||
|
2
wp-includes/blocks/file/style.min.css
vendored
2
wp-includes/blocks/file/style.min.css
vendored
@ -1 +1 @@
|
||||
.wp-block-file:not(.wp-element-button){font-size:.8em}.wp-block-file.aligncenter{text-align:center}.wp-block-file.alignright{text-align:right}.wp-block-file *+.wp-block-file__button{margin-left:.75em}:where(.wp-block-file){margin-bottom:1.5em}.wp-block-file__embed{margin-bottom:1em}:where(.wp-block-file__button){border-radius:2em;display:inline-block;padding:.5em 1em}:where(.wp-block-file__button):is(a):active,:where(.wp-block-file__button):is(a):focus,:where(.wp-block-file__button):is(a):hover,:where(.wp-block-file__button):is(a):visited{box-shadow:none;color:#fff;opacity:.85;text-decoration:none}
|
||||
.wp-block-file{box-sizing:border-box}.wp-block-file:not(.wp-element-button){font-size:.8em}.wp-block-file.aligncenter{text-align:center}.wp-block-file.alignright{text-align:right}.wp-block-file *+.wp-block-file__button{margin-left:.75em}:where(.wp-block-file){margin-bottom:1.5em}.wp-block-file__embed{margin-bottom:1em}@media (max-width:768px){.wp-block-file__embed{display:none}}:where(.wp-block-file__button){border-radius:2em;display:inline-block;padding:.5em 1em}:where(.wp-block-file__button):is(a):active,:where(.wp-block-file__button):is(a):focus,:where(.wp-block-file__button):is(a):hover,:where(.wp-block-file__button):is(a):visited{box-shadow:none;color:#fff;opacity:.85;text-decoration:none}
|
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '4d04e0384ecd085abe4c');
|
||||
<?php return array('dependencies' => array(), 'version' => 'fb3967e9bafc6e7ca2eb');
|
||||
|
@ -1,7 +1,12 @@
|
||||
/******/ (function() { // webpackBootstrap
|
||||
/******/ "use strict";
|
||||
var __webpack_exports__ = {};
|
||||
"use strict";
|
||||
(self["__WordPressPrivateInteractivityAPI__"] = self["__WordPressPrivateInteractivityAPI__"] || []).push([[81],{
|
||||
|
||||
/***/ 149:
|
||||
/***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
|
||||
|
||||
|
||||
// EXTERNAL MODULE: ./node_modules/@wordpress/interactivity/src/index.js + 15 modules
|
||||
var src = __webpack_require__(754);
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/utils/index.js
|
||||
/**
|
||||
* Uses a combination of user agent matching and feature detection to determine whether
|
||||
@ -13,25 +18,25 @@ const browserSupportsPdfs = () => {
|
||||
// Most mobile devices include "Mobi" in their UA.
|
||||
if (window.navigator.userAgent.indexOf('Mobi') > -1) {
|
||||
return false;
|
||||
} // Android tablets are the noteable exception.
|
||||
|
||||
}
|
||||
|
||||
// Android tablets are the noteable exception.
|
||||
if (window.navigator.userAgent.indexOf('Android') > -1) {
|
||||
return false;
|
||||
} // iPad pretends to be a Mac.
|
||||
|
||||
|
||||
if (window.navigator.userAgent.indexOf('Macintosh') > -1 && window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2) {
|
||||
return false;
|
||||
} // IE only supports PDFs when there's an ActiveX object available for it.
|
||||
|
||||
|
||||
if (!!(window.ActiveXObject || 'ActiveXObject' in window) && !(createActiveXObject('AcroPDF.PDF') || createActiveXObject('PDF.PdfCtrl'))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// iPad pretends to be a Mac.
|
||||
if (window.navigator.userAgent.indexOf('Macintosh') > -1 && window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// IE only supports PDFs when there's an ActiveX object available for it.
|
||||
if (!!(window.ActiveXObject || 'ActiveXObject' in window) && !(createActiveXObject('AcroPDF.PDF') || createActiveXObject('PDF.PdfCtrl'))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper function for creating ActiveX objects, catching any errors that are thrown
|
||||
* when it's generated.
|
||||
@ -39,39 +44,39 @@ const browserSupportsPdfs = () => {
|
||||
* @param {string} type The name of the ActiveX object to create.
|
||||
* @return {window.ActiveXObject|undefined} The generated ActiveXObject, or null if it failed.
|
||||
*/
|
||||
|
||||
const createActiveXObject = type => {
|
||||
let ax;
|
||||
|
||||
try {
|
||||
ax = new window.ActiveXObject(type);
|
||||
} catch (e) {
|
||||
ax = undefined;
|
||||
}
|
||||
|
||||
return ax;
|
||||
};
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/view.js
|
||||
/**
|
||||
* Hides all .wp-block-file__embed elements on the document. This function is only intended
|
||||
* to be run on the front-end, it may have weird side effects running in the block editor.
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
|
||||
const hidePdfEmbedsOnUnsupportedBrowsers = () => {
|
||||
if (!browserSupportsPdfs()) {
|
||||
const embeds = document.getElementsByClassName('wp-block-file__embed');
|
||||
Array.from(embeds).forEach(embed => {
|
||||
embed.style.display = 'none';
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/view.js
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
document.addEventListener('DOMContentLoaded', hidePdfEmbedsOnUnsupportedBrowsers);
|
||||
(0,src/* store */.h)({
|
||||
selectors: {
|
||||
core: {
|
||||
file: {
|
||||
hasPdfPreview: browserSupportsPdfs() ? 'inherit' : 'none'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/******/ })()
|
||||
;
|
||||
/***/ })
|
||||
|
||||
},
|
||||
/******/ function(__webpack_require__) { // webpackRuntimeModules
|
||||
/******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
|
||||
/******/ var __webpack_exports__ = (__webpack_exec__(149));
|
||||
/******/ }
|
||||
]);
|
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '9d287166f699a66eff3b');
|
||||
<?php return array('dependencies' => array(), 'version' => 'cf908645ea0e9c064392');
|
||||
|
2
wp-includes/blocks/file/view.min.js
vendored
2
wp-includes/blocks/file/view.min.js
vendored
@ -1 +1 @@
|
||||
!function(){"use strict";const n=n=>{let t;try{t=new window.ActiveXObject(n)}catch(n){t=void 0}return t};document.addEventListener("DOMContentLoaded",(()=>{if(window.navigator.userAgent.indexOf("Mobi")>-1||window.navigator.userAgent.indexOf("Android")>-1||window.navigator.userAgent.indexOf("Macintosh")>-1&&window.navigator.maxTouchPoints&&window.navigator.maxTouchPoints>2||(window.ActiveXObject||"ActiveXObject"in window)&&!n("AcroPDF.PDF")&&!n("PDF.PdfCtrl")){const n=document.getElementsByClassName("wp-block-file__embed");Array.from(n).forEach((n=>{n.style.display="none"}))}}))}();
|
||||
"use strict";(self.__WordPressPrivateInteractivityAPI__=self.__WordPressPrivateInteractivityAPI__||[]).push([[81],{149:function(i,t,n){var e=n(754);const o=i=>{let t;try{t=new window.ActiveXObject(i)}catch(i){t=void 0}return t};(0,e.h)({selectors:{core:{file:{hasPdfPreview:window.navigator.userAgent.indexOf("Mobi")>-1||window.navigator.userAgent.indexOf("Android")>-1||window.navigator.userAgent.indexOf("Macintosh")>-1&&window.navigator.maxTouchPoints&&window.navigator.maxTouchPoints>2||(window.ActiveXObject||"ActiveXObject"in window)&&!o("AcroPDF.PDF")&&!o("PDF.PdfCtrl")?"none":"inherit"}}}})}},function(i){var t;t=149,i(i.s=t)}]);
|
@ -9,9 +9,52 @@
|
||||
"textdomain": "default",
|
||||
"usesContext": [ "postId", "postType" ],
|
||||
"supports": {
|
||||
"__experimentalBorder": {
|
||||
"radius": true,
|
||||
"color": true,
|
||||
"width": true,
|
||||
"style": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"radius": false,
|
||||
"color": false,
|
||||
"width": false,
|
||||
"style": false
|
||||
}
|
||||
},
|
||||
"color": {
|
||||
"background": true,
|
||||
"link": true,
|
||||
"text": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"link": true,
|
||||
"text": true
|
||||
}
|
||||
},
|
||||
"html": false,
|
||||
"multiple": false,
|
||||
"reusable": false
|
||||
"reusable": false,
|
||||
"spacing": {
|
||||
"margin": true,
|
||||
"padding": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"margin": false,
|
||||
"padding": false
|
||||
}
|
||||
},
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
"lineHeight": true,
|
||||
"__experimentalFontFamily": true,
|
||||
"__experimentalTextDecoration": true,
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalWritingMode": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"style": "wp-block-footnotes"
|
||||
}
|
||||
|
@ -301,27 +301,31 @@ div[data-type="core/freeform"].is-selected .block-library-classic__toolbar{
|
||||
display:block;
|
||||
}
|
||||
|
||||
.block-editor-freeform-modal .block-editor-freeform-modal__content .mce-edit-area iframe{
|
||||
height:50vh !important;
|
||||
}
|
||||
@media (min-width:960px){
|
||||
.block-editor-freeform-modal .components-modal__frame{
|
||||
.block-editor-freeform-modal .block-editor-freeform-modal__content:not(.is-full-screen){
|
||||
height:9999rem;
|
||||
}
|
||||
.block-editor-freeform-modal .components-modal__frame .components-modal__header+div{
|
||||
.block-editor-freeform-modal .block-editor-freeform-modal__content .components-modal__header+div{
|
||||
height:100%;
|
||||
}
|
||||
.block-editor-freeform-modal .components-modal__frame .mce-tinymce{
|
||||
.block-editor-freeform-modal .block-editor-freeform-modal__content .mce-tinymce{
|
||||
height:calc(100% - 52px);
|
||||
}
|
||||
.block-editor-freeform-modal .components-modal__frame .mce-container-body{
|
||||
.block-editor-freeform-modal .block-editor-freeform-modal__content .mce-container-body{
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
height:100%;
|
||||
min-width:50vw;
|
||||
}
|
||||
.block-editor-freeform-modal .components-modal__frame .mce-edit-area{
|
||||
.block-editor-freeform-modal .block-editor-freeform-modal__content .mce-edit-area{
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
flex-grow:1;
|
||||
}
|
||||
.block-editor-freeform-modal .components-modal__frame .mce-edit-area iframe{
|
||||
.block-editor-freeform-modal .block-editor-freeform-modal__content .mce-edit-area iframe{
|
||||
flex-grow:1;
|
||||
height:10px !important;
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -301,27 +301,31 @@ div[data-type="core/freeform"].is-selected .block-library-classic__toolbar{
|
||||
display:block;
|
||||
}
|
||||
|
||||
.block-editor-freeform-modal .block-editor-freeform-modal__content .mce-edit-area iframe{
|
||||
height:50vh !important;
|
||||
}
|
||||
@media (min-width:960px){
|
||||
.block-editor-freeform-modal .components-modal__frame{
|
||||
.block-editor-freeform-modal .block-editor-freeform-modal__content:not(.is-full-screen){
|
||||
height:9999rem;
|
||||
}
|
||||
.block-editor-freeform-modal .components-modal__frame .components-modal__header+div{
|
||||
.block-editor-freeform-modal .block-editor-freeform-modal__content .components-modal__header+div{
|
||||
height:100%;
|
||||
}
|
||||
.block-editor-freeform-modal .components-modal__frame .mce-tinymce{
|
||||
.block-editor-freeform-modal .block-editor-freeform-modal__content .mce-tinymce{
|
||||
height:calc(100% - 52px);
|
||||
}
|
||||
.block-editor-freeform-modal .components-modal__frame .mce-container-body{
|
||||
.block-editor-freeform-modal .block-editor-freeform-modal__content .mce-container-body{
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
height:100%;
|
||||
min-width:50vw;
|
||||
}
|
||||
.block-editor-freeform-modal .components-modal__frame .mce-edit-area{
|
||||
.block-editor-freeform-modal .block-editor-freeform-modal__content .mce-edit-area{
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
flex-grow:1;
|
||||
}
|
||||
.block-editor-freeform-modal .components-modal__frame .mce-edit-area iframe{
|
||||
.block-editor-freeform-modal .block-editor-freeform-modal__content .mce-edit-area iframe{
|
||||
flex-grow:1;
|
||||
height:10px !important;
|
||||
}
|
||||
|
2
wp-includes/blocks/freeform/editor.min.css
vendored
2
wp-includes/blocks/freeform/editor.min.css
vendored
File diff suppressed because one or more lines are too long
@ -44,7 +44,7 @@ add_filter( 'render_block_data', 'block_core_gallery_data_id_backcompatibility'
|
||||
* @return string The content of the block being rendered.
|
||||
*/
|
||||
function block_core_gallery_render( $attributes, $content ) {
|
||||
$gap = _wp_array_get( $attributes, array( 'style', 'spacing', 'blockGap' ) );
|
||||
$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
|
||||
// because we only want to match against the value, not the CSS attribute.
|
||||
|
@ -61,10 +61,10 @@
|
||||
},
|
||||
"shortCodeTransforms": {
|
||||
"type": "array",
|
||||
"default": [],
|
||||
"items": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"default": []
|
||||
},
|
||||
"columns": {
|
||||
"type": "number",
|
||||
|
@ -22,13 +22,20 @@
|
||||
},
|
||||
"supports": {
|
||||
"__experimentalOnEnter": true,
|
||||
"__experimentalOnMerge": true,
|
||||
"__experimentalSettings": true,
|
||||
"__experimentalMetadata": true,
|
||||
"align": [ "wide", "full" ],
|
||||
"anchor": true,
|
||||
"ariaLabel": true,
|
||||
"html": false,
|
||||
"background": {
|
||||
"backgroundImage": true
|
||||
},
|
||||
"color": {
|
||||
"gradients": true,
|
||||
"heading": true,
|
||||
"button": true,
|
||||
"link": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"background": true,
|
||||
|
@ -55,6 +55,7 @@
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalTextDecoration": true,
|
||||
"__experimentalWritingMode": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true,
|
||||
"fontAppearance": true,
|
||||
|
@ -1,3 +1,6 @@
|
||||
h1.has-background,h2.has-background,h3.has-background,h4.has-background,h5.has-background,h6.has-background{
|
||||
padding:1.25em 2.375em;
|
||||
}
|
||||
h1.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h1.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h2.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h2.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h3.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h3.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h4.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h4.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h5.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h5.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h6.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h6.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]){
|
||||
rotate:180deg;
|
||||
}
|
2
wp-includes/blocks/heading/style-rtl.min.css
vendored
2
wp-includes/blocks/heading/style-rtl.min.css
vendored
@ -1 +1 @@
|
||||
h1.has-background,h2.has-background,h3.has-background,h4.has-background,h5.has-background,h6.has-background{padding:1.25em 2.375em}
|
||||
h1.has-background,h2.has-background,h3.has-background,h4.has-background,h5.has-background,h6.has-background{padding:1.25em 2.375em}h1.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h1.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h2.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h2.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h3.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h3.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h4.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h4.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h5.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h5.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h6.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h6.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]){rotate:180deg}
|
@ -1,3 +1,6 @@
|
||||
h1.has-background,h2.has-background,h3.has-background,h4.has-background,h5.has-background,h6.has-background{
|
||||
padding:1.25em 2.375em;
|
||||
}
|
||||
h1.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h1.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h2.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h2.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h3.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h3.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h4.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h4.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h5.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h5.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h6.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h6.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]){
|
||||
rotate:180deg;
|
||||
}
|
2
wp-includes/blocks/heading/style.min.css
vendored
2
wp-includes/blocks/heading/style.min.css
vendored
@ -1 +1 @@
|
||||
h1.has-background,h2.has-background,h3.has-background,h4.has-background,h5.has-background,h6.has-background{padding:1.25em 2.375em}
|
||||
h1.has-background,h2.has-background,h3.has-background,h4.has-background,h5.has-background,h6.has-background{padding:1.25em 2.375em}h1.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h1.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h2.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h2.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h3.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h3.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h4.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h4.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h5.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h5.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]),h6.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr]),h6.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl]){rotate:180deg}
|
@ -98,8 +98,15 @@ function block_core_home_link_build_li_wrapper_attributes( $context ) {
|
||||
$colors['css_classes'],
|
||||
$font_sizes['css_classes']
|
||||
);
|
||||
$classes[] = 'wp-block-navigation-item';
|
||||
$style_attribute = ( $colors['inline_styles'] . $font_sizes['inline_styles'] );
|
||||
$classes[] = 'wp-block-navigation-item';
|
||||
|
||||
if ( is_front_page() ) {
|
||||
$classes[] = 'current-menu-item';
|
||||
} elseif ( is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) {
|
||||
// Edge case where the Reading settings has a posts page set but not a static homepage.
|
||||
$classes[] = 'current-menu-item';
|
||||
}
|
||||
|
||||
$wrapper_attributes = get_block_wrapper_attributes(
|
||||
array(
|
||||
@ -124,8 +131,14 @@ function render_block_core_home_link( $attributes, $content, $block ) {
|
||||
if ( empty( $attributes['label'] ) ) {
|
||||
return '';
|
||||
}
|
||||
$aria_current = '';
|
||||
|
||||
$aria_current = is_home() || ( is_front_page() && 'page' === get_option( 'show_on_front' ) ) ? ' aria-current="page"' : '';
|
||||
if ( is_front_page() ) {
|
||||
$aria_current = ' aria-current="page"';
|
||||
} elseif ( is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) {
|
||||
// Edge case where the Reading settings has a posts page set but not a static homepage.
|
||||
$aria_current = ' aria-current="page"';
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
'<li %1$s><a class="wp-block-home-link__content wp-block-navigation-item__content" href="%2$s" rel="home"%3$s>%4$s</a></li>',
|
||||
|
@ -9,11 +9,12 @@
|
||||
* Renders the `core/image` block on the server,
|
||||
* adding a data-id attribute to the element if core/gallery has added on pre-render.
|
||||
*
|
||||
* @param array $attributes The block attributes.
|
||||
* @param string $content The block content.
|
||||
* @param array $attributes The block attributes.
|
||||
* @param string $content The block content.
|
||||
* @param WP_Block $block The block object.
|
||||
* @return string Returns the block content with the data-id attribute added.
|
||||
*/
|
||||
function render_block_core_image( $attributes, $content ) {
|
||||
function render_block_core_image( $attributes, $content, $block ) {
|
||||
|
||||
$processor = new WP_HTML_Tag_Processor( $content );
|
||||
$processor->next_tag( 'img' );
|
||||
@ -30,14 +31,280 @@ function render_block_core_image( $attributes, $content ) {
|
||||
$processor->set_attribute( 'data-id', $attributes['data-id'] );
|
||||
}
|
||||
|
||||
$lightbox_enabled = false;
|
||||
$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, flag the lightbox to be rendered.
|
||||
if ( isset( $lightbox_settings ) && 'none' === $link_destination ) {
|
||||
|
||||
if ( isset( $lightbox_settings['enabled'] ) && true === $lightbox_settings['enabled'] ) {
|
||||
$lightbox_enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If at least one block in the page has the lightbox, mark the block type as interactive.
|
||||
if ( $lightbox_enabled ) {
|
||||
$block->block_type->supports['interactivity'] = true;
|
||||
}
|
||||
|
||||
// Determine whether the view script should be enqueued or not.
|
||||
$view_js_file = 'wp-block-image-view';
|
||||
if ( ! wp_script_is( $view_js_file ) ) {
|
||||
$script_handles = $block->block_type->view_script_handles;
|
||||
|
||||
// If the script is not needed, and it is still in the `view_script_handles`, remove it.
|
||||
if ( ! $lightbox_enabled && in_array( $view_js_file, $script_handles, true ) ) {
|
||||
$block->block_type->view_script_handles = array_diff( $script_handles, array( $view_js_file ) );
|
||||
}
|
||||
// If the script is needed, but it was previously removed, add it again.
|
||||
if ( $lightbox_enabled && ! in_array( $view_js_file, $script_handles, true ) ) {
|
||||
$block->block_type->view_script_handles = array_merge( $script_handles, array( $view_js_file ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $lightbox_enabled ) {
|
||||
return block_core_image_render_lightbox( $processor->get_updated_html(), $block->parsed_block );
|
||||
}
|
||||
|
||||
return $processor->get_updated_html();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the lightboxEnabled flag to the block data.
|
||||
*
|
||||
* This is used to determine whether the lightbox should be rendered or not.
|
||||
*
|
||||
* @param array $block Block data.
|
||||
* @return array Filtered block data.
|
||||
*/
|
||||
function block_core_image_get_lightbox_settings( $block ) {
|
||||
// Get the lightbox setting from the block attributes.
|
||||
if ( isset( $block['attrs']['lightbox'] ) ) {
|
||||
$lightbox_settings = $block['attrs']['lightbox'];
|
||||
// If the lightbox setting is not set in the block attributes,
|
||||
// check the legacy lightbox settings that are set using the
|
||||
// `gutenberg_should_render_lightbox` filter.
|
||||
// We can remove this elseif statement when the legacy lightbox settings are removed.
|
||||
} elseif ( isset( $block['legacyLightboxSettings'] ) ) {
|
||||
$lightbox_settings = $block['legacyLightboxSettings'];
|
||||
}
|
||||
|
||||
if ( ! isset( $lightbox_settings ) ) {
|
||||
$lightbox_settings = wp_get_global_settings( array( 'lightbox' ), array( 'block_name' => 'core/image' ) );
|
||||
|
||||
// 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.
|
||||
if ( isset( $lightbox_settings['lightbox'] ) ) {
|
||||
$lightbox_settings = wp_get_global_settings( array( 'lightbox' ) );
|
||||
}
|
||||
}
|
||||
|
||||
return $lightbox_settings ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the directives and layout needed for the lightbox behavior.
|
||||
*
|
||||
* @param string $block_content Rendered block content.
|
||||
* @param array $block Block object.
|
||||
* @return string Filtered block content.
|
||||
*/
|
||||
function block_core_image_render_lightbox( $block_content, $block ) {
|
||||
$processor = new WP_HTML_Tag_Processor( $block_content );
|
||||
|
||||
$aria_label = __( 'Enlarge image' );
|
||||
|
||||
$alt_attribute = $processor->get_attribute( 'alt' );
|
||||
|
||||
if ( null !== $alt_attribute ) {
|
||||
$alt_attribute = trim( $alt_attribute );
|
||||
}
|
||||
|
||||
if ( $alt_attribute ) {
|
||||
/* translators: %s: Image alt text. */
|
||||
$aria_label = sprintf( __( 'Enlarge image: %s' ), $alt_attribute );
|
||||
}
|
||||
$content = $processor->get_updated_html();
|
||||
|
||||
// Currently, we are only enabling the zoom animation.
|
||||
$lightbox_animation = 'zoom';
|
||||
|
||||
// We want to store the src in the context so we can set it dynamically when the lightbox is opened.
|
||||
$z = new WP_HTML_Tag_Processor( $content );
|
||||
$z->next_tag( 'img' );
|
||||
|
||||
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'];
|
||||
$img_height = $img_metadata['height'];
|
||||
} else {
|
||||
$img_uploaded_src = $z->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( $content );
|
||||
$w->next_tag( 'figure' );
|
||||
$w->add_class( 'wp-lightbox-container' );
|
||||
$w->set_attribute( 'data-wp-interactive', true );
|
||||
|
||||
$w->set_attribute(
|
||||
'data-wp-context',
|
||||
sprintf(
|
||||
'{ "core":
|
||||
{ "image":
|
||||
{ "imageLoaded": false,
|
||||
"initialized": false,
|
||||
"lightboxEnabled": false,
|
||||
"hideAnimationEnabled": false,
|
||||
"preloadInitialized": false,
|
||||
"lightboxAnimation": "%s",
|
||||
"imageUploadedSrc": "%s",
|
||||
"imageCurrentSrc": "",
|
||||
"targetWidth": "%s",
|
||||
"targetHeight": "%s",
|
||||
"scaleAttr": "%s"
|
||||
}
|
||||
}
|
||||
}',
|
||||
$lightbox_animation,
|
||||
$img_uploaded_src,
|
||||
$img_width,
|
||||
$img_height,
|
||||
$scale_attr
|
||||
)
|
||||
);
|
||||
$w->next_tag( 'img' );
|
||||
$w->set_attribute( 'data-wp-init', 'effects.core.image.setCurrentSrc' );
|
||||
$w->set_attribute( 'data-wp-on--load', 'actions.core.image.handleLoad' );
|
||||
$w->set_attribute( 'data-wp-effect', 'effects.core.image.setButtonStyles' );
|
||||
$body_content = $w->get_updated_html();
|
||||
|
||||
// Wrap the image in the body content with a button.
|
||||
$img = null;
|
||||
preg_match( '/<img[^>]+>/', $body_content, $img );
|
||||
$button =
|
||||
'<button
|
||||
type="button"
|
||||
aria-haspopup="dialog"
|
||||
aria-label="' . esc_attr( $aria_label ) . '"
|
||||
data-wp-on--click="actions.core.image.showLightbox"
|
||||
data-wp-style--width="context.core.image.imageButtonWidth"
|
||||
data-wp-style--height="context.core.image.imageButtonHeight"
|
||||
data-wp-style--left="context.core.image.imageButtonLeft"
|
||||
data-wp-style--top="context.core.image.imageButtonTop"
|
||||
>
|
||||
</button>'
|
||||
. $img[0];
|
||||
$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( $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.core.image.imageCurrentSrc' );
|
||||
$m->set_attribute( 'data-wp-style--object-fit', 'selectors.core.image.lightboxObjectFit' );
|
||||
$initial_image_content = $m->get_updated_html();
|
||||
|
||||
$q = new WP_HTML_Tag_Processor( $content );
|
||||
$q->next_tag( 'figure' );
|
||||
$q->add_class( 'enlarged-image' );
|
||||
$q->next_tag( 'img' );
|
||||
|
||||
// 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', 'selectors.core.image.enlargedImgSrc' );
|
||||
$q->set_attribute( 'data-wp-style--object-fit', 'selectors.core.image.lightboxObjectFit' );
|
||||
$enlarged_image_content = $q->get_updated_html();
|
||||
|
||||
$background_color = esc_attr( wp_get_global_styles( array( 'color', 'background' ) ) );
|
||||
|
||||
$close_button_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="15" height="15" 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_color = esc_attr( wp_get_global_styles( array( 'color', 'text' ) ) );
|
||||
$dialog_label = $alt_attribute ? esc_attr( $alt_attribute ) : esc_attr__( 'Image' );
|
||||
$close_button_label = esc_attr__( 'Close' );
|
||||
|
||||
$lightbox_html = <<<HTML
|
||||
<div data-wp-body="" class="wp-lightbox-overlay $lightbox_animation"
|
||||
data-wp-bind--role="selectors.core.image.roleAttribute"
|
||||
aria-label="$dialog_label"
|
||||
data-wp-class--initialized="context.core.image.initialized"
|
||||
data-wp-class--active="context.core.image.lightboxEnabled"
|
||||
data-wp-class--hideAnimationEnabled="context.core.image.hideAnimationEnabled"
|
||||
data-wp-bind--aria-hidden="!context.core.image.lightboxEnabled"
|
||||
aria-hidden="true"
|
||||
data-wp-bind--aria-modal="context.core.image.lightboxEnabled"
|
||||
aria-modal="false"
|
||||
data-wp-effect="effects.core.image.initLightbox"
|
||||
data-wp-on--keydown="actions.core.image.handleKeydown"
|
||||
data-wp-on--mousewheel="actions.core.image.hideLightbox"
|
||||
data-wp-on--click="actions.core.image.hideLightbox"
|
||||
>
|
||||
<button type="button" aria-label="$close_button_label" style="fill: $close_button_color" class="close-button" data-wp-on--click="actions.core.image.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"></div>
|
||||
</div>
|
||||
HTML;
|
||||
|
||||
return str_replace( '</figure>', $lightbox_html . '</figure>', $body_content );
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that the view script has the `wp-interactivity` dependency.
|
||||
*
|
||||
* @since 6.4.0
|
||||
*
|
||||
* @global WP_Scripts $wp_scripts
|
||||
*/
|
||||
function block_core_image_ensure_interactivity_dependency() {
|
||||
global $wp_scripts;
|
||||
if (
|
||||
isset( $wp_scripts->registered['wp-block-image-view'] ) &&
|
||||
! in_array( 'wp-interactivity', $wp_scripts->registered['wp-block-image-view']->deps, true )
|
||||
) {
|
||||
$wp_scripts->registered['wp-block-image-view']->deps[] = 'wp-interactivity';
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'wp_print_scripts', 'block_core_image_ensure_interactivity_dependency' );
|
||||
|
||||
/**
|
||||
* Registers the `core/image` block on server.
|
||||
*/
|
||||
function register_block_core_image() {
|
||||
|
||||
register_block_type_from_metadata(
|
||||
__DIR__ . '/image',
|
||||
array(
|
||||
|
@ -33,6 +33,12 @@
|
||||
"selector": "figcaption",
|
||||
"__experimentalRole": "content"
|
||||
},
|
||||
"lightbox": {
|
||||
"type": "object",
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"title": {
|
||||
"type": "string",
|
||||
"source": "attribute",
|
||||
@ -90,9 +96,6 @@
|
||||
},
|
||||
"supports": {
|
||||
"anchor": true,
|
||||
"behaviors": {
|
||||
"lightbox": true
|
||||
},
|
||||
"color": {
|
||||
"text": false,
|
||||
"background": false
|
||||
@ -127,5 +130,6 @@
|
||||
{ "name": "rounded", "label": "Rounded" }
|
||||
],
|
||||
"editorStyle": "wp-block-image-editor",
|
||||
"style": "wp-block-image"
|
||||
"style": "wp-block-image",
|
||||
"viewScript": "file:./view.min.js"
|
||||
}
|
||||
|
@ -92,7 +92,7 @@
|
||||
margin:0;
|
||||
}
|
||||
|
||||
.wp-lightbox-container .img-container{
|
||||
.wp-lightbox-container{
|
||||
position:relative;
|
||||
}
|
||||
.wp-lightbox-container button{
|
||||
@ -111,6 +111,8 @@
|
||||
}
|
||||
|
||||
.wp-lightbox-overlay{
|
||||
box-sizing:border-box;
|
||||
cursor:zoom-out;
|
||||
height:100vh;
|
||||
overflow:hidden;
|
||||
position:fixed;
|
||||
@ -122,31 +124,44 @@
|
||||
}
|
||||
.wp-lightbox-overlay .close-button{
|
||||
cursor:pointer;
|
||||
left:12.5px;
|
||||
left:calc(env(safe-area-inset-left) + 12.5px);
|
||||
padding:0;
|
||||
position:absolute;
|
||||
top:12.5px;
|
||||
top:calc(env(safe-area-inset-top) + 12.5px);
|
||||
z-index:5000000;
|
||||
}
|
||||
.wp-lightbox-overlay .lightbox-image-container{
|
||||
height:var(--wp--lightbox-container-height);
|
||||
overflow:hidden;
|
||||
position:absolute;
|
||||
right:50%;
|
||||
top:50%;
|
||||
transform:translate(50%, -50%);
|
||||
transform-origin:top right;
|
||||
width:var(--wp--lightbox-container-width);
|
||||
z-index:9999999999;
|
||||
}
|
||||
.wp-lightbox-overlay .wp-block-image{
|
||||
align-items:center;
|
||||
box-sizing:border-box;
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
height:100%;
|
||||
justify-content:center;
|
||||
position:absolute;
|
||||
margin:0;
|
||||
position:relative;
|
||||
transform-origin:100% 0;
|
||||
width:100%;
|
||||
z-index:3000000;
|
||||
}
|
||||
.wp-lightbox-overlay .wp-block-image img{
|
||||
height:var(--wp--lightbox-image-height);
|
||||
min-height:var(--wp--lightbox-image-height);
|
||||
min-width:var(--wp--lightbox-image-width);
|
||||
width:var(--wp--lightbox-image-width);
|
||||
}
|
||||
.wp-lightbox-overlay .wp-block-image figcaption{
|
||||
display:none;
|
||||
}
|
||||
.wp-lightbox-overlay .wp-block-image img{
|
||||
max-height:100%;
|
||||
max-width:100%;
|
||||
width:auto;
|
||||
}
|
||||
.wp-lightbox-overlay button{
|
||||
background:none;
|
||||
border:none;
|
||||
@ -159,53 +174,49 @@
|
||||
width:100%;
|
||||
z-index:2000000;
|
||||
}
|
||||
.wp-lightbox-overlay.fade.active{
|
||||
.wp-lightbox-overlay.active{
|
||||
animation:turn-on-visibility .25s both;
|
||||
visibility:visible;
|
||||
}
|
||||
.wp-lightbox-overlay.fade.active img{
|
||||
animation:turn-on-visibility .3s both;
|
||||
.wp-lightbox-overlay.active img{
|
||||
animation:turn-on-visibility .35s both;
|
||||
}
|
||||
.wp-lightbox-overlay.fade.hideanimationenabled:not(.active){
|
||||
animation:turn-off-visibility .3s both;
|
||||
.wp-lightbox-overlay.hideanimationenabled:not(.active){
|
||||
animation:turn-off-visibility .35s both;
|
||||
}
|
||||
.wp-lightbox-overlay.fade.hideanimationenabled:not(.active) img{
|
||||
.wp-lightbox-overlay.hideanimationenabled:not(.active) img{
|
||||
animation:turn-off-visibility .25s both;
|
||||
}
|
||||
.wp-lightbox-overlay.zoom img{
|
||||
height:var(--lightbox-image-max-height);
|
||||
position:absolute;
|
||||
transform-origin:top right;
|
||||
width:var(--lightbox-image-max-width);
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.active{
|
||||
opacity:1;
|
||||
visibility:visible;
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.active .wp-block-image img{
|
||||
animation:lightbox-zoom-in .4s forwards;
|
||||
}
|
||||
@media (prefers-reduced-motion){
|
||||
.wp-lightbox-overlay.zoom.active .wp-block-image img{
|
||||
animation:turn-on-visibility .4s both;
|
||||
@media (prefers-reduced-motion:no-preference){
|
||||
.wp-lightbox-overlay.zoom.active{
|
||||
animation:none;
|
||||
opacity:1;
|
||||
visibility:visible;
|
||||
}
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.active .scrim{
|
||||
animation:turn-on-visibility .4s forwards;
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.hideanimationenabled:not(.active) .wp-block-image img{
|
||||
animation:lightbox-zoom-out .4s forwards;
|
||||
}
|
||||
@media (prefers-reduced-motion){
|
||||
.wp-lightbox-overlay.zoom.hideanimationenabled:not(.active) .wp-block-image img{
|
||||
animation:turn-off-visibility .4s both;
|
||||
.wp-lightbox-overlay.zoom.active .lightbox-image-container{
|
||||
animation:lightbox-zoom-in .4s;
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.active .lightbox-image-container img{
|
||||
animation:none;
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.active .scrim{
|
||||
animation:turn-on-visibility .4s forwards;
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.hideanimationenabled:not(.active){
|
||||
animation:none;
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.hideanimationenabled:not(.active) .lightbox-image-container{
|
||||
animation:lightbox-zoom-out .4s;
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.hideanimationenabled:not(.active) .lightbox-image-container img{
|
||||
animation:none;
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.hideanimationenabled:not(.active) .scrim{
|
||||
animation:turn-off-visibility .4s forwards;
|
||||
}
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.hideanimationenabled:not(.active) .scrim{
|
||||
animation:turn-off-visibility .4s forwards;
|
||||
}
|
||||
|
||||
html.has-lightbox-open{
|
||||
html.wp-has-lightbox-open{
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
@ -233,29 +244,22 @@ html.has-lightbox-open{
|
||||
}
|
||||
@keyframes lightbox-zoom-in{
|
||||
0%{
|
||||
right:var(--lightbox-initial-left-position);
|
||||
top:var(--lightbox-initial-top-position);
|
||||
transform:scale(var(--lightbox-scale-width), var(--lightbox-scale-height));
|
||||
transform:translate(calc((-50vw + var(--wp--lightbox-initial-left-position))*-1), calc(-50vh + var(--wp--lightbox-initial-top-position))) scale(var(--wp--lightbox-scale));
|
||||
}
|
||||
to{
|
||||
right:var(--lightbox-target-left-position);
|
||||
top:var(--lightbox-target-top-position);
|
||||
transform:scale(1);
|
||||
transform:translate(50%, -50%) scale(1);
|
||||
}
|
||||
}
|
||||
@keyframes lightbox-zoom-out{
|
||||
0%{
|
||||
right:var(--lightbox-target-left-position);
|
||||
top:var(--lightbox-target-top-position);
|
||||
transform:scale(1);
|
||||
transform:translate(50%, -50%) scale(1);
|
||||
visibility:visible;
|
||||
}
|
||||
99%{
|
||||
visibility:visible;
|
||||
}
|
||||
to{
|
||||
right:var(--lightbox-initial-left-position);
|
||||
top:var(--lightbox-initial-top-position);
|
||||
transform:scale(var(--lightbox-scale-width), var(--lightbox-scale-height));
|
||||
transform:translate(calc((-50vw + var(--wp--lightbox-initial-left-position))*-1), calc(-50vh + var(--wp--lightbox-initial-top-position))) scale(var(--wp--lightbox-scale));
|
||||
visibility:hidden;
|
||||
}
|
||||
}
|
2
wp-includes/blocks/image/style-rtl.min.css
vendored
2
wp-includes/blocks/image/style-rtl.min.css
vendored
File diff suppressed because one or more lines are too long
@ -92,7 +92,7 @@
|
||||
margin:0;
|
||||
}
|
||||
|
||||
.wp-lightbox-container .img-container{
|
||||
.wp-lightbox-container{
|
||||
position:relative;
|
||||
}
|
||||
.wp-lightbox-container button{
|
||||
@ -111,6 +111,8 @@
|
||||
}
|
||||
|
||||
.wp-lightbox-overlay{
|
||||
box-sizing:border-box;
|
||||
cursor:zoom-out;
|
||||
height:100vh;
|
||||
left:0;
|
||||
overflow:hidden;
|
||||
@ -124,29 +126,42 @@
|
||||
cursor:pointer;
|
||||
padding:0;
|
||||
position:absolute;
|
||||
right:12.5px;
|
||||
top:12.5px;
|
||||
right:calc(env(safe-area-inset-right) + 12.5px);
|
||||
top:calc(env(safe-area-inset-top) + 12.5px);
|
||||
z-index:5000000;
|
||||
}
|
||||
.wp-lightbox-overlay .lightbox-image-container{
|
||||
height:var(--wp--lightbox-container-height);
|
||||
left:50%;
|
||||
overflow:hidden;
|
||||
position:absolute;
|
||||
top:50%;
|
||||
transform:translate(-50%, -50%);
|
||||
transform-origin:top left;
|
||||
width:var(--wp--lightbox-container-width);
|
||||
z-index:9999999999;
|
||||
}
|
||||
.wp-lightbox-overlay .wp-block-image{
|
||||
align-items:center;
|
||||
box-sizing:border-box;
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
height:100%;
|
||||
justify-content:center;
|
||||
position:absolute;
|
||||
margin:0;
|
||||
position:relative;
|
||||
transform-origin:0 0;
|
||||
width:100%;
|
||||
z-index:3000000;
|
||||
}
|
||||
.wp-lightbox-overlay .wp-block-image img{
|
||||
height:var(--wp--lightbox-image-height);
|
||||
min-height:var(--wp--lightbox-image-height);
|
||||
min-width:var(--wp--lightbox-image-width);
|
||||
width:var(--wp--lightbox-image-width);
|
||||
}
|
||||
.wp-lightbox-overlay .wp-block-image figcaption{
|
||||
display:none;
|
||||
}
|
||||
.wp-lightbox-overlay .wp-block-image img{
|
||||
max-height:100%;
|
||||
max-width:100%;
|
||||
width:auto;
|
||||
}
|
||||
.wp-lightbox-overlay button{
|
||||
background:none;
|
||||
border:none;
|
||||
@ -159,53 +174,49 @@
|
||||
width:100%;
|
||||
z-index:2000000;
|
||||
}
|
||||
.wp-lightbox-overlay.fade.active{
|
||||
.wp-lightbox-overlay.active{
|
||||
animation:turn-on-visibility .25s both;
|
||||
visibility:visible;
|
||||
}
|
||||
.wp-lightbox-overlay.fade.active img{
|
||||
animation:turn-on-visibility .3s both;
|
||||
.wp-lightbox-overlay.active img{
|
||||
animation:turn-on-visibility .35s both;
|
||||
}
|
||||
.wp-lightbox-overlay.fade.hideanimationenabled:not(.active){
|
||||
animation:turn-off-visibility .3s both;
|
||||
.wp-lightbox-overlay.hideanimationenabled:not(.active){
|
||||
animation:turn-off-visibility .35s both;
|
||||
}
|
||||
.wp-lightbox-overlay.fade.hideanimationenabled:not(.active) img{
|
||||
.wp-lightbox-overlay.hideanimationenabled:not(.active) img{
|
||||
animation:turn-off-visibility .25s both;
|
||||
}
|
||||
.wp-lightbox-overlay.zoom img{
|
||||
height:var(--lightbox-image-max-height);
|
||||
position:absolute;
|
||||
transform-origin:top left;
|
||||
width:var(--lightbox-image-max-width);
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.active{
|
||||
opacity:1;
|
||||
visibility:visible;
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.active .wp-block-image img{
|
||||
animation:lightbox-zoom-in .4s forwards;
|
||||
}
|
||||
@media (prefers-reduced-motion){
|
||||
.wp-lightbox-overlay.zoom.active .wp-block-image img{
|
||||
animation:turn-on-visibility .4s both;
|
||||
@media (prefers-reduced-motion:no-preference){
|
||||
.wp-lightbox-overlay.zoom.active{
|
||||
animation:none;
|
||||
opacity:1;
|
||||
visibility:visible;
|
||||
}
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.active .scrim{
|
||||
animation:turn-on-visibility .4s forwards;
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.hideanimationenabled:not(.active) .wp-block-image img{
|
||||
animation:lightbox-zoom-out .4s forwards;
|
||||
}
|
||||
@media (prefers-reduced-motion){
|
||||
.wp-lightbox-overlay.zoom.hideanimationenabled:not(.active) .wp-block-image img{
|
||||
animation:turn-off-visibility .4s both;
|
||||
.wp-lightbox-overlay.zoom.active .lightbox-image-container{
|
||||
animation:lightbox-zoom-in .4s;
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.active .lightbox-image-container img{
|
||||
animation:none;
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.active .scrim{
|
||||
animation:turn-on-visibility .4s forwards;
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.hideanimationenabled:not(.active){
|
||||
animation:none;
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.hideanimationenabled:not(.active) .lightbox-image-container{
|
||||
animation:lightbox-zoom-out .4s;
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.hideanimationenabled:not(.active) .lightbox-image-container img{
|
||||
animation:none;
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.hideanimationenabled:not(.active) .scrim{
|
||||
animation:turn-off-visibility .4s forwards;
|
||||
}
|
||||
}
|
||||
.wp-lightbox-overlay.zoom.hideanimationenabled:not(.active) .scrim{
|
||||
animation:turn-off-visibility .4s forwards;
|
||||
}
|
||||
|
||||
html.has-lightbox-open{
|
||||
html.wp-has-lightbox-open{
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
@ -233,29 +244,22 @@ html.has-lightbox-open{
|
||||
}
|
||||
@keyframes lightbox-zoom-in{
|
||||
0%{
|
||||
left:var(--lightbox-initial-left-position);
|
||||
top:var(--lightbox-initial-top-position);
|
||||
transform:scale(var(--lightbox-scale-width), var(--lightbox-scale-height));
|
||||
transform:translate(calc(-50vw + var(--wp--lightbox-initial-left-position)), calc(-50vh + var(--wp--lightbox-initial-top-position))) scale(var(--wp--lightbox-scale));
|
||||
}
|
||||
to{
|
||||
left:var(--lightbox-target-left-position);
|
||||
top:var(--lightbox-target-top-position);
|
||||
transform:scale(1);
|
||||
transform:translate(-50%, -50%) scale(1);
|
||||
}
|
||||
}
|
||||
@keyframes lightbox-zoom-out{
|
||||
0%{
|
||||
left:var(--lightbox-target-left-position);
|
||||
top:var(--lightbox-target-top-position);
|
||||
transform:scale(1);
|
||||
transform:translate(-50%, -50%) scale(1);
|
||||
visibility:visible;
|
||||
}
|
||||
99%{
|
||||
visibility:visible;
|
||||
}
|
||||
to{
|
||||
left:var(--lightbox-initial-left-position);
|
||||
top:var(--lightbox-initial-top-position);
|
||||
transform:scale(var(--lightbox-scale-width), var(--lightbox-scale-height));
|
||||
transform:translate(calc(-50vw + var(--wp--lightbox-initial-left-position)), calc(-50vh + var(--wp--lightbox-initial-top-position))) scale(var(--wp--lightbox-scale));
|
||||
visibility:hidden;
|
||||
}
|
||||
}
|
2
wp-includes/blocks/image/style.min.css
vendored
2
wp-includes/blocks/image/style.min.css
vendored
File diff suppressed because one or more lines are too long
1
wp-includes/blocks/image/view.asset.php
Normal file
1
wp-includes/blocks/image/view.asset.php
Normal file
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => 'a61b46e3f411e7d14cfc');
|
400
wp-includes/blocks/image/view.js
Normal file
400
wp-includes/blocks/image/view.js
Normal file
@ -0,0 +1,400 @@
|
||||
"use strict";
|
||||
(self["__WordPressPrivateInteractivityAPI__"] = self["__WordPressPrivateInteractivityAPI__"] || []).push([[354],{
|
||||
|
||||
/***/ 699:
|
||||
/***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
|
||||
|
||||
/* harmony import */ var _wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(754);
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
const focusableSelectors = ['a[href]', 'area[href]', 'input:not([disabled]):not([type="hidden"]):not([aria-hidden])', 'select:not([disabled]):not([aria-hidden])', 'textarea:not([disabled]):not([aria-hidden])', 'button:not([disabled]):not([aria-hidden])', 'iframe', 'object', 'embed', '[contenteditable]', '[tabindex]:not([tabindex^="-"])'];
|
||||
(0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__/* .store */ .h)({
|
||||
state: {
|
||||
core: {
|
||||
image: {
|
||||
windowWidth: window.innerWidth,
|
||||
windowHeight: window.innerHeight
|
||||
}
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
core: {
|
||||
image: {
|
||||
showLightbox: ({
|
||||
context,
|
||||
event
|
||||
}) => {
|
||||
// We can't initialize the lightbox until the reference
|
||||
// image is loaded, otherwise the UX is broken.
|
||||
if (!context.core.image.imageLoaded) {
|
||||
return;
|
||||
}
|
||||
context.core.image.initialized = true;
|
||||
context.core.image.lastFocusedElement = window.document.activeElement;
|
||||
context.core.image.scrollDelta = 0;
|
||||
context.core.image.lightboxEnabled = true;
|
||||
setStyles(context, event);
|
||||
// Hide overflow only when the animation is in progress,
|
||||
// otherwise the removal of the scrollbars will draw attention
|
||||
// to itself and look like an error
|
||||
document.documentElement.classList.add('wp-has-lightbox-open');
|
||||
},
|
||||
hideLightbox: async ({
|
||||
context,
|
||||
event
|
||||
}) => {
|
||||
context.core.image.hideAnimationEnabled = true;
|
||||
if (context.core.image.lightboxEnabled) {
|
||||
// If scrolling, wait a moment before closing the lightbox.
|
||||
if (context.core.image.lightboxAnimation === 'fade') {
|
||||
context.core.image.scrollDelta += event.deltaY;
|
||||
if (event.type === 'mousewheel' && Math.abs(window.scrollY - context.core.image.scrollDelta) < 10) {
|
||||
return;
|
||||
}
|
||||
} else if (context.core.image.lightboxAnimation === 'zoom') {
|
||||
// Disable scroll until the zoom animation ends.
|
||||
// Get the current page scroll position
|
||||
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
||||
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
||||
// if any scroll is attempted, set this to the previous value.
|
||||
window.onscroll = function () {
|
||||
window.scrollTo(scrollLeft, scrollTop);
|
||||
};
|
||||
// Enable scrolling after the animation finishes
|
||||
setTimeout(function () {
|
||||
window.onscroll = function () {};
|
||||
}, 400);
|
||||
}
|
||||
document.documentElement.classList.remove('wp-has-lightbox-open');
|
||||
context.core.image.lightboxEnabled = false;
|
||||
context.core.image.lastFocusedElement.focus({
|
||||
preventScroll: true
|
||||
});
|
||||
}
|
||||
},
|
||||
handleKeydown: ({
|
||||
context,
|
||||
actions,
|
||||
event
|
||||
}) => {
|
||||
if (context.core.image.lightboxEnabled) {
|
||||
if (event.key === 'Tab' || event.keyCode === 9) {
|
||||
// If shift + tab it change the direction
|
||||
if (event.shiftKey && window.document.activeElement === context.core.image.firstFocusableElement) {
|
||||
event.preventDefault();
|
||||
context.core.image.lastFocusableElement.focus();
|
||||
} else if (!event.shiftKey && window.document.activeElement === context.core.image.lastFocusableElement) {
|
||||
event.preventDefault();
|
||||
context.core.image.firstFocusableElement.focus();
|
||||
}
|
||||
}
|
||||
if (event.key === 'Escape' || event.keyCode === 27) {
|
||||
actions.core.image.hideLightbox({
|
||||
context,
|
||||
event
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
handleLoad: ({
|
||||
state,
|
||||
context,
|
||||
effects,
|
||||
ref
|
||||
}) => {
|
||||
context.core.image.imageLoaded = true;
|
||||
context.core.image.imageCurrentSrc = ref.currentSrc;
|
||||
effects.core.image.setButtonStyles({
|
||||
state,
|
||||
context,
|
||||
ref
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
selectors: {
|
||||
core: {
|
||||
image: {
|
||||
roleAttribute: ({
|
||||
context
|
||||
}) => {
|
||||
return context.core.image.lightboxEnabled ? 'dialog' : '';
|
||||
},
|
||||
lightboxObjectFit: ({
|
||||
context
|
||||
}) => {
|
||||
if (context.core.image.initialized) {
|
||||
return 'cover';
|
||||
}
|
||||
},
|
||||
enlargedImgSrc: ({
|
||||
context
|
||||
}) => {
|
||||
return context.core.image.initialized ? context.core.image.imageUploadedSrc : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
effects: {
|
||||
core: {
|
||||
image: {
|
||||
setCurrentSrc: ({
|
||||
context,
|
||||
ref
|
||||
}) => {
|
||||
if (ref.complete) {
|
||||
context.core.image.imageLoaded = true;
|
||||
context.core.image.imageCurrentSrc = ref.currentSrc;
|
||||
}
|
||||
},
|
||||
initLightbox: async ({
|
||||
context,
|
||||
ref
|
||||
}) => {
|
||||
context.core.image.figureRef = ref.querySelector('figure');
|
||||
context.core.image.imageRef = ref.querySelector('img');
|
||||
if (context.core.image.lightboxEnabled) {
|
||||
const focusableElements = ref.querySelectorAll(focusableSelectors);
|
||||
context.core.image.firstFocusableElement = focusableElements[0];
|
||||
context.core.image.lastFocusableElement = focusableElements[focusableElements.length - 1];
|
||||
ref.querySelector('.close-button').focus();
|
||||
}
|
||||
},
|
||||
setButtonStyles: ({
|
||||
state,
|
||||
context,
|
||||
ref
|
||||
}) => {
|
||||
const {
|
||||
naturalWidth,
|
||||
naturalHeight,
|
||||
offsetWidth,
|
||||
offsetHeight
|
||||
} = ref;
|
||||
|
||||
// If the image isn't loaded yet, we can't
|
||||
// calculate how big the button should be.
|
||||
if (naturalWidth === 0 || naturalHeight === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Subscribe to the window dimensions so we can
|
||||
// recalculate the styles if the window is resized.
|
||||
if ((state.core.image.windowWidth || state.core.image.windowHeight) && context.core.image.scaleAttr === 'contain') {
|
||||
// In the case of an image with object-fit: contain, the
|
||||
// size of the img element can be larger than the image itself,
|
||||
// so we need to calculate the size of the button to match.
|
||||
|
||||
// Natural ratio of the image.
|
||||
const naturalRatio = naturalWidth / naturalHeight;
|
||||
// Offset ratio of the image.
|
||||
const offsetRatio = offsetWidth / offsetHeight;
|
||||
if (naturalRatio > offsetRatio) {
|
||||
// If it reaches the width first, keep
|
||||
// the width and recalculate the height.
|
||||
context.core.image.imageButtonWidth = offsetWidth;
|
||||
const buttonHeight = offsetWidth / naturalRatio;
|
||||
context.core.image.imageButtonHeight = buttonHeight;
|
||||
context.core.image.imageButtonTop = (offsetHeight - buttonHeight) / 2;
|
||||
} else {
|
||||
// If it reaches the height first, keep
|
||||
// the height and recalculate the width.
|
||||
context.core.image.imageButtonHeight = offsetHeight;
|
||||
const buttonWidth = offsetHeight * naturalRatio;
|
||||
context.core.image.imageButtonWidth = buttonWidth;
|
||||
context.core.image.imageButtonLeft = (offsetWidth - buttonWidth) / 2;
|
||||
}
|
||||
} else {
|
||||
// In all other cases, we can trust that the size of
|
||||
// the image is the right size for the button as well.
|
||||
|
||||
context.core.image.imageButtonWidth = offsetWidth;
|
||||
context.core.image.imageButtonHeight = offsetHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
afterLoad: ({
|
||||
state
|
||||
}) => {
|
||||
window.addEventListener('resize', debounce(() => {
|
||||
state.core.image.windowWidth = window.innerWidth;
|
||||
state.core.image.windowHeight = window.innerHeight;
|
||||
}));
|
||||
}
|
||||
});
|
||||
function setStyles(context, event) {
|
||||
// The reference img element lies adjacent
|
||||
// to the event target button in the DOM.
|
||||
let {
|
||||
naturalWidth,
|
||||
naturalHeight,
|
||||
offsetWidth: originalWidth,
|
||||
offsetHeight: originalHeight
|
||||
} = event.target.nextElementSibling;
|
||||
let {
|
||||
x: screenPosX,
|
||||
y: screenPosY
|
||||
} = event.target.nextElementSibling.getBoundingClientRect();
|
||||
|
||||
// Natural ratio of the image clicked to open the lightbox.
|
||||
const naturalRatio = naturalWidth / naturalHeight;
|
||||
// Original ratio of the image clicked to open the lightbox.
|
||||
let originalRatio = originalWidth / originalHeight;
|
||||
|
||||
// If it has object-fit: contain, recalculate the original sizes
|
||||
// and the screen position without the blank spaces.
|
||||
if (context.core.image.scaleAttr === 'contain') {
|
||||
if (naturalRatio > originalRatio) {
|
||||
const heightWithoutSpace = originalWidth / naturalRatio;
|
||||
// Recalculate screen position without the top space.
|
||||
screenPosY += (originalHeight - heightWithoutSpace) / 2;
|
||||
originalHeight = heightWithoutSpace;
|
||||
} else {
|
||||
const widthWithoutSpace = originalHeight * naturalRatio;
|
||||
// Recalculate screen position without the left space.
|
||||
screenPosX += (originalWidth - widthWithoutSpace) / 2;
|
||||
originalWidth = widthWithoutSpace;
|
||||
}
|
||||
}
|
||||
originalRatio = originalWidth / originalHeight;
|
||||
|
||||
// Typically, we use the image's full-sized dimensions. If those
|
||||
// dimensions have not been set (i.e. an external image with only one size),
|
||||
// the image's dimensions in the lightbox are the same
|
||||
// as those of the image in the content.
|
||||
let imgMaxWidth = parseFloat(context.core.image.targetWidth !== 'none' ? context.core.image.targetWidth : naturalWidth);
|
||||
let imgMaxHeight = parseFloat(context.core.image.targetHeight !== 'none' ? context.core.image.targetHeight : naturalHeight);
|
||||
|
||||
// Ratio of the biggest image stored in the database.
|
||||
let imgRatio = imgMaxWidth / imgMaxHeight;
|
||||
let containerMaxWidth = imgMaxWidth;
|
||||
let containerMaxHeight = imgMaxHeight;
|
||||
let containerWidth = imgMaxWidth;
|
||||
let containerHeight = imgMaxHeight;
|
||||
// Check if the target image has a different ratio than the original one (thumbnail).
|
||||
// Recalculate the width and height.
|
||||
if (naturalRatio.toFixed(2) !== imgRatio.toFixed(2)) {
|
||||
if (naturalRatio > imgRatio) {
|
||||
// If the width is reached before the height, we keep the maxWidth
|
||||
// and recalculate the height.
|
||||
// Unless the difference between the maxHeight and the reducedHeight
|
||||
// is higher than the maxWidth, where we keep the reducedHeight and
|
||||
// recalculate the width.
|
||||
const reducedHeight = imgMaxWidth / naturalRatio;
|
||||
if (imgMaxHeight - reducedHeight > imgMaxWidth) {
|
||||
imgMaxHeight = reducedHeight;
|
||||
imgMaxWidth = reducedHeight * naturalRatio;
|
||||
} else {
|
||||
imgMaxHeight = imgMaxWidth / naturalRatio;
|
||||
}
|
||||
} else {
|
||||
// If the height is reached before the width, we keep the maxHeight
|
||||
// and recalculate the width.
|
||||
// Unless the difference between the maxWidth and the reducedWidth
|
||||
// is higher than the maxHeight, where we keep the reducedWidth and
|
||||
// recalculate the height.
|
||||
const reducedWidth = imgMaxHeight * naturalRatio;
|
||||
if (imgMaxWidth - reducedWidth > imgMaxHeight) {
|
||||
imgMaxWidth = reducedWidth;
|
||||
imgMaxHeight = reducedWidth / naturalRatio;
|
||||
} else {
|
||||
imgMaxWidth = imgMaxHeight * naturalRatio;
|
||||
}
|
||||
}
|
||||
containerWidth = imgMaxWidth;
|
||||
containerHeight = imgMaxHeight;
|
||||
imgRatio = imgMaxWidth / imgMaxHeight;
|
||||
|
||||
// Calculate the max size of the container.
|
||||
if (originalRatio > imgRatio) {
|
||||
containerMaxWidth = imgMaxWidth;
|
||||
containerMaxHeight = containerMaxWidth / originalRatio;
|
||||
} else {
|
||||
containerMaxHeight = imgMaxHeight;
|
||||
containerMaxWidth = containerMaxHeight * originalRatio;
|
||||
}
|
||||
}
|
||||
|
||||
// If the image has been pixelated on purpose, keep that size.
|
||||
if (originalWidth > containerWidth || originalHeight > containerHeight) {
|
||||
containerWidth = originalWidth;
|
||||
containerHeight = originalHeight;
|
||||
}
|
||||
|
||||
// Calculate the final lightbox image size and the
|
||||
// scale factor. MaxWidth is either the window container
|
||||
// (accounting for padding) or the image resolution.
|
||||
let horizontalPadding = 0;
|
||||
if (window.innerWidth > 480) {
|
||||
horizontalPadding = 80;
|
||||
} else if (window.innerWidth > 1920) {
|
||||
horizontalPadding = 160;
|
||||
}
|
||||
const verticalPadding = 80;
|
||||
const targetMaxWidth = Math.min(window.innerWidth - horizontalPadding, containerWidth);
|
||||
const targetMaxHeight = Math.min(window.innerHeight - verticalPadding, containerHeight);
|
||||
const targetContainerRatio = targetMaxWidth / targetMaxHeight;
|
||||
if (originalRatio > targetContainerRatio) {
|
||||
// If targetMaxWidth is reached before targetMaxHeight
|
||||
containerWidth = targetMaxWidth;
|
||||
containerHeight = containerWidth / originalRatio;
|
||||
} else {
|
||||
// If targetMaxHeight is reached before targetMaxWidth
|
||||
containerHeight = targetMaxHeight;
|
||||
containerWidth = containerHeight * originalRatio;
|
||||
}
|
||||
const containerScale = originalWidth / containerWidth;
|
||||
const lightboxImgWidth = imgMaxWidth * (containerWidth / containerMaxWidth);
|
||||
const lightboxImgHeight = imgMaxHeight * (containerHeight / containerMaxHeight);
|
||||
|
||||
// Add the CSS variables needed.
|
||||
let styleTag = document.getElementById('wp-lightbox-styles');
|
||||
if (!styleTag) {
|
||||
styleTag = document.createElement('style');
|
||||
styleTag.id = 'wp-lightbox-styles';
|
||||
document.head.appendChild(styleTag);
|
||||
}
|
||||
|
||||
// As of this writing, using the calculations above will render the lightbox
|
||||
// with a small, erroneous whitespace on the left side of the image in iOS Safari,
|
||||
// perhaps due to an inconsistency in how browsers handle absolute positioning and CSS
|
||||
// transformation. In any case, adding 1 pixel to the container width and height solves
|
||||
// the problem, though this can be removed if the issue is fixed in the future.
|
||||
styleTag.innerHTML = `
|
||||
:root {
|
||||
--wp--lightbox-initial-top-position: ${screenPosY}px;
|
||||
--wp--lightbox-initial-left-position: ${screenPosX}px;
|
||||
--wp--lightbox-container-width: ${containerWidth + 1}px;
|
||||
--wp--lightbox-container-height: ${containerHeight + 1}px;
|
||||
--wp--lightbox-image-width: ${lightboxImgWidth}px;
|
||||
--wp--lightbox-image-height: ${lightboxImgHeight}px;
|
||||
--wp--lightbox-scale: ${containerScale};
|
||||
}
|
||||
`;
|
||||
}
|
||||
function debounce(func, wait = 50) {
|
||||
let timeout;
|
||||
return () => {
|
||||
const later = () => {
|
||||
timeout = null;
|
||||
func();
|
||||
};
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(later, wait);
|
||||
};
|
||||
}
|
||||
|
||||
/***/ })
|
||||
|
||||
},
|
||||
/******/ function(__webpack_require__) { // webpackRuntimeModules
|
||||
/******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
|
||||
/******/ var __webpack_exports__ = (__webpack_exec__(699));
|
||||
/******/ }
|
||||
]);
|
1
wp-includes/blocks/image/view.min.asset.php
Normal file
1
wp-includes/blocks/image/view.min.asset.php
Normal file
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '1ba4adb54bc7c9f552d5');
|
1
wp-includes/blocks/image/view.min.js
vendored
Normal file
1
wp-includes/blocks/image/view.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -48,7 +48,7 @@ function render_block_core_latest_posts( $attributes ) {
|
||||
$block_core_latest_posts_excerpt_length = $attributes['excerptLength'];
|
||||
add_filter( 'excerpt_length', 'block_core_latest_posts_get_excerpt_length', 20 );
|
||||
|
||||
$filter_latest_posts_excerpt_more = static function( $more ) use ( $attributes ) {
|
||||
$filter_latest_posts_excerpt_more = static function ( $more ) use ( $attributes ) {
|
||||
$use_excerpt = 'excerpt' === $attributes['displayPostContentRadio'];
|
||||
/* translators: %1$s is a URL to a post, excerpt truncation character, default … */
|
||||
return $use_excerpt ? sprintf( __( ' … <a href="%1$s" rel="noopener noreferrer">Read more</a>' ), esc_url( get_permalink() ) ) : $more;
|
||||
@ -56,7 +56,7 @@ function render_block_core_latest_posts( $attributes ) {
|
||||
|
||||
add_filter( 'excerpt_more', $filter_latest_posts_excerpt_more );
|
||||
|
||||
if ( isset( $attributes['categories'] ) ) {
|
||||
if ( ! empty( $attributes['categories'] ) ) {
|
||||
$args['category__in'] = array_column( $attributes['categories'], 'id' );
|
||||
}
|
||||
if ( isset( $attributes['selectedAuthor'] ) ) {
|
||||
|
@ -69,6 +69,7 @@
|
||||
},
|
||||
"__unstablePasteTextInline": true,
|
||||
"__experimentalSelector": "ol,ul",
|
||||
"__experimentalOnMerge": true,
|
||||
"__experimentalSlashInserter": true
|
||||
},
|
||||
"editorStyle": "wp-block-list-editor",
|
||||
|
@ -100,6 +100,7 @@
|
||||
"html": false,
|
||||
"color": {
|
||||
"gradients": true,
|
||||
"heading": true,
|
||||
"link": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"background": true,
|
||||
|
@ -31,15 +31,6 @@
|
||||
.wp-block-navigation-link__invalid-item{
|
||||
color:#000;
|
||||
}
|
||||
|
||||
.wp-block-navigation-link__missing_text-tooltip{
|
||||
height:1px;
|
||||
margin:-1px;
|
||||
overflow:hidden;
|
||||
padding:0;
|
||||
position:absolute;
|
||||
width:1px;
|
||||
}
|
||||
.wp-block-navigation-link__placeholder{
|
||||
background-image:none !important;
|
||||
box-shadow:none !important;
|
||||
|
@ -1 +1 @@
|
||||
.wp-block-navigation .block-list-appender{position:relative}.wp-block-navigation .has-child{cursor:pointer}.wp-block-navigation .has-child .wp-block-navigation__submenu-container{z-index:28}.wp-block-navigation .has-child:hover .wp-block-navigation__submenu-container{z-index:29}.wp-block-navigation .has-child.has-child-selected>.wp-block-navigation__submenu-container,.wp-block-navigation .has-child.is-selected>.wp-block-navigation__submenu-container{height:auto!important;min-width:200px!important;opacity:1!important;overflow:visible!important;visibility:visible!important;width:auto!important}.wp-block-navigation-item .wp-block-navigation-item__content{cursor:text}.wp-block-navigation-item.is-editing,.wp-block-navigation-item.is-selected{min-width:20px}.wp-block-navigation-item .block-list-appender{margin:16px 16px 16px auto}.wp-block-navigation-link__invalid-item{color:#000}.wp-block-navigation-link__missing_text-tooltip{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.wp-block-navigation-link__placeholder{background-image:none!important;box-shadow:none!important;position:relative;text-decoration:none!important}.wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{--wp-underline-color:var(--wp-admin-theme-color);background-image:linear-gradient(-45deg,transparent 20%,var(--wp-underline-color) 30%,var(--wp-underline-color) 36%,transparent 46%),linear-gradient(-135deg,transparent 54%,var(--wp-underline-color) 64%,var(--wp-underline-color) 70%,transparent 80%);background-position:100% 100%;background-repeat:repeat-x;background-size:6px 3px;padding-bottom:.1em}.is-dark-theme .wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{--wp-underline-color:#fff}.wp-block-navigation-link__placeholder.wp-block-navigation-item__content{cursor:pointer}.link-control-transform{border-top:1px solid #ccc;padding:0 16px 8px}.link-control-transform__subheading{color:#1e1e1e;font-size:11px;font-weight:500;margin-bottom:1.5em;text-transform:uppercase}.link-control-transform__items{display:flex;justify-content:space-between}.link-control-transform__item{flex-basis:33%;flex-direction:column;gap:8px;height:auto}
|
||||
.wp-block-navigation .block-list-appender{position:relative}.wp-block-navigation .has-child{cursor:pointer}.wp-block-navigation .has-child .wp-block-navigation__submenu-container{z-index:28}.wp-block-navigation .has-child:hover .wp-block-navigation__submenu-container{z-index:29}.wp-block-navigation .has-child.has-child-selected>.wp-block-navigation__submenu-container,.wp-block-navigation .has-child.is-selected>.wp-block-navigation__submenu-container{height:auto!important;min-width:200px!important;opacity:1!important;overflow:visible!important;visibility:visible!important;width:auto!important}.wp-block-navigation-item .wp-block-navigation-item__content{cursor:text}.wp-block-navigation-item.is-editing,.wp-block-navigation-item.is-selected{min-width:20px}.wp-block-navigation-item .block-list-appender{margin:16px 16px 16px auto}.wp-block-navigation-link__invalid-item{color:#000}.wp-block-navigation-link__placeholder{background-image:none!important;box-shadow:none!important;position:relative;text-decoration:none!important}.wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{--wp-underline-color:var(--wp-admin-theme-color);background-image:linear-gradient(-45deg,transparent 20%,var(--wp-underline-color) 30%,var(--wp-underline-color) 36%,transparent 46%),linear-gradient(-135deg,transparent 54%,var(--wp-underline-color) 64%,var(--wp-underline-color) 70%,transparent 80%);background-position:100% 100%;background-repeat:repeat-x;background-size:6px 3px;padding-bottom:.1em}.is-dark-theme .wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{--wp-underline-color:#fff}.wp-block-navigation-link__placeholder.wp-block-navigation-item__content{cursor:pointer}.link-control-transform{border-top:1px solid #ccc;padding:0 16px 8px}.link-control-transform__subheading{color:#1e1e1e;font-size:11px;font-weight:500;margin-bottom:1.5em;text-transform:uppercase}.link-control-transform__items{display:flex;justify-content:space-between}.link-control-transform__item{flex-basis:33%;flex-direction:column;gap:8px;height:auto}
|
@ -31,15 +31,6 @@
|
||||
.wp-block-navigation-link__invalid-item{
|
||||
color:#000;
|
||||
}
|
||||
|
||||
.wp-block-navigation-link__missing_text-tooltip{
|
||||
height:1px;
|
||||
margin:-1px;
|
||||
overflow:hidden;
|
||||
padding:0;
|
||||
position:absolute;
|
||||
width:1px;
|
||||
}
|
||||
.wp-block-navigation-link__placeholder{
|
||||
background-image:none !important;
|
||||
box-shadow:none !important;
|
||||
|
@ -1 +1 @@
|
||||
.wp-block-navigation .block-list-appender{position:relative}.wp-block-navigation .has-child{cursor:pointer}.wp-block-navigation .has-child .wp-block-navigation__submenu-container{z-index:28}.wp-block-navigation .has-child:hover .wp-block-navigation__submenu-container{z-index:29}.wp-block-navigation .has-child.has-child-selected>.wp-block-navigation__submenu-container,.wp-block-navigation .has-child.is-selected>.wp-block-navigation__submenu-container{height:auto!important;min-width:200px!important;opacity:1!important;overflow:visible!important;visibility:visible!important;width:auto!important}.wp-block-navigation-item .wp-block-navigation-item__content{cursor:text}.wp-block-navigation-item.is-editing,.wp-block-navigation-item.is-selected{min-width:20px}.wp-block-navigation-item .block-list-appender{margin:16px auto 16px 16px}.wp-block-navigation-link__invalid-item{color:#000}.wp-block-navigation-link__missing_text-tooltip{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.wp-block-navigation-link__placeholder{background-image:none!important;box-shadow:none!important;position:relative;text-decoration:none!important}.wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{--wp-underline-color:var(--wp-admin-theme-color);background-image:linear-gradient(45deg,transparent 20%,var(--wp-underline-color) 30%,var(--wp-underline-color) 36%,transparent 46%),linear-gradient(135deg,transparent 54%,var(--wp-underline-color) 64%,var(--wp-underline-color) 70%,transparent 80%);background-position:0 100%;background-repeat:repeat-x;background-size:6px 3px;padding-bottom:.1em}.is-dark-theme .wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{--wp-underline-color:#fff}.wp-block-navigation-link__placeholder.wp-block-navigation-item__content{cursor:pointer}.link-control-transform{border-top:1px solid #ccc;padding:0 16px 8px}.link-control-transform__subheading{color:#1e1e1e;font-size:11px;font-weight:500;margin-bottom:1.5em;text-transform:uppercase}.link-control-transform__items{display:flex;justify-content:space-between}.link-control-transform__item{flex-basis:33%;flex-direction:column;gap:8px;height:auto}
|
||||
.wp-block-navigation .block-list-appender{position:relative}.wp-block-navigation .has-child{cursor:pointer}.wp-block-navigation .has-child .wp-block-navigation__submenu-container{z-index:28}.wp-block-navigation .has-child:hover .wp-block-navigation__submenu-container{z-index:29}.wp-block-navigation .has-child.has-child-selected>.wp-block-navigation__submenu-container,.wp-block-navigation .has-child.is-selected>.wp-block-navigation__submenu-container{height:auto!important;min-width:200px!important;opacity:1!important;overflow:visible!important;visibility:visible!important;width:auto!important}.wp-block-navigation-item .wp-block-navigation-item__content{cursor:text}.wp-block-navigation-item.is-editing,.wp-block-navigation-item.is-selected{min-width:20px}.wp-block-navigation-item .block-list-appender{margin:16px auto 16px 16px}.wp-block-navigation-link__invalid-item{color:#000}.wp-block-navigation-link__placeholder{background-image:none!important;box-shadow:none!important;position:relative;text-decoration:none!important}.wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{--wp-underline-color:var(--wp-admin-theme-color);background-image:linear-gradient(45deg,transparent 20%,var(--wp-underline-color) 30%,var(--wp-underline-color) 36%,transparent 46%),linear-gradient(135deg,transparent 54%,var(--wp-underline-color) 64%,var(--wp-underline-color) 70%,transparent 80%);background-position:0 100%;background-repeat:repeat-x;background-size:6px 3px;padding-bottom:.1em}.is-dark-theme .wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{--wp-underline-color:#fff}.wp-block-navigation-link__placeholder.wp-block-navigation-item__content{cursor:pointer}.link-control-transform{border-top:1px solid #ccc;padding:0 16px 8px}.link-control-transform__subheading{color:#1e1e1e;font-size:11px;font-weight:500;margin-bottom:1.5em;text-transform:uppercase}.link-control-transform__items{display:flex;justify-content:space-between}.link-control-transform__item{flex-basis:33%;flex-direction:column;gap:8px;height:auto}
|
@ -5,16 +5,6 @@
|
||||
* @package WordPress
|
||||
*/
|
||||
|
||||
/**
|
||||
* Build an array with CSS classes and inline styles defining the colors
|
||||
* which will be applied to the navigation markup in the front-end.
|
||||
*
|
||||
* @param array $context Navigation block context.
|
||||
* @param array $attributes Block attributes.
|
||||
* @param bool $is_sub_menu Whether the block is a sub-menu.
|
||||
* @return array Colors CSS classes and inline styles.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Build an array with CSS classes and inline styles defining the font sizes
|
||||
* which will be applied to the navigation markup in the front-end.
|
||||
|
@ -65,87 +65,62 @@ if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
|
||||
|
||||
return $menu_items_by_parent_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Interactivity API directives to the navigation-submenu and page-list blocks markup using the Tag Processor
|
||||
* The final HTML of the navigation-submenu and the page-list blocks will look similar to this:
|
||||
*
|
||||
* <li
|
||||
* class="has-child"
|
||||
* data-wp-context='{ "core": { "navigation": { "isMenuOpen": false, "overlay": false } } }'
|
||||
* data-wp-effect="effects.core.navigation.initMenu"
|
||||
* data-wp-on.keydown="actions.core.navigation.handleMenuKeydown"
|
||||
* data-wp-on.focusout="actions.core.navigation.handleMenuFocusout"
|
||||
* >
|
||||
* <button
|
||||
* class="wp-block-navigation-submenu__toggle"
|
||||
* data-wp-on.click="actions.core.navigation.openMenu"
|
||||
* data-wp-bind.aria-expanded="context.core.navigation.isMenuOpen"
|
||||
* >
|
||||
* </button>
|
||||
* <span>Title</span>
|
||||
* <ul class="wp-block-navigation__submenu-container">
|
||||
* SUBMENU ITEMS
|
||||
* </ul>
|
||||
* </li>
|
||||
*
|
||||
* @param string $w Markup of the navigation block.
|
||||
* @param array $block_attributes Block attributes.
|
||||
*
|
||||
* @return string Submenu markup with the directives injected.
|
||||
*/
|
||||
function block_core_navigation_add_directives_to_submenu( $w, $block_attributes ) {
|
||||
while ( $w->next_tag(
|
||||
array(
|
||||
'tag_name' => 'LI',
|
||||
'class_name' => 'has-child',
|
||||
)
|
||||
) ) {
|
||||
// Add directives to the parent `<li>`.
|
||||
$w->set_attribute( 'data-wp-interactive', true );
|
||||
$w->set_attribute( 'data-wp-context', '{ "core": { "navigation": { "isMenuOpen": { "click": false, "hover": false }, "overlay": false } } }' );
|
||||
$w->set_attribute( 'data-wp-effect', 'effects.core.navigation.initMenu' );
|
||||
$w->set_attribute( 'data-wp-on--focusout', 'actions.core.navigation.handleMenuFocusout' );
|
||||
$w->set_attribute( 'data-wp-on--keydown', 'actions.core.navigation.handleMenuKeydown' );
|
||||
if ( ! isset( $block_attributes['openSubmenusOnClick'] ) || false === $block_attributes['openSubmenusOnClick'] ) {
|
||||
$w->set_attribute( 'data-wp-on--mouseenter', 'actions.core.navigation.openMenuOnHover' );
|
||||
$w->set_attribute( 'data-wp-on--mouseleave', 'actions.core.navigation.closeMenuOnHover' );
|
||||
}
|
||||
|
||||
// Add directives to the toggle submenu button.
|
||||
if ( $w->next_tag(
|
||||
array(
|
||||
'tag_name' => 'BUTTON',
|
||||
'class_name' => 'wp-block-navigation-submenu__toggle',
|
||||
)
|
||||
) ) {
|
||||
$w->set_attribute( 'data-wp-on--click', 'actions.core.navigation.toggleMenuOnClick' );
|
||||
$w->set_attribute( 'data-wp-bind--aria-expanded', 'selectors.core.navigation.isMenuOpen' );
|
||||
};
|
||||
|
||||
// Iterate through subitems if exist.
|
||||
block_core_navigation_add_directives_to_submenu( $w, $block_attributes );
|
||||
}
|
||||
return $w->get_updated_html();
|
||||
};
|
||||
|
||||
/**
|
||||
* Replaces view script for the Navigation block with version using Interactivity API.
|
||||
*
|
||||
* @param array $metadata Block metadata as read in via block.json.
|
||||
*
|
||||
* @return array Filtered block type metadata.
|
||||
*/
|
||||
function gutenberg_block_core_navigation_update_interactive_view_script( $metadata ) {
|
||||
if ( 'core/navigation' === $metadata['name'] ) {
|
||||
$metadata['viewScript'] = array( 'file:./interactivity.min.js' );
|
||||
}
|
||||
return $metadata;
|
||||
}
|
||||
add_filter( 'block_type_metadata', 'gutenberg_block_core_navigation_update_interactive_view_script', 10, 1 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add Interactivity API directives to the navigation-submenu and page-list
|
||||
* blocks markup using the Tag Processor.
|
||||
*
|
||||
* @param string $w Markup of the navigation block.
|
||||
* @param array $block_attributes Block attributes.
|
||||
*
|
||||
* @return string Submenu markup with the directives injected.
|
||||
*/
|
||||
function block_core_navigation_add_directives_to_submenu( $w, $block_attributes ) {
|
||||
while ( $w->next_tag(
|
||||
array(
|
||||
'tag_name' => 'LI',
|
||||
'class_name' => 'has-child',
|
||||
)
|
||||
) ) {
|
||||
// Add directives to the parent `<li>`.
|
||||
$w->set_attribute( 'data-wp-interactive', true );
|
||||
$w->set_attribute( 'data-wp-context', '{ "core": { "navigation": { "submenuOpenedBy": {}, "type": "submenu" } } }' );
|
||||
$w->set_attribute( 'data-wp-effect', 'effects.core.navigation.initMenu' );
|
||||
$w->set_attribute( 'data-wp-on--focusout', 'actions.core.navigation.handleMenuFocusout' );
|
||||
$w->set_attribute( 'data-wp-on--keydown', 'actions.core.navigation.handleMenuKeydown' );
|
||||
if ( ! isset( $block_attributes['openSubmenusOnClick'] ) || false === $block_attributes['openSubmenusOnClick'] ) {
|
||||
$w->set_attribute( 'data-wp-on--mouseenter', 'actions.core.navigation.openMenuOnHover' );
|
||||
$w->set_attribute( 'data-wp-on--mouseleave', 'actions.core.navigation.closeMenuOnHover' );
|
||||
}
|
||||
|
||||
// Add directives to the toggle submenu button.
|
||||
if ( $w->next_tag(
|
||||
array(
|
||||
'tag_name' => 'BUTTON',
|
||||
'class_name' => 'wp-block-navigation-submenu__toggle',
|
||||
)
|
||||
) ) {
|
||||
$w->set_attribute( 'data-wp-on--click', 'actions.core.navigation.toggleMenuOnClick' );
|
||||
$w->set_attribute( 'data-wp-bind--aria-expanded', 'selectors.core.navigation.isMenuOpen' );
|
||||
// The `aria-expanded` attribute for SSR is already added in the submenu block.
|
||||
}
|
||||
// Add directives to the submenu.
|
||||
if ( $w->next_tag(
|
||||
array(
|
||||
'tag_name' => 'UL',
|
||||
'class_name' => 'wp-block-navigation__submenu-container',
|
||||
)
|
||||
) ) {
|
||||
$w->set_attribute( 'data-wp-on--focus', 'actions.core.navigation.openMenuOnFocus' );
|
||||
}
|
||||
|
||||
// Iterate through subitems if exist.
|
||||
block_core_navigation_add_directives_to_submenu( $w, $block_attributes );
|
||||
}
|
||||
return $w->get_updated_html();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an array with CSS classes and inline styles defining the colors
|
||||
@ -276,10 +251,6 @@ function block_core_navigation_render_submenu_icon() {
|
||||
return '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Filter out empty "null" blocks from the block list.
|
||||
* 'parse_blocks' includes a null block with '\n\n' as the content when
|
||||
@ -292,7 +263,7 @@ function block_core_navigation_render_submenu_icon() {
|
||||
function block_core_navigation_filter_out_empty_blocks( $parsed_blocks ) {
|
||||
$filtered = array_filter(
|
||||
$parsed_blocks,
|
||||
static function( $block ) {
|
||||
static function ( $block ) {
|
||||
return isset( $block['blockName'] );
|
||||
}
|
||||
);
|
||||
@ -422,7 +393,7 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
||||
// a fallback (i.e. the block has no menu associated with it).
|
||||
$is_fallback = false;
|
||||
|
||||
$nav_menu_name = '';
|
||||
$nav_menu_name = $attributes['ariaLabel'] ?? '';
|
||||
|
||||
/**
|
||||
* Deprecated:
|
||||
@ -558,7 +529,7 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
||||
}
|
||||
|
||||
// Manually add block support text decoration as CSS class.
|
||||
$text_decoration = _wp_array_get( $attributes, array( 'style', 'typography', 'textDecoration' ), null );
|
||||
$text_decoration = $attributes['style']['typography']['textDecoration'] ?? null;
|
||||
$text_decoration_class = sprintf( 'has-text-decoration-%s', $text_decoration );
|
||||
|
||||
$colors = block_core_navigation_build_css_colors( $attributes );
|
||||
@ -658,24 +629,25 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
||||
$inner_blocks_html .= '</ul>';
|
||||
}
|
||||
|
||||
// If the script already exists, there is no point in removing it from viewScript.
|
||||
$should_load_view_script = ( $is_responsive_menu || ( $has_submenus && ( $attributes['openSubmenusOnClick'] || $attributes['showSubmenuIcon'] ) ) );
|
||||
$should_load_view_script = ( $has_submenus && ( $attributes['openSubmenusOnClick'] || $attributes['showSubmenuIcon'] ) ) || $is_responsive_menu;
|
||||
$view_js_file = 'wp-block-navigation-view';
|
||||
|
||||
// If the script already exists, there is no point in removing it from viewScript.
|
||||
if ( ! wp_script_is( $view_js_file ) ) {
|
||||
$script_handles = $block->block_type->view_script_handles;
|
||||
|
||||
// If the script is not needed, and it is still in the `view_script_handles`, remove it.
|
||||
if ( ! $should_load_view_script && in_array( $view_js_file, $script_handles, true ) ) {
|
||||
$block->block_type->view_script_handles = array_diff( $script_handles, array( $view_js_file, 'wp-block-navigation-view-2' ) );
|
||||
$block->block_type->view_script_handles = array_diff( $script_handles, array( $view_js_file ) );
|
||||
}
|
||||
// If the script is needed, but it was previously removed, add it again.
|
||||
if ( $should_load_view_script && ! in_array( $view_js_file, $script_handles, true ) ) {
|
||||
$block->block_type->view_script_handles = array_merge( $script_handles, array( $view_js_file, 'wp-block-navigation-view-2' ) );
|
||||
$block->block_type->view_script_handles = array_merge( $script_handles, array( $view_js_file ) );
|
||||
}
|
||||
}
|
||||
|
||||
// Add directives to the submenu if needed.
|
||||
if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN && $has_submenus && $should_load_view_script ) {
|
||||
if ( $has_submenus && $should_load_view_script ) {
|
||||
$w = new WP_HTML_Tag_Processor( $inner_blocks_html );
|
||||
$inner_blocks_html = block_core_navigation_add_directives_to_submenu( $w, $attributes );
|
||||
}
|
||||
@ -723,10 +695,10 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
||||
$responsive_container_directives = '';
|
||||
$responsive_dialog_directives = '';
|
||||
$close_button_directives = '';
|
||||
if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN && $should_load_view_script ) {
|
||||
if ( $should_load_view_script ) {
|
||||
$nav_element_directives = '
|
||||
data-wp-interactive
|
||||
data-wp-context=\'{ "core": { "navigation": { "isMenuOpen": { "click": false, "hover": false }, "overlay": true, "roleAttribute": "" } } }\'
|
||||
data-wp-context=\'{ "core": { "navigation": { "overlayOpenedBy": {}, "type": "overlay", "roleAttribute": "" } } }\'
|
||||
';
|
||||
$open_button_directives = '
|
||||
data-wp-on--click="actions.core.navigation.openMenuOnClick"
|
||||
@ -741,7 +713,7 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
||||
tabindex="-1"
|
||||
';
|
||||
$responsive_dialog_directives = '
|
||||
data-wp-bind--aria-modal="selectors.core.navigation.isMenuOpen"
|
||||
data-wp-bind--aria-modal="selectors.core.navigation.ariaModal"
|
||||
data-wp-bind--role="selectors.core.navigation.roleAttribute"
|
||||
data-wp-effect="effects.core.navigation.focusFirstElement"
|
||||
';
|
||||
@ -751,11 +723,11 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
||||
}
|
||||
|
||||
$responsive_container_markup = sprintf(
|
||||
'<button aria-haspopup="true" %3$s class="%6$s" data-micromodal-trigger="%1$s" %11$s>%9$s</button>
|
||||
'<button aria-haspopup="true" %3$s class="%6$s" %11$s>%9$s</button>
|
||||
<div class="%5$s" style="%7$s" id="%1$s" %12$s>
|
||||
<div class="wp-block-navigation__responsive-close" tabindex="-1" data-micromodal-close>
|
||||
<div class="wp-block-navigation__responsive-close" tabindex="-1">
|
||||
<div class="wp-block-navigation__responsive-dialog" aria-label="%8$s" %13$s>
|
||||
<button %4$s data-micromodal-close class="wp-block-navigation__responsive-container-close" %14$s>%10$s</button>
|
||||
<button %4$s class="wp-block-navigation__responsive-container-close" %14$s>%10$s</button>
|
||||
<div class="wp-block-navigation__responsive-container-content" id="%1$s-content">
|
||||
%2$s
|
||||
</div>
|
||||
@ -837,6 +809,25 @@ function block_core_navigation_typographic_presets_backcompatibility( $parsed_bl
|
||||
|
||||
add_filter( 'render_block_data', 'block_core_navigation_typographic_presets_backcompatibility' );
|
||||
|
||||
/**
|
||||
* Ensure that the view script has the `wp-interactivity` dependency.
|
||||
*
|
||||
* @since 6.4.0
|
||||
*
|
||||
* @global WP_Scripts $wp_scripts
|
||||
*/
|
||||
function block_core_navigation_ensure_interactivity_dependency() {
|
||||
global $wp_scripts;
|
||||
if (
|
||||
isset( $wp_scripts->registered['wp-block-navigation-view'] ) &&
|
||||
! in_array( 'wp-interactivity', $wp_scripts->registered['wp-block-navigation-view']->deps, true )
|
||||
) {
|
||||
$wp_scripts->registered['wp-block-navigation-view']->deps[] = 'wp-interactivity';
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'wp_print_scripts', 'block_core_navigation_ensure_interactivity_dependency' );
|
||||
|
||||
/**
|
||||
* Turns menu item data into a nested array of parsed blocks
|
||||
*
|
||||
@ -930,7 +921,7 @@ function block_core_navigation_get_classic_menu_fallback() {
|
||||
// Otherwise return the most recently created classic menu.
|
||||
usort(
|
||||
$classic_nav_menus,
|
||||
static function( $a, $b ) {
|
||||
static function ( $a, $b ) {
|
||||
return $b->term_id - $a->term_id;
|
||||
}
|
||||
);
|
||||
|
@ -91,6 +91,7 @@
|
||||
},
|
||||
"supports": {
|
||||
"align": [ "wide", "full" ],
|
||||
"ariaLabel": true,
|
||||
"html": false,
|
||||
"inserter": true,
|
||||
"typography": {
|
||||
@ -131,9 +132,10 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"interactivity": true
|
||||
},
|
||||
"viewScript": [ "file:./view.min.js", "file:./view-modal.min.js" ],
|
||||
"viewScript": "file:./view.min.js",
|
||||
"editorStyle": "wp-block-navigation-editor",
|
||||
"style": "wp-block-navigation"
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
}
|
||||
.wp-block-navigation .wp-block-navigation-item{
|
||||
align-items:center;
|
||||
background-color:inherit;
|
||||
display:flex;
|
||||
position:relative;
|
||||
}
|
||||
@ -234,6 +235,13 @@ button.wp-block-navigation-item__content{
|
||||
.wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-container{
|
||||
background-color:#fff;
|
||||
border:1px solid rgba(0,0,0,.15);
|
||||
}
|
||||
|
||||
.wp-block-navigation.has-background .wp-block-navigation__submenu-container{
|
||||
background-color:inherit;
|
||||
}
|
||||
|
||||
.wp-block-navigation:not(.has-text-color) .wp-block-navigation__submenu-container{
|
||||
color:#000;
|
||||
}
|
||||
|
||||
@ -272,7 +280,7 @@ button.wp-block-navigation-item__content{
|
||||
right:0;
|
||||
top:0;
|
||||
}
|
||||
.wp-block-navigation__responsive-container .wp-block-navigation-link a{
|
||||
.wp-block-navigation__responsive-container :where(.wp-block-navigation-item a){
|
||||
color:inherit;
|
||||
}
|
||||
.wp-block-navigation__responsive-container .wp-block-navigation__responsive-container-content{
|
||||
@ -342,7 +350,7 @@ button.wp-block-navigation-item__content{
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
}
|
||||
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item .wp-block-navigation__submenu-container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-page-list{
|
||||
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item .wp-block-navigation__submenu-container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-page-list{
|
||||
background:transparent !important;
|
||||
color:inherit !important;
|
||||
}
|
||||
@ -368,6 +376,9 @@ button.wp-block-navigation-item__content{
|
||||
|
||||
.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open{
|
||||
background-color:#fff;
|
||||
}
|
||||
|
||||
.wp-block-navigation:not(.has-text-color) .wp-block-navigation__responsive-container.is-menu-open{
|
||||
color:#000;
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -18,6 +18,7 @@
|
||||
}
|
||||
.wp-block-navigation .wp-block-navigation-item{
|
||||
align-items:center;
|
||||
background-color:inherit;
|
||||
display:flex;
|
||||
position:relative;
|
||||
}
|
||||
@ -234,6 +235,13 @@ button.wp-block-navigation-item__content{
|
||||
.wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-container{
|
||||
background-color:#fff;
|
||||
border:1px solid rgba(0,0,0,.15);
|
||||
}
|
||||
|
||||
.wp-block-navigation.has-background .wp-block-navigation__submenu-container{
|
||||
background-color:inherit;
|
||||
}
|
||||
|
||||
.wp-block-navigation:not(.has-text-color) .wp-block-navigation__submenu-container{
|
||||
color:#000;
|
||||
}
|
||||
|
||||
@ -272,7 +280,7 @@ button.wp-block-navigation-item__content{
|
||||
right:0;
|
||||
top:0;
|
||||
}
|
||||
.wp-block-navigation__responsive-container .wp-block-navigation-link a{
|
||||
.wp-block-navigation__responsive-container :where(.wp-block-navigation-item a){
|
||||
color:inherit;
|
||||
}
|
||||
.wp-block-navigation__responsive-container .wp-block-navigation__responsive-container-content{
|
||||
@ -342,7 +350,7 @@ button.wp-block-navigation-item__content{
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
}
|
||||
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item .wp-block-navigation__submenu-container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-page-list{
|
||||
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item .wp-block-navigation__submenu-container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-page-list{
|
||||
background:transparent !important;
|
||||
color:inherit !important;
|
||||
}
|
||||
@ -368,6 +376,9 @@ button.wp-block-navigation-item__content{
|
||||
|
||||
.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open{
|
||||
background-color:#fff;
|
||||
}
|
||||
|
||||
.wp-block-navigation:not(.has-text-color) .wp-block-navigation__responsive-container.is-menu-open{
|
||||
color:#000;
|
||||
}
|
||||
|
||||
|
2
wp-includes/blocks/navigation/style.min.css
vendored
2
wp-includes/blocks/navigation/style.min.css
vendored
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '6391fb107a84d15c14f4');
|
||||
<?php return array('dependencies' => array(), 'version' => 'a145d0113e969f692877');
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => 'b0c5026864ec3616bae7');
|
||||
<?php return array('dependencies' => array(), 'version' => 'efa7b39e8a2ac7d3f83a');
|
||||
|
@ -1,63 +1,191 @@
|
||||
/******/ (function() { // webpackBootstrap
|
||||
var __webpack_exports__ = {};
|
||||
// Open on click functionality.
|
||||
function closeSubmenus(element) {
|
||||
element.querySelectorAll('[aria-expanded="true"]').forEach(function (toggle) {
|
||||
toggle.setAttribute('aria-expanded', 'false');
|
||||
});
|
||||
}
|
||||
"use strict";
|
||||
(self["__WordPressPrivateInteractivityAPI__"] = self["__WordPressPrivateInteractivityAPI__"] || []).push([[3],{
|
||||
|
||||
function toggleSubmenuOnClick(event) {
|
||||
const buttonToggle = event.target.closest('[aria-expanded]');
|
||||
const isSubmenuOpen = buttonToggle.getAttribute('aria-expanded');
|
||||
/***/ 932:
|
||||
/***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
|
||||
|
||||
if (isSubmenuOpen === 'true') {
|
||||
closeSubmenus(buttonToggle.closest('.wp-block-navigation-item'));
|
||||
} else {
|
||||
// Close all sibling submenus.
|
||||
const parentElement = buttonToggle.closest('.wp-block-navigation-item');
|
||||
const navigationParent = buttonToggle.closest('.wp-block-navigation__submenu-container, .wp-block-navigation__container, .wp-block-page-list');
|
||||
navigationParent.querySelectorAll('.wp-block-navigation-item').forEach(function (child) {
|
||||
if (child !== parentElement) {
|
||||
closeSubmenus(child);
|
||||
}
|
||||
}); // Open submenu.
|
||||
/* harmony import */ var _wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(754);
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
buttonToggle.setAttribute('aria-expanded', 'true');
|
||||
const focusableSelectors = ['a[href]', 'input:not([disabled]):not([type="hidden"]):not([aria-hidden])', 'select:not([disabled]):not([aria-hidden])', 'textarea:not([disabled]):not([aria-hidden])', 'button:not([disabled]):not([aria-hidden])', '[contenteditable]', '[tabindex]:not([tabindex^="-"])'];
|
||||
const openMenu = (store, menuOpenedOn) => {
|
||||
const {
|
||||
context,
|
||||
ref,
|
||||
selectors
|
||||
} = store;
|
||||
selectors.core.navigation.menuOpenedBy(store)[menuOpenedOn] = true;
|
||||
context.core.navigation.previousFocus = ref;
|
||||
if (context.core.navigation.type === 'overlay') {
|
||||
// Add a `has-modal-open` class to the <html> root.
|
||||
document.documentElement.classList.add('has-modal-open');
|
||||
}
|
||||
} // Necessary for some themes such as TT1 Blocks, where
|
||||
// scripts could be loaded before the body.
|
||||
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
const submenuButtons = document.querySelectorAll('.wp-block-navigation-submenu__toggle');
|
||||
submenuButtons.forEach(function (button) {
|
||||
button.addEventListener('click', toggleSubmenuOnClick);
|
||||
}); // Close on click outside.
|
||||
|
||||
document.addEventListener('click', function (event) {
|
||||
const navigationBlocks = document.querySelectorAll('.wp-block-navigation');
|
||||
navigationBlocks.forEach(function (block) {
|
||||
if (!block.contains(event.target)) {
|
||||
closeSubmenus(block);
|
||||
};
|
||||
const closeMenu = (store, menuClosedOn) => {
|
||||
const {
|
||||
context,
|
||||
selectors
|
||||
} = store;
|
||||
selectors.core.navigation.menuOpenedBy(store)[menuClosedOn] = false;
|
||||
// Check if the menu is still open or not.
|
||||
if (!selectors.core.navigation.isMenuOpen(store)) {
|
||||
if (context.core.navigation.modal?.contains(window.document.activeElement)) {
|
||||
context.core.navigation.previousFocus.focus();
|
||||
}
|
||||
context.core.navigation.modal = null;
|
||||
context.core.navigation.previousFocus = null;
|
||||
if (context.core.navigation.type === 'overlay') {
|
||||
document.documentElement.classList.remove('has-modal-open');
|
||||
}
|
||||
}
|
||||
};
|
||||
(0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__/* .store */ .h)({
|
||||
effects: {
|
||||
core: {
|
||||
navigation: {
|
||||
initMenu: store => {
|
||||
const {
|
||||
context,
|
||||
selectors,
|
||||
ref
|
||||
} = store;
|
||||
if (selectors.core.navigation.isMenuOpen(store)) {
|
||||
const focusableElements = ref.querySelectorAll(focusableSelectors);
|
||||
context.core.navigation.modal = ref;
|
||||
context.core.navigation.firstFocusableElement = focusableElements[0];
|
||||
context.core.navigation.lastFocusableElement = focusableElements[focusableElements.length - 1];
|
||||
}
|
||||
},
|
||||
focusFirstElement: store => {
|
||||
const {
|
||||
selectors,
|
||||
ref
|
||||
} = store;
|
||||
if (selectors.core.navigation.isMenuOpen(store)) {
|
||||
ref.querySelector('.wp-block-navigation-item > *:first-child').focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}); // Close on focus outside or escape key.
|
||||
|
||||
document.addEventListener('keyup', function (event) {
|
||||
const submenuBlocks = document.querySelectorAll('.wp-block-navigation-item.has-child');
|
||||
submenuBlocks.forEach(function (block) {
|
||||
if (!block.contains(event.target)) {
|
||||
closeSubmenus(block);
|
||||
} else if (event.key === 'Escape') {
|
||||
const toggle = block.querySelector('[aria-expanded="true"]');
|
||||
closeSubmenus(block); // Focus the submenu trigger so focus does not get trapped in the closed submenu.
|
||||
|
||||
toggle?.focus();
|
||||
}
|
||||
},
|
||||
selectors: {
|
||||
core: {
|
||||
navigation: {
|
||||
roleAttribute: store => {
|
||||
const {
|
||||
context,
|
||||
selectors
|
||||
} = store;
|
||||
return context.core.navigation.type === 'overlay' && selectors.core.navigation.isMenuOpen(store) ? 'dialog' : null;
|
||||
},
|
||||
ariaModal: store => {
|
||||
const {
|
||||
context,
|
||||
selectors
|
||||
} = store;
|
||||
return context.core.navigation.type === 'overlay' && selectors.core.navigation.isMenuOpen(store) ? 'true' : null;
|
||||
},
|
||||
isMenuOpen: ({
|
||||
context
|
||||
}) =>
|
||||
// The menu is opened if either `click`, `hover` or `focus` is true.
|
||||
Object.values(context.core.navigation[context.core.navigation.type === 'overlay' ? 'overlayOpenedBy' : 'submenuOpenedBy']).filter(Boolean).length > 0,
|
||||
menuOpenedBy: ({
|
||||
context
|
||||
}) => context.core.navigation[context.core.navigation.type === 'overlay' ? 'overlayOpenedBy' : 'submenuOpenedBy']
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
core: {
|
||||
navigation: {
|
||||
openMenuOnHover(store) {
|
||||
const {
|
||||
navigation
|
||||
} = store.context.core;
|
||||
if (navigation.type === 'submenu' &&
|
||||
// Only open on hover if the overlay is closed.
|
||||
Object.values(navigation.overlayOpenedBy || {}).filter(Boolean).length === 0) openMenu(store, 'hover');
|
||||
},
|
||||
closeMenuOnHover(store) {
|
||||
closeMenu(store, 'hover');
|
||||
},
|
||||
openMenuOnClick(store) {
|
||||
openMenu(store, 'click');
|
||||
},
|
||||
closeMenuOnClick(store) {
|
||||
closeMenu(store, 'click');
|
||||
closeMenu(store, 'focus');
|
||||
},
|
||||
openMenuOnFocus(store) {
|
||||
openMenu(store, 'focus');
|
||||
},
|
||||
toggleMenuOnClick: store => {
|
||||
const {
|
||||
selectors
|
||||
} = store;
|
||||
const menuOpenedBy = selectors.core.navigation.menuOpenedBy(store);
|
||||
if (menuOpenedBy.click || menuOpenedBy.focus) {
|
||||
closeMenu(store, 'click');
|
||||
closeMenu(store, 'focus');
|
||||
} else {
|
||||
openMenu(store, 'click');
|
||||
}
|
||||
},
|
||||
handleMenuKeydown: store => {
|
||||
const {
|
||||
context,
|
||||
selectors,
|
||||
event
|
||||
} = store;
|
||||
if (selectors.core.navigation.menuOpenedBy(store).click) {
|
||||
// If Escape close the menu.
|
||||
if (event?.key === 'Escape') {
|
||||
closeMenu(store, 'click');
|
||||
closeMenu(store, 'focus');
|
||||
return;
|
||||
}
|
||||
|
||||
// Trap focus if it is an overlay (main menu).
|
||||
if (context.core.navigation.type === 'overlay' && event.key === 'Tab') {
|
||||
// If shift + tab it change the direction.
|
||||
if (event.shiftKey && window.document.activeElement === context.core.navigation.firstFocusableElement) {
|
||||
event.preventDefault();
|
||||
context.core.navigation.lastFocusableElement.focus();
|
||||
} else if (!event.shiftKey && window.document.activeElement === context.core.navigation.lastFocusableElement) {
|
||||
event.preventDefault();
|
||||
context.core.navigation.firstFocusableElement.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
handleMenuFocusout: store => {
|
||||
const {
|
||||
context,
|
||||
event
|
||||
} = store;
|
||||
// If focus is outside modal, and in the document, close menu
|
||||
// event.target === The element losing focus
|
||||
// event.relatedTarget === The element receiving focus (if any)
|
||||
// When focusout is outsite the document,
|
||||
// `window.document.activeElement` doesn't change.
|
||||
if (!context.core.navigation.modal?.contains(event.relatedTarget) && event.target !== window.document.activeElement) {
|
||||
closeMenu(store, 'click');
|
||||
closeMenu(store, 'focus');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/******/ })()
|
||||
;
|
||||
/***/ })
|
||||
|
||||
},
|
||||
/******/ function(__webpack_require__) { // webpackRuntimeModules
|
||||
/******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
|
||||
/******/ var __webpack_exports__ = (__webpack_exec__(932));
|
||||
/******/ }
|
||||
]);
|
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '886680af40b7521d60fc');
|
||||
<?php return array('dependencies' => array(), 'version' => 'dde7635cad8b0819b900');
|
||||
|
2
wp-includes/blocks/navigation/view.min.js
vendored
2
wp-includes/blocks/navigation/view.min.js
vendored
@ -1 +1 @@
|
||||
!function(){function e(e){e.querySelectorAll('[aria-expanded="true"]').forEach((function(e){e.setAttribute("aria-expanded","false")}))}function t(t){const n=t.target.closest("[aria-expanded]");if("true"===n.getAttribute("aria-expanded"))e(n.closest(".wp-block-navigation-item"));else{const t=n.closest(".wp-block-navigation-item");n.closest(".wp-block-navigation__submenu-container, .wp-block-navigation__container, .wp-block-page-list").querySelectorAll(".wp-block-navigation-item").forEach((function(n){n!==t&&e(n)})),n.setAttribute("aria-expanded","true")}}window.addEventListener("load",(()=>{document.querySelectorAll(".wp-block-navigation-submenu__toggle").forEach((function(e){e.addEventListener("click",t)})),document.addEventListener("click",(function(t){document.querySelectorAll(".wp-block-navigation").forEach((function(n){n.contains(t.target)||e(n)}))})),document.addEventListener("keyup",(function(t){document.querySelectorAll(".wp-block-navigation-item.has-child").forEach((function(n){if(n.contains(t.target)){if("Escape"===t.key){const t=n.querySelector('[aria-expanded="true"]');e(n),t?.focus()}}else e(n)}))}))}))}();
|
||||
"use strict";(self.__WordPressPrivateInteractivityAPI__=self.__WordPressPrivateInteractivityAPI__||[]).push([[3],{932:function(e,n,o){var t=o(754);const i=["a[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","[contenteditable]",'[tabindex]:not([tabindex^="-"])'],a=(e,n)=>{const{context:o,ref:t,selectors:i}=e;i.core.navigation.menuOpenedBy(e)[n]=!0,o.core.navigation.previousFocus=t,"overlay"===o.core.navigation.type&&document.documentElement.classList.add("has-modal-open")},c=(e,n)=>{const{context:o,selectors:t}=e;t.core.navigation.menuOpenedBy(e)[n]=!1,t.core.navigation.isMenuOpen(e)||(o.core.navigation.modal?.contains(window.document.activeElement)&&o.core.navigation.previousFocus.focus(),o.core.navigation.modal=null,o.core.navigation.previousFocus=null,"overlay"===o.core.navigation.type&&document.documentElement.classList.remove("has-modal-open"))};(0,t.h)({effects:{core:{navigation:{initMenu:e=>{const{context:n,selectors:o,ref:t}=e;if(o.core.navigation.isMenuOpen(e)){const e=t.querySelectorAll(i);n.core.navigation.modal=t,n.core.navigation.firstFocusableElement=e[0],n.core.navigation.lastFocusableElement=e[e.length-1]}},focusFirstElement:e=>{const{selectors:n,ref:o}=e;n.core.navigation.isMenuOpen(e)&&o.querySelector(".wp-block-navigation-item > *:first-child").focus()}}}},selectors:{core:{navigation:{roleAttribute:e=>{const{context:n,selectors:o}=e;return"overlay"===n.core.navigation.type&&o.core.navigation.isMenuOpen(e)?"dialog":null},ariaModal:e=>{const{context:n,selectors:o}=e;return"overlay"===n.core.navigation.type&&o.core.navigation.isMenuOpen(e)?"true":null},isMenuOpen:({context:e})=>Object.values(e.core.navigation["overlay"===e.core.navigation.type?"overlayOpenedBy":"submenuOpenedBy"]).filter(Boolean).length>0,menuOpenedBy:({context:e})=>e.core.navigation["overlay"===e.core.navigation.type?"overlayOpenedBy":"submenuOpenedBy"]}}},actions:{core:{navigation:{openMenuOnHover(e){const{navigation:n}=e.context.core;"submenu"===n.type&&0===Object.values(n.overlayOpenedBy||{}).filter(Boolean).length&&a(e,"hover")},closeMenuOnHover(e){c(e,"hover")},openMenuOnClick(e){a(e,"click")},closeMenuOnClick(e){c(e,"click"),c(e,"focus")},openMenuOnFocus(e){a(e,"focus")},toggleMenuOnClick:e=>{const{selectors:n}=e,o=n.core.navigation.menuOpenedBy(e);o.click||o.focus?(c(e,"click"),c(e,"focus")):a(e,"click")},handleMenuKeydown:e=>{const{context:n,selectors:o,event:t}=e;if(o.core.navigation.menuOpenedBy(e).click){if("Escape"===t?.key)return c(e,"click"),void c(e,"focus");"overlay"===n.core.navigation.type&&"Tab"===t.key&&(t.shiftKey&&window.document.activeElement===n.core.navigation.firstFocusableElement?(t.preventDefault(),n.core.navigation.lastFocusableElement.focus()):t.shiftKey||window.document.activeElement!==n.core.navigation.lastFocusableElement||(t.preventDefault(),n.core.navigation.firstFocusableElement.focus()))}},handleMenuFocusout:e=>{const{context:n,event:o}=e;n.core.navigation.modal?.contains(o.relatedTarget)||o.target===window.document.activeElement||(c(e,"click"),c(e,"focus"))}}}}})}},function(e){var n;n=932,e(e.s=n)}]);
|
@ -7,6 +7,7 @@
|
||||
"description": "Start with the basic building block of all narrative.",
|
||||
"keywords": [ "text" ],
|
||||
"textdomain": "default",
|
||||
"usesContext": [ "postId" ],
|
||||
"attributes": {
|
||||
"align": {
|
||||
"type": "string"
|
||||
@ -41,6 +42,7 @@
|
||||
"text": true
|
||||
}
|
||||
},
|
||||
"__experimentalConnections": true,
|
||||
"spacing": {
|
||||
"margin": true,
|
||||
"padding": true,
|
||||
@ -58,6 +60,7 @@
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalWritingMode": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
|
@ -9,3 +9,7 @@
|
||||
.block-editor-block-list__block[data-empty=true]+.block-editor-block-list__block[data-empty=true]:not([data-custom-placeholder=true]) [data-rich-text-placeholder]{
|
||||
opacity:0;
|
||||
}
|
||||
|
||||
.block-editor-block-list__block[data-type="core/paragraph"].has-text-align-left[style*="writing-mode: vertical-lr"],.block-editor-block-list__block[data-type="core/paragraph"].has-text-align-right[style*="writing-mode: vertical-rl"]{
|
||||
rotate:180deg;
|
||||
}
|
@ -1 +1 @@
|
||||
.block-editor-block-list__block[data-type="core/paragraph"].has-drop-cap:focus{min-height:auto!important}.block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder]{opacity:1}.block-editor-block-list__block[data-empty=true]+.block-editor-block-list__block[data-empty=true]:not([data-custom-placeholder=true]) [data-rich-text-placeholder]{opacity:0}
|
||||
.block-editor-block-list__block[data-type="core/paragraph"].has-drop-cap:focus{min-height:auto!important}.block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder]{opacity:1}.block-editor-block-list__block[data-empty=true]+.block-editor-block-list__block[data-empty=true]:not([data-custom-placeholder=true]) [data-rich-text-placeholder]{opacity:0}.block-editor-block-list__block[data-type="core/paragraph"].has-text-align-left[style*="writing-mode: vertical-lr"],.block-editor-block-list__block[data-type="core/paragraph"].has-text-align-right[style*="writing-mode: vertical-rl"]{rotate:180deg}
|
@ -9,3 +9,7 @@
|
||||
.block-editor-block-list__block[data-empty=true]+.block-editor-block-list__block[data-empty=true]:not([data-custom-placeholder=true]) [data-rich-text-placeholder]{
|
||||
opacity:0;
|
||||
}
|
||||
|
||||
.block-editor-block-list__block[data-type="core/paragraph"].has-text-align-left[style*="writing-mode: vertical-lr"],.block-editor-block-list__block[data-type="core/paragraph"].has-text-align-right[style*="writing-mode: vertical-rl"]{
|
||||
rotate:180deg;
|
||||
}
|
2
wp-includes/blocks/paragraph/editor.min.css
vendored
2
wp-includes/blocks/paragraph/editor.min.css
vendored
@ -1 +1 @@
|
||||
.block-editor-block-list__block[data-type="core/paragraph"].has-drop-cap:focus{min-height:auto!important}.block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder]{opacity:1}.block-editor-block-list__block[data-empty=true]+.block-editor-block-list__block[data-empty=true]:not([data-custom-placeholder=true]) [data-rich-text-placeholder]{opacity:0}
|
||||
.block-editor-block-list__block[data-type="core/paragraph"].has-drop-cap:focus{min-height:auto!important}.block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder]{opacity:1}.block-editor-block-list__block[data-empty=true]+.block-editor-block-list__block[data-empty=true]:not([data-custom-placeholder=true]) [data-rich-text-placeholder]{opacity:0}.block-editor-block-list__block[data-type="core/paragraph"].has-text-align-left[style*="writing-mode: vertical-lr"],.block-editor-block-list__block[data-type="core/paragraph"].has-text-align-right[style*="writing-mode: vertical-rl"]{rotate:180deg}
|
@ -40,3 +40,7 @@ p.has-background{
|
||||
:where(p.has-text-color:not(.has-link-color)) a{
|
||||
color:inherit;
|
||||
}
|
||||
|
||||
p.has-text-align-left[style*="writing-mode:vertical-lr"],p.has-text-align-right[style*="writing-mode:vertical-rl"]{
|
||||
rotate:180deg;
|
||||
}
|
@ -1 +1 @@
|
||||
.is-small-text{font-size:.875em}.is-regular-text{font-size:1em}.is-large-text{font-size:2.25em}.is-larger-text{font-size:3em}.has-drop-cap:not(:focus):first-letter{float:right;font-size:8.4em;font-style:normal;font-weight:100;line-height:.68;margin:.05em 0 0 .1em;text-transform:uppercase}body.rtl .has-drop-cap:not(:focus):first-letter{float:none;margin-right:.1em}p.has-drop-cap.has-background{overflow:hidden}p.has-background{padding:1.25em 2.375em}:where(p.has-text-color:not(.has-link-color)) a{color:inherit}
|
||||
.is-small-text{font-size:.875em}.is-regular-text{font-size:1em}.is-large-text{font-size:2.25em}.is-larger-text{font-size:3em}.has-drop-cap:not(:focus):first-letter{float:right;font-size:8.4em;font-style:normal;font-weight:100;line-height:.68;margin:.05em 0 0 .1em;text-transform:uppercase}body.rtl .has-drop-cap:not(:focus):first-letter{float:none;margin-right:.1em}p.has-drop-cap.has-background{overflow:hidden}p.has-background{padding:1.25em 2.375em}:where(p.has-text-color:not(.has-link-color)) a{color:inherit}p.has-text-align-left[style*="writing-mode:vertical-lr"],p.has-text-align-right[style*="writing-mode:vertical-rl"]{rotate:180deg}
|
@ -40,3 +40,7 @@ p.has-background{
|
||||
:where(p.has-text-color:not(.has-link-color)) a{
|
||||
color:inherit;
|
||||
}
|
||||
|
||||
p.has-text-align-left[style*="writing-mode:vertical-lr"],p.has-text-align-right[style*="writing-mode:vertical-rl"]{
|
||||
rotate:180deg;
|
||||
}
|
2
wp-includes/blocks/paragraph/style.min.css
vendored
2
wp-includes/blocks/paragraph/style.min.css
vendored
@ -1 +1 @@
|
||||
.is-small-text{font-size:.875em}.is-regular-text{font-size:1em}.is-large-text{font-size:2.25em}.is-larger-text{font-size:3em}.has-drop-cap:not(:focus):first-letter{float:left;font-size:8.4em;font-style:normal;font-weight:100;line-height:.68;margin:.05em .1em 0 0;text-transform:uppercase}body.rtl .has-drop-cap:not(:focus):first-letter{float:none;margin-left:.1em}p.has-drop-cap.has-background{overflow:hidden}p.has-background{padding:1.25em 2.375em}:where(p.has-text-color:not(.has-link-color)) a{color:inherit}
|
||||
.is-small-text{font-size:.875em}.is-regular-text{font-size:1em}.is-large-text{font-size:2.25em}.is-larger-text{font-size:3em}.has-drop-cap:not(:focus):first-letter{float:left;font-size:8.4em;font-style:normal;font-weight:100;line-height:.68;margin:.05em .1em 0 0;text-transform:uppercase}body.rtl .has-drop-cap:not(:focus):first-letter{float:none;margin-left:.1em}p.has-drop-cap.has-background{overflow:hidden}p.has-background{padding:1.25em 2.375em}:where(p.has-text-color:not(.has-link-color)) a{color:inherit}p.has-text-align-left[style*="writing-mode:vertical-lr"],p.has-text-align-right[style*="writing-mode:vertical-rl"]{rotate:180deg}
|
@ -41,7 +41,17 @@ function render_block_core_pattern( $attributes ) {
|
||||
}
|
||||
|
||||
$pattern = $registry->get_registered( $slug );
|
||||
return do_blocks( $pattern['content'] );
|
||||
$content = $pattern['content'];
|
||||
|
||||
// Backward compatibility for handling Block Hooks and injecting the theme attribute in the Gutenberg plugin.
|
||||
// This can be removed when the minimum supported WordPress is >= 6.4.
|
||||
if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN && ! function_exists( 'traverse_and_serialize_blocks' ) ) {
|
||||
$content = _inject_theme_attribute_in_block_template_content( $content );
|
||||
$blocks = parse_blocks( $content );
|
||||
$content = gutenberg_serialize_blocks( $blocks );
|
||||
}
|
||||
|
||||
return do_blocks( $content );
|
||||
}
|
||||
|
||||
add_action( 'init', 'register_block_core_pattern' );
|
||||
|
@ -2,7 +2,7 @@
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "core/post-author-biography",
|
||||
"title": "Post Author Biography",
|
||||
"title": "Author Biography",
|
||||
"category": "theme",
|
||||
"description": "The author biography.",
|
||||
"textdomain": "default",
|
||||
|
@ -2,7 +2,7 @@
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "core/post-author-name",
|
||||
"title": "Post Author Name",
|
||||
"title": "Author Name",
|
||||
"category": "theme",
|
||||
"description": "The author name.",
|
||||
"textdomain": "default",
|
||||
|
@ -2,7 +2,7 @@
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "core/post-author",
|
||||
"title": "Post Author",
|
||||
"title": "Author",
|
||||
"category": "theme",
|
||||
"description": "Display post author details such as name, avatar, and bio.",
|
||||
"textdomain": "default",
|
||||
|
@ -2,7 +2,7 @@
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "core/post-comments-form",
|
||||
"title": "Post Comments Form",
|
||||
"title": "Comments Form",
|
||||
"category": "theme",
|
||||
"description": "Display a post's comments form.",
|
||||
"textdomain": "default",
|
||||
@ -16,6 +16,7 @@
|
||||
"html": false,
|
||||
"color": {
|
||||
"gradients": true,
|
||||
"heading": true,
|
||||
"link": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"background": true,
|
||||
|
@ -35,12 +35,6 @@ function render_block_core_post_content( $attributes, $content, $block ) {
|
||||
|
||||
$seen_ids[ $post_id ] = true;
|
||||
|
||||
// Check is needed for backward compatibility with third-party plugins
|
||||
// that might rely on the `in_the_loop` check; calling `the_post` sets it to true.
|
||||
if ( ! in_the_loop() && have_posts() ) {
|
||||
the_post();
|
||||
}
|
||||
|
||||
// When inside the main loop, we want to use queried object
|
||||
// so that `the_preview` for the current post can apply.
|
||||
// We force this behavior by omitting the third argument (post ID) from the `get_the_content`.
|
||||
|
@ -2,7 +2,7 @@
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "core/post-content",
|
||||
"title": "Post Content",
|
||||
"title": "Content",
|
||||
"category": "theme",
|
||||
"description": "Displays the contents of a post or page.",
|
||||
"textdomain": "default",
|
||||
@ -14,6 +14,17 @@
|
||||
"dimensions": {
|
||||
"minHeight": true
|
||||
},
|
||||
"spacing": {
|
||||
"blockGap": true
|
||||
},
|
||||
"color": {
|
||||
"gradients": true,
|
||||
"link": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"background": false,
|
||||
"text": false
|
||||
}
|
||||
},
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
"lineHeight": true,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user