Merged in feature/81-dev-dev01 (pull request #5)
auto-patch 81-dev-dev01-2023-12-05T22_45_26 * auto-patch 81-dev-dev01-2023-12-05T22_45_26
This commit is contained in:
@@ -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',
|
||||
@@ -2221,10 +2314,10 @@
|
||||
'__experimentalRole' => 'content'
|
||||
),
|
||||
'width' => array(
|
||||
'type' => 'number'
|
||||
'type' => 'string'
|
||||
),
|
||||
'height' => array(
|
||||
'type' => 'number'
|
||||
'type' => 'string'
|
||||
),
|
||||
'aspectRatio' => array(
|
||||
'type' => 'string'
|
||||
@@ -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%;
|
||||
}
|
||||
@@ -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/wp-includes/blocks/columns/style.min.css
vendored
2
wp/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{
|
||||
|
||||
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/wp-includes/blocks/cover/style.min.css
vendored
2
wp/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",
|
||||
|
||||
@@ -5,13 +5,4 @@
|
||||
|
||||
.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;
|
||||
}
|
||||
@@ -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,13 +5,4 @@
|
||||
|
||||
.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/wp-includes/blocks/details/style.min.css
vendored
2
wp/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,7 +54,7 @@ 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', '' );
|
||||
@@ -84,6 +67,25 @@ function render_block_core_file( $attributes, $content, $block ) {
|
||||
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;
|
||||
}
|
||||
|
||||
2
wp/wp-includes/blocks/file/style-rtl.min.css
vendored
2
wp/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}: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;
|
||||
}
|
||||
|
||||
2
wp/wp-includes/blocks/file/style.min.css
vendored
2
wp/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}: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' => '3fd0154de23a0ecc28af');
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/******/ })()
|
||||
;
|
||||
/***/ })
|
||||
|
||||
},
|
||||
/******/ 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' => '8a0237493a27c0d781aa');
|
||||
|
||||
2
wp/wp-includes/blocks/file/view.min.js
vendored
2
wp/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,e){var n=e(754);const o=i=>{let t;try{t=new window.ActiveXObject(i)}catch(i){t=void 0}return t};(0,n.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"))))}}}})}},function(i){var t;t=149,i(i.s=t)}]);
|
||||
@@ -34,20 +34,25 @@ function render_block_core_footnotes( $attributes, $content, $block ) {
|
||||
|
||||
$footnotes = json_decode( $footnotes, true );
|
||||
|
||||
if ( count( $footnotes ) === 0 ) {
|
||||
if ( ! is_array( $footnotes ) || count( $footnotes ) === 0 ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$wrapper_attributes = get_block_wrapper_attributes();
|
||||
$footnote_index = 1;
|
||||
|
||||
$block_content = '';
|
||||
|
||||
foreach ( $footnotes as $footnote ) {
|
||||
// Translators: %d: Integer representing the number of return links on the page.
|
||||
$aria_label = sprintf( __( 'Jump to footnote reference %1$d' ), $footnote_index );
|
||||
$block_content .= sprintf(
|
||||
'<li id="%1$s">%2$s <a href="#%1$s-link">↩︎</a></li>',
|
||||
'<li id="%1$s">%2$s <a href="#%1$s-link" aria-label="%3$s">↩︎</a></li>',
|
||||
$footnote['id'],
|
||||
$footnote['content']
|
||||
$footnote['content'],
|
||||
$aria_label
|
||||
);
|
||||
++$footnote_index;
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
@@ -68,9 +73,10 @@ function register_block_core_footnotes() {
|
||||
$post_type,
|
||||
'footnotes',
|
||||
array(
|
||||
'show_in_rest' => true,
|
||||
'single' => true,
|
||||
'type' => 'string',
|
||||
'show_in_rest' => true,
|
||||
'single' => true,
|
||||
'type' => 'string',
|
||||
'revisions_enabled' => true,
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -84,107 +90,7 @@ function register_block_core_footnotes() {
|
||||
add_action( 'init', 'register_block_core_footnotes' );
|
||||
|
||||
/**
|
||||
* Saves the footnotes meta value to the revision.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
* @param int $revision_id The revision ID.
|
||||
*/
|
||||
function wp_save_footnotes_meta( $revision_id ) {
|
||||
$post_id = wp_is_post_revision( $revision_id );
|
||||
|
||||
if ( $post_id ) {
|
||||
$footnotes = get_post_meta( $post_id, 'footnotes', true );
|
||||
|
||||
if ( $footnotes ) {
|
||||
// Can't use update_post_meta() because it doesn't allow revisions.
|
||||
update_metadata( 'post', $revision_id, 'footnotes', $footnotes );
|
||||
}
|
||||
}
|
||||
}
|
||||
add_action( 'wp_after_insert_post', 'wp_save_footnotes_meta' );
|
||||
|
||||
/**
|
||||
* Keeps track of the revision ID for "rest_after_insert_{$post_type}".
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
* @global int $wp_temporary_footnote_revision_id The footnote revision ID.
|
||||
*
|
||||
* @param int $revision_id The revision ID.
|
||||
*/
|
||||
function wp_keep_footnotes_revision_id( $revision_id ) {
|
||||
global $wp_temporary_footnote_revision_id;
|
||||
$wp_temporary_footnote_revision_id = $revision_id;
|
||||
}
|
||||
add_action( '_wp_put_post_revision', 'wp_keep_footnotes_revision_id' );
|
||||
|
||||
/**
|
||||
* This is a specific fix for the REST API. The REST API doesn't update
|
||||
* the post and post meta in one go (through `meta_input`). While it
|
||||
* does fix the `wp_after_insert_post` hook to be called correctly after
|
||||
* updating meta, it does NOT fix hooks such as post_updated and
|
||||
* save_post, which are normally also fired after post meta is updated
|
||||
* in `wp_insert_post()`. Unfortunately, `wp_save_post_revision` is
|
||||
* added to the `post_updated` action, which means the meta is not
|
||||
* available at the time, so we have to add it afterwards through the
|
||||
* `"rest_after_insert_{$post_type}"` action.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
* @global int $wp_temporary_footnote_revision_id The footnote revision ID.
|
||||
*
|
||||
* @param WP_Post $post The post object.
|
||||
*/
|
||||
function wp_add_footnotes_revisions_to_post_meta( $post ) {
|
||||
global $wp_temporary_footnote_revision_id;
|
||||
|
||||
if ( $wp_temporary_footnote_revision_id ) {
|
||||
$revision = get_post( $wp_temporary_footnote_revision_id );
|
||||
|
||||
if ( ! $revision ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$post_id = $revision->post_parent;
|
||||
|
||||
// Just making sure we're updating the right revision.
|
||||
if ( $post->ID === $post_id ) {
|
||||
$footnotes = get_post_meta( $post_id, 'footnotes', true );
|
||||
|
||||
if ( $footnotes ) {
|
||||
// Can't use update_post_meta() because it doesn't allow revisions.
|
||||
update_metadata( 'post', $wp_temporary_footnote_revision_id, 'footnotes', $footnotes );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( array( 'post', 'page' ) as $post_type ) {
|
||||
add_action( "rest_after_insert_{$post_type}", 'wp_add_footnotes_revisions_to_post_meta' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores the footnotes meta value from the revision.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
* @param int $post_id The post ID.
|
||||
* @param int $revision_id The revision ID.
|
||||
*/
|
||||
function wp_restore_footnotes_from_revision( $post_id, $revision_id ) {
|
||||
$footnotes = get_post_meta( $revision_id, 'footnotes', true );
|
||||
|
||||
if ( $footnotes ) {
|
||||
update_post_meta( $post_id, 'footnotes', $footnotes );
|
||||
} else {
|
||||
delete_post_meta( $post_id, 'footnotes' );
|
||||
}
|
||||
}
|
||||
add_action( 'wp_restore_post_revision', 'wp_restore_footnotes_from_revision', 10, 2 );
|
||||
|
||||
/**
|
||||
* Adds the footnotes field to the revision.
|
||||
* Adds the footnotes field to the revisions display.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
@@ -198,7 +104,7 @@ function wp_add_footnotes_to_revision( $fields ) {
|
||||
add_filter( '_wp_post_revision_fields', 'wp_add_footnotes_to_revision' );
|
||||
|
||||
/**
|
||||
* Gets the footnotes field from the revision.
|
||||
* Gets the footnotes field from the revision for the revisions screen.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
@@ -212,76 +118,3 @@ function wp_get_footnotes_from_revision( $revision_field, $field, $revision ) {
|
||||
return get_metadata( 'post', $revision->ID, $field, true );
|
||||
}
|
||||
add_filter( '_wp_post_revision_field_footnotes', 'wp_get_footnotes_from_revision', 10, 3 );
|
||||
|
||||
/**
|
||||
* The REST API autosave endpoint doesn't save meta, so we can use the
|
||||
* `wp_creating_autosave` when it updates an exiting autosave, and
|
||||
* `_wp_put_post_revision` when it creates a new autosave.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
* @param int|array $autosave The autosave ID or array.
|
||||
*/
|
||||
function _wp_rest_api_autosave_meta( $autosave ) {
|
||||
// Ensure it's a REST API request.
|
||||
if ( ! defined( 'REST_REQUEST' ) || ! REST_REQUEST ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$body = rest_get_server()->get_raw_data();
|
||||
$body = json_decode( $body, true );
|
||||
|
||||
if ( ! isset( $body['meta']['footnotes'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// `wp_creating_autosave` passes the array,
|
||||
// `_wp_put_post_revision` passes the ID.
|
||||
$id = is_int( $autosave ) ? $autosave : $autosave['ID'];
|
||||
|
||||
if ( ! $id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
update_post_meta( $id, 'footnotes', $body['meta']['footnotes'] );
|
||||
}
|
||||
// See https://github.com/WordPress/wordpress-develop/blob/2103cb9966e57d452c94218bbc3171579b536a40/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php#L391C1-L391C1.
|
||||
add_action( 'wp_creating_autosave', '_wp_rest_api_autosave_meta' );
|
||||
// See https://github.com/WordPress/wordpress-develop/blob/2103cb9966e57d452c94218bbc3171579b536a40/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php#L398.
|
||||
// Then https://github.com/WordPress/wordpress-develop/blob/2103cb9966e57d452c94218bbc3171579b536a40/src/wp-includes/revision.php#L367.
|
||||
add_action( '_wp_put_post_revision', '_wp_rest_api_autosave_meta' );
|
||||
|
||||
/**
|
||||
* This is a workaround for the autosave endpoint returning early if the
|
||||
* revision field are equal. The problem is that "footnotes" is not real
|
||||
* revision post field, so there's nothing to compare against.
|
||||
*
|
||||
* This trick sets the "footnotes" field (value doesn't matter), which will
|
||||
* cause the autosave endpoint to always update the latest revision. That should
|
||||
* be fine, it should be ok to update the revision even if nothing changed. Of
|
||||
* course, this is temporary fix.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
* @param WP_Post $prepared_post The prepared post object.
|
||||
* @param WP_REST_Request $request The request object.
|
||||
*
|
||||
* See https://github.com/WordPress/wordpress-develop/blob/2103cb9966e57d452c94218bbc3171579b536a40/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php#L365-L384.
|
||||
* See https://github.com/WordPress/wordpress-develop/blob/2103cb9966e57d452c94218bbc3171579b536a40/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php#L219.
|
||||
*/
|
||||
function _wp_rest_api_force_autosave_difference( $prepared_post, $request ) {
|
||||
// We only want to be altering POST requests.
|
||||
if ( $request->get_method() !== 'POST' ) {
|
||||
return $prepared_post;
|
||||
}
|
||||
|
||||
// Only alter requests for the '/autosaves' route.
|
||||
if ( substr( $request->get_route(), -strlen( '/autosaves' ) ) !== '/autosaves' ) {
|
||||
return $prepared_post;
|
||||
}
|
||||
|
||||
$prepared_post->footnotes = '[]';
|
||||
return $prepared_post;
|
||||
}
|
||||
|
||||
add_filter( 'rest_pre_insert_post', '_wp_rest_api_force_autosave_difference', 10, 2 );
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -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/wp-includes/blocks/heading/style.min.css
vendored
2
wp/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,16 +9,20 @@
|
||||
* 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.
|
||||
* @return string Returns the block content with the data-id attribute added.
|
||||
* @param array $attributes The block attributes.
|
||||
* @param string $content The block content.
|
||||
* @param WP_Block $block The block object.
|
||||
*
|
||||
* @return string The block content with the data-id attribute added.
|
||||
*/
|
||||
function render_block_core_image( $attributes, $content ) {
|
||||
function render_block_core_image( $attributes, $content, $block ) {
|
||||
if ( false === stripos( $content, '<img' ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$processor = new WP_HTML_Tag_Processor( $content );
|
||||
$processor->next_tag( 'img' );
|
||||
|
||||
if ( $processor->get_attribute( 'src' ) === null ) {
|
||||
if ( ! $processor->next_tag( 'img' ) || null === $processor->get_attribute( 'src' ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -30,14 +34,328 @@ function render_block_core_image( $attributes, $content ) {
|
||||
$processor->set_attribute( 'data-id', $attributes['data-id'] );
|
||||
}
|
||||
|
||||
$link_destination = isset( $attributes['linkDestination'] ) ? $attributes['linkDestination'] : 'none';
|
||||
$lightbox_settings = block_core_image_get_lightbox_settings( $block->parsed_block );
|
||||
|
||||
$view_js_file_handle = 'wp-block-image-view';
|
||||
$script_handles = $block->block_type->view_script_handles;
|
||||
|
||||
/*
|
||||
* If the lightbox is enabled and the image is not linked, add the filter
|
||||
* and the JavaScript view file.
|
||||
*/
|
||||
if (
|
||||
isset( $lightbox_settings ) &&
|
||||
'none' === $link_destination &&
|
||||
isset( $lightbox_settings['enabled'] ) &&
|
||||
true === $lightbox_settings['enabled']
|
||||
) {
|
||||
$block->block_type->supports['interactivity'] = true;
|
||||
|
||||
if ( ! in_array( $view_js_file_handle, $script_handles, true ) ) {
|
||||
$block->block_type->view_script_handles = array_merge( $script_handles, array( $view_js_file_handle ) );
|
||||
}
|
||||
|
||||
/*
|
||||
* This render needs to happen in a filter with priority 15 to ensure
|
||||
* that it runs after the duotone filter and that duotone styles are
|
||||
* applied to the image in the lightbox. We also need to ensure that the
|
||||
* lightbox works with any plugins that might use filters as well. We
|
||||
* can consider removing this in the future if the way the blocks are
|
||||
* rendered changes, or if a new kind of filter is introduced.
|
||||
*/
|
||||
add_filter( 'render_block_core/image', 'block_core_image_render_lightbox', 15, 2 );
|
||||
} else {
|
||||
/*
|
||||
* Remove the filter and the JavaScript view file if previously added by
|
||||
* other Image blocks.
|
||||
*/
|
||||
remove_filter( 'render_block_core/image', 'block_core_image_render_lightbox', 15 );
|
||||
// If the script is not needed, and it is still in the `view_script_handles`, remove it.
|
||||
if ( in_array( $view_js_file_handle, $script_handles, true ) ) {
|
||||
$block->block_type->view_script_handles = array_diff( $script_handles, array( $view_js_file_handle ) );
|
||||
}
|
||||
}
|
||||
|
||||
return $processor->get_updated_html();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds 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 ) {
|
||||
/*
|
||||
* If it's not possible that an IMG element exists then return the given
|
||||
* block content as-is. It may be that there's no actual image in the block
|
||||
* or it could be that another plugin already modified this HTML.
|
||||
*/
|
||||
if ( false === stripos( $block_content, '<img' ) ) {
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
$processor = new WP_HTML_Tag_Processor( $block_content );
|
||||
|
||||
$aria_label = __( 'Enlarge image' );
|
||||
|
||||
/*
|
||||
* If there's definitely no IMG element in the block then return the given
|
||||
* block content as-is. There's nothing that this code can knowingly modify
|
||||
* to add the lightbox behavior.
|
||||
*/
|
||||
if ( ! $processor->next_tag( 'img' ) ) {
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
$alt_attribute = $processor->get_attribute( 'alt' );
|
||||
|
||||
// An empty alt attribute `alt=""` is valid for decorative images.
|
||||
if ( is_string( $alt_attribute ) ) {
|
||||
$alt_attribute = trim( $alt_attribute );
|
||||
}
|
||||
|
||||
// It only makes sense to append the alt text to the button aria-label when the alt text is non-empty.
|
||||
if ( $alt_attribute ) {
|
||||
/* translators: %s: Image alt text. */
|
||||
$aria_label = sprintf( __( 'Enlarge image: %s' ), $alt_attribute );
|
||||
}
|
||||
|
||||
// Currently, we are only enabling the zoom animation.
|
||||
$lightbox_animation = 'zoom';
|
||||
|
||||
// Note: We want to store the `src` in the context so we
|
||||
// can set it dynamically when the lightbox is opened.
|
||||
if ( isset( $block['attrs']['id'] ) ) {
|
||||
$img_uploaded_src = wp_get_attachment_url( $block['attrs']['id'] );
|
||||
$img_metadata = wp_get_attachment_metadata( $block['attrs']['id'] );
|
||||
$img_width = $img_metadata['width'] ?? 'none';
|
||||
$img_height = $img_metadata['height'] ?? 'none';
|
||||
} else {
|
||||
$img_uploaded_src = $processor->get_attribute( 'src' );
|
||||
$img_width = 'none';
|
||||
$img_height = 'none';
|
||||
}
|
||||
|
||||
if ( isset( $block['attrs']['scale'] ) ) {
|
||||
$scale_attr = $block['attrs']['scale'];
|
||||
} else {
|
||||
$scale_attr = false;
|
||||
}
|
||||
|
||||
$w = new WP_HTML_Tag_Processor( $block_content );
|
||||
$w->next_tag( 'figure' );
|
||||
$w->add_class( 'wp-lightbox-container' );
|
||||
$w->set_attribute( 'data-wp-interactive', 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",
|
||||
"dialogLabel": "%s"
|
||||
}
|
||||
}
|
||||
}',
|
||||
$lightbox_animation,
|
||||
$img_uploaded_src,
|
||||
$img_width,
|
||||
$img_height,
|
||||
$scale_attr,
|
||||
__( 'Enlarged image' )
|
||||
)
|
||||
);
|
||||
$w->next_tag( 'img' );
|
||||
$w->set_attribute( 'data-wp-init', 'effects.core.image.initOriginImage' );
|
||||
$w->set_attribute( 'data-wp-on--load', 'actions.core.image.handleLoad' );
|
||||
$w->set_attribute( 'data-wp-effect', 'effects.core.image.setButtonStyles' );
|
||||
// We need to set an event callback on the `img` specifically
|
||||
// because the `figure` element can also contain a caption, and
|
||||
// we don't want to trigger the lightbox when the caption is clicked.
|
||||
$w->set_attribute( 'data-wp-on--click', 'actions.core.image.showLightbox' );
|
||||
$w->set_attribute( 'data-wp-effect--setStylesOnResize', 'effects.core.image.setStylesOnResize' );
|
||||
$body_content = $w->get_updated_html();
|
||||
|
||||
// Add a button alongside image in the body content.
|
||||
$img = null;
|
||||
preg_match( '/<img[^>]+>/', $body_content, $img );
|
||||
|
||||
$button =
|
||||
$img[0]
|
||||
. '<button
|
||||
class="lightbox-trigger"
|
||||
type="button"
|
||||
aria-haspopup="dialog"
|
||||
aria-label="' . esc_attr( $aria_label ) . '"
|
||||
data-wp-on--click="actions.core.image.showLightbox"
|
||||
data-wp-style--right="context.core.image.imageButtonRight"
|
||||
data-wp-style--top="context.core.image.imageButtonTop"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" viewBox="0 0 12 12">
|
||||
<path fill="#fff" d="M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z" />
|
||||
</svg>
|
||||
</button>';
|
||||
|
||||
$body_content = preg_replace( '/<img[^>]+>/', $button, $body_content );
|
||||
|
||||
// We need both a responsive image and an enlarged image to animate
|
||||
// the zoom seamlessly on slow internet connections; the responsive
|
||||
// image is a copy of the one in the body, which animates immediately
|
||||
// as the lightbox is opened, while the enlarged one is a full-sized
|
||||
// version that will likely still be loading as the animation begins.
|
||||
$m = new WP_HTML_Tag_Processor( $block_content );
|
||||
$m->next_tag( 'figure' );
|
||||
$m->add_class( 'responsive-image' );
|
||||
$m->next_tag( 'img' );
|
||||
// We want to set the 'src' attribute to an empty string in the responsive image
|
||||
// because otherwise, as of this writing, the wp_filter_content_tags() function in
|
||||
// WordPress will automatically add a 'srcset' attribute to the image, which will at
|
||||
// times cause the incorrectly sized image to be loaded in the lightbox on Firefox.
|
||||
// Because of this, we bind the 'src' attribute explicitly the current src to reliably
|
||||
// use the exact same image as in the content when the lightbox is first opened while
|
||||
// we wait for the larger image to load.
|
||||
$m->set_attribute( 'src', '' );
|
||||
$m->set_attribute( 'data-wp-bind--src', 'context.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( $block_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();
|
||||
|
||||
// If the current theme does NOT have a `theme.json`, or the colors are not defined,
|
||||
// we need to set the background color & close button color to some default values
|
||||
// because we can't get them from the Global Styles.
|
||||
$background_color = '#fff';
|
||||
$close_button_color = '#000';
|
||||
if ( wp_theme_has_theme_json() ) {
|
||||
$global_styles_color = wp_get_global_styles( array( 'color' ) );
|
||||
if ( ! empty( $global_styles_color['background'] ) ) {
|
||||
$background_color = esc_attr( $global_styles_color['background'] );
|
||||
}
|
||||
if ( ! empty( $global_styles_color['text'] ) ) {
|
||||
$close_button_color = esc_attr( $global_styles_color['text'] );
|
||||
}
|
||||
}
|
||||
|
||||
$close_button_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" focusable="false"><path d="M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"></path></svg>';
|
||||
$close_button_label = esc_attr__( 'Close' );
|
||||
|
||||
$lightbox_html = <<<HTML
|
||||
<div data-wp-body="" class="wp-lightbox-overlay $lightbox_animation"
|
||||
data-wp-bind--role="selectors.core.image.roleAttribute"
|
||||
data-wp-bind--aria-label="selectors.core.image.dialogLabel"
|
||||
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-modal="selectors.core.image.ariaModal"
|
||||
data-wp-effect="effects.core.image.initLightbox"
|
||||
data-wp-on--keydown="actions.core.image.handleKeydown"
|
||||
data-wp-on--touchstart="actions.core.image.handleTouchStart"
|
||||
data-wp-on--touchmove="actions.core.image.handleTouchMove"
|
||||
data-wp-on--touchend="actions.core.image.handleTouchEnd"
|
||||
data-wp-on--click="actions.core.image.hideLightbox"
|
||||
tabindex="-1"
|
||||
>
|
||||
<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" aria-hidden="true"></div>
|
||||
</div>
|
||||
HTML;
|
||||
|
||||
return str_replace( '</figure>', $lightbox_html . '</figure>', $body_content );
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures 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",
|
||||
@@ -64,10 +70,10 @@
|
||||
"__experimentalRole": "content"
|
||||
},
|
||||
"width": {
|
||||
"type": "number"
|
||||
"type": "string"
|
||||
},
|
||||
"height": {
|
||||
"type": "number"
|
||||
"type": "string"
|
||||
},
|
||||
"aspectRatio": {
|
||||
"type": "string"
|
||||
@@ -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,25 +92,58 @@
|
||||
margin:0;
|
||||
}
|
||||
|
||||
.wp-lightbox-container .img-container{
|
||||
.wp-lightbox-container{
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
position:relative;
|
||||
}
|
||||
.wp-lightbox-container button{
|
||||
background:none;
|
||||
border:none;
|
||||
.wp-lightbox-container img{
|
||||
cursor:zoom-in;
|
||||
height:100%;
|
||||
}
|
||||
.wp-lightbox-container img:hover+button{
|
||||
opacity:1;
|
||||
}
|
||||
.wp-lightbox-container button{
|
||||
align-items:center;
|
||||
-webkit-backdrop-filter:blur(16px) saturate(180%);
|
||||
backdrop-filter:blur(16px) saturate(180%);
|
||||
background-color:rgba(90,90,90,.25);
|
||||
border:none;
|
||||
border-radius:4px;
|
||||
cursor:zoom-in;
|
||||
display:flex;
|
||||
height:20px;
|
||||
justify-content:center;
|
||||
left:16px;
|
||||
opacity:0;
|
||||
padding:0;
|
||||
position:absolute;
|
||||
width:100%;
|
||||
text-align:center;
|
||||
top:16px;
|
||||
transition:opacity .2s ease;
|
||||
width:20px;
|
||||
z-index:100;
|
||||
}
|
||||
.wp-lightbox-container button:focus-visible{
|
||||
outline:5px auto #212121;
|
||||
outline:5px auto -webkit-focus-ring-color;
|
||||
outline-offset:5px;
|
||||
outline:3px auto rgba(90,90,90,.25);
|
||||
outline:3px auto -webkit-focus-ring-color;
|
||||
outline-offset:3px;
|
||||
}
|
||||
.wp-lightbox-container button:hover{
|
||||
cursor:pointer;
|
||||
opacity:1;
|
||||
}
|
||||
.wp-lightbox-container button:focus{
|
||||
opacity:1;
|
||||
}
|
||||
.wp-lightbox-container button:focus,.wp-lightbox-container button:hover,.wp-lightbox-container button:not(:hover):not(:active):not(.has-background){
|
||||
background-color:rgba(90,90,90,.25);
|
||||
border:none;
|
||||
}
|
||||
|
||||
.wp-lightbox-overlay{
|
||||
box-sizing:border-box;
|
||||
cursor:zoom-out;
|
||||
height:100vh;
|
||||
overflow:hidden;
|
||||
position:fixed;
|
||||
@@ -121,32 +154,54 @@
|
||||
z-index:100000;
|
||||
}
|
||||
.wp-lightbox-overlay .close-button{
|
||||
align-items:center;
|
||||
cursor:pointer;
|
||||
left:12.5px;
|
||||
display:flex;
|
||||
justify-content:center;
|
||||
left:calc(env(safe-area-inset-left) + 16px);
|
||||
min-height:40px;
|
||||
min-width:40px;
|
||||
padding:0;
|
||||
position:absolute;
|
||||
top:12.5px;
|
||||
top:calc(env(safe-area-inset-top) + 16px);
|
||||
z-index:5000000;
|
||||
}
|
||||
.wp-lightbox-overlay .close-button:focus,.wp-lightbox-overlay .close-button:hover,.wp-lightbox-overlay .close-button:not(:hover):not(:active):not(.has-background){
|
||||
background:none;
|
||||
border:none;
|
||||
}
|
||||
.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,54 +214,46 @@
|
||||
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{
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
@keyframes turn-on-visibility{
|
||||
@@ -233,29 +280,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;
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -92,25 +92,58 @@
|
||||
margin:0;
|
||||
}
|
||||
|
||||
.wp-lightbox-container .img-container{
|
||||
.wp-lightbox-container{
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
position:relative;
|
||||
}
|
||||
.wp-lightbox-container button{
|
||||
background:none;
|
||||
border:none;
|
||||
.wp-lightbox-container img{
|
||||
cursor:zoom-in;
|
||||
height:100%;
|
||||
}
|
||||
.wp-lightbox-container img:hover+button{
|
||||
opacity:1;
|
||||
}
|
||||
.wp-lightbox-container button{
|
||||
align-items:center;
|
||||
-webkit-backdrop-filter:blur(16px) saturate(180%);
|
||||
backdrop-filter:blur(16px) saturate(180%);
|
||||
background-color:rgba(90,90,90,.25);
|
||||
border:none;
|
||||
border-radius:4px;
|
||||
cursor:zoom-in;
|
||||
display:flex;
|
||||
height:20px;
|
||||
justify-content:center;
|
||||
opacity:0;
|
||||
padding:0;
|
||||
position:absolute;
|
||||
width:100%;
|
||||
right:16px;
|
||||
text-align:center;
|
||||
top:16px;
|
||||
transition:opacity .2s ease;
|
||||
width:20px;
|
||||
z-index:100;
|
||||
}
|
||||
.wp-lightbox-container button:focus-visible{
|
||||
outline:5px auto #212121;
|
||||
outline:5px auto -webkit-focus-ring-color;
|
||||
outline-offset:5px;
|
||||
outline:3px auto rgba(90,90,90,.25);
|
||||
outline:3px auto -webkit-focus-ring-color;
|
||||
outline-offset:3px;
|
||||
}
|
||||
.wp-lightbox-container button:hover{
|
||||
cursor:pointer;
|
||||
opacity:1;
|
||||
}
|
||||
.wp-lightbox-container button:focus{
|
||||
opacity:1;
|
||||
}
|
||||
.wp-lightbox-container button:focus,.wp-lightbox-container button:hover,.wp-lightbox-container button:not(:hover):not(:active):not(.has-background){
|
||||
background-color:rgba(90,90,90,.25);
|
||||
border:none;
|
||||
}
|
||||
|
||||
.wp-lightbox-overlay{
|
||||
box-sizing:border-box;
|
||||
cursor:zoom-out;
|
||||
height:100vh;
|
||||
left:0;
|
||||
overflow:hidden;
|
||||
@@ -121,32 +154,54 @@
|
||||
z-index:100000;
|
||||
}
|
||||
.wp-lightbox-overlay .close-button{
|
||||
align-items:center;
|
||||
cursor:pointer;
|
||||
display:flex;
|
||||
justify-content:center;
|
||||
min-height:40px;
|
||||
min-width:40px;
|
||||
padding:0;
|
||||
position:absolute;
|
||||
right:12.5px;
|
||||
top:12.5px;
|
||||
right:calc(env(safe-area-inset-right) + 16px);
|
||||
top:calc(env(safe-area-inset-top) + 16px);
|
||||
z-index:5000000;
|
||||
}
|
||||
.wp-lightbox-overlay .close-button:focus,.wp-lightbox-overlay .close-button:hover,.wp-lightbox-overlay .close-button:not(:hover):not(:active):not(.has-background){
|
||||
background:none;
|
||||
border:none;
|
||||
}
|
||||
.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,54 +214,46 @@
|
||||
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{
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
@keyframes turn-on-visibility{
|
||||
@@ -233,29 +280,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/wp-includes/blocks/image/style.min.css
vendored
2
wp/wp-includes/blocks/image/style.min.css
vendored
File diff suppressed because one or more lines are too long
1
wp/wp-includes/blocks/image/view.asset.php
Normal file
1
wp/wp-includes/blocks/image/view.asset.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '749bd8d7dd37390bdeea');
|
||||
533
wp/wp-includes/blocks/image/view.js
Normal file
533
wp/wp-includes/blocks/image/view.js
Normal file
@@ -0,0 +1,533 @@
|
||||
"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^="-"])'];
|
||||
|
||||
/*
|
||||
* Stores a context-bound scroll handler.
|
||||
*
|
||||
* This callback could be defined inline inside of the store
|
||||
* object but it's created externally to avoid confusion about
|
||||
* how its logic is called. This logic is not referenced directly
|
||||
* by the directives in the markup because the scroll event we
|
||||
* need to listen to is triggered on the window; so by defining it
|
||||
* outside of the store, we signal that the behavior here is different.
|
||||
* If we find a compelling reason to move it to the store, feel free.
|
||||
*
|
||||
* @type {Function}
|
||||
*/
|
||||
let scrollCallback;
|
||||
|
||||
/*
|
||||
* Tracks whether user is touching screen; used to
|
||||
* differentiate behavior for touch and mouse input.
|
||||
*
|
||||
* @type {boolean}
|
||||
*/
|
||||
let isTouching = false;
|
||||
|
||||
/*
|
||||
* Tracks the last time the screen was touched; used to
|
||||
* differentiate behavior for touch and mouse input.
|
||||
*
|
||||
* @type {number}
|
||||
*/
|
||||
let lastTouchTime = 0;
|
||||
|
||||
/*
|
||||
* Lightbox page-scroll handler: prevents scrolling.
|
||||
*
|
||||
* This handler is added to prevent scrolling behaviors that
|
||||
* trigger content shift while the lightbox is open.
|
||||
*
|
||||
* It would be better to accomplish this through CSS alone, but
|
||||
* using overflow: hidden is currently the only way to do so, and
|
||||
* that causes the layout to shift and prevents the zoom animation
|
||||
* from working in some cases because we're unable to account for
|
||||
* the layout shift when doing the animation calculations. Instead,
|
||||
* here we use JavaScript to prevent and reset the scrolling
|
||||
* behavior. In the future, we may be able to use CSS or overflow: hidden
|
||||
* instead to not rely on JavaScript, but this seems to be the best approach
|
||||
* for now that provides the best visual experience.
|
||||
*
|
||||
* @param {Object} context Interactivity page context?
|
||||
*/
|
||||
function handleScroll(context) {
|
||||
// We can't override the scroll behavior on mobile devices
|
||||
// because doing so breaks the pinch to zoom functionality, and we
|
||||
// want to allow users to zoom in further on the high-res image.
|
||||
if (!isTouching && Date.now() - lastTouchTime > 450) {
|
||||
// We are unable to use event.preventDefault() to prevent scrolling
|
||||
// because the scroll event can't be canceled, so we reset the position instead.
|
||||
window.scrollTo(context.core.image.scrollLeftReset, context.core.image.scrollTopReset);
|
||||
}
|
||||
}
|
||||
(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.pointerType = event.pointerType;
|
||||
context.core.image.lightboxEnabled = true;
|
||||
setStyles(context, context.core.image.imageRef);
|
||||
context.core.image.scrollTopReset = window.pageYOffset || document.documentElement.scrollTop;
|
||||
|
||||
// In most cases, this value will be 0, but this is included
|
||||
// in case a user has created a page with horizontal scrolling.
|
||||
context.core.image.scrollLeftReset = window.pageXOffset || document.documentElement.scrollLeft;
|
||||
|
||||
// We define and bind the scroll callback here so
|
||||
// that we can pass the context and as an argument.
|
||||
// We may be able to change this in the future if we
|
||||
// define the scroll callback in the store instead, but
|
||||
// this approach seems to tbe clearest for now.
|
||||
scrollCallback = handleScroll.bind(null, context);
|
||||
|
||||
// We need to add a scroll event listener to the window
|
||||
// here because we are unable to otherwise access it via
|
||||
// the Interactivity API directives. If we add a native way
|
||||
// to access the window, we can remove this.
|
||||
window.addEventListener('scroll', scrollCallback, false);
|
||||
},
|
||||
hideLightbox: async ({
|
||||
context
|
||||
}) => {
|
||||
context.core.image.hideAnimationEnabled = true;
|
||||
if (context.core.image.lightboxEnabled) {
|
||||
// We want to wait until the close animation is completed
|
||||
// before allowing a user to scroll again. The duration of this
|
||||
// animation is defined in the styles.scss and depends on if the
|
||||
// animation is 'zoom' or 'fade', but in any case we should wait
|
||||
// a few milliseconds longer than the duration, otherwise a user
|
||||
// may scroll too soon and cause the animation to look sloppy.
|
||||
setTimeout(function () {
|
||||
window.removeEventListener('scroll', scrollCallback);
|
||||
// If we don't delay before changing the focus,
|
||||
// the focus ring will appear on Firefox before
|
||||
// the image has finished animating, which looks broken.
|
||||
context.core.image.lightboxTriggerRef.focus({
|
||||
preventScroll: true
|
||||
});
|
||||
}, 450);
|
||||
context.core.image.lightboxEnabled = false;
|
||||
}
|
||||
},
|
||||
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
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
// This is fired just by lazily loaded
|
||||
// images on the page, not all images.
|
||||
handleLoad: ({
|
||||
context,
|
||||
effects,
|
||||
ref
|
||||
}) => {
|
||||
context.core.image.imageLoaded = true;
|
||||
context.core.image.imageCurrentSrc = ref.currentSrc;
|
||||
effects.core.image.setButtonStyles({
|
||||
context,
|
||||
ref
|
||||
});
|
||||
},
|
||||
handleTouchStart: () => {
|
||||
isTouching = true;
|
||||
},
|
||||
handleTouchMove: ({
|
||||
context,
|
||||
event
|
||||
}) => {
|
||||
// On mobile devices, we want to prevent triggering the
|
||||
// scroll event because otherwise the page jumps around as
|
||||
// we reset the scroll position. This also means that closing
|
||||
// the lightbox requires that a user perform a simple tap. This
|
||||
// may be changed in the future if we find a better alternative
|
||||
// to override or reset the scroll position during swipe actions.
|
||||
if (context.core.image.lightboxEnabled) {
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
handleTouchEnd: () => {
|
||||
// We need to wait a few milliseconds before resetting
|
||||
// to ensure that pinch to zoom works consistently
|
||||
// on mobile devices when the lightbox is open.
|
||||
lastTouchTime = Date.now();
|
||||
isTouching = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
selectors: {
|
||||
core: {
|
||||
image: {
|
||||
roleAttribute: ({
|
||||
context
|
||||
}) => {
|
||||
return context.core.image.lightboxEnabled ? 'dialog' : null;
|
||||
},
|
||||
ariaModal: ({
|
||||
context
|
||||
}) => {
|
||||
return context.core.image.lightboxEnabled ? 'true' : null;
|
||||
},
|
||||
dialogLabel: ({
|
||||
context
|
||||
}) => {
|
||||
return context.core.image.lightboxEnabled ? context.core.image.dialogLabel : null;
|
||||
},
|
||||
lightboxObjectFit: ({
|
||||
context
|
||||
}) => {
|
||||
if (context.core.image.initialized) {
|
||||
return 'cover';
|
||||
}
|
||||
},
|
||||
enlargedImgSrc: ({
|
||||
context
|
||||
}) => {
|
||||
return context.core.image.initialized ? context.core.image.imageUploadedSrc : 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
effects: {
|
||||
core: {
|
||||
image: {
|
||||
initOriginImage: ({
|
||||
context,
|
||||
ref
|
||||
}) => {
|
||||
context.core.image.imageRef = ref;
|
||||
context.core.image.lightboxTriggerRef = ref.parentElement.querySelector('.lightbox-trigger');
|
||||
if (ref.complete) {
|
||||
context.core.image.imageLoaded = true;
|
||||
context.core.image.imageCurrentSrc = ref.currentSrc;
|
||||
}
|
||||
},
|
||||
initLightbox: async ({
|
||||
context,
|
||||
ref
|
||||
}) => {
|
||||
if (context.core.image.lightboxEnabled) {
|
||||
const focusableElements = ref.querySelectorAll(focusableSelectors);
|
||||
context.core.image.firstFocusableElement = focusableElements[0];
|
||||
context.core.image.lastFocusableElement = focusableElements[focusableElements.length - 1];
|
||||
|
||||
// Move focus to the dialog when opening it.
|
||||
ref.focus();
|
||||
}
|
||||
},
|
||||
setButtonStyles: ({
|
||||
context,
|
||||
ref
|
||||
}) => {
|
||||
const {
|
||||
naturalWidth,
|
||||
naturalHeight,
|
||||
offsetWidth,
|
||||
offsetHeight
|
||||
} = ref;
|
||||
|
||||
// If the image isn't loaded yet, we can't
|
||||
// calculate where the button should be.
|
||||
if (naturalWidth === 0 || naturalHeight === 0) {
|
||||
return;
|
||||
}
|
||||
const figure = ref.parentElement;
|
||||
const figureWidth = ref.parentElement.clientWidth;
|
||||
|
||||
// We need special handling for the height because
|
||||
// a caption will cause the figure to be taller than
|
||||
// the image, which means we need to account for that
|
||||
// when calculating the placement of the button in the
|
||||
// top right corner of the image.
|
||||
let figureHeight = ref.parentElement.clientHeight;
|
||||
const caption = figure.querySelector('figcaption');
|
||||
if (caption) {
|
||||
const captionComputedStyle = window.getComputedStyle(caption);
|
||||
figureHeight = figureHeight - caption.offsetHeight - parseFloat(captionComputedStyle.marginTop) - parseFloat(captionComputedStyle.marginBottom);
|
||||
}
|
||||
const buttonOffsetTop = figureHeight - offsetHeight;
|
||||
const buttonOffsetRight = figureWidth - offsetWidth;
|
||||
|
||||
// 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 where to place the button.
|
||||
if (context.core.image.scaleAttr === 'contain') {
|
||||
// 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 compute the height.
|
||||
const referenceHeight = offsetWidth / naturalRatio;
|
||||
context.core.image.imageButtonTop = (offsetHeight - referenceHeight) / 2 + buttonOffsetTop + 16;
|
||||
context.core.image.imageButtonRight = buttonOffsetRight + 16;
|
||||
} else {
|
||||
// If it reaches the height first, keep
|
||||
// the height and compute the width.
|
||||
const referenceWidth = offsetHeight * naturalRatio;
|
||||
context.core.image.imageButtonTop = buttonOffsetTop + 16;
|
||||
context.core.image.imageButtonRight = (offsetWidth - referenceWidth) / 2 + buttonOffsetRight + 16;
|
||||
}
|
||||
} else {
|
||||
context.core.image.imageButtonTop = buttonOffsetTop + 16;
|
||||
context.core.image.imageButtonRight = buttonOffsetRight + 16;
|
||||
}
|
||||
},
|
||||
setStylesOnResize: ({
|
||||
state,
|
||||
context,
|
||||
ref
|
||||
}) => {
|
||||
if (context.core.image.lightboxEnabled && (state.core.image.windowWidth || state.core.image.windowHeight)) {
|
||||
setStyles(context, ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
afterLoad: ({
|
||||
state
|
||||
}) => {
|
||||
window.addEventListener('resize', debounce(() => {
|
||||
state.core.image.windowWidth = window.innerWidth;
|
||||
state.core.image.windowHeight = window.innerHeight;
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* Computes styles for the lightbox and adds them to the document.
|
||||
*
|
||||
* @function
|
||||
* @param {Object} context - An Interactivity API context
|
||||
* @param {Object} event - A triggering event
|
||||
*/
|
||||
function setStyles(context, ref) {
|
||||
// The reference img element lies adjacent
|
||||
// to the event target button in the DOM.
|
||||
let {
|
||||
naturalWidth,
|
||||
naturalHeight,
|
||||
offsetWidth: originalWidth,
|
||||
offsetHeight: originalHeight
|
||||
} = ref;
|
||||
let {
|
||||
x: screenPosX,
|
||||
y: screenPosY
|
||||
} = ref.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};
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
/*
|
||||
* Debounces a function call.
|
||||
*
|
||||
* @function
|
||||
* @param {Function} func - A function to be called
|
||||
* @param {number} wait - The time to wait before calling the function
|
||||
*/
|
||||
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/wp-includes/blocks/image/view.min.asset.php
Normal file
1
wp/wp-includes/blocks/image/view.min.asset.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '32caaf5e7c6834efef4c');
|
||||
1
wp/wp-includes/blocks/image/view.min.js
vendored
Normal file
1
wp/wp-includes/blocks/image/view.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -20,46 +20,82 @@ require BLOCKS_PATH . 'require-dynamic-blocks.php';
|
||||
* avoids unnecessary logic and filesystem lookups in the other function.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
* @global string $wp_version The WordPress version string.
|
||||
*/
|
||||
function register_core_block_style_handles() {
|
||||
global $wp_version;
|
||||
|
||||
if ( ! wp_should_load_separate_core_block_assets() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
static $core_blocks_meta;
|
||||
if ( ! $core_blocks_meta ) {
|
||||
$core_blocks_meta = require ABSPATH . WPINC . '/blocks/blocks-json.php';
|
||||
}
|
||||
|
||||
$includes_url = includes_url();
|
||||
$includes_path = ABSPATH . WPINC . '/';
|
||||
$suffix = wp_scripts_get_suffix();
|
||||
$wp_styles = wp_styles();
|
||||
$style_fields = array(
|
||||
$blocks_url = includes_url( 'blocks/' );
|
||||
$suffix = wp_scripts_get_suffix();
|
||||
$wp_styles = wp_styles();
|
||||
$style_fields = array(
|
||||
'style' => 'style',
|
||||
'editorStyle' => 'editor',
|
||||
);
|
||||
|
||||
static $core_blocks_meta;
|
||||
if ( ! $core_blocks_meta ) {
|
||||
$core_blocks_meta = require BLOCKS_PATH . 'blocks-json.php';
|
||||
}
|
||||
|
||||
$files = false;
|
||||
$transient_name = 'wp_core_block_css_files';
|
||||
|
||||
/*
|
||||
* Ignore transient cache when the development mode is set to 'core'. Why? To avoid interfering with
|
||||
* the core developer's workflow.
|
||||
*/
|
||||
if ( ! wp_is_development_mode( 'core' ) ) {
|
||||
$transient_name = 'wp_core_block_css_files';
|
||||
$files = get_transient( $transient_name );
|
||||
if ( ! $files ) {
|
||||
$files = glob( wp_normalize_path( __DIR__ . '/**/**.css' ) );
|
||||
set_transient( $transient_name, $files );
|
||||
$can_use_cached = ! wp_is_development_mode( 'core' );
|
||||
|
||||
if ( $can_use_cached ) {
|
||||
$cached_files = get_transient( $transient_name );
|
||||
|
||||
// Check the validity of cached values by checking against the current WordPress version.
|
||||
if (
|
||||
is_array( $cached_files )
|
||||
&& isset( $cached_files['version'] )
|
||||
&& $cached_files['version'] === $wp_version
|
||||
&& isset( $cached_files['files'] )
|
||||
) {
|
||||
$files = $cached_files['files'];
|
||||
}
|
||||
} else {
|
||||
$files = glob( wp_normalize_path( __DIR__ . '/**/**.css' ) );
|
||||
}
|
||||
|
||||
$register_style = static function( $name, $filename, $style_handle ) use ( $includes_path, $includes_url, $suffix, $wp_styles, $files ) {
|
||||
$style_path = "blocks/{$name}/{$filename}{$suffix}.css";
|
||||
$path = wp_normalize_path( $includes_path . $style_path );
|
||||
if ( ! $files ) {
|
||||
$files = glob( wp_normalize_path( BLOCKS_PATH . '**/**.css' ) );
|
||||
|
||||
if ( ! in_array( $path, $files, true ) ) {
|
||||
// Normalize BLOCKS_PATH prior to substitution for Windows environments.
|
||||
$normalized_blocks_path = wp_normalize_path( BLOCKS_PATH );
|
||||
|
||||
$files = array_map(
|
||||
static function ( $file ) use ( $normalized_blocks_path ) {
|
||||
return str_replace( $normalized_blocks_path, '', $file );
|
||||
},
|
||||
$files
|
||||
);
|
||||
|
||||
// Save core block style paths in cache when not in development mode.
|
||||
if ( $can_use_cached ) {
|
||||
set_transient(
|
||||
$transient_name,
|
||||
array(
|
||||
'version' => $wp_version,
|
||||
'files' => $files,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$register_style = static function ( $name, $filename, $style_handle ) use ( $blocks_url, $suffix, $wp_styles, $files ) {
|
||||
$style_path = "{$name}/{$filename}{$suffix}.css";
|
||||
$path = wp_normalize_path( BLOCKS_PATH . $style_path );
|
||||
|
||||
if ( ! in_array( $style_path, $files, true ) ) {
|
||||
$wp_styles->add(
|
||||
$style_handle,
|
||||
false
|
||||
@@ -67,14 +103,14 @@ function register_core_block_style_handles() {
|
||||
return;
|
||||
}
|
||||
|
||||
$wp_styles->add( $style_handle, $includes_url . $style_path );
|
||||
$wp_styles->add( $style_handle, $blocks_url . $style_path );
|
||||
$wp_styles->add_data( $style_handle, 'path', $path );
|
||||
|
||||
$rtl_file = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $path );
|
||||
$rtl_file = "{$name}/{$filename}-rtl{$suffix}.css";
|
||||
if ( is_rtl() && in_array( $rtl_file, $files, true ) ) {
|
||||
$wp_styles->add_data( $style_handle, 'rtl', 'replace' );
|
||||
$wp_styles->add_data( $style_handle, 'suffix', $suffix );
|
||||
$wp_styles->add_data( $style_handle, 'path', $rtl_file );
|
||||
$wp_styles->add_data( $style_handle, 'path', str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $path ) );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -48,15 +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 ) {
|
||||
$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;
|
||||
};
|
||||
|
||||
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'] ) ) {
|
||||
@@ -151,6 +143,23 @@ function render_block_core_latest_posts( $attributes ) {
|
||||
|
||||
$trimmed_excerpt = get_the_excerpt( $post );
|
||||
|
||||
/*
|
||||
* Adds a "Read more" link with screen reader text.
|
||||
* […] is the default excerpt ending from wp_trim_excerpt() in Core.
|
||||
*/
|
||||
if ( str_ends_with( $trimmed_excerpt, ' […]' ) ) {
|
||||
$excerpt_length = (int) apply_filters( 'excerpt_length', $block_core_latest_posts_excerpt_length );
|
||||
if ( $excerpt_length <= $block_core_latest_posts_excerpt_length ) {
|
||||
$trimmed_excerpt = substr( $trimmed_excerpt, 0, -11 );
|
||||
$trimmed_excerpt .= sprintf(
|
||||
/* translators: 1: A URL to a post, 2: Hidden accessibility text: Post title */
|
||||
__( '… <a href="%1$s" rel="noopener noreferrer">Read more<span class="screen-reader-text">: %2$s</span></a>' ),
|
||||
esc_url( $post_link ),
|
||||
esc_html( $title )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( post_password_required( $post ) ) {
|
||||
$trimmed_excerpt = __( 'This content is password protected.' );
|
||||
}
|
||||
|
||||
@@ -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}
|
||||
@@ -1,6 +1,5 @@
|
||||
.wp-block-navigation .wp-block-navigation-item__label{
|
||||
overflow-wrap:break-word;
|
||||
word-break:normal;
|
||||
}
|
||||
.wp-block-navigation .wp-block-navigation-item__description{
|
||||
display:none;
|
||||
|
||||
@@ -1 +1 @@
|
||||
.wp-block-navigation .wp-block-navigation-item__label{overflow-wrap:break-word;word-break:normal}.wp-block-navigation .wp-block-navigation-item__description{display:none}
|
||||
.wp-block-navigation .wp-block-navigation-item__label{overflow-wrap:break-word}.wp-block-navigation .wp-block-navigation-item__description{display:none}
|
||||
@@ -1,6 +1,5 @@
|
||||
.wp-block-navigation .wp-block-navigation-item__label{
|
||||
overflow-wrap:break-word;
|
||||
word-break:normal;
|
||||
}
|
||||
.wp-block-navigation .wp-block-navigation-item__description{
|
||||
display:none;
|
||||
|
||||
@@ -1 +1 @@
|
||||
.wp-block-navigation .wp-block-navigation-item__label{overflow-wrap:break-word;word-break:normal}.wp-block-navigation .wp-block-navigation-item__description{display:none}
|
||||
.wp-block-navigation .wp-block-navigation-item__label{overflow-wrap:break-word}.wp-block-navigation .wp-block-navigation-item__description{display:none}
|
||||
@@ -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,69 @@ 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' );
|
||||
|
||||
// This is a fix for Safari. Without it, Safari doesn't change the active
|
||||
// element when the user clicks on a button. It can be removed once we add
|
||||
// an overlay to capture the clicks, instead of relying on the focusout
|
||||
// event.
|
||||
$w->set_attribute( 'tabindex', '-1' );
|
||||
|
||||
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 +258,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 +270,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 +400,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 +536,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 +636,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 +702,23 @@ 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_context = wp_json_encode(
|
||||
array(
|
||||
'core' => array(
|
||||
'navigation' => array(
|
||||
'overlayOpenedBy' => array(),
|
||||
'type' => 'overlay',
|
||||
'roleAttribute' => '',
|
||||
'ariaLabel' => __( 'Menu' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP
|
||||
);
|
||||
$nav_element_directives = '
|
||||
data-wp-interactive
|
||||
data-wp-context=\'{ "core": { "navigation": { "isMenuOpen": { "click": false, "hover": false }, "overlay": true, "roleAttribute": "" } } }\'
|
||||
data-wp-context=\'' . $nav_element_context . '\'
|
||||
';
|
||||
$open_button_directives = '
|
||||
data-wp-on--click="actions.core.navigation.openMenuOnClick"
|
||||
@@ -741,7 +733,8 @@ 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--aria-label="selectors.core.navigation.ariaLabel"
|
||||
data-wp-bind--role="selectors.core.navigation.roleAttribute"
|
||||
data-wp-effect="effects.core.navigation.focusFirstElement"
|
||||
';
|
||||
@@ -751,11 +744,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>
|
||||
<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-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 aria-haspopup="true" %3$s class="%6$s" %10$s>%8$s</button>
|
||||
<div class="%5$s" style="%7$s" id="%1$s" %11$s>
|
||||
<div class="wp-block-navigation__responsive-close" tabindex="-1">
|
||||
<div class="wp-block-navigation__responsive-dialog" %12$s>
|
||||
<button %4$s class="wp-block-navigation__responsive-container-close" %13$s>%9$s</button>
|
||||
<div class="wp-block-navigation__responsive-container-content" id="%1$s-content">
|
||||
%2$s
|
||||
</div>
|
||||
@@ -769,7 +762,6 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
||||
esc_attr( implode( ' ', $responsive_container_classes ) ),
|
||||
esc_attr( implode( ' ', $open_button_classes ) ),
|
||||
esc_attr( safecss_filter_attr( $colors['overlay_inline_styles'] ) ),
|
||||
__( 'Menu' ),
|
||||
$toggle_button_content,
|
||||
$toggle_close_button_content,
|
||||
$open_button_directives,
|
||||
@@ -837,6 +829,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 +941,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{
|
||||
@@ -293,7 +301,7 @@ button.wp-block-navigation-item__content{
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
overflow:auto;
|
||||
padding:var(--wp--style--root--padding-top, 2rem) var(--wp--style--root--padding-left, 2rem) var(--wp--style--root--padding-bottom, 2rem) var(--wp--style--root--padding-right, 2rem);
|
||||
padding:clamp(1rem, var(--wp--style--root--padding-top), 20rem) clamp(1rem, var(--wp--style--root--padding-left), 20em) clamp(1rem, var(--wp--style--root--padding-bottom), 20rem) clamp(1rem, var(--wp--style--root--padding-right), 20rem);
|
||||
z-index:100000;
|
||||
}
|
||||
@media (prefers-reduced-motion:reduce){
|
||||
@@ -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{
|
||||
@@ -293,7 +301,7 @@ button.wp-block-navigation-item__content{
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
overflow:auto;
|
||||
padding:var(--wp--style--root--padding-top, 2rem) var(--wp--style--root--padding-right, 2rem) var(--wp--style--root--padding-bottom, 2rem) var(--wp--style--root--padding-left, 2rem);
|
||||
padding:clamp(1rem, var(--wp--style--root--padding-top), 20rem) clamp(1rem, var(--wp--style--root--padding-right), 20rem) clamp(1rem, var(--wp--style--root--padding-bottom), 20rem) clamp(1rem, var(--wp--style--root--padding-left), 20em);
|
||||
z-index:100000;
|
||||
}
|
||||
@media (prefers-reduced-motion:reduce){
|
||||
@@ -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
@@ -1 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '6391fb107a84d15c14f4');
|
||||
<?php return array('dependencies' => array(), 'version' => 'a145d0113e969f692877');
|
||||
|
||||
@@ -1 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => 'b0c5026864ec3616bae7');
|
||||
<?php return array('dependencies' => array(), 'version' => 'b3eba25769c9fe5ec0fa');
|
||||
|
||||
@@ -1,63 +1,213 @@
|
||||
/******/ (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^="-"])'];
|
||||
|
||||
// This is a fix for Safari in iOS/iPadOS. Without it, Safari doesn't focus out
|
||||
// when the user taps in the body. It can be removed once we add an overlay to
|
||||
// capture the clicks, instead of relying on the focusout event.
|
||||
document.addEventListener('click', () => {});
|
||||
const openMenu = (store, menuOpenedOn) => {
|
||||
const {
|
||||
context,
|
||||
selectors
|
||||
} = store;
|
||||
selectors.core.navigation.menuOpenedBy(store)[menuOpenedOn] = true;
|
||||
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;
|
||||
},
|
||||
ariaLabel: store => {
|
||||
const {
|
||||
context,
|
||||
selectors
|
||||
} = store;
|
||||
return context.core.navigation.type === 'overlay' && selectors.core.navigation.isMenuOpen(store) ? context.core.navigation.ariaLabel : 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) {
|
||||
const {
|
||||
context,
|
||||
ref
|
||||
} = store;
|
||||
context.core.navigation.previousFocus = ref;
|
||||
openMenu(store, 'click');
|
||||
},
|
||||
closeMenuOnClick(store) {
|
||||
closeMenu(store, 'click');
|
||||
closeMenu(store, 'focus');
|
||||
},
|
||||
openMenuOnFocus(store) {
|
||||
openMenu(store, 'focus');
|
||||
},
|
||||
toggleMenuOnClick: store => {
|
||||
const {
|
||||
selectors,
|
||||
context,
|
||||
ref
|
||||
} = store;
|
||||
// Safari won't send focus to the clicked element, so we need to manually place it: https://bugs.webkit.org/show_bug.cgi?id=22261
|
||||
if (window.document.activeElement !== ref) ref.focus();
|
||||
const menuOpenedBy = selectors.core.navigation.menuOpenedBy(store);
|
||||
if (menuOpenedBy.click || menuOpenedBy.focus) {
|
||||
closeMenu(store, 'click');
|
||||
closeMenu(store, 'focus');
|
||||
} else {
|
||||
context.core.navigation.previousFocus = ref;
|
||||
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.
|
||||
|
||||
// The event.relatedTarget is null when something outside the navigation menu is clicked. This is only necessary for Safari.
|
||||
if (event.relatedTarget === null || !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' => 'e3d6f3216904b5b42831');
|
||||
|
||||
2
wp/wp-includes/blocks/navigation/view.min.js
vendored
2
wp/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 a=["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^="-"])'];document.addEventListener("click",(()=>{}));const i=(e,n)=>{const{context:o,selectors:t}=e;t.core.navigation.menuOpenedBy(e)[n]=!0,"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(a);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},ariaLabel:e=>{const{context:n,selectors:o}=e;return"overlay"===n.core.navigation.type&&o.core.navigation.isMenuOpen(e)?n.core.navigation.ariaLabel: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&&i(e,"hover")},closeMenuOnHover(e){c(e,"hover")},openMenuOnClick(e){const{context:n,ref:o}=e;n.core.navigation.previousFocus=o,i(e,"click")},closeMenuOnClick(e){c(e,"click"),c(e,"focus")},openMenuOnFocus(e){i(e,"focus")},toggleMenuOnClick:e=>{const{selectors:n,context:o,ref:t}=e;window.document.activeElement!==t&&t.focus();const a=n.core.navigation.menuOpenedBy(e);a.click||a.focus?(c(e,"click"),c(e,"focus")):(o.core.navigation.previousFocus=t,i(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;(null===o.relatedTarget||!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
|
||||
}
|
||||
|
||||
@@ -8,4 +8,8 @@
|
||||
|
||||
.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}
|
||||
@@ -8,4 +8,8 @@
|
||||
|
||||
.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}
|
||||
@@ -39,4 +39,8 @@ 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}
|
||||
@@ -39,4 +39,8 @@ 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: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}
|
||||
@@ -7,8 +7,6 @@
|
||||
|
||||
/**
|
||||
* Registers the `core/pattern` block on the server.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function register_block_core_pattern() {
|
||||
register_block_type_from_metadata(
|
||||
@@ -41,7 +39,16 @@ 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' ) ) {
|
||||
$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,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user