Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.

This patch, somewhat small brings a lot to WordPress. 
This includes features like:

 - DataViews.
 - Customization tools like box shadow, background size and repeat.
 - UI improvements in the site editor. 
 - Preferences sharing between the post and site editors.
 - Unified panels and editors between post and site editors.
 - Improved template mode in the post editor.
 - Iterations to multiple interactive blocks.
 - Preparing the blocks and UI for pattern overrides.
 - and a lot more.

Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377


git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
youknowriad 2024-01-29 21:07:12 +00:00
parent aba105c851
commit 1de40f71be
312 changed files with 88033 additions and 85099 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<?php return array('dependencies' => array('wp-react-refresh-runtime'), 'version' => '794dd7047e2302828128'); <?php return array('dependencies' => array('wp-react-refresh-runtime'), 'version' => 'e51671a96bba47d2d62d');

View File

@ -1 +1 @@
<?php return array('dependencies' => array('wp-react-refresh-runtime'), 'version' => '794dd7047e2302828128'); <?php return array('dependencies' => array('wp-react-refresh-runtime'), 'version' => 'e51671a96bba47d2d62d');

166
wp-includes/blocks/908.js Normal file
View File

@ -0,0 +1,166 @@
(self["webpackChunkWordPress"] = self["webpackChunkWordPress"] || []).push([[908],{
/***/ 908:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ actions: function() { return /* binding */ actions; },
/* harmony export */ state: function() { return /* binding */ state; }
/* harmony export */ });
/* harmony import */ var _wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(998);
/**
* WordPress dependencies
*/
// The cache of visited and prefetched pages.
const pages = new Map();
// Helper to remove domain and hash from the URL. We are only interesting in
// caching the path and the query.
const cleanUrl = url => {
const u = new URL(url, window.location);
return u.pathname + u.search;
};
// Fetch a new page and convert it to a static virtual DOM.
const fetchPage = async (url, {
html
}) => {
try {
if (!html) {
const res = await window.fetch(url);
if (res.status !== 200) return false;
html = await res.text();
}
const dom = new window.DOMParser().parseFromString(html, 'text/html');
return regionsToVdom(dom);
} catch (e) {
return false;
}
};
// Return an object with VDOM trees of those HTML regions marked with a
// `router-region` directive.
const regionsToVdom = dom => {
const regions = {};
const attrName = `data-${_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.directivePrefix}-router-region`;
dom.querySelectorAll(`[${attrName}]`).forEach(region => {
const id = region.getAttribute(attrName);
regions[id] = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.toVdom)(region);
});
const title = dom.querySelector('title')?.innerText;
return {
regions,
title
};
};
// Render all interactive regions contained in the given page.
const renderRegions = page => {
const attrName = `data-${_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.directivePrefix}-router-region`;
document.querySelectorAll(`[${attrName}]`).forEach(region => {
const id = region.getAttribute(attrName);
const fragment = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.getRegionRootFragment)(region);
(0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.render)(page.regions[id], fragment);
});
if (page.title) {
document.title = page.title;
}
};
// Variable to store the current navigation.
let navigatingTo = '';
// Listen to the back and forward buttons and restore the page if it's in the
// cache.
window.addEventListener('popstate', async () => {
const url = cleanUrl(window.location); // Remove hash.
const page = pages.has(url) && (await pages.get(url));
if (page) {
renderRegions(page);
} else {
window.location.reload();
}
});
// Cache the current regions.
pages.set(cleanUrl(window.location), Promise.resolve(regionsToVdom(document)));
const {
state,
actions
} = (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__.store)('core/router', {
actions: {
/**
* Navigates to the specified page.
*
* This function normalizes the passed href, fetchs the page HTML if
* needed, and updates any interactive regions whose contents have
* changed. It also creates a new entry in the browser session history.
*
* @param {string} href The page href.
* @param {Object} [options] Options object.
* @param {boolean} [options.force] If true, it forces re-fetching the
* URL.
* @param {string} [options.html] HTML string to be used instead of
* fetching the requested URL.
* @param {boolean} [options.replace] If true, it replaces the current
* entry in the browser session
* history.
* @param {number} [options.timeout] Time until the navigation is
* aborted, in milliseconds. Default
* is 10000.
*
* @return {Promise} Promise that resolves once the navigation is
* completed or aborted.
*/
*navigate(href, options = {}) {
const url = cleanUrl(href);
navigatingTo = href;
actions.prefetch(url, options);
// Create a promise that resolves when the specified timeout ends.
// The timeout value is 10 seconds by default.
const timeoutPromise = new Promise(resolve => {
var _options$timeout;
return setTimeout(resolve, (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : 10000);
});
const page = yield Promise.race([pages.get(url), timeoutPromise]);
// Once the page is fetched, the destination URL could have changed
// (e.g., by clicking another link in the meantime). If so, bail
// out, and let the newer execution to update the HTML.
if (navigatingTo !== href) return;
if (page) {
renderRegions(page);
window.history[options.replace ? 'replaceState' : 'pushState']({}, '', href);
} else {
window.location.assign(href);
yield new Promise(() => {});
}
},
/**
* Prefetchs the page with the passed URL.
*
* The function normalizes the URL and stores internally the fetch
* promise, to avoid triggering a second fetch for an ongoing request.
*
* @param {string} url The page URL.
* @param {Object} [options] Options object.
* @param {boolean} [options.force] Force fetching the URL again.
* @param {string} [options.html] HTML string to be used instead of
* fetching the requested URL.
*/
prefetch(url, options = {}) {
url = cleanUrl(url);
if (options.force || !pages.has(url)) {
pages.set(url, fetchPage(url, options));
}
}
}
});
/***/ })
}])

1
wp-includes/blocks/908.min.js vendored Normal file
View File

@ -0,0 +1 @@
(self.webpackChunkWordPress=self.webpackChunkWordPress||[]).push([[908],{908:function(t,e,o){o.r(e),o.d(e,{actions:function(){return u},state:function(){return l}});var r=o(998);const n=new Map,i=t=>{const e=new URL(t,window.location);return e.pathname+e.search},s=t=>{const e={},o=`data-${r.directivePrefix}-router-region`;t.querySelectorAll(`[${o}]`).forEach((t=>{const n=t.getAttribute(o);e[n]=(0,r.toVdom)(t)}));const n=t.querySelector("title")?.innerText;return{regions:e,title:n}},a=t=>{const e=`data-${r.directivePrefix}-router-region`;document.querySelectorAll(`[${e}]`).forEach((o=>{const n=o.getAttribute(e),i=(0,r.getRegionRootFragment)(o);(0,r.render)(t.regions[n],i)})),t.title&&(document.title=t.title)};let c="";window.addEventListener("popstate",(async()=>{const t=i(window.location),e=n.has(t)&&await n.get(t);e?a(e):window.location.reload()})),n.set(i(window.location),Promise.resolve(s(document)));const{state:l,actions:u}=(0,r.store)("core/router",{actions:{*navigate(t,e={}){const o=i(t);c=t,u.prefetch(o,e);const r=new Promise((t=>{var o;return setTimeout(t,null!==(o=e.timeout)&&void 0!==o?o:1e4)})),s=yield Promise.race([n.get(o),r]);c===t&&(s?(a(s),window.history[e.replace?"replaceState":"pushState"]({},"",t)):(window.location.assign(t),yield new Promise((()=>{}))))},prefetch(t,e={}){t=i(t),!e.force&&n.has(t)||n.set(t,(async(t,{html:e})=>{try{if(!e){const o=await window.fetch(t);if(200!==o.status)return!1;e=await o.text()}const o=(new window.DOMParser).parseFromString(e,"text/html");return s(o)}catch(t){return!1}})(t,e))}}})}}]);

View File

@ -16,8 +16,8 @@
"__experimentalRole": "content" "__experimentalRole": "content"
}, },
"caption": { "caption": {
"type": "string", "type": "rich-text",
"source": "html", "source": "rich-text",
"selector": "figcaption", "selector": "figcaption",
"__experimentalRole": "content" "__experimentalRole": "content"
}, },

View File

@ -30,7 +30,11 @@
"alignWide": false, "alignWide": false,
"spacing": { "spacing": {
"margin": true, "margin": true,
"padding": true "padding": true,
"__experimentalDefaultControls": {
"margin": false,
"padding": false
}
}, },
"__experimentalBorder": { "__experimentalBorder": {
"__experimentalSkipSerialization": true, "__experimentalSkipSerialization": true,

View File

@ -46,8 +46,28 @@ function render_block_core_block( $attributes ) {
$content = $wp_embed->run_shortcode( $reusable_block->post_content ); $content = $wp_embed->run_shortcode( $reusable_block->post_content );
$content = $wp_embed->autoembed( $content ); $content = $wp_embed->autoembed( $content );
$has_pattern_overrides = isset( $attributes['overrides'] );
/**
* We set the `pattern/overrides` context through the `render_block_context`
* filter so that it is available when a pattern's inner blocks are
* rendering via do_blocks given it only receives the inner content.
*/
if ( $has_pattern_overrides ) {
$filter_block_context = static function ( $context ) use ( $attributes ) {
$context['pattern/overrides'] = $attributes['overrides'];
return $context;
};
add_filter( 'render_block_context', $filter_block_context, 1 );
}
$content = do_blocks( $content ); $content = do_blocks( $content );
unset( $seen_refs[ $attributes['ref'] ] ); unset( $seen_refs[ $attributes['ref'] ] );
if ( $has_pattern_overrides ) {
remove_filter( 'render_block_context', $filter_block_context, 1 );
}
return $content; return $content;
} }

View File

@ -10,11 +10,15 @@
"attributes": { "attributes": {
"ref": { "ref": {
"type": "number" "type": "number"
},
"overrides": {
"type": "object"
} }
}, },
"supports": { "supports": {
"customClassName": false, "customClassName": false,
"html": false, "html": false,
"inserter": false "inserter": false,
"renaming": false
} }
} }

View File

@ -75,8 +75,8 @@
'__experimentalRole' => 'content' '__experimentalRole' => 'content'
), ),
'caption' => array( 'caption' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html', 'source' => 'rich-text',
'selector' => 'figcaption', 'selector' => 'figcaption',
'__experimentalRole' => 'content' '__experimentalRole' => 'content'
), ),
@ -154,7 +154,11 @@
'alignWide' => false, 'alignWide' => false,
'spacing' => array( 'spacing' => array(
'margin' => true, 'margin' => true,
'padding' => true 'padding' => true,
'__experimentalDefaultControls' => array(
'margin' => false,
'padding' => false
)
), ),
'__experimentalBorder' => array( '__experimentalBorder' => array(
'__experimentalSkipSerialization' => true, '__experimentalSkipSerialization' => true,
@ -192,12 +196,16 @@
'attributes' => array( 'attributes' => array(
'ref' => array( 'ref' => array(
'type' => 'number' 'type' => 'number'
),
'overrides' => array(
'type' => 'object'
) )
), ),
'supports' => array( 'supports' => array(
'customClassName' => false, 'customClassName' => false,
'html' => false, 'html' => false,
'inserter' => false 'inserter' => false,
'renaming' => false
) )
), ),
'button' => array( 'button' => array(
@ -214,6 +222,9 @@
'link' 'link'
), ),
'textdomain' => 'default', 'textdomain' => 'default',
'usesContext' => array(
'pattern/overrides'
),
'attributes' => array( 'attributes' => array(
'tagName' => array( 'tagName' => array(
'type' => 'string', 'type' => 'string',
@ -245,8 +256,8 @@
'__experimentalRole' => 'content' '__experimentalRole' => 'content'
), ),
'text' => array( 'text' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html', 'source' => 'rich-text',
'selector' => 'a,button', 'selector' => 'a,button',
'__experimentalRole' => 'content' '__experimentalRole' => 'content'
), ),
@ -516,8 +527,8 @@
'textdomain' => 'default', 'textdomain' => 'default',
'attributes' => array( 'attributes' => array(
'content' => array( 'content' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html', 'source' => 'rich-text',
'selector' => 'code', 'selector' => 'code',
'__unstablePreserveWhiteSpace' => true '__unstablePreserveWhiteSpace' => true
) )
@ -1314,7 +1325,7 @@
'ancestor' => array( 'ancestor' => array(
'core/comments' 'core/comments'
), ),
'description' => 'Displays a title with the number of comments', 'description' => 'Displays a title with the number of comments.',
'textdomain' => 'default', 'textdomain' => 'default',
'usesContext' => array( 'usesContext' => array(
'postId', 'postId',
@ -1397,9 +1408,6 @@
), ),
'alt' => array( 'alt' => array(
'type' => 'string', 'type' => 'string',
'source' => 'attribute',
'selector' => 'img',
'attribute' => 'alt',
'default' => '' 'default' => ''
), ),
'hasParallax' => array( 'hasParallax' => array(
@ -1420,6 +1428,9 @@
'customOverlayColor' => array( 'customOverlayColor' => array(
'type' => 'string' 'type' => 'string'
), ),
'isUserOverlayColor' => array(
'type' => 'boolean'
),
'backgroundType' => array( 'backgroundType' => array(
'type' => 'string', 'type' => 'string',
'default' => 'image' 'default' => 'image'
@ -1508,6 +1519,9 @@
), ),
'enableContrastChecker' => false 'enableContrastChecker' => false
), ),
'dimensions' => array(
'aspectRatio' => true
),
'typography' => array( 'typography' => array(
'fontSize' => true, 'fontSize' => true,
'lineHeight' => true, 'lineHeight' => true,
@ -1548,8 +1562,8 @@
'default' => false 'default' => false
), ),
'summary' => array( 'summary' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html', 'source' => 'rich-text',
'selector' => 'summary' 'selector' => 'summary'
) )
), ),
@ -1615,8 +1629,8 @@
'__experimentalRole' => 'content' '__experimentalRole' => 'content'
), ),
'caption' => array( 'caption' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html', 'source' => 'rich-text',
'selector' => 'figcaption', 'selector' => 'figcaption',
'__experimentalRole' => 'content' '__experimentalRole' => 'content'
), ),
@ -1679,8 +1693,8 @@
'attribute' => 'id' 'attribute' => 'id'
), ),
'fileName' => array( 'fileName' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html', 'source' => 'rich-text',
'selector' => 'a:not([download])' 'selector' => 'a:not([download])'
), ),
'textLinkHref' => array( 'textLinkHref' => array(
@ -1700,8 +1714,8 @@
'default' => true 'default' => true
), ),
'downloadButtonText' => array( 'downloadButtonText' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html', 'source' => 'rich-text',
'selector' => 'a[download]' 'selector' => 'a[download]'
), ),
'displayPreview' => array( 'displayPreview' => array(
@ -1730,7 +1744,6 @@
), ),
'interactivity' => true 'interactivity' => true
), ),
'viewScript' => 'file:./view.min.js',
'editorStyle' => 'wp-block-file-editor', 'editorStyle' => 'wp-block-file-editor',
'style' => 'wp-block-file' 'style' => 'wp-block-file'
), ),
@ -1740,7 +1753,7 @@
'name' => 'core/footnotes', 'name' => 'core/footnotes',
'title' => 'Footnotes', 'title' => 'Footnotes',
'category' => 'text', 'category' => 'text',
'description' => '', 'description' => 'Display footnotes added to the page.',
'keywords' => array( 'keywords' => array(
'references' 'references'
), ),
@ -1774,6 +1787,7 @@
'html' => false, 'html' => false,
'multiple' => false, 'multiple' => false,
'reusable' => false, 'reusable' => false,
'inserter' => false,
'spacing' => array( 'spacing' => array(
'margin' => true, 'margin' => true,
'padding' => true, 'padding' => true,
@ -1873,8 +1887,8 @@
'attribute' => 'data-id' 'attribute' => 'data-id'
), ),
'caption' => array( 'caption' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html', 'source' => 'rich-text',
'selector' => '.blocks-gallery-item__caption' 'selector' => '.blocks-gallery-item__caption'
) )
) )
@ -1903,14 +1917,18 @@
'maximum' => 8 'maximum' => 8
), ),
'caption' => array( 'caption' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html', 'source' => 'rich-text',
'selector' => '.blocks-gallery-caption' 'selector' => '.blocks-gallery-caption'
), ),
'imageCrop' => array( 'imageCrop' => array(
'type' => 'boolean', 'type' => 'boolean',
'default' => true 'default' => true
), ),
'randomOrder' => array(
'type' => 'boolean',
'default' => false
),
'fixedHeight' => array( 'fixedHeight' => array(
'type' => 'boolean', 'type' => 'boolean',
'default' => true 'default' => true
@ -2018,7 +2036,6 @@
'__experimentalOnEnter' => true, '__experimentalOnEnter' => true,
'__experimentalOnMerge' => true, '__experimentalOnMerge' => true,
'__experimentalSettings' => true, '__experimentalSettings' => true,
'__experimentalMetadata' => true,
'align' => array( 'align' => array(
'wide', 'wide',
'full' 'full'
@ -2027,7 +2044,11 @@
'ariaLabel' => true, 'ariaLabel' => true,
'html' => false, 'html' => false,
'background' => array( 'background' => array(
'backgroundImage' => true 'backgroundImage' => true,
'backgroundSize' => true,
'__experimentalDefaultControls' => array(
'backgroundImage' => true
)
), ),
'color' => array( 'color' => array(
'gradients' => true, 'gradients' => true,
@ -2052,6 +2073,7 @@
) )
), ),
'dimensions' => array( 'dimensions' => array(
'aspectRatio' => true,
'minHeight' => true 'minHeight' => true
), ),
'__experimentalBorder' => array( '__experimentalBorder' => array(
@ -2101,15 +2123,17 @@
'subtitle' 'subtitle'
), ),
'textdomain' => 'default', 'textdomain' => 'default',
'usesContext' => array(
'pattern/overrides'
),
'attributes' => array( 'attributes' => array(
'textAlign' => array( 'textAlign' => array(
'type' => 'string' 'type' => 'string'
), ),
'content' => array( 'content' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html', 'source' => 'rich-text',
'selector' => 'h1,h2,h3,h4,h5,h6', 'selector' => 'h1,h2,h3,h4,h5,h6',
'default' => '',
'__experimentalRole' => 'content' '__experimentalRole' => 'content'
), ),
'level' => array( 'level' => array(
@ -2154,9 +2178,7 @@
'__experimentalTextDecoration' => true, '__experimentalTextDecoration' => true,
'__experimentalWritingMode' => true, '__experimentalWritingMode' => true,
'__experimentalDefaultControls' => array( '__experimentalDefaultControls' => array(
'fontSize' => true, 'fontSize' => true
'fontAppearance' => true,
'textTransform' => true
) )
), ),
'__unstablePasteTextInline' => true, '__unstablePasteTextInline' => true,
@ -2243,7 +2265,8 @@
'usesContext' => array( 'usesContext' => array(
'allowResize', 'allowResize',
'imageCrop', 'imageCrop',
'fixedHeight' 'fixedHeight',
'pattern/overrides'
), ),
'description' => 'Insert an image to make a visual statement.', 'description' => 'Insert an image to make a visual statement.',
'keywords' => array( 'keywords' => array(
@ -2253,9 +2276,6 @@
), ),
'textdomain' => 'default', 'textdomain' => 'default',
'attributes' => array( 'attributes' => array(
'align' => array(
'type' => 'string'
),
'url' => array( 'url' => array(
'type' => 'string', 'type' => 'string',
'source' => 'attribute', 'source' => 'attribute',
@ -2272,8 +2292,8 @@
'__experimentalRole' => 'content' '__experimentalRole' => 'content'
), ),
'caption' => array( 'caption' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html', 'source' => 'rich-text',
'selector' => 'figcaption', 'selector' => 'figcaption',
'__experimentalRole' => 'content' '__experimentalRole' => 'content'
), ),
@ -2339,6 +2359,14 @@
) )
), ),
'supports' => array( 'supports' => array(
'interactivity' => true,
'align' => array(
'left',
'center',
'right',
'wide',
'full'
),
'anchor' => true, 'anchor' => true,
'color' => array( 'color' => array(
'text' => false, 'text' => false,
@ -2377,8 +2405,7 @@
) )
), ),
'editorStyle' => 'wp-block-image-editor', 'editorStyle' => 'wp-block-image-editor',
'style' => 'wp-block-image', 'style' => 'wp-block-image'
'viewScript' => 'file:./view.min.js'
), ),
'latest-comments' => array( 'latest-comments' => array(
'$schema' => 'https://schemas.wp.org/trunk/block.json', '$schema' => 'https://schemas.wp.org/trunk/block.json',
@ -2559,6 +2586,7 @@
'style' => 'wp-block-latest-posts' 'style' => 'wp-block-latest-posts'
), ),
'legacy-widget' => array( 'legacy-widget' => array(
'$schema' => 'https://schemas.wp.org/trunk/block.json',
'apiVersion' => 3, 'apiVersion' => 3,
'name' => 'core/legacy-widget', 'name' => 'core/legacy-widget',
'title' => 'Legacy Widget', 'title' => 'Legacy Widget',
@ -2686,16 +2714,23 @@
'type' => 'string' 'type' => 'string'
), ),
'content' => array( 'content' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html', 'source' => 'rich-text',
'selector' => 'li', 'selector' => 'li',
'default' => '',
'__experimentalRole' => 'content' '__experimentalRole' => 'content'
) )
), ),
'supports' => array( 'supports' => array(
'className' => false, 'className' => false,
'__experimentalSelector' => 'li', '__experimentalSelector' => 'li',
'spacing' => array(
'margin' => true,
'padding' => true,
'__experimentalDefaultControls' => array(
'margin' => false,
'padding' => false
)
),
'typography' => array( 'typography' => array(
'fontSize' => true, 'fontSize' => true,
'lineHeight' => true, 'lineHeight' => true,
@ -2736,6 +2771,14 @@
), ),
'supports' => array( 'supports' => array(
'className' => true, 'className' => true,
'spacing' => array(
'margin' => true,
'padding' => true,
'__experimentalDefaultControls' => array(
'margin' => false,
'padding' => false
)
),
'typography' => array( 'typography' => array(
'fontSize' => true, 'fontSize' => true,
'lineHeight' => true, 'lineHeight' => true,
@ -2904,7 +2947,7 @@
), ),
'originalContent' => array( 'originalContent' => array(
'type' => 'string', 'type' => 'string',
'source' => 'html' 'source' => 'raw'
) )
), ),
'supports' => array( 'supports' => array(
@ -3101,9 +3144,9 @@
) )
) )
), ),
'interactivity' => true 'interactivity' => true,
'renaming' => false
), ),
'viewScript' => 'file:./view.min.js',
'editorStyle' => 'wp-block-navigation-editor', 'editorStyle' => 'wp-block-navigation-editor',
'style' => 'wp-block-navigation' 'style' => 'wp-block-navigation'
), ),
@ -3182,7 +3225,8 @@
'__experimentalDefaultControls' => array( '__experimentalDefaultControls' => array(
'fontSize' => true 'fontSize' => true
) )
) ),
'renaming' => false
), ),
'editorStyle' => 'wp-block-navigation-link-editor', 'editorStyle' => 'wp-block-navigation-link-editor',
'style' => 'wp-block-navigation-link' 'style' => 'wp-block-navigation-link'
@ -3403,17 +3447,17 @@
), ),
'textdomain' => 'default', 'textdomain' => 'default',
'usesContext' => array( 'usesContext' => array(
'postId' 'postId',
'pattern/overrides'
), ),
'attributes' => array( 'attributes' => array(
'align' => array( 'align' => array(
'type' => 'string' 'type' => 'string'
), ),
'content' => array( 'content' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html', 'source' => 'rich-text',
'selector' => 'p', 'selector' => 'p',
'default' => '',
'__experimentalRole' => 'content' '__experimentalRole' => 'content'
), ),
'dropCap' => array( 'dropCap' => array(
@ -3442,7 +3486,6 @@
'text' => true 'text' => true
) )
), ),
'__experimentalConnections' => true,
'spacing' => array( 'spacing' => array(
'margin' => true, 'margin' => true,
'padding' => true, 'padding' => true,
@ -3480,7 +3523,8 @@
'description' => 'Show a block pattern.', 'description' => 'Show a block pattern.',
'supports' => array( 'supports' => array(
'html' => false, 'html' => false,
'inserter' => false 'inserter' => false,
'renaming' => false
), ),
'textdomain' => 'default', 'textdomain' => 'default',
'attributes' => array( 'attributes' => array(
@ -3934,6 +3978,10 @@
), ),
'customGradient' => array( 'customGradient' => array(
'type' => 'string' 'type' => 'string'
),
'useFirstImageFromPost' => array(
'type' => 'boolean',
'default' => false
) )
), ),
'usesContext' => array( 'usesContext' => array(
@ -4005,8 +4053,18 @@
'arrow' => array( 'arrow' => array(
'type' => 'string', 'type' => 'string',
'default' => 'none' 'default' => 'none'
),
'inSameTerm' => array(
'type' => 'boolean'
),
'taxonomy' => array(
'type' => 'string',
'default' => ''
) )
), ),
'usesContext' => array(
'postType'
),
'supports' => array( 'supports' => array(
'reusable' => false, 'reusable' => false,
'html' => false, 'html' => false,
@ -4044,7 +4102,6 @@
'usesContext' => array( 'usesContext' => array(
'queryId', 'queryId',
'query', 'query',
'queryContext',
'displayLayout', 'displayLayout',
'templateSlug', 'templateSlug',
'previewPostType', 'previewPostType',
@ -4218,9 +4275,7 @@
'__experimentalTextDecoration' => true, '__experimentalTextDecoration' => true,
'__experimentalLetterSpacing' => true, '__experimentalLetterSpacing' => true,
'__experimentalDefaultControls' => array( '__experimentalDefaultControls' => array(
'fontSize' => true, 'fontSize' => true
'fontAppearance' => true,
'textTransform' => true
) )
) )
), ),
@ -4236,10 +4291,9 @@
'textdomain' => 'default', 'textdomain' => 'default',
'attributes' => array( 'attributes' => array(
'content' => array( 'content' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html', 'source' => 'rich-text',
'selector' => 'pre', 'selector' => 'pre',
'default' => '',
'__unstablePreserveWhiteSpace' => true, '__unstablePreserveWhiteSpace' => true,
'__experimentalRole' => 'content' '__experimentalRole' => 'content'
) )
@ -4283,16 +4337,15 @@
'textdomain' => 'default', 'textdomain' => 'default',
'attributes' => array( 'attributes' => array(
'value' => array( 'value' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html', 'source' => 'rich-text',
'selector' => 'p', 'selector' => 'p',
'__experimentalRole' => 'content' '__experimentalRole' => 'content'
), ),
'citation' => array( 'citation' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html', 'source' => 'rich-text',
'selector' => 'cite', 'selector' => 'cite',
'default' => '',
'__experimentalRole' => 'content' '__experimentalRole' => 'content'
), ),
'textAlign' => array( 'textAlign' => array(
@ -4316,6 +4369,10 @@
'text' => true 'text' => true
) )
), ),
'spacing' => array(
'margin' => true,
'padding' => true
),
'typography' => array( 'typography' => array(
'fontSize' => true, 'fontSize' => true,
'lineHeight' => true, 'lineHeight' => true,
@ -4326,8 +4383,7 @@
'__experimentalTextDecoration' => true, '__experimentalTextDecoration' => true,
'__experimentalLetterSpacing' => true, '__experimentalLetterSpacing' => true,
'__experimentalDefaultControls' => array( '__experimentalDefaultControls' => array(
'fontSize' => true, 'fontSize' => true
'fontAppearance' => true
) )
), ),
'__experimentalBorder' => array( '__experimentalBorder' => array(
@ -4413,8 +4469,7 @@
'layout' => true 'layout' => true
), ),
'editorStyle' => 'wp-block-query-editor', 'editorStyle' => 'wp-block-query-editor',
'style' => 'wp-block-query', 'style' => 'wp-block-query'
'viewScript' => 'file:./view.min.js'
), ),
'query-no-results' => array( 'query-no-results' => array(
'$schema' => 'https://schemas.wp.org/trunk/block.json', '$schema' => 'https://schemas.wp.org/trunk/block.json',
@ -4577,7 +4632,7 @@
'parent' => array( 'parent' => array(
'core/query-pagination' 'core/query-pagination'
), ),
'description' => 'Displays a list of page numbers for pagination', 'description' => 'Displays a list of page numbers for pagination.',
'textdomain' => 'default', 'textdomain' => 'default',
'attributes' => array( 'attributes' => array(
'midSize' => array( 'midSize' => array(
@ -4719,9 +4774,7 @@
'__experimentalTextTransform' => true, '__experimentalTextTransform' => true,
'__experimentalTextDecoration' => true, '__experimentalTextDecoration' => true,
'__experimentalDefaultControls' => array( '__experimentalDefaultControls' => array(
'fontSize' => true, 'fontSize' => true
'fontAppearance' => true,
'textTransform' => true
) )
) )
), ),
@ -4749,10 +4802,9 @@
'__experimentalRole' => 'content' '__experimentalRole' => 'content'
), ),
'citation' => array( 'citation' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html', 'source' => 'rich-text',
'selector' => 'cite', 'selector' => 'cite',
'default' => '',
'__experimentalRole' => 'content' '__experimentalRole' => 'content'
), ),
'align' => array( 'align' => array(
@ -4774,8 +4826,7 @@
'__experimentalTextDecoration' => true, '__experimentalTextDecoration' => true,
'__experimentalLetterSpacing' => true, '__experimentalLetterSpacing' => true,
'__experimentalDefaultControls' => array( '__experimentalDefaultControls' => array(
'fontSize' => true, 'fontSize' => true
'fontAppearance' => true
) )
), ),
'color' => array( 'color' => array(
@ -4786,6 +4837,12 @@
'background' => true, 'background' => true,
'text' => true 'text' => true
) )
),
'layout' => array(
'allowEditing' => false
),
'spacing' => array(
'blockGap' => true
) )
), ),
'styles' => array( 'styles' => array(
@ -4965,10 +5022,6 @@
) )
), ),
'buttonBehavior' => array(
'type' => 'string',
'default' => 'expand-searchfield'
),
'isSearchFieldHidden' => array( 'isSearchFieldHidden' => array(
'type' => 'boolean', 'type' => 'boolean',
'default' => false 'default' => false
@ -5017,7 +5070,6 @@
), ),
'html' => false 'html' => false
), ),
'viewScript' => 'file:./view.min.js',
'editorStyle' => 'wp-block-search-editor', 'editorStyle' => 'wp-block-search-editor',
'style' => 'wp-block-search' 'style' => 'wp-block-search'
), ),
@ -5283,11 +5335,7 @@
'__experimentalFontWeight' => true, '__experimentalFontWeight' => true,
'__experimentalLetterSpacing' => true, '__experimentalLetterSpacing' => true,
'__experimentalDefaultControls' => array( '__experimentalDefaultControls' => array(
'fontSize' => true, 'fontSize' => true
'lineHeight' => true,
'fontAppearance' => true,
'letterSpacing' => true,
'textTransform' => true
) )
) )
), ),
@ -5496,10 +5544,9 @@
'default' => false 'default' => false
), ),
'caption' => array( 'caption' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html', 'source' => 'rich-text',
'selector' => 'figcaption', 'selector' => 'figcaption'
'default' => ''
), ),
'head' => array( 'head' => array(
'type' => 'array', 'type' => 'array',
@ -5518,8 +5565,8 @@
'selector' => 'td,th', 'selector' => 'td,th',
'query' => array( 'query' => array(
'content' => array( 'content' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html' 'source' => 'rich-text'
), ),
'tag' => array( 'tag' => array(
'type' => 'string', 'type' => 'string',
@ -5567,8 +5614,8 @@
'selector' => 'td,th', 'selector' => 'td,th',
'query' => array( 'query' => array(
'content' => array( 'content' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html' 'source' => 'rich-text'
), ),
'tag' => array( 'tag' => array(
'type' => 'string', 'type' => 'string',
@ -5616,8 +5663,8 @@
'selector' => 'td,th', 'selector' => 'td,th',
'query' => array( 'query' => array(
'content' => array( 'content' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html' 'source' => 'rich-text'
), ),
'tag' => array( 'tag' => array(
'type' => 'string', 'type' => 'string',
@ -5794,7 +5841,8 @@
'supports' => array( 'supports' => array(
'align' => true, 'align' => true,
'html' => false, 'html' => false,
'reusable' => false 'reusable' => false,
'renaming' => false
), ),
'editorStyle' => 'wp-block-template-part-editor' 'editorStyle' => 'wp-block-template-part-editor'
), ),
@ -5900,10 +5948,9 @@
'textdomain' => 'default', 'textdomain' => 'default',
'attributes' => array( 'attributes' => array(
'content' => array( 'content' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html', 'source' => 'rich-text',
'selector' => 'pre', 'selector' => 'pre',
'default' => '',
'__unstablePreserveWhiteSpace' => true, '__unstablePreserveWhiteSpace' => true,
'__experimentalRole' => 'content' '__experimentalRole' => 'content'
), ),
@ -5931,8 +5978,7 @@
'__experimentalTextTransform' => true, '__experimentalTextTransform' => true,
'__experimentalTextDecoration' => true, '__experimentalTextDecoration' => true,
'__experimentalDefaultControls' => array( '__experimentalDefaultControls' => array(
'fontSize' => true, 'fontSize' => true
'fontAppearance' => true
) )
), ),
'spacing' => array( 'spacing' => array(
@ -5972,8 +6018,8 @@
'attribute' => 'autoplay' 'attribute' => 'autoplay'
), ),
'caption' => array( 'caption' => array(
'type' => 'string', 'type' => 'rich-text',
'source' => 'html', 'source' => 'rich-text',
'selector' => 'figcaption', 'selector' => 'figcaption',
'__experimentalRole' => 'content' '__experimentalRole' => 'content'
), ),
@ -6053,6 +6099,7 @@
'style' => 'wp-block-video' 'style' => 'wp-block-video'
), ),
'widget-group' => array( 'widget-group' => array(
'$schema' => 'https://schemas.wp.org/trunk/block.json',
'apiVersion' => 3, 'apiVersion' => 3,
'name' => 'core/widget-group', 'name' => 'core/widget-group',
'category' => 'widgets', 'category' => 'widgets',

View File

@ -8,6 +8,7 @@
"description": "Prompt visitors to take action with a button-style link.", "description": "Prompt visitors to take action with a button-style link.",
"keywords": [ "link" ], "keywords": [ "link" ],
"textdomain": "default", "textdomain": "default",
"usesContext": [ "pattern/overrides" ],
"attributes": { "attributes": {
"tagName": { "tagName": {
"type": "string", "type": "string",
@ -36,8 +37,8 @@
"__experimentalRole": "content" "__experimentalRole": "content"
}, },
"text": { "text": {
"type": "string", "type": "rich-text",
"source": "html", "source": "rich-text",
"selector": "a,button", "selector": "a,button",
"__experimentalRole": "content" "__experimentalRole": "content"
}, },

View File

@ -21,37 +21,6 @@
opacity:.8; opacity:.8;
} }
.wp-block-button__inline-link{
color:#757575;
height:0;
max-width:290px;
overflow:hidden;
}
.wp-block-button__inline-link-input__suggestions{
max-width:290px;
}
@media (min-width:782px){
.wp-block-button__inline-link,.wp-block-button__inline-link-input__suggestions{
max-width:260px;
}
}
@media (min-width:960px){
.wp-block-button__inline-link,.wp-block-button__inline-link-input__suggestions{
max-width:290px;
}
}
.is-selected .wp-block-button__inline-link{
height:auto;
overflow:visible;
}
.wp-button-label__width .components-button-group{
display:block;
}
.wp-button-label__width .components-base-control__field{
margin-bottom:12px;
}
div[data-type="core/button"]{ div[data-type="core/button"]{
display:table; display:table;
} }

View File

@ -1 +1 @@
.wp-block[data-align=center]>.wp-block-button{margin-left:auto;margin-right:auto;text-align:center}.wp-block[data-align=right]>.wp-block-button{text-align:right}.wp-block-button{cursor:text;position:relative}.wp-block-button:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px var(--wp-admin-theme-color);outline:2px solid transparent;outline-offset:-2px}.wp-block-button[data-rich-text-placeholder]:after{opacity:.8}.wp-block-button__inline-link{color:#757575;height:0;max-width:290px;overflow:hidden}.wp-block-button__inline-link-input__suggestions{max-width:290px}@media (min-width:782px){.wp-block-button__inline-link,.wp-block-button__inline-link-input__suggestions{max-width:260px}}@media (min-width:960px){.wp-block-button__inline-link,.wp-block-button__inline-link-input__suggestions{max-width:290px}}.is-selected .wp-block-button__inline-link{height:auto;overflow:visible}.wp-button-label__width .components-button-group{display:block}.wp-button-label__width .components-base-control__field{margin-bottom:12px}div[data-type="core/button"]{display:table}.editor-styles-wrapper .wp-block-button[style*=text-decoration] .wp-block-button__link{text-decoration:inherit}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where(.has-border-color){border-width:initial}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-top-color]){border-top-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-right-color]){border-left-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-bottom-color]){border-bottom-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-left-color]){border-right-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-style]){border-width:initial}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-top-style]){border-top-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-right-style]){border-left-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-bottom-style]){border-bottom-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-left-style]){border-right-width:medium} .wp-block[data-align=center]>.wp-block-button{margin-left:auto;margin-right:auto;text-align:center}.wp-block[data-align=right]>.wp-block-button{text-align:right}.wp-block-button{cursor:text;position:relative}.wp-block-button:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px var(--wp-admin-theme-color);outline:2px solid transparent;outline-offset:-2px}.wp-block-button[data-rich-text-placeholder]:after{opacity:.8}div[data-type="core/button"]{display:table}.editor-styles-wrapper .wp-block-button[style*=text-decoration] .wp-block-button__link{text-decoration:inherit}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where(.has-border-color){border-width:initial}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-top-color]){border-top-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-right-color]){border-left-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-bottom-color]){border-bottom-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-left-color]){border-right-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-style]){border-width:initial}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-top-style]){border-top-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-right-style]){border-left-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-bottom-style]){border-bottom-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-left-style]){border-right-width:medium}

View File

@ -21,37 +21,6 @@
opacity:.8; opacity:.8;
} }
.wp-block-button__inline-link{
color:#757575;
height:0;
max-width:290px;
overflow:hidden;
}
.wp-block-button__inline-link-input__suggestions{
max-width:290px;
}
@media (min-width:782px){
.wp-block-button__inline-link,.wp-block-button__inline-link-input__suggestions{
max-width:260px;
}
}
@media (min-width:960px){
.wp-block-button__inline-link,.wp-block-button__inline-link-input__suggestions{
max-width:290px;
}
}
.is-selected .wp-block-button__inline-link{
height:auto;
overflow:visible;
}
.wp-button-label__width .components-button-group{
display:block;
}
.wp-button-label__width .components-base-control__field{
margin-bottom:12px;
}
div[data-type="core/button"]{ div[data-type="core/button"]{
display:table; display:table;
} }

View File

@ -1,2 +1,2 @@
.wp-block[data-align=center]>.wp-block-button{margin-left:auto;margin-right:auto;text-align:center}.wp-block[data-align=right]>.wp-block-button{ .wp-block[data-align=center]>.wp-block-button{margin-left:auto;margin-right:auto;text-align:center}.wp-block[data-align=right]>.wp-block-button{
/*!rtl:ignore*/text-align:right}.wp-block-button{cursor:text;position:relative}.wp-block-button:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px var(--wp-admin-theme-color);outline:2px solid transparent;outline-offset:-2px}.wp-block-button[data-rich-text-placeholder]:after{opacity:.8}.wp-block-button__inline-link{color:#757575;height:0;max-width:290px;overflow:hidden}.wp-block-button__inline-link-input__suggestions{max-width:290px}@media (min-width:782px){.wp-block-button__inline-link,.wp-block-button__inline-link-input__suggestions{max-width:260px}}@media (min-width:960px){.wp-block-button__inline-link,.wp-block-button__inline-link-input__suggestions{max-width:290px}}.is-selected .wp-block-button__inline-link{height:auto;overflow:visible}.wp-button-label__width .components-button-group{display:block}.wp-button-label__width .components-base-control__field{margin-bottom:12px}div[data-type="core/button"]{display:table}.editor-styles-wrapper .wp-block-button[style*=text-decoration] .wp-block-button__link{text-decoration:inherit}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where(.has-border-color){border-width:initial}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-top-color]){border-top-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-right-color]){border-right-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-bottom-color]){border-bottom-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-left-color]){border-left-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-style]){border-width:initial}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-top-style]){border-top-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-right-style]){border-right-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-bottom-style]){border-bottom-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-left-style]){border-left-width:medium} /*!rtl:ignore*/text-align:right}.wp-block-button{cursor:text;position:relative}.wp-block-button:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px var(--wp-admin-theme-color);outline:2px solid transparent;outline-offset:-2px}.wp-block-button[data-rich-text-placeholder]:after{opacity:.8}div[data-type="core/button"]{display:table}.editor-styles-wrapper .wp-block-button[style*=text-decoration] .wp-block-button__link{text-decoration:inherit}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where(.has-border-color){border-width:initial}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-top-color]){border-top-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-right-color]){border-right-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-bottom-color]){border-bottom-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-left-color]){border-left-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-style]){border-width:initial}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-top-style]){border-top-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-right-style]){border-right-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-bottom-style]){border-bottom-width:medium}.editor-styles-wrapper .wp-block-button .wp-block-button__link:where([style*=border-left-style]){border-left-width:medium}

View File

@ -64,16 +64,16 @@
border-radius:0 !important; border-radius:0 !important;
} }
.wp-block-button .wp-block-button__link.is-style-outline,.wp-block-button.is-style-outline>.wp-block-button__link{ .wp-block-button .wp-block-button__link:where(.is-style-outline),.wp-block-button:where(.is-style-outline)>.wp-block-button__link{
border:2px solid; border:2px solid;
padding:.667em 1.333em; padding:.667em 1.333em;
} }
.wp-block-button .wp-block-button__link.is-style-outline:not(.has-text-color),.wp-block-button.is-style-outline>.wp-block-button__link:not(.has-text-color){ .wp-block-button .wp-block-button__link:where(.is-style-outline):not(.has-text-color),.wp-block-button:where(.is-style-outline)>.wp-block-button__link:not(.has-text-color){
color:currentColor; color:currentColor;
} }
.wp-block-button .wp-block-button__link.is-style-outline:not(.has-background),.wp-block-button.is-style-outline>.wp-block-button__link:not(.has-background){ .wp-block-button .wp-block-button__link:where(.is-style-outline):not(.has-background),.wp-block-button:where(.is-style-outline)>.wp-block-button__link:not(.has-background){
background-color:transparent; background-color:transparent;
background-image:none; background-image:none;
} }

View File

@ -1 +1 @@
.wp-block-button__link{box-sizing:border-box;cursor:pointer;display:inline-block;text-align:center;word-break:break-word}.wp-block-button__link.aligncenter{text-align:center}.wp-block-button__link.alignright{text-align:right}:where(.wp-block-button__link){border-radius:9999px;box-shadow:none;padding:calc(.667em + 2px) calc(1.333em + 2px);text-decoration:none}.wp-block-button[style*=text-decoration] .wp-block-button__link{text-decoration:inherit}.wp-block-buttons>.wp-block-button.has-custom-width{max-width:none}.wp-block-buttons>.wp-block-button.has-custom-width .wp-block-button__link{width:100%}.wp-block-buttons>.wp-block-button.has-custom-font-size .wp-block-button__link{font-size:inherit}.wp-block-buttons>.wp-block-button.wp-block-button__width-25{width:calc(25% - var(--wp--style--block-gap, .5em)*.75)}.wp-block-buttons>.wp-block-button.wp-block-button__width-50{width:calc(50% - var(--wp--style--block-gap, .5em)*.5)}.wp-block-buttons>.wp-block-button.wp-block-button__width-75{width:calc(75% - var(--wp--style--block-gap, .5em)*.25)}.wp-block-buttons>.wp-block-button.wp-block-button__width-100{flex-basis:100%;width:100%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-25{width:25%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-50{width:50%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-75{width:75%}.wp-block-button.is-style-squared,.wp-block-button__link.wp-block-button.is-style-squared{border-radius:0}.wp-block-button.no-border-radius,.wp-block-button__link.no-border-radius{border-radius:0!important}.wp-block-button .wp-block-button__link.is-style-outline,.wp-block-button.is-style-outline>.wp-block-button__link{border:2px solid;padding:.667em 1.333em}.wp-block-button .wp-block-button__link.is-style-outline:not(.has-text-color),.wp-block-button.is-style-outline>.wp-block-button__link:not(.has-text-color){color:currentColor}.wp-block-button .wp-block-button__link.is-style-outline:not(.has-background),.wp-block-button.is-style-outline>.wp-block-button__link:not(.has-background){background-color:transparent;background-image:none}.wp-block-button .wp-block-button__link:where(.has-border-color){border-width:initial}.wp-block-button .wp-block-button__link:where([style*=border-top-color]){border-top-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-right-color]){border-left-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-bottom-color]){border-bottom-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-left-color]){border-right-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-style]){border-width:initial}.wp-block-button .wp-block-button__link:where([style*=border-top-style]){border-top-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-right-style]){border-left-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-bottom-style]){border-bottom-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-left-style]){border-right-width:medium} .wp-block-button__link{box-sizing:border-box;cursor:pointer;display:inline-block;text-align:center;word-break:break-word}.wp-block-button__link.aligncenter{text-align:center}.wp-block-button__link.alignright{text-align:right}:where(.wp-block-button__link){border-radius:9999px;box-shadow:none;padding:calc(.667em + 2px) calc(1.333em + 2px);text-decoration:none}.wp-block-button[style*=text-decoration] .wp-block-button__link{text-decoration:inherit}.wp-block-buttons>.wp-block-button.has-custom-width{max-width:none}.wp-block-buttons>.wp-block-button.has-custom-width .wp-block-button__link{width:100%}.wp-block-buttons>.wp-block-button.has-custom-font-size .wp-block-button__link{font-size:inherit}.wp-block-buttons>.wp-block-button.wp-block-button__width-25{width:calc(25% - var(--wp--style--block-gap, .5em)*.75)}.wp-block-buttons>.wp-block-button.wp-block-button__width-50{width:calc(50% - var(--wp--style--block-gap, .5em)*.5)}.wp-block-buttons>.wp-block-button.wp-block-button__width-75{width:calc(75% - var(--wp--style--block-gap, .5em)*.25)}.wp-block-buttons>.wp-block-button.wp-block-button__width-100{flex-basis:100%;width:100%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-25{width:25%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-50{width:50%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-75{width:75%}.wp-block-button.is-style-squared,.wp-block-button__link.wp-block-button.is-style-squared{border-radius:0}.wp-block-button.no-border-radius,.wp-block-button__link.no-border-radius{border-radius:0!important}.wp-block-button .wp-block-button__link:where(.is-style-outline),.wp-block-button:where(.is-style-outline)>.wp-block-button__link{border:2px solid;padding:.667em 1.333em}.wp-block-button .wp-block-button__link:where(.is-style-outline):not(.has-text-color),.wp-block-button:where(.is-style-outline)>.wp-block-button__link:not(.has-text-color){color:currentColor}.wp-block-button .wp-block-button__link:where(.is-style-outline):not(.has-background),.wp-block-button:where(.is-style-outline)>.wp-block-button__link:not(.has-background){background-color:transparent;background-image:none}.wp-block-button .wp-block-button__link:where(.has-border-color){border-width:initial}.wp-block-button .wp-block-button__link:where([style*=border-top-color]){border-top-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-right-color]){border-left-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-bottom-color]){border-bottom-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-left-color]){border-right-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-style]){border-width:initial}.wp-block-button .wp-block-button__link:where([style*=border-top-style]){border-top-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-right-style]){border-left-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-bottom-style]){border-bottom-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-left-style]){border-right-width:medium}

View File

@ -64,16 +64,16 @@
border-radius:0 !important; border-radius:0 !important;
} }
.wp-block-button .wp-block-button__link.is-style-outline,.wp-block-button.is-style-outline>.wp-block-button__link{ .wp-block-button .wp-block-button__link:where(.is-style-outline),.wp-block-button:where(.is-style-outline)>.wp-block-button__link{
border:2px solid; border:2px solid;
padding:.667em 1.333em; padding:.667em 1.333em;
} }
.wp-block-button .wp-block-button__link.is-style-outline:not(.has-text-color),.wp-block-button.is-style-outline>.wp-block-button__link:not(.has-text-color){ .wp-block-button .wp-block-button__link:where(.is-style-outline):not(.has-text-color),.wp-block-button:where(.is-style-outline)>.wp-block-button__link:not(.has-text-color){
color:currentColor; color:currentColor;
} }
.wp-block-button .wp-block-button__link.is-style-outline:not(.has-background),.wp-block-button.is-style-outline>.wp-block-button__link:not(.has-background){ .wp-block-button .wp-block-button__link:where(.is-style-outline):not(.has-background),.wp-block-button:where(.is-style-outline)>.wp-block-button__link:not(.has-background){
background-color:transparent; background-color:transparent;
background-image:none; background-image:none;
} }

View File

@ -1 +1 @@
.wp-block-button__link{box-sizing:border-box;cursor:pointer;display:inline-block;text-align:center;word-break:break-word}.wp-block-button__link.aligncenter{text-align:center}.wp-block-button__link.alignright{text-align:right}:where(.wp-block-button__link){border-radius:9999px;box-shadow:none;padding:calc(.667em + 2px) calc(1.333em + 2px);text-decoration:none}.wp-block-button[style*=text-decoration] .wp-block-button__link{text-decoration:inherit}.wp-block-buttons>.wp-block-button.has-custom-width{max-width:none}.wp-block-buttons>.wp-block-button.has-custom-width .wp-block-button__link{width:100%}.wp-block-buttons>.wp-block-button.has-custom-font-size .wp-block-button__link{font-size:inherit}.wp-block-buttons>.wp-block-button.wp-block-button__width-25{width:calc(25% - var(--wp--style--block-gap, .5em)*.75)}.wp-block-buttons>.wp-block-button.wp-block-button__width-50{width:calc(50% - var(--wp--style--block-gap, .5em)*.5)}.wp-block-buttons>.wp-block-button.wp-block-button__width-75{width:calc(75% - var(--wp--style--block-gap, .5em)*.25)}.wp-block-buttons>.wp-block-button.wp-block-button__width-100{flex-basis:100%;width:100%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-25{width:25%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-50{width:50%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-75{width:75%}.wp-block-button.is-style-squared,.wp-block-button__link.wp-block-button.is-style-squared{border-radius:0}.wp-block-button.no-border-radius,.wp-block-button__link.no-border-radius{border-radius:0!important}.wp-block-button .wp-block-button__link.is-style-outline,.wp-block-button.is-style-outline>.wp-block-button__link{border:2px solid;padding:.667em 1.333em}.wp-block-button .wp-block-button__link.is-style-outline:not(.has-text-color),.wp-block-button.is-style-outline>.wp-block-button__link:not(.has-text-color){color:currentColor}.wp-block-button .wp-block-button__link.is-style-outline:not(.has-background),.wp-block-button.is-style-outline>.wp-block-button__link:not(.has-background){background-color:transparent;background-image:none}.wp-block-button .wp-block-button__link:where(.has-border-color){border-width:initial}.wp-block-button .wp-block-button__link:where([style*=border-top-color]){border-top-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-right-color]){border-right-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-bottom-color]){border-bottom-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-left-color]){border-left-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-style]){border-width:initial}.wp-block-button .wp-block-button__link:where([style*=border-top-style]){border-top-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-right-style]){border-right-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-bottom-style]){border-bottom-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-left-style]){border-left-width:medium} .wp-block-button__link{box-sizing:border-box;cursor:pointer;display:inline-block;text-align:center;word-break:break-word}.wp-block-button__link.aligncenter{text-align:center}.wp-block-button__link.alignright{text-align:right}:where(.wp-block-button__link){border-radius:9999px;box-shadow:none;padding:calc(.667em + 2px) calc(1.333em + 2px);text-decoration:none}.wp-block-button[style*=text-decoration] .wp-block-button__link{text-decoration:inherit}.wp-block-buttons>.wp-block-button.has-custom-width{max-width:none}.wp-block-buttons>.wp-block-button.has-custom-width .wp-block-button__link{width:100%}.wp-block-buttons>.wp-block-button.has-custom-font-size .wp-block-button__link{font-size:inherit}.wp-block-buttons>.wp-block-button.wp-block-button__width-25{width:calc(25% - var(--wp--style--block-gap, .5em)*.75)}.wp-block-buttons>.wp-block-button.wp-block-button__width-50{width:calc(50% - var(--wp--style--block-gap, .5em)*.5)}.wp-block-buttons>.wp-block-button.wp-block-button__width-75{width:calc(75% - var(--wp--style--block-gap, .5em)*.25)}.wp-block-buttons>.wp-block-button.wp-block-button__width-100{flex-basis:100%;width:100%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-25{width:25%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-50{width:50%}.wp-block-buttons.is-vertical>.wp-block-button.wp-block-button__width-75{width:75%}.wp-block-button.is-style-squared,.wp-block-button__link.wp-block-button.is-style-squared{border-radius:0}.wp-block-button.no-border-radius,.wp-block-button__link.no-border-radius{border-radius:0!important}.wp-block-button .wp-block-button__link:where(.is-style-outline),.wp-block-button:where(.is-style-outline)>.wp-block-button__link{border:2px solid;padding:.667em 1.333em}.wp-block-button .wp-block-button__link:where(.is-style-outline):not(.has-text-color),.wp-block-button:where(.is-style-outline)>.wp-block-button__link:not(.has-text-color){color:currentColor}.wp-block-button .wp-block-button__link:where(.is-style-outline):not(.has-background),.wp-block-button:where(.is-style-outline)>.wp-block-button__link:not(.has-background){background-color:transparent;background-image:none}.wp-block-button .wp-block-button__link:where(.has-border-color){border-width:initial}.wp-block-button .wp-block-button__link:where([style*=border-top-color]){border-top-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-right-color]){border-right-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-bottom-color]){border-bottom-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-left-color]){border-left-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-style]){border-width:initial}.wp-block-button .wp-block-button__link:where([style*=border-top-style]){border-top-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-right-style]){border-right-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-bottom-style]){border-bottom-width:medium}.wp-block-button .wp-block-button__link:where([style*=border-left-style]){border-left-width:medium}

View File

@ -33,10 +33,8 @@ function render_block_core_calendar( $attributes ) {
str_contains( $permalink_structure, '%monthnum%' ) && str_contains( $permalink_structure, '%monthnum%' ) &&
str_contains( $permalink_structure, '%year%' ) str_contains( $permalink_structure, '%year%' )
) { ) {
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited
$monthnum = $attributes['month']; $monthnum = $attributes['month'];
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited $year = $attributes['year'];
$year = $attributes['year'];
} }
} }
@ -70,10 +68,8 @@ function render_block_core_calendar( $attributes ) {
$calendar $calendar
); );
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited
$monthnum = $previous_monthnum; $monthnum = $previous_monthnum;
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited $year = $previous_year;
$year = $previous_year;
return $output; return $output;
} }

View File

@ -70,8 +70,7 @@ function render_block_core_categories( $attributes ) {
function build_dropdown_script_block_core_categories( $dropdown_id ) { function build_dropdown_script_block_core_categories( $dropdown_id ) {
ob_start(); ob_start();
?> ?>
<script type='text/javascript'> <script>
/* <![CDATA[ */
( function() { ( function() {
var dropdown = document.getElementById( '<?php echo esc_js( $dropdown_id ); ?>' ); var dropdown = document.getElementById( '<?php echo esc_js( $dropdown_id ); ?>' );
function onCatChange() { function onCatChange() {
@ -81,10 +80,9 @@ function build_dropdown_script_block_core_categories( $dropdown_id ) {
} }
dropdown.onchange = onCatChange; dropdown.onchange = onCatChange;
})(); })();
/* ]]> */
</script> </script>
<?php <?php
return ob_get_clean(); return wp_get_inline_script_tag( str_replace( array( '<script>', '</script>' ), '', ob_get_clean() ) );
} }
/** /**

View File

@ -8,8 +8,8 @@
"textdomain": "default", "textdomain": "default",
"attributes": { "attributes": {
"content": { "content": {
"type": "string", "type": "rich-text",
"source": "html", "source": "rich-text",
"selector": "code", "selector": "code",
"__unstablePreserveWhiteSpace": true "__unstablePreserveWhiteSpace": true
} }

View File

@ -5,7 +5,7 @@
"title": "Comments Title", "title": "Comments Title",
"category": "theme", "category": "theme",
"ancestor": [ "core/comments" ], "ancestor": [ "core/comments" ],
"description": "Displays a title with the number of comments", "description": "Displays a title with the number of comments.",
"textdomain": "default", "textdomain": "default",
"usesContext": [ "postId", "postType" ], "usesContext": [ "postId", "postType" ],
"attributes": { "attributes": {

View File

@ -19,9 +19,6 @@
}, },
"alt": { "alt": {
"type": "string", "type": "string",
"source": "attribute",
"selector": "img",
"attribute": "alt",
"default": "" "default": ""
}, },
"hasParallax": { "hasParallax": {
@ -42,6 +39,9 @@
"customOverlayColor": { "customOverlayColor": {
"type": "string" "type": "string"
}, },
"isUserOverlayColor": {
"type": "boolean"
},
"backgroundType": { "backgroundType": {
"type": "string", "type": "string",
"default": "image" "default": "image"
@ -114,6 +114,9 @@
"__experimentalSkipSerialization": [ "gradients" ], "__experimentalSkipSerialization": [ "gradients" ],
"enableContrastChecker": false "enableContrastChecker": false
}, },
"dimensions": {
"aspectRatio": true
},
"typography": { "typography": {
"fontSize": true, "fontSize": true,
"lineHeight": true, "lineHeight": true,

View File

@ -5,8 +5,7 @@
display:flex; display:flex;
justify-content:center; justify-content:center;
min-height:430px; min-height:430px;
overflow:hidden; overflow-x:clip;
overflow:clip;
padding:1em; padding:1em;
position:relative; position:relative;
} }

File diff suppressed because one or more lines are too long

View File

@ -5,8 +5,7 @@
display:flex; display:flex;
justify-content:center; justify-content:center;
min-height:430px; min-height:430px;
overflow:hidden; overflow-x:clip;
overflow:clip;
padding:1em; padding:1em;
position:relative; position:relative;
} }

File diff suppressed because one or more lines are too long

View File

@ -13,8 +13,8 @@
"default": false "default": false
}, },
"summary": { "summary": {
"type": "string", "type": "rich-text",
"source": "html", "source": "rich-text",
"selector": "summary" "selector": "summary"
} }
}, },

View File

@ -12,8 +12,8 @@
"__experimentalRole": "content" "__experimentalRole": "content"
}, },
"caption": { "caption": {
"type": "string", "type": "rich-text",
"source": "html", "source": "rich-text",
"selector": "figcaption", "selector": "figcaption",
"__experimentalRole": "content" "__experimentalRole": "content"
}, },

View File

@ -1,12 +1,32 @@
"use strict"; import * as __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__ from "@wordpress/interactivity";
(self["__WordPressPrivateInteractivityAPI__"] = self["__WordPressPrivateInteractivityAPI__"] || []).push([[81],{ /******/ // The require scope
/******/ var __webpack_require__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ !function() {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = function(exports, definition) {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ }();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ !function() {
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ }();
/******/
/************************************************************************/
var __webpack_exports__ = {};
/***/ 149: ;// CONCATENATED MODULE: external "@wordpress/interactivity"
/***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) { var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var y = x => () => x
var interactivity_namespaceObject = x({ ["store"]: () => __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.store });
// 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 ;// 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 * Uses a combination of user agent matching and feature detection to determine whether
@ -62,21 +82,10 @@ const createActiveXObject = type => {
* Internal dependencies * Internal dependencies
*/ */
(0,src/* store */.h)({ (0,interactivity_namespaceObject.store)('core/file', {
selectors: { state: {
core: { get hasPdfPreview() {
file: { return browserSupportsPdfs();
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
wp-includes/blocks/file.min.js vendored Normal file
View File

@ -0,0 +1 @@
import*as t from"@wordpress/interactivity";var e={d:function(t,o){for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},o=(t=>{var o={};return e.d(o,t),o})({store:()=>t.store});const r=t=>{let e;try{e=new window.ActiveXObject(t)}catch(t){e=void 0}return e};(0,o.store)("core/file",{state:{get hasPdfPreview(){return!(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)&&!r("AcroPDF.PDF")&&!r("PDF.PdfCtrl"))}}});

View File

@ -14,25 +14,8 @@
* *
* @return string Returns the block content. * @return string Returns the block content.
*/ */
function render_block_core_file( $attributes, $content, $block ) { function render_block_core_file( $attributes, $content ) {
$should_load_view_script = ! empty( $attributes['displayPreview'] );
$view_js_file = 'wp-block-file-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 ) );
}
// 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 ) );
}
}
// Update object's aria-label attribute if present in block HTML. // Update object's aria-label attribute if present in block HTML.
// Match an aria-label attribute from an object tag. // Match an aria-label attribute from an object tag.
$pattern = '@<object.+(?<attribute>aria-label="(?<filename>[^"]+)?")@i'; $pattern = '@<object.+(?<attribute>aria-label="(?<filename>[^"]+)?")@i';
$content = preg_replace_callback( $content = preg_replace_callback(
@ -53,13 +36,15 @@ function render_block_core_file( $attributes, $content, $block ) {
$content $content
); );
// If it uses the Interactivity API, add the directives. // If it's interactive, enqueue the script module and add the directives.
if ( $should_load_view_script ) { if ( ! empty( $attributes['displayPreview'] ) ) {
wp_enqueue_script_module( '@wordpress/block-library/file' );
$processor = new WP_HTML_Tag_Processor( $content ); $processor = new WP_HTML_Tag_Processor( $content );
$processor->next_tag(); $processor->next_tag();
$processor->set_attribute( 'data-wp-interactive', '' ); $processor->set_attribute( 'data-wp-interactive', '{"namespace":"core/file"}' );
$processor->next_tag( 'object' ); $processor->next_tag( 'object' );
$processor->set_attribute( 'data-wp-bind--hidden', '!selectors.core.file.hasPdfPreview' ); $processor->set_attribute( 'data-wp-bind--hidden', '!state.hasPdfPreview' );
$processor->set_attribute( 'hidden', true ); $processor->set_attribute( 'hidden', true );
return $processor->get_updated_html(); return $processor->get_updated_html();
} }
@ -67,25 +52,6 @@ function render_block_core_file( $attributes, $content, $block ) {
return $content; 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. * Registers the `core/file` block on server.
*/ */
@ -96,5 +62,12 @@ function register_block_core_file() {
'render_callback' => 'render_block_core_file', 'render_callback' => 'render_block_core_file',
) )
); );
wp_register_script_module(
'@wordpress/block-library/file',
defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ? gutenberg_url( '/build/interactivity/file.min.js' ) : includes_url( 'blocks/file/view.min.js' ),
array( '@wordpress/interactivity' ),
defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' )
);
} }
add_action( 'init', 'register_block_core_file' ); add_action( 'init', 'register_block_core_file' );

View File

@ -21,8 +21,8 @@
"attribute": "id" "attribute": "id"
}, },
"fileName": { "fileName": {
"type": "string", "type": "rich-text",
"source": "html", "source": "rich-text",
"selector": "a:not([download])" "selector": "a:not([download])"
}, },
"textLinkHref": { "textLinkHref": {
@ -42,8 +42,8 @@
"default": true "default": true
}, },
"downloadButtonText": { "downloadButtonText": {
"type": "string", "type": "rich-text",
"source": "html", "source": "rich-text",
"selector": "a[download]" "selector": "a[download]"
}, },
"displayPreview": { "displayPreview": {
@ -72,7 +72,6 @@
}, },
"interactivity": true "interactivity": true
}, },
"viewScript": "file:./view.min.js",
"editorStyle": "wp-block-file-editor", "editorStyle": "wp-block-file-editor",
"style": "wp-block-file" "style": "wp-block-file"
} }

View File

@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '3fd0154de23a0ecc28af'); <?php return array('dependencies' => array(), 'version' => '498971a8a9512421f3b5');

View File

@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '8a0237493a27c0d781aa'); <?php return array('dependencies' => array(), 'version' => '9c04187f1796859989c3');

View File

@ -1 +0,0 @@
"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)}]);

View File

@ -68,17 +68,26 @@ function render_block_core_footnotes( $attributes, $content, $block ) {
* @since 6.3.0 * @since 6.3.0
*/ */
function register_block_core_footnotes() { function register_block_core_footnotes() {
foreach ( array( 'post', 'page' ) as $post_type ) { $post_types = get_post_types(
register_post_meta( array(
$post_type, 'show_in_rest' => true,
'footnotes', 'public' => true,
array( )
'show_in_rest' => true, );
'single' => true, foreach ( $post_types as $post_type ) {
'type' => 'string', // Only register the meta field if the post type supports the editor, custom fields, and revisions.
'revisions_enabled' => true, if ( post_type_supports( $post_type, 'editor' ) && post_type_supports( $post_type, 'custom-fields' ) && post_type_supports( $post_type, 'revisions' ) ) {
) register_post_meta(
); $post_type,
'footnotes',
array(
'show_in_rest' => true,
'single' => true,
'type' => 'string',
'revisions_enabled' => true,
)
);
}
} }
register_block_type_from_metadata( register_block_type_from_metadata(
__DIR__ . '/footnotes', __DIR__ . '/footnotes',

View File

@ -4,7 +4,7 @@
"name": "core/footnotes", "name": "core/footnotes",
"title": "Footnotes", "title": "Footnotes",
"category": "text", "category": "text",
"description": "", "description": "Display footnotes added to the page.",
"keywords": [ "references" ], "keywords": [ "references" ],
"textdomain": "default", "textdomain": "default",
"usesContext": [ "postId", "postType" ], "usesContext": [ "postId", "postType" ],
@ -33,6 +33,7 @@
"html": false, "html": false,
"multiple": false, "multiple": false,
"reusable": false, "reusable": false,
"inserter": false,
"spacing": { "spacing": {
"margin": true, "margin": true,
"padding": true, "padding": true,

View File

@ -32,6 +32,21 @@ function block_core_gallery_data_id_backcompatibility( $parsed_block ) {
add_filter( 'render_block_data', 'block_core_gallery_data_id_backcompatibility' ); add_filter( 'render_block_data', 'block_core_gallery_data_id_backcompatibility' );
/**
* Filter to randomize the order of image blocks.
*
* @param array $parsed_block The block being rendered.
* @return array The block object with randomized order of image blocks.
*/
function block_core_gallery_random_order( $parsed_block ) {
if ( 'core/gallery' === $parsed_block['blockName'] && ! empty( $parsed_block['attrs']['randomOrder'] ) ) {
shuffle( $parsed_block['innerBlocks'] );
}
return $parsed_block;
}
add_filter( 'render_block_data', 'block_core_gallery_random_order' );
/** /**
* Adds a style tag for the --wp--style--unstable-gallery-gap var. * Adds a style tag for the --wp--style--unstable-gallery-gap var.
* *

View File

@ -46,8 +46,8 @@
"attribute": "data-id" "attribute": "data-id"
}, },
"caption": { "caption": {
"type": "string", "type": "rich-text",
"source": "html", "source": "rich-text",
"selector": ".blocks-gallery-item__caption" "selector": ".blocks-gallery-item__caption"
} }
} }
@ -72,14 +72,18 @@
"maximum": 8 "maximum": 8
}, },
"caption": { "caption": {
"type": "string", "type": "rich-text",
"source": "html", "source": "rich-text",
"selector": ".blocks-gallery-caption" "selector": ".blocks-gallery-caption"
}, },
"imageCrop": { "imageCrop": {
"type": "boolean", "type": "boolean",
"default": true "default": true
}, },
"randomOrder": {
"type": "boolean",
"default": false
},
"fixedHeight": { "fixedHeight": {
"type": "boolean", "type": "boolean",
"default": true "default": true

View File

@ -145,8 +145,36 @@ figure.wp-block-gallery.has-nested-images{
padding:0 8px 8px; padding:0 8px 8px;
position:absolute; position:absolute;
right:0; right:0;
scrollbar-color:transparent transparent;
scrollbar-gutter:stable both-edges;
scrollbar-width:thin;
text-align:center; text-align:center;
width:100%; width:100%;
will-change:transform;
}
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption::-webkit-scrollbar{
height:12px;
width:12px;
}
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption::-webkit-scrollbar-track{
background-color:transparent;
}
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption::-webkit-scrollbar-thumb{
background-clip:padding-box;
background-color:transparent;
border:3px solid transparent;
border-radius:8px;
}
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption:focus-within::-webkit-scrollbar-thumb,.wp-block-gallery.has-nested-images figure.wp-block-image figcaption:focus::-webkit-scrollbar-thumb,.wp-block-gallery.has-nested-images figure.wp-block-image figcaption:hover::-webkit-scrollbar-thumb{
background-color:hsla(0,0%,100%,.8);
}
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption:focus,.wp-block-gallery.has-nested-images figure.wp-block-image figcaption:focus-within,.wp-block-gallery.has-nested-images figure.wp-block-image figcaption:hover{
scrollbar-color:hsla(0,0%,100%,.8) transparent;
}
@media (hover:none){
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption{
scrollbar-color:hsla(0,0%,100%,.8) transparent;
}
} }
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption img{ .wp-block-gallery.has-nested-images figure.wp-block-image figcaption img{
display:inline; display:inline;

File diff suppressed because one or more lines are too long

View File

@ -145,8 +145,36 @@ figure.wp-block-gallery.has-nested-images{
overflow:auto; overflow:auto;
padding:0 8px 8px; padding:0 8px 8px;
position:absolute; position:absolute;
scrollbar-color:transparent transparent;
scrollbar-gutter:stable both-edges;
scrollbar-width:thin;
text-align:center; text-align:center;
width:100%; width:100%;
will-change:transform;
}
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption::-webkit-scrollbar{
height:12px;
width:12px;
}
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption::-webkit-scrollbar-track{
background-color:transparent;
}
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption::-webkit-scrollbar-thumb{
background-clip:padding-box;
background-color:transparent;
border:3px solid transparent;
border-radius:8px;
}
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption:focus-within::-webkit-scrollbar-thumb,.wp-block-gallery.has-nested-images figure.wp-block-image figcaption:focus::-webkit-scrollbar-thumb,.wp-block-gallery.has-nested-images figure.wp-block-image figcaption:hover::-webkit-scrollbar-thumb{
background-color:hsla(0,0%,100%,.8);
}
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption:focus,.wp-block-gallery.has-nested-images figure.wp-block-image figcaption:focus-within,.wp-block-gallery.has-nested-images figure.wp-block-image figcaption:hover{
scrollbar-color:hsla(0,0%,100%,.8) transparent;
}
@media (hover:none){
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption{
scrollbar-color:hsla(0,0%,100%,.8) transparent;
}
} }
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption img{ .wp-block-gallery.has-nested-images figure.wp-block-image figcaption img{
display:inline; display:inline;

File diff suppressed because one or more lines are too long

View File

@ -24,13 +24,16 @@
"__experimentalOnEnter": true, "__experimentalOnEnter": true,
"__experimentalOnMerge": true, "__experimentalOnMerge": true,
"__experimentalSettings": true, "__experimentalSettings": true,
"__experimentalMetadata": true,
"align": [ "wide", "full" ], "align": [ "wide", "full" ],
"anchor": true, "anchor": true,
"ariaLabel": true, "ariaLabel": true,
"html": false, "html": false,
"background": { "background": {
"backgroundImage": true "backgroundImage": true,
"backgroundSize": true,
"__experimentalDefaultControls": {
"backgroundImage": true
}
}, },
"color": { "color": {
"gradients": true, "gradients": true,
@ -52,6 +55,7 @@
} }
}, },
"dimensions": { "dimensions": {
"aspectRatio": true,
"minHeight": true "minHeight": true
}, },
"__experimentalBorder": { "__experimentalBorder": {

View File

@ -7,15 +7,15 @@
"description": "Introduce new sections and organize content to help visitors (and search engines) understand the structure of your content.", "description": "Introduce new sections and organize content to help visitors (and search engines) understand the structure of your content.",
"keywords": [ "title", "subtitle" ], "keywords": [ "title", "subtitle" ],
"textdomain": "default", "textdomain": "default",
"usesContext": [ "pattern/overrides" ],
"attributes": { "attributes": {
"textAlign": { "textAlign": {
"type": "string" "type": "string"
}, },
"content": { "content": {
"type": "string", "type": "rich-text",
"source": "html", "source": "rich-text",
"selector": "h1,h2,h3,h4,h5,h6", "selector": "h1,h2,h3,h4,h5,h6",
"default": "",
"__experimentalRole": "content" "__experimentalRole": "content"
}, },
"level": { "level": {
@ -57,9 +57,7 @@
"__experimentalTextDecoration": true, "__experimentalTextDecoration": true,
"__experimentalWritingMode": true, "__experimentalWritingMode": true,
"__experimentalDefaultControls": { "__experimentalDefaultControls": {
"fontSize": true, "fontSize": true
"fontAppearance": true,
"textTransform": true
} }
}, },
"__unstablePasteTextInline": true, "__unstablePasteTextInline": true,

521
wp-includes/blocks/image.js Normal file
View File

@ -0,0 +1,521 @@
import * as __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__ from "@wordpress/interactivity";
/******/ // The require scope
/******/ var __webpack_require__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ !function() {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = function(exports, definition) {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ }();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ !function() {
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ }();
/******/
/************************************************************************/
var __webpack_exports__ = {};
;// CONCATENATED MODULE: external "@wordpress/interactivity"
var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var y = x => () => x
var interactivity_namespaceObject = x({ ["getContext"]: () => __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.getContext, ["getElement"]: () => __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.getElement, ["store"]: () => __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.store });
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/view.js
/**
* 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} ctx Context object with the `core/image` namespace.
*/
function handleScroll(ctx) {
// 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(ctx.scrollLeftReset, ctx.scrollTopReset);
}
}
const {
state,
actions,
callbacks
} = (0,interactivity_namespaceObject.store)('core/image', {
state: {
windowWidth: window.innerWidth,
windowHeight: window.innerHeight,
get roleAttribute() {
const ctx = (0,interactivity_namespaceObject.getContext)();
return ctx.lightboxEnabled ? 'dialog' : null;
},
get ariaModal() {
const ctx = (0,interactivity_namespaceObject.getContext)();
return ctx.lightboxEnabled ? 'true' : null;
},
get dialogLabel() {
const ctx = (0,interactivity_namespaceObject.getContext)();
return ctx.lightboxEnabled ? ctx.dialogLabel : null;
},
get lightboxObjectFit() {
const ctx = (0,interactivity_namespaceObject.getContext)();
if (ctx.initialized) {
return 'cover';
}
},
get enlargedImgSrc() {
const ctx = (0,interactivity_namespaceObject.getContext)();
return ctx.initialized ? ctx.imageUploadedSrc : 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';
}
},
actions: {
showLightbox(event) {
const ctx = (0,interactivity_namespaceObject.getContext)();
// We can't initialize the lightbox until the reference
// image is loaded, otherwise the UX is broken.
if (!ctx.imageLoaded) {
return;
}
ctx.initialized = true;
ctx.lastFocusedElement = window.document.activeElement;
ctx.scrollDelta = 0;
ctx.pointerType = event.pointerType;
ctx.lightboxEnabled = true;
setStyles(ctx, ctx.imageRef);
ctx.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.
ctx.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, ctx);
// 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() {
const ctx = (0,interactivity_namespaceObject.getContext)();
ctx.hideAnimationEnabled = true;
if (ctx.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.
ctx.lightboxTriggerRef.focus({
preventScroll: true
});
}, 450);
ctx.lightboxEnabled = false;
}
},
handleKeydown(event) {
const ctx = (0,interactivity_namespaceObject.getContext)();
if (ctx.lightboxEnabled) {
if (event.key === 'Tab' || event.keyCode === 9) {
// If shift + tab it change the direction
if (event.shiftKey && window.document.activeElement === ctx.firstFocusableElement) {
event.preventDefault();
ctx.lastFocusableElement.focus();
} else if (!event.shiftKey && window.document.activeElement === ctx.lastFocusableElement) {
event.preventDefault();
ctx.firstFocusableElement.focus();
}
}
if (event.key === 'Escape' || event.keyCode === 27) {
actions.hideLightbox(event);
}
}
},
// This is fired just by lazily loaded
// images on the page, not all images.
handleLoad() {
const ctx = (0,interactivity_namespaceObject.getContext)();
const {
ref
} = (0,interactivity_namespaceObject.getElement)();
ctx.imageLoaded = true;
ctx.imageCurrentSrc = ref.currentSrc;
callbacks.setButtonStyles();
},
handleTouchStart() {
isTouching = true;
},
handleTouchMove(event) {
const ctx = (0,interactivity_namespaceObject.getContext)();
// 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 (ctx.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;
}
},
callbacks: {
initOriginImage() {
const ctx = (0,interactivity_namespaceObject.getContext)();
const {
ref
} = (0,interactivity_namespaceObject.getElement)();
ctx.imageRef = ref;
if (ref.complete) {
ctx.imageLoaded = true;
ctx.imageCurrentSrc = ref.currentSrc;
}
},
initTriggerButton() {
const ctx = (0,interactivity_namespaceObject.getContext)();
const {
ref
} = (0,interactivity_namespaceObject.getElement)();
ctx.lightboxTriggerRef = ref;
},
initLightbox() {
const ctx = (0,interactivity_namespaceObject.getContext)();
const {
ref
} = (0,interactivity_namespaceObject.getElement)();
if (ctx.lightboxEnabled) {
const focusableElements = ref.querySelectorAll(focusableSelectors);
ctx.firstFocusableElement = focusableElements[0];
ctx.lastFocusableElement = focusableElements[focusableElements.length - 1];
// Move focus to the dialog when opening it.
ref.focus();
}
},
setButtonStyles() {
const {
ref
} = (0,interactivity_namespaceObject.getElement)();
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);
if (!['absolute', 'fixed'].includes(captionComputedStyle.position)) {
figureHeight = figureHeight - caption.offsetHeight - parseFloat(captionComputedStyle.marginTop) - parseFloat(captionComputedStyle.marginBottom);
}
}
const buttonOffsetTop = figureHeight - offsetHeight;
const buttonOffsetRight = figureWidth - offsetWidth;
const ctx = (0,interactivity_namespaceObject.getContext)();
// 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 (ctx.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;
ctx.imageButtonTop = (offsetHeight - referenceHeight) / 2 + buttonOffsetTop + 16;
ctx.imageButtonRight = buttonOffsetRight + 16;
} else {
// If it reaches the height first, keep
// the height and compute the width.
const referenceWidth = offsetHeight * naturalRatio;
ctx.imageButtonTop = buttonOffsetTop + 16;
ctx.imageButtonRight = (offsetWidth - referenceWidth) / 2 + buttonOffsetRight + 16;
}
} else {
ctx.imageButtonTop = buttonOffsetTop + 16;
ctx.imageButtonRight = buttonOffsetRight + 16;
}
},
setStylesOnResize() {
const ctx = (0,interactivity_namespaceObject.getContext)();
const {
ref
} = (0,interactivity_namespaceObject.getElement)();
if (ctx.lightboxEnabled && (state.windowWidth || state.windowHeight)) {
setStyles(ctx, ref);
}
}
}
});
window.addEventListener('resize', debounce(() => {
state.windowWidth = window.innerWidth;
state.windowHeight = window.innerHeight;
}));
/**
* Computes styles for the lightbox and adds them to the document.
*
* @function
* @param {Object} ctx - Context for the `core/image` namespace.
* @param {Object} ref - The element reference.
*/
function setStyles(ctx, 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 (ctx.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(ctx.targetWidth !== 'none' ? ctx.targetWidth : naturalWidth);
let imgMaxHeight = parseFloat(ctx.targetHeight !== 'none' ? ctx.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};
--wp--lightbox-scrollbar-width: ${window.innerWidth - document.documentElement.clientWidth}px;
}
`;
}
/**
* 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);
};
}

1
wp-includes/blocks/image.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -37,9 +37,6 @@ function render_block_core_image( $attributes, $content, $block ) {
$link_destination = isset( $attributes['linkDestination'] ) ? $attributes['linkDestination'] : 'none'; $link_destination = isset( $attributes['linkDestination'] ) ? $attributes['linkDestination'] : 'none';
$lightbox_settings = block_core_image_get_lightbox_settings( $block->parsed_block ); $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 * If the lightbox is enabled and the image is not linked, add the filter
* and the JavaScript view file. * and the JavaScript view file.
@ -50,31 +47,22 @@ function render_block_core_image( $attributes, $content, $block ) {
isset( $lightbox_settings['enabled'] ) && isset( $lightbox_settings['enabled'] ) &&
true === $lightbox_settings['enabled'] true === $lightbox_settings['enabled']
) { ) {
$block->block_type->supports['interactivity'] = true; wp_enqueue_script_module( '@wordpress/block-library/image' );
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 * This render needs to happen in a filter with priority 15 to ensure that
* that it runs after the duotone filter and that duotone styles are * it runs after the duotone filter and that duotone styles are applied to
* applied to the image in the lightbox. We also need to ensure that the * the image in the lightbox. Lightbox has to work with any plugins that
* lightbox works with any plugins that might use filters as well. We * might use filters as well. Removing this can be considered in the
* can consider removing this in the future if the way the blocks are * future if the way the blocks are rendered changes, or if a
* rendered changes, or if a new kind of filter is introduced. * new kind of filter is introduced.
*/ */
add_filter( 'render_block_core/image', 'block_core_image_render_lightbox', 15, 2 ); add_filter( 'render_block_core/image', 'block_core_image_render_lightbox', 15, 2 );
} else { } else {
/* /*
* Remove the filter and the JavaScript view file if previously added by * Remove the filter if previously added by other Image blocks.
* other Image blocks.
*/ */
remove_filter( 'render_block_core/image', 'block_core_image_render_lightbox', 15 ); 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(); return $processor->get_updated_html();
@ -93,12 +81,6 @@ function block_core_image_get_lightbox_settings( $block ) {
// Get the lightbox setting from the block attributes. // Get the lightbox setting from the block attributes.
if ( isset( $block['attrs']['lightbox'] ) ) { if ( isset( $block['attrs']['lightbox'] ) ) {
$lightbox_settings = $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 ) ) { if ( ! isset( $lightbox_settings ) ) {
@ -187,27 +169,23 @@ function block_core_image_render_lightbox( $block_content, $block ) {
$w = new WP_HTML_Tag_Processor( $block_content ); $w = new WP_HTML_Tag_Processor( $block_content );
$w->next_tag( 'figure' ); $w->next_tag( 'figure' );
$w->add_class( 'wp-lightbox-container' ); $w->add_class( 'wp-lightbox-container' );
$w->set_attribute( 'data-wp-interactive', true ); $w->set_attribute( 'data-wp-interactive', '{"namespace":"core/image"}' );
$w->set_attribute( $w->set_attribute(
'data-wp-context', 'data-wp-context',
sprintf( sprintf(
'{ "core": '{ "imageLoaded": false,
{ "image": "initialized": false,
{ "imageLoaded": false, "lightboxEnabled": false,
"initialized": false, "hideAnimationEnabled": false,
"lightboxEnabled": false, "preloadInitialized": false,
"hideAnimationEnabled": false, "lightboxAnimation": "%s",
"preloadInitialized": false, "imageUploadedSrc": "%s",
"lightboxAnimation": "%s", "imageCurrentSrc": "",
"imageUploadedSrc": "%s", "targetWidth": "%s",
"imageCurrentSrc": "", "targetHeight": "%s",
"targetWidth": "%s", "scaleAttr": "%s",
"targetHeight": "%s", "dialogLabel": "%s"
"scaleAttr": "%s",
"dialogLabel": "%s"
}
}
}', }',
$lightbox_animation, $lightbox_animation,
$img_uploaded_src, $img_uploaded_src,
@ -218,14 +196,14 @@ function block_core_image_render_lightbox( $block_content, $block ) {
) )
); );
$w->next_tag( 'img' ); $w->next_tag( 'img' );
$w->set_attribute( 'data-wp-init', 'effects.core.image.initOriginImage' ); $w->set_attribute( 'data-wp-init', 'callbacks.initOriginImage' );
$w->set_attribute( 'data-wp-on--load', 'actions.core.image.handleLoad' ); $w->set_attribute( 'data-wp-on--load', 'actions.handleLoad' );
$w->set_attribute( 'data-wp-effect', 'effects.core.image.setButtonStyles' ); $w->set_attribute( 'data-wp-watch', 'callbacks.setButtonStyles' );
// We need to set an event callback on the `img` specifically // We need to set an event callback on the `img` specifically
// because the `figure` element can also contain a caption, and // because the `figure` element can also contain a caption, and
// we don't want to trigger the lightbox when the caption is clicked. // 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-on--click', 'actions.showLightbox' );
$w->set_attribute( 'data-wp-effect--setStylesOnResize', 'effects.core.image.setStylesOnResize' ); $w->set_attribute( 'data-wp-watch--setStylesOnResize', 'callbacks.setStylesOnResize' );
$body_content = $w->get_updated_html(); $body_content = $w->get_updated_html();
// Add a button alongside image in the body content. // Add a button alongside image in the body content.
@ -239,9 +217,10 @@ function block_core_image_render_lightbox( $block_content, $block ) {
type="button" type="button"
aria-haspopup="dialog" aria-haspopup="dialog"
aria-label="' . esc_attr( $aria_label ) . '" aria-label="' . esc_attr( $aria_label ) . '"
data-wp-on--click="actions.core.image.showLightbox" data-wp-init="callbacks.initTriggerButton"
data-wp-style--right="context.core.image.imageButtonRight" data-wp-on--click="actions.showLightbox"
data-wp-style--top="context.core.image.imageButtonTop" data-wp-style--right="context.imageButtonRight"
data-wp-style--top="context.imageButtonTop"
> >
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" viewBox="0 0 12 12"> <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" /> <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" />
@ -267,8 +246,8 @@ function block_core_image_render_lightbox( $block_content, $block ) {
// use the exact same image as in the content when the lightbox is first opened while // use the exact same image as in the content when the lightbox is first opened while
// we wait for the larger image to load. // we wait for the larger image to load.
$m->set_attribute( 'src', '' ); $m->set_attribute( 'src', '' );
$m->set_attribute( 'data-wp-bind--src', 'context.core.image.imageCurrentSrc' ); $m->set_attribute( 'data-wp-bind--src', 'context.imageCurrentSrc' );
$m->set_attribute( 'data-wp-style--object-fit', 'selectors.core.image.lightboxObjectFit' ); $m->set_attribute( 'data-wp-style--object-fit', 'state.lightboxObjectFit' );
$initial_image_content = $m->get_updated_html(); $initial_image_content = $m->get_updated_html();
$q = new WP_HTML_Tag_Processor( $block_content ); $q = new WP_HTML_Tag_Processor( $block_content );
@ -283,8 +262,8 @@ function block_core_image_render_lightbox( $block_content, $block ) {
// and Chrome (see https://github.com/WordPress/gutenberg/pull/52765#issuecomment-1674008151). Until that // 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. // 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( 'src', '' );
$q->set_attribute( 'data-wp-bind--src', 'selectors.core.image.enlargedImgSrc' ); $q->set_attribute( 'data-wp-bind--src', 'state.enlargedImgSrc' );
$q->set_attribute( 'data-wp-style--object-fit', 'selectors.core.image.lightboxObjectFit' ); $q->set_attribute( 'data-wp-style--object-fit', 'state.lightboxObjectFit' );
$enlarged_image_content = $q->get_updated_html(); $enlarged_image_content = $q->get_updated_html();
// If the current theme does NOT have a `theme.json`, or the colors are not defined, // If the current theme does NOT have a `theme.json`, or the colors are not defined,
@ -307,21 +286,21 @@ function block_core_image_render_lightbox( $block_content, $block ) {
$lightbox_html = <<<HTML $lightbox_html = <<<HTML
<div data-wp-body="" class="wp-lightbox-overlay $lightbox_animation" <div data-wp-body="" class="wp-lightbox-overlay $lightbox_animation"
data-wp-bind--role="selectors.core.image.roleAttribute" data-wp-bind--role="state.roleAttribute"
data-wp-bind--aria-label="selectors.core.image.dialogLabel" data-wp-bind--aria-label="state.dialogLabel"
data-wp-class--initialized="context.core.image.initialized" data-wp-class--initialized="context.initialized"
data-wp-class--active="context.core.image.lightboxEnabled" data-wp-class--active="context.lightboxEnabled"
data-wp-class--hideAnimationEnabled="context.core.image.hideAnimationEnabled" data-wp-class--hideAnimationEnabled="context.hideAnimationEnabled"
data-wp-bind--aria-modal="selectors.core.image.ariaModal" data-wp-bind--aria-modal="state.ariaModal"
data-wp-effect="effects.core.image.initLightbox" data-wp-watch="callbacks.initLightbox"
data-wp-on--keydown="actions.core.image.handleKeydown" data-wp-on--keydown="actions.handleKeydown"
data-wp-on--touchstart="actions.core.image.handleTouchStart" data-wp-on--touchstart="actions.handleTouchStart"
data-wp-on--touchmove="actions.core.image.handleTouchMove" data-wp-on--touchmove="actions.handleTouchMove"
data-wp-on--touchend="actions.core.image.handleTouchEnd" data-wp-on--touchend="actions.handleTouchEnd"
data-wp-on--click="actions.core.image.hideLightbox" data-wp-on--click="actions.hideLightbox"
tabindex="-1" 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"> <button type="button" aria-label="$close_button_label" style="fill: $close_button_color" class="close-button" data-wp-on--click="actions.hideLightbox">
$close_button_icon $close_button_icon
</button> </button>
<div class="lightbox-image-container">$initial_image_content</div> <div class="lightbox-image-container">$initial_image_content</div>
@ -333,25 +312,6 @@ HTML;
return str_replace( '</figure>', $lightbox_html . '</figure>', $body_content ); 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. * Registers the `core/image` block on server.
*/ */
@ -362,5 +322,12 @@ function register_block_core_image() {
'render_callback' => 'render_block_core_image', 'render_callback' => 'render_block_core_image',
) )
); );
wp_register_script_module(
'@wordpress/block-library/image',
defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ? gutenberg_url( '/build/interactivity/image.min.js' ) : includes_url( 'blocks/image/view.min.js' ),
array( '@wordpress/interactivity' ),
defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' )
);
} }
add_action( 'init', 'register_block_core_image' ); add_action( 'init', 'register_block_core_image' );

View File

@ -4,14 +4,16 @@
"name": "core/image", "name": "core/image",
"title": "Image", "title": "Image",
"category": "media", "category": "media",
"usesContext": [ "allowResize", "imageCrop", "fixedHeight" ], "usesContext": [
"allowResize",
"imageCrop",
"fixedHeight",
"pattern/overrides"
],
"description": "Insert an image to make a visual statement.", "description": "Insert an image to make a visual statement.",
"keywords": [ "img", "photo", "picture" ], "keywords": [ "img", "photo", "picture" ],
"textdomain": "default", "textdomain": "default",
"attributes": { "attributes": {
"align": {
"type": "string"
},
"url": { "url": {
"type": "string", "type": "string",
"source": "attribute", "source": "attribute",
@ -28,8 +30,8 @@
"__experimentalRole": "content" "__experimentalRole": "content"
}, },
"caption": { "caption": {
"type": "string", "type": "rich-text",
"source": "html", "source": "rich-text",
"selector": "figcaption", "selector": "figcaption",
"__experimentalRole": "content" "__experimentalRole": "content"
}, },
@ -95,6 +97,8 @@
} }
}, },
"supports": { "supports": {
"interactivity": true,
"align": [ "left", "center", "right", "wide", "full" ],
"anchor": true, "anchor": true,
"color": { "color": {
"text": false, "text": false,
@ -130,6 +134,5 @@
{ "name": "rounded", "label": "Rounded" } { "name": "rounded", "label": "Rounded" }
], ],
"editorStyle": "wp-block-image-editor", "editorStyle": "wp-block-image-editor",
"style": "wp-block-image", "style": "wp-block-image"
"viewScript": "file:./view.min.js"
} }

View File

@ -12,9 +12,12 @@
.wp-block-image.wp-block-image.is-selected .components-placeholder .components-placeholder__illustration{ .wp-block-image.wp-block-image.is-selected .components-placeholder .components-placeholder__illustration{
display:none; display:none;
} }
.wp-block-image.wp-block-image.is-selected .components-placeholder:before{ .wp-block-image.wp-block-image .block-bindings-media-placeholder-message,.wp-block-image.wp-block-image.is-selected .components-placeholder:before{
opacity:0; opacity:0;
} }
.wp-block-image.wp-block-image.is-selected .block-bindings-media-placeholder-message{
opacity:1;
}
.wp-block-image.wp-block-image .components-button,.wp-block-image.wp-block-image .components-placeholder__instructions,.wp-block-image.wp-block-image .components-placeholder__label{ .wp-block-image.wp-block-image .components-button,.wp-block-image.wp-block-image .components-placeholder__instructions,.wp-block-image.wp-block-image .components-placeholder__label{
transition:none; transition:none;
} }

View File

@ -1 +1 @@
.wp-block-image.wp-block-image.is-selected .components-placeholder{background-color:#fff;border:none;border-radius:2px;box-shadow:inset 0 0 0 1px #1e1e1e;color:#1e1e1e;filter:none!important}.wp-block-image.wp-block-image.is-selected .components-placeholder>svg{opacity:0}.wp-block-image.wp-block-image.is-selected .components-placeholder .components-placeholder__illustration{display:none}.wp-block-image.wp-block-image.is-selected .components-placeholder:before{opacity:0}.wp-block-image.wp-block-image .components-button,.wp-block-image.wp-block-image .components-placeholder__instructions,.wp-block-image.wp-block-image .components-placeholder__label{transition:none}figure.wp-block-image:not(.wp-block){margin:0}.wp-block-image{position:relative}.wp-block-image .is-applying img,.wp-block-image.is-transient img{opacity:.3}.wp-block-image figcaption img{display:inline}.wp-block-image .components-spinner{position:absolute;right:50%;top:50%;transform:translate(50%,-50%)}.wp-block-image .components-resizable-box__container{display:table}.wp-block-image .components-resizable-box__container img{display:block;height:inherit;width:inherit}.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal{left:0;margin:-1px 0;position:absolute;right:0}@media (min-width:600px){.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal{margin:-1px}}[data-align=full]>.wp-block-image img,[data-align=wide]>.wp-block-image img{height:auto;width:100%}.wp-block[data-align=center]>.wp-block-image,.wp-block[data-align=left]>.wp-block-image,.wp-block[data-align=right]>.wp-block-image{display:table}.wp-block[data-align=center]>.wp-block-image>figcaption,.wp-block[data-align=left]>.wp-block-image>figcaption,.wp-block[data-align=right]>.wp-block-image>figcaption{caption-side:bottom;display:table-caption}.wp-block[data-align=left]>.wp-block-image{margin:.5em 0 .5em 1em}.wp-block[data-align=right]>.wp-block-image{margin:.5em 1em .5em 0}.wp-block[data-align=center]>.wp-block-image{margin-left:auto;margin-right:auto;text-align:center}.wp-block-image__crop-area{max-width:100%;overflow:hidden;position:relative;width:100%}.wp-block-image__crop-area .reactEasyCrop_Container .reactEasyCrop_Image{border:none;border-radius:0}.wp-block-image__crop-icon{align-items:center;display:flex;justify-content:center;min-width:48px;padding:0 8px}.wp-block-image__crop-icon svg{fill:currentColor}.wp-block-image__zoom .components-popover__content{min-width:260px;overflow:visible!important}.wp-block-image__aspect-ratio{align-items:center;display:flex;height:46px;margin-bottom:-8px}.wp-block-image__aspect-ratio .components-button{padding-left:0;padding-right:0;width:36px} .wp-block-image.wp-block-image.is-selected .components-placeholder{background-color:#fff;border:none;border-radius:2px;box-shadow:inset 0 0 0 1px #1e1e1e;color:#1e1e1e;filter:none!important}.wp-block-image.wp-block-image.is-selected .components-placeholder>svg{opacity:0}.wp-block-image.wp-block-image.is-selected .components-placeholder .components-placeholder__illustration{display:none}.wp-block-image.wp-block-image .block-bindings-media-placeholder-message,.wp-block-image.wp-block-image.is-selected .components-placeholder:before{opacity:0}.wp-block-image.wp-block-image.is-selected .block-bindings-media-placeholder-message{opacity:1}.wp-block-image.wp-block-image .components-button,.wp-block-image.wp-block-image .components-placeholder__instructions,.wp-block-image.wp-block-image .components-placeholder__label{transition:none}figure.wp-block-image:not(.wp-block){margin:0}.wp-block-image{position:relative}.wp-block-image .is-applying img,.wp-block-image.is-transient img{opacity:.3}.wp-block-image figcaption img{display:inline}.wp-block-image .components-spinner{position:absolute;right:50%;top:50%;transform:translate(50%,-50%)}.wp-block-image .components-resizable-box__container{display:table}.wp-block-image .components-resizable-box__container img{display:block;height:inherit;width:inherit}.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal{left:0;margin:-1px 0;position:absolute;right:0}@media (min-width:600px){.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal{margin:-1px}}[data-align=full]>.wp-block-image img,[data-align=wide]>.wp-block-image img{height:auto;width:100%}.wp-block[data-align=center]>.wp-block-image,.wp-block[data-align=left]>.wp-block-image,.wp-block[data-align=right]>.wp-block-image{display:table}.wp-block[data-align=center]>.wp-block-image>figcaption,.wp-block[data-align=left]>.wp-block-image>figcaption,.wp-block[data-align=right]>.wp-block-image>figcaption{caption-side:bottom;display:table-caption}.wp-block[data-align=left]>.wp-block-image{margin:.5em 0 .5em 1em}.wp-block[data-align=right]>.wp-block-image{margin:.5em 1em .5em 0}.wp-block[data-align=center]>.wp-block-image{margin-left:auto;margin-right:auto;text-align:center}.wp-block-image__crop-area{max-width:100%;overflow:hidden;position:relative;width:100%}.wp-block-image__crop-area .reactEasyCrop_Container .reactEasyCrop_Image{border:none;border-radius:0}.wp-block-image__crop-icon{align-items:center;display:flex;justify-content:center;min-width:48px;padding:0 8px}.wp-block-image__crop-icon svg{fill:currentColor}.wp-block-image__zoom .components-popover__content{min-width:260px;overflow:visible!important}.wp-block-image__aspect-ratio{align-items:center;display:flex;height:46px;margin-bottom:-8px}.wp-block-image__aspect-ratio .components-button{padding-left:0;padding-right:0;width:36px}

View File

@ -12,9 +12,12 @@
.wp-block-image.wp-block-image.is-selected .components-placeholder .components-placeholder__illustration{ .wp-block-image.wp-block-image.is-selected .components-placeholder .components-placeholder__illustration{
display:none; display:none;
} }
.wp-block-image.wp-block-image.is-selected .components-placeholder:before{ .wp-block-image.wp-block-image .block-bindings-media-placeholder-message,.wp-block-image.wp-block-image.is-selected .components-placeholder:before{
opacity:0; opacity:0;
} }
.wp-block-image.wp-block-image.is-selected .block-bindings-media-placeholder-message{
opacity:1;
}
.wp-block-image.wp-block-image .components-button,.wp-block-image.wp-block-image .components-placeholder__instructions,.wp-block-image.wp-block-image .components-placeholder__label{ .wp-block-image.wp-block-image .components-button,.wp-block-image.wp-block-image .components-placeholder__instructions,.wp-block-image.wp-block-image .components-placeholder__label{
transition:none; transition:none;
} }

View File

@ -1 +1 @@
.wp-block-image.wp-block-image.is-selected .components-placeholder{background-color:#fff;border:none;border-radius:2px;box-shadow:inset 0 0 0 1px #1e1e1e;color:#1e1e1e;filter:none!important}.wp-block-image.wp-block-image.is-selected .components-placeholder>svg{opacity:0}.wp-block-image.wp-block-image.is-selected .components-placeholder .components-placeholder__illustration{display:none}.wp-block-image.wp-block-image.is-selected .components-placeholder:before{opacity:0}.wp-block-image.wp-block-image .components-button,.wp-block-image.wp-block-image .components-placeholder__instructions,.wp-block-image.wp-block-image .components-placeholder__label{transition:none}figure.wp-block-image:not(.wp-block){margin:0}.wp-block-image{position:relative}.wp-block-image .is-applying img,.wp-block-image.is-transient img{opacity:.3}.wp-block-image figcaption img{display:inline}.wp-block-image .components-spinner{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}.wp-block-image .components-resizable-box__container{display:table}.wp-block-image .components-resizable-box__container img{display:block;height:inherit;width:inherit}.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal{left:0;margin:-1px 0;position:absolute;right:0}@media (min-width:600px){.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal{margin:-1px}}[data-align=full]>.wp-block-image img,[data-align=wide]>.wp-block-image img{height:auto;width:100%}.wp-block[data-align=center]>.wp-block-image,.wp-block[data-align=left]>.wp-block-image,.wp-block[data-align=right]>.wp-block-image{display:table}.wp-block[data-align=center]>.wp-block-image>figcaption,.wp-block[data-align=left]>.wp-block-image>figcaption,.wp-block[data-align=right]>.wp-block-image>figcaption{caption-side:bottom;display:table-caption}.wp-block[data-align=left]>.wp-block-image{margin:.5em 1em .5em 0}.wp-block[data-align=right]>.wp-block-image{margin:.5em 0 .5em 1em}.wp-block[data-align=center]>.wp-block-image{margin-left:auto;margin-right:auto;text-align:center}.wp-block-image__crop-area{max-width:100%;overflow:hidden;position:relative;width:100%}.wp-block-image__crop-area .reactEasyCrop_Container .reactEasyCrop_Image{border:none;border-radius:0}.wp-block-image__crop-icon{align-items:center;display:flex;justify-content:center;min-width:48px;padding:0 8px}.wp-block-image__crop-icon svg{fill:currentColor}.wp-block-image__zoom .components-popover__content{min-width:260px;overflow:visible!important}.wp-block-image__aspect-ratio{align-items:center;display:flex;height:46px;margin-bottom:-8px}.wp-block-image__aspect-ratio .components-button{padding-left:0;padding-right:0;width:36px} .wp-block-image.wp-block-image.is-selected .components-placeholder{background-color:#fff;border:none;border-radius:2px;box-shadow:inset 0 0 0 1px #1e1e1e;color:#1e1e1e;filter:none!important}.wp-block-image.wp-block-image.is-selected .components-placeholder>svg{opacity:0}.wp-block-image.wp-block-image.is-selected .components-placeholder .components-placeholder__illustration{display:none}.wp-block-image.wp-block-image .block-bindings-media-placeholder-message,.wp-block-image.wp-block-image.is-selected .components-placeholder:before{opacity:0}.wp-block-image.wp-block-image.is-selected .block-bindings-media-placeholder-message{opacity:1}.wp-block-image.wp-block-image .components-button,.wp-block-image.wp-block-image .components-placeholder__instructions,.wp-block-image.wp-block-image .components-placeholder__label{transition:none}figure.wp-block-image:not(.wp-block){margin:0}.wp-block-image{position:relative}.wp-block-image .is-applying img,.wp-block-image.is-transient img{opacity:.3}.wp-block-image figcaption img{display:inline}.wp-block-image .components-spinner{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}.wp-block-image .components-resizable-box__container{display:table}.wp-block-image .components-resizable-box__container img{display:block;height:inherit;width:inherit}.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal{left:0;margin:-1px 0;position:absolute;right:0}@media (min-width:600px){.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal{margin:-1px}}[data-align=full]>.wp-block-image img,[data-align=wide]>.wp-block-image img{height:auto;width:100%}.wp-block[data-align=center]>.wp-block-image,.wp-block[data-align=left]>.wp-block-image,.wp-block[data-align=right]>.wp-block-image{display:table}.wp-block[data-align=center]>.wp-block-image>figcaption,.wp-block[data-align=left]>.wp-block-image>figcaption,.wp-block[data-align=right]>.wp-block-image>figcaption{caption-side:bottom;display:table-caption}.wp-block[data-align=left]>.wp-block-image{margin:.5em 1em .5em 0}.wp-block[data-align=right]>.wp-block-image{margin:.5em 0 .5em 1em}.wp-block[data-align=center]>.wp-block-image{margin-left:auto;margin-right:auto;text-align:center}.wp-block-image__crop-area{max-width:100%;overflow:hidden;position:relative;width:100%}.wp-block-image__crop-area .reactEasyCrop_Container .reactEasyCrop_Image{border:none;border-radius:0}.wp-block-image__crop-icon{align-items:center;display:flex;justify-content:center;min-width:48px;padding:0 8px}.wp-block-image__crop-icon svg{fill:currentColor}.wp-block-image__zoom .components-popover__content{min-width:260px;overflow:visible!important}.wp-block-image__aspect-ratio{align-items:center;display:flex;height:46px;margin-bottom:-8px}.wp-block-image__aspect-ratio .components-button{padding-left:0;padding-right:0;width:36px}

View File

@ -150,7 +150,7 @@
right:0; right:0;
top:0; top:0;
visibility:hidden; visibility:hidden;
width:100vw; width:100%;
z-index:100000; z-index:100000;
} }
.wp-lightbox-overlay .close-button{ .wp-lightbox-overlay .close-button{
@ -280,7 +280,7 @@
} }
@keyframes lightbox-zoom-in{ @keyframes lightbox-zoom-in{
0%{ 0%{
transform:translate(calc((-50vw + var(--wp--lightbox-initial-left-position))*-1), calc(-50vh + var(--wp--lightbox-initial-top-position))) scale(var(--wp--lightbox-scale)); transform:translate(calc(((-100vw + var(--wp--lightbox-scrollbar-width))/2 + var(--wp--lightbox-initial-left-position))*-1), calc(-50vh + var(--wp--lightbox-initial-top-position))) scale(var(--wp--lightbox-scale));
} }
to{ to{
transform:translate(50%, -50%) scale(1); transform:translate(50%, -50%) scale(1);
@ -295,7 +295,7 @@
visibility:visible; visibility:visible;
} }
to{ to{
transform:translate(calc((-50vw + var(--wp--lightbox-initial-left-position))*-1), calc(-50vh + var(--wp--lightbox-initial-top-position))) scale(var(--wp--lightbox-scale)); transform:translate(calc(((-100vw + var(--wp--lightbox-scrollbar-width))/2 + var(--wp--lightbox-initial-left-position))*-1), calc(-50vh + var(--wp--lightbox-initial-top-position))) scale(var(--wp--lightbox-scale));
visibility:hidden; visibility:hidden;
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -150,7 +150,7 @@
position:fixed; position:fixed;
top:0; top:0;
visibility:hidden; visibility:hidden;
width:100vw; width:100%;
z-index:100000; z-index:100000;
} }
.wp-lightbox-overlay .close-button{ .wp-lightbox-overlay .close-button{
@ -280,7 +280,7 @@
} }
@keyframes lightbox-zoom-in{ @keyframes lightbox-zoom-in{
0%{ 0%{
transform:translate(calc(-50vw + var(--wp--lightbox-initial-left-position)), calc(-50vh + var(--wp--lightbox-initial-top-position))) scale(var(--wp--lightbox-scale)); transform:translate(calc((-100vw + var(--wp--lightbox-scrollbar-width))/2 + var(--wp--lightbox-initial-left-position)), calc(-50vh + var(--wp--lightbox-initial-top-position))) scale(var(--wp--lightbox-scale));
} }
to{ to{
transform:translate(-50%, -50%) scale(1); transform:translate(-50%, -50%) scale(1);
@ -295,7 +295,7 @@
visibility:visible; visibility:visible;
} }
to{ to{
transform:translate(calc(-50vw + var(--wp--lightbox-initial-left-position)), calc(-50vh + var(--wp--lightbox-initial-top-position))) scale(var(--wp--lightbox-scale)); transform:translate(calc((-100vw + var(--wp--lightbox-scrollbar-width))/2 + var(--wp--lightbox-initial-left-position)), calc(-50vh + var(--wp--lightbox-initial-top-position))) scale(var(--wp--lightbox-scale));
visibility:hidden; visibility:hidden;
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '749bd8d7dd37390bdeea'); <?php return array('dependencies' => array(), 'version' => '7500eb032759d407a71d');

View File

@ -1,533 +0,0 @@
"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));
/******/ }
]);

View File

@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '32caaf5e7c6834efef4c'); <?php return array('dependencies' => array(), 'version' => 'ff354d5368d64857fef0');

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,5 @@
{ {
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "core/legacy-widget", "name": "core/legacy-widget",
"title": "Legacy Widget", "title": "Legacy Widget",

View File

@ -12,16 +12,23 @@
"type": "string" "type": "string"
}, },
"content": { "content": {
"type": "string", "type": "rich-text",
"source": "html", "source": "rich-text",
"selector": "li", "selector": "li",
"default": "",
"__experimentalRole": "content" "__experimentalRole": "content"
} }
}, },
"supports": { "supports": {
"className": false, "className": false,
"__experimentalSelector": "li", "__experimentalSelector": "li",
"spacing": {
"margin": true,
"padding": true,
"__experimentalDefaultControls": {
"margin": false,
"padding": false
}
},
"typography": { "typography": {
"fontSize": true, "fontSize": true,
"lineHeight": true, "lineHeight": true,

View File

@ -19,6 +19,14 @@
}, },
"supports": { "supports": {
"className": true, "className": true,
"spacing": {
"margin": true,
"padding": true,
"__experimentalDefaultControls": {
"margin": false,
"padding": false
}
},
"typography": { "typography": {
"fontSize": true, "fontSize": true,
"lineHeight": true, "lineHeight": true,

View File

@ -15,7 +15,7 @@
}, },
"originalContent": { "originalContent": {
"type": "string", "type": "string",
"source": "html" "source": "raw"
} }
}, },
"supports": { "supports": {

View File

@ -1,6 +1,6 @@
<?php <?php
/** /**
* Server-side rendering of the `core/navigation-link` block. * Server-side registering and rendering of the `core/navigation-link` block.
* *
* @package WordPress * @package WordPress
*/ */
@ -323,12 +323,63 @@ function build_variation_for_navigation_link( $entity, $kind ) {
} }
/** /**
* Register the navigation link block. * Register a variation for a post type / taxonomy for the navigation link block.
* *
* @uses render_block_core_navigation() * @param array $variation Variation array from build_variation_for_navigation_link.
* @throws WP_Error An WP_Error exception parsing the block definition. * @return void
*/ */
function register_block_core_navigation_link() { function block_core_navigation_link_register_variation( $variation ) {
// Directly set the variations on the registered block type
// because there's no server side registration for variations (see #47170).
$navigation_block_type = WP_Block_Type_Registry::get_instance()->get_registered( 'core/navigation-link' );
// If the block is not registered yet, bail early.
// Variation will be registered in register_block_core_navigation_link then.
if ( ! $navigation_block_type ) {
return;
}
$navigation_block_type->variations = array_merge(
$navigation_block_type->variations,
array( $variation )
);
}
/**
* Unregister a variation for a post type / taxonomy for the navigation link block.
*
* @param string $name Name of the post type / taxonomy (which was used as variation name).
* @return void
*/
function block_core_navigation_link_unregister_variation( $name ) {
// Directly get the variations from the registered block type
// because there's no server side (un)registration for variations (see #47170).
$navigation_block_type = WP_Block_Type_Registry::get_instance()->get_registered( 'core/navigation-link' );
// If the block is not registered (yet), there's no need to remove a variation.
if ( ! $navigation_block_type || empty( $navigation_block_type->variations ) ) {
return;
}
$variations = $navigation_block_type->variations;
// Search for the variation and remove it from the array.
foreach ( $variations as $i => $variation ) {
if ( $variation['name'] === $name ) {
unset( $variations[ $i ] );
break;
}
}
// Reindex array after removing one variation.
$navigation_block_type->variations = array_values( $variations );
}
/**
* Register the navigation link block.
* Returns an array of variations for the navigation link block.
*
* @return array
*/
function build_navigation_link_block_variations() {
// This will only handle post types and taxonomies registered until this point (init on priority 9).
// See action hooks below for other post types and taxonomies.
// See https://github.com/WordPress/gutenberg/issues/53826 for details.
$post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'objects' ); $post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'objects' );
$taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'objects' ); $taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'objects' );
@ -360,12 +411,80 @@ function register_block_core_navigation_link() {
} }
} }
return array_merge( $built_ins, $variations );
}
/**
* Register the navigation link block.
*
* @uses render_block_core_navigation()
* @throws WP_Error An WP_Error exception parsing the block definition.
*/
function register_block_core_navigation_link() {
register_block_type_from_metadata( register_block_type_from_metadata(
__DIR__ . '/navigation-link', __DIR__ . '/navigation-link',
array( array(
'render_callback' => 'render_block_core_navigation_link', 'render_callback' => 'render_block_core_navigation_link',
'variations' => array_merge( $built_ins, $variations ), 'variation_callback' => 'build_navigation_link_block_variations',
) )
); );
} }
add_action( 'init', 'register_block_core_navigation_link' ); add_action( 'init', 'register_block_core_navigation_link' );
// Register actions for all post types and taxonomies, to add variations when they are registered.
// All post types/taxonomies registered before register_block_core_navigation_link, will be handled by that function.
add_action( 'registered_post_type', 'block_core_navigation_link_register_post_type_variation', 10, 2 );
add_action( 'registered_taxonomy', 'block_core_navigation_link_register_taxonomy_variation', 10, 3 );
// Handle unregistering of post types and taxonomies and remove the variations.
add_action( 'unregistered_post_type', 'block_core_navigation_link_unregister_post_type_variation' );
add_action( 'unregistered_taxonomy', 'block_core_navigation_link_unregister_taxonomy_variation' );
/**
* Register custom post type variations for navigation link on post type registration
* Handles all post types registered after the block is registered in register_navigation_link_post_type_variations
*
* @param string $post_type The post type name passed from registered_post_type action hook.
* @param WP_Post_Type $post_type_object The post type object passed from registered_post_type.
* @return void
*/
function block_core_navigation_link_register_post_type_variation( $post_type, $post_type_object ) {
if ( $post_type_object->show_in_nav_menus ) {
$variation = build_variation_for_navigation_link( $post_type_object, 'post-type' );
block_core_navigation_link_register_variation( $variation );
}
}
/**
* Register a custom taxonomy variation for navigation link on taxonomy registration
* Handles all taxonomies registered after the block is registered in register_navigation_link_post_type_variations
*
* @param string $taxonomy Taxonomy slug.
* @param array|string $object_type Object type or array of object types.
* @param array $args Array of taxonomy registration arguments.
* @return void
*/
function block_core_navigation_link_register_taxonomy_variation( $taxonomy, $object_type, $args ) {
if ( isset( $args['show_in_nav_menus'] ) && $args['show_in_nav_menus'] ) {
$variation = build_variation_for_navigation_link( (object) $args, 'post-type' );
block_core_navigation_link_register_variation( $variation );
}
}
/**
* Unregisters a custom post type variation for navigation link on post type unregistration.
*
* @param string $post_type The post type name passed from unregistered_post_type action hook.
* @return void
*/
function block_core_navigation_link_unregister_post_type_variation( $post_type ) {
block_core_navigation_link_unregister_variation( $post_type );
}
/**
* Unregisters a custom taxonomy variation for navigation link on taxonomy unregistration.
*
* @param string $taxonomy The taxonomy name passed from unregistered_taxonomy action hook.
* @return void
*/
function block_core_navigation_link_unregister_taxonomy_variation( $taxonomy ) {
block_core_navigation_link_unregister_variation( $taxonomy );
}

View File

@ -71,7 +71,8 @@
"__experimentalDefaultControls": { "__experimentalDefaultControls": {
"fontSize": true "fontSize": true
} }
} },
"renaming": false
}, },
"editorStyle": "wp-block-navigation-link-editor", "editorStyle": "wp-block-navigation-link-editor",
"style": "wp-block-navigation-link" "style": "wp-block-navigation-link"

View File

@ -0,0 +1,247 @@
import * as __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__ from "@wordpress/interactivity";
/******/ // The require scope
/******/ var __webpack_require__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ !function() {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = function(exports, definition) {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ }();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ !function() {
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ }();
/******/
/************************************************************************/
var __webpack_exports__ = {};
;// CONCATENATED MODULE: external "@wordpress/interactivity"
var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var y = x => () => x
var interactivity_namespaceObject = x({ ["getContext"]: () => __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.getContext, ["getElement"]: () => __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.getElement, ["store"]: () => __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.store });
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/constants.js
const DEFAULT_BLOCK = {
name: 'core/navigation-link'
};
const ALLOWED_BLOCKS = (/* unused pure expression or super */ null && (['core/navigation-link', 'core/search', 'core/social-links', 'core/page-list', 'core/spacer', 'core/home-link', 'core/site-title', 'core/site-logo', 'core/navigation-submenu', 'core/loginout', 'core/buttons']));
const PRIORITIZED_INSERTER_BLOCKS = (/* unused pure expression or super */ null && (['core/navigation-link/page', 'core/navigation-link']));
// These parameters must be kept aligned with those in
// lib/compat/wordpress-6.3/navigation-block-preloading.php
// and
// edit-site/src/components/sidebar-navigation-screen-navigation-menus/constants.js
const PRELOADED_NAVIGATION_MENUS_QUERY = {
per_page: 100,
status: ['publish', 'draft'],
order: 'desc',
orderby: 'date'
};
const SELECT_NAVIGATION_MENUS_ARGS = ['postType', 'wp_navigation', PRELOADED_NAVIGATION_MENUS_QUERY];
const NAVIGATION_MOBILE_COLLAPSE = '600px';
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/view.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
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 {
state,
actions
} = (0,interactivity_namespaceObject.store)('core/navigation', {
state: {
get roleAttribute() {
const ctx = (0,interactivity_namespaceObject.getContext)();
return ctx.type === 'overlay' && state.isMenuOpen ? 'dialog' : null;
},
get ariaModal() {
const ctx = (0,interactivity_namespaceObject.getContext)();
return ctx.type === 'overlay' && state.isMenuOpen ? 'true' : null;
},
get ariaLabel() {
const ctx = (0,interactivity_namespaceObject.getContext)();
return ctx.type === 'overlay' && state.isMenuOpen ? ctx.ariaLabel : null;
},
get isMenuOpen() {
// The menu is opened if either `click`, `hover` or `focus` is true.
return Object.values(state.menuOpenedBy).filter(Boolean).length > 0;
},
get menuOpenedBy() {
const ctx = (0,interactivity_namespaceObject.getContext)();
return ctx.type === 'overlay' ? ctx.overlayOpenedBy : ctx.submenuOpenedBy;
}
},
actions: {
openMenuOnHover() {
const {
type,
overlayOpenedBy
} = (0,interactivity_namespaceObject.getContext)();
if (type === 'submenu' &&
// Only open on hover if the overlay is closed.
Object.values(overlayOpenedBy || {}).filter(Boolean).length === 0) actions.openMenu('hover');
},
closeMenuOnHover() {
actions.closeMenu('hover');
},
openMenuOnClick() {
const ctx = (0,interactivity_namespaceObject.getContext)();
const {
ref
} = (0,interactivity_namespaceObject.getElement)();
ctx.previousFocus = ref;
actions.openMenu('click');
},
closeMenuOnClick() {
actions.closeMenu('click');
actions.closeMenu('focus');
},
openMenuOnFocus() {
actions.openMenu('focus');
},
toggleMenuOnClick() {
const ctx = (0,interactivity_namespaceObject.getContext)();
const {
ref
} = (0,interactivity_namespaceObject.getElement)();
// 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
} = state;
if (menuOpenedBy.click || menuOpenedBy.focus) {
actions.closeMenu('click');
actions.closeMenu('focus');
} else {
ctx.previousFocus = ref;
actions.openMenu('click');
}
},
handleMenuKeydown(event) {
const {
type,
firstFocusableElement,
lastFocusableElement
} = (0,interactivity_namespaceObject.getContext)();
if (state.menuOpenedBy.click) {
// If Escape close the menu.
if (event?.key === 'Escape') {
actions.closeMenu('click');
actions.closeMenu('focus');
return;
}
// Trap focus if it is an overlay (main menu).
if (type === 'overlay' && event.key === 'Tab') {
// If shift + tab it change the direction.
if (event.shiftKey && window.document.activeElement === firstFocusableElement) {
event.preventDefault();
lastFocusableElement.focus();
} else if (!event.shiftKey && window.document.activeElement === lastFocusableElement) {
event.preventDefault();
firstFocusableElement.focus();
}
}
}
},
handleMenuFocusout(event) {
const {
modal
} = (0,interactivity_namespaceObject.getContext)();
// 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 || !modal?.contains(event.relatedTarget) && event.target !== window.document.activeElement) {
actions.closeMenu('click');
actions.closeMenu('focus');
}
},
openMenu(menuOpenedOn = 'click') {
const {
type
} = (0,interactivity_namespaceObject.getContext)();
state.menuOpenedBy[menuOpenedOn] = true;
if (type === 'overlay') {
// Add a `has-modal-open` class to the <html> root.
document.documentElement.classList.add('has-modal-open');
}
},
closeMenu(menuClosedOn = 'click') {
const ctx = (0,interactivity_namespaceObject.getContext)();
state.menuOpenedBy[menuClosedOn] = false;
// Check if the menu is still open or not.
if (!state.isMenuOpen) {
if (ctx.modal?.contains(window.document.activeElement)) {
ctx.previousFocus?.focus();
}
ctx.modal = null;
ctx.previousFocus = null;
if (ctx.type === 'overlay') {
document.documentElement.classList.remove('has-modal-open');
}
}
}
},
callbacks: {
initMenu() {
const ctx = (0,interactivity_namespaceObject.getContext)();
const {
ref
} = (0,interactivity_namespaceObject.getElement)();
if (state.isMenuOpen) {
const focusableElements = ref.querySelectorAll(focusableSelectors);
ctx.modal = ref;
ctx.firstFocusableElement = focusableElements[0];
ctx.lastFocusableElement = focusableElements[focusableElements.length - 1];
}
},
focusFirstElement() {
const {
ref
} = (0,interactivity_namespaceObject.getElement)();
if (state.isMenuOpen) {
const focusableElements = ref.querySelectorAll(focusableSelectors);
focusableElements?.[0]?.focus();
}
},
initNav() {
const context = (0,interactivity_namespaceObject.getContext)();
const mediaQuery = window.matchMedia(`(max-width: ${NAVIGATION_MOBILE_COLLAPSE})`);
// Run once to set the initial state.
context.isCollapsed = mediaQuery.matches;
function handleCollapse(event) {
context.isCollapsed = event.matches;
}
// Run on resize to update the state.
mediaQuery.addEventListener('change', handleCollapse);
// Remove the listener when the component is unmounted.
return () => {
mediaQuery.removeEventListener('change', handleCollapse);
};
}
}
});

1
wp-includes/blocks/navigation.min.js vendored Normal file
View File

@ -0,0 +1 @@
import*as e from"@wordpress/interactivity";var t={d:function(e,n){for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},n=(e=>{var n={};return t.d(n,e),n})({getContext:()=>e.getContext,getElement:()=>e.getElement,store:()=>e.store});const o=["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{state:l,actions:c}=(0,n.store)("core/navigation",{state:{get roleAttribute(){return"overlay"===(0,n.getContext)().type&&l.isMenuOpen?"dialog":null},get ariaModal(){return"overlay"===(0,n.getContext)().type&&l.isMenuOpen?"true":null},get ariaLabel(){const e=(0,n.getContext)();return"overlay"===e.type&&l.isMenuOpen?e.ariaLabel:null},get isMenuOpen(){return Object.values(l.menuOpenedBy).filter(Boolean).length>0},get menuOpenedBy(){const e=(0,n.getContext)();return"overlay"===e.type?e.overlayOpenedBy:e.submenuOpenedBy}},actions:{openMenuOnHover(){const{type:e,overlayOpenedBy:t}=(0,n.getContext)();"submenu"===e&&0===Object.values(t||{}).filter(Boolean).length&&c.openMenu("hover")},closeMenuOnHover(){c.closeMenu("hover")},openMenuOnClick(){const e=(0,n.getContext)(),{ref:t}=(0,n.getElement)();e.previousFocus=t,c.openMenu("click")},closeMenuOnClick(){c.closeMenu("click"),c.closeMenu("focus")},openMenuOnFocus(){c.openMenu("focus")},toggleMenuOnClick(){const e=(0,n.getContext)(),{ref:t}=(0,n.getElement)();window.document.activeElement!==t&&t.focus();const{menuOpenedBy:o}=l;o.click||o.focus?(c.closeMenu("click"),c.closeMenu("focus")):(e.previousFocus=t,c.openMenu("click"))},handleMenuKeydown(e){const{type:t,firstFocusableElement:o,lastFocusableElement:s}=(0,n.getContext)();if(l.menuOpenedBy.click){if("Escape"===e?.key)return c.closeMenu("click"),void c.closeMenu("focus");"overlay"===t&&"Tab"===e.key&&(e.shiftKey&&window.document.activeElement===o?(e.preventDefault(),s.focus()):e.shiftKey||window.document.activeElement!==s||(e.preventDefault(),o.focus()))}},handleMenuFocusout(e){const{modal:t}=(0,n.getContext)();(null===e.relatedTarget||!t?.contains(e.relatedTarget)&&e.target!==window.document.activeElement)&&(c.closeMenu("click"),c.closeMenu("focus"))},openMenu(e="click"){const{type:t}=(0,n.getContext)();l.menuOpenedBy[e]=!0,"overlay"===t&&document.documentElement.classList.add("has-modal-open")},closeMenu(e="click"){const t=(0,n.getContext)();l.menuOpenedBy[e]=!1,l.isMenuOpen||(t.modal?.contains(window.document.activeElement)&&t.previousFocus?.focus(),t.modal=null,t.previousFocus=null,"overlay"===t.type&&document.documentElement.classList.remove("has-modal-open"))}},callbacks:{initMenu(){const e=(0,n.getContext)(),{ref:t}=(0,n.getElement)();if(l.isMenuOpen){const n=t.querySelectorAll(o);e.modal=t,e.firstFocusableElement=n[0],e.lastFocusableElement=n[n.length-1]}},focusFirstElement(){const{ref:e}=(0,n.getElement)();if(l.isMenuOpen){const t=e.querySelectorAll(o);t?.[0]?.focus()}},initNav(){const e=(0,n.getContext)(),t=window.matchMedia("(max-width: 600px)");function o(t){e.isCollapsed=t.matches}return e.isCollapsed=t.matches,t.addEventListener("change",o),()=>{t.removeEventListener("change",o)}}}});

File diff suppressed because it is too large Load Diff

View File

@ -133,9 +133,9 @@
} }
} }
}, },
"interactivity": true "interactivity": true,
"renaming": false
}, },
"viewScript": "file:./view.min.js",
"editorStyle": "wp-block-navigation-editor", "editorStyle": "wp-block-navigation-editor",
"style": "wp-block-navigation" "style": "wp-block-navigation"
} }

View File

@ -277,10 +277,8 @@
min-height:1px; min-height:1px;
min-width:1px; min-width:1px;
} }
@media (min-width:600px){ .is-collapsed .wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close{
.wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close{ display:none;
display:none;
}
} }
.wp-block-navigation__responsive-container.is-menu-open{ .wp-block-navigation__responsive-container.is-menu-open{

File diff suppressed because one or more lines are too long

View File

@ -277,10 +277,8 @@
min-height:1px; min-height:1px;
min-width:1px; min-width:1px;
} }
@media (min-width:600px){ .is-collapsed .wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close{
.wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close{ display:none;
display:none;
}
} }
.wp-block-navigation__responsive-container.is-menu-open{ .wp-block-navigation__responsive-container.is-menu-open{

File diff suppressed because one or more lines are too long

View File

@ -202,11 +202,16 @@ button.wp-block-navigation-item__content{
.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle{ .wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle{
padding-left:.85em; padding-left:.85em;
padding-right:0;
} }
.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle+.wp-block-navigation__submenu-icon{ .wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle+.wp-block-navigation__submenu-icon{
margin-right:-.6em; margin-right:-.6em;
pointer-events:none; pointer-events:none;
} }
.wp-block-navigation-item.open-on-click button.wp-block-navigation-item__content:not(.wp-block-navigation-submenu__toggle){
padding:0;
}
.wp-block-navigation .wp-block-page-list,.wp-block-navigation__container,.wp-block-navigation__responsive-close,.wp-block-navigation__responsive-container,.wp-block-navigation__responsive-container-content,.wp-block-navigation__responsive-dialog{ .wp-block-navigation .wp-block-page-list,.wp-block-navigation__container,.wp-block-navigation__responsive-close,.wp-block-navigation__responsive-container,.wp-block-navigation__responsive-container-content,.wp-block-navigation__responsive-dialog{
gap:inherit; gap:inherit;
} }
@ -358,20 +363,18 @@ button.wp-block-navigation-item__content{
left:auto; left:auto;
right:auto; right:auto;
} }
@media (min-width:600px){ :not(.is-collapsed)>.wp-block-navigation__responsive-container:not(.is-menu-open){
.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open){ background-color:inherit;
background-color:inherit; display:block;
display:block; position:relative;
position:relative; width:100%;
width:100%; z-index:auto;
z-index:auto; }
} :not(.is-collapsed)>.wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__responsive-container-close{
.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close{ display:none;
display:none; }
} :not(.is-collapsed)>.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container{
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container{ right:0;
right:0;
}
} }
.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open{ .wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open{
@ -413,10 +416,8 @@ button.wp-block-navigation-item__content{
font-size:inherit; font-size:inherit;
font-weight:inherit; font-weight:inherit;
} }
@media (min-width:600px){ :not(.is-collapsed)>.wp-block-navigation__responsive-container-open{
.wp-block-navigation__responsive-container-open:not(.always-shown){ display:none;
display:none;
}
} }
.wp-block-navigation__responsive-container-close{ .wp-block-navigation__responsive-container-close{

File diff suppressed because one or more lines are too long

View File

@ -201,12 +201,17 @@ button.wp-block-navigation-item__content{
} }
.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle{ .wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle{
padding-left:0;
padding-right:.85em; padding-right:.85em;
} }
.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle+.wp-block-navigation__submenu-icon{ .wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle+.wp-block-navigation__submenu-icon{
margin-left:-.6em; margin-left:-.6em;
pointer-events:none; pointer-events:none;
} }
.wp-block-navigation-item.open-on-click button.wp-block-navigation-item__content:not(.wp-block-navigation-submenu__toggle){
padding:0;
}
.wp-block-navigation .wp-block-page-list,.wp-block-navigation__container,.wp-block-navigation__responsive-close,.wp-block-navigation__responsive-container,.wp-block-navigation__responsive-container-content,.wp-block-navigation__responsive-dialog{ .wp-block-navigation .wp-block-page-list,.wp-block-navigation__container,.wp-block-navigation__responsive-close,.wp-block-navigation__responsive-container,.wp-block-navigation__responsive-container-content,.wp-block-navigation__responsive-dialog{
gap:inherit; gap:inherit;
} }
@ -358,20 +363,18 @@ button.wp-block-navigation-item__content{
left:auto; left:auto;
right:auto; right:auto;
} }
@media (min-width:600px){ :not(.is-collapsed)>.wp-block-navigation__responsive-container:not(.is-menu-open){
.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open){ background-color:inherit;
background-color:inherit; display:block;
display:block; position:relative;
position:relative; width:100%;
width:100%; z-index:auto;
z-index:auto; }
} :not(.is-collapsed)>.wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__responsive-container-close{
.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close{ display:none;
display:none; }
} :not(.is-collapsed)>.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container{
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container{ left:0;
left:0;
}
} }
.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open{ .wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open{
@ -413,10 +416,8 @@ button.wp-block-navigation-item__content{
font-size:inherit; font-size:inherit;
font-weight:inherit; font-weight:inherit;
} }
@media (min-width:600px){ :not(.is-collapsed)>.wp-block-navigation__responsive-container-open{
.wp-block-navigation__responsive-container-open:not(.always-shown){ display:none;
display:none;
}
} }
.wp-block-navigation__responsive-container-close{ .wp-block-navigation__responsive-container-close{

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => 'b3eba25769c9fe5ec0fa'); <?php return array('dependencies' => array(), 'version' => 'c7aadf427ad3311e0624');

View File

@ -1,213 +0,0 @@
"use strict";
(self["__WordPressPrivateInteractivityAPI__"] = self["__WordPressPrivateInteractivityAPI__"] || []).push([[3],{
/***/ 932:
/***/ (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]', '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');
}
};
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();
}
}
}
}
},
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));
/******/ }
]);

View File

@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => 'e3d6f3216904b5b42831'); <?php return array('dependencies' => array(), 'version' => 'dfccca53c03e01ca94e5');

View File

@ -1 +0,0 @@
"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)}]);

View File

@ -37,10 +37,6 @@
width:auto; width:auto;
} }
.wp-block-page-list .components-notice{
margin-right:0;
}
.wp-block-page-list__loading-indicator-container{ .wp-block-page-list__loading-indicator-container{
padding:8px 12px; padding:8px 12px;
} }

View File

@ -1 +1 @@
.wp-block-navigation .wp-block-page-list,.wp-block-navigation .wp-block-page-list>div{background-color:inherit}.wp-block-navigation.items-justified-space-between .wp-block-page-list,.wp-block-navigation.items-justified-space-between .wp-block-page-list>div{display:contents;flex:1}.wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list,.wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list>div,.wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list,.wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list>div{flex:inherit}.wp-block-navigation .wp-block-navigation__submenu-container>.wp-block-page-list{display:block}.wp-block-pages-list__item__link{pointer-events:none}@media (min-width:600px){.wp-block-page-list-modal{max-width:480px}}.wp-block-page-list-modal-buttons{display:flex;gap:12px;justify-content:flex-end}.wp-block-page-list .open-on-click:focus-within>.wp-block-navigation__submenu-container{height:auto;min-width:200px;opacity:1;visibility:visible;width:auto}.wp-block-page-list .components-notice{margin-right:0}.wp-block-page-list__loading-indicator-container{padding:8px 12px} .wp-block-navigation .wp-block-page-list,.wp-block-navigation .wp-block-page-list>div{background-color:inherit}.wp-block-navigation.items-justified-space-between .wp-block-page-list,.wp-block-navigation.items-justified-space-between .wp-block-page-list>div{display:contents;flex:1}.wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list,.wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list>div,.wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list,.wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list>div{flex:inherit}.wp-block-navigation .wp-block-navigation__submenu-container>.wp-block-page-list{display:block}.wp-block-pages-list__item__link{pointer-events:none}@media (min-width:600px){.wp-block-page-list-modal{max-width:480px}}.wp-block-page-list-modal-buttons{display:flex;gap:12px;justify-content:flex-end}.wp-block-page-list .open-on-click:focus-within>.wp-block-navigation__submenu-container{height:auto;min-width:200px;opacity:1;visibility:visible;width:auto}.wp-block-page-list__loading-indicator-container{padding:8px 12px}

View File

@ -37,10 +37,6 @@
width:auto; width:auto;
} }
.wp-block-page-list .components-notice{
margin-left:0;
}
.wp-block-page-list__loading-indicator-container{ .wp-block-page-list__loading-indicator-container{
padding:8px 12px; padding:8px 12px;
} }

View File

@ -1 +1 @@
.wp-block-navigation .wp-block-page-list,.wp-block-navigation .wp-block-page-list>div{background-color:inherit}.wp-block-navigation.items-justified-space-between .wp-block-page-list,.wp-block-navigation.items-justified-space-between .wp-block-page-list>div{display:contents;flex:1}.wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list,.wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list>div,.wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list,.wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list>div{flex:inherit}.wp-block-navigation .wp-block-navigation__submenu-container>.wp-block-page-list{display:block}.wp-block-pages-list__item__link{pointer-events:none}@media (min-width:600px){.wp-block-page-list-modal{max-width:480px}}.wp-block-page-list-modal-buttons{display:flex;gap:12px;justify-content:flex-end}.wp-block-page-list .open-on-click:focus-within>.wp-block-navigation__submenu-container{height:auto;min-width:200px;opacity:1;visibility:visible;width:auto}.wp-block-page-list .components-notice{margin-left:0}.wp-block-page-list__loading-indicator-container{padding:8px 12px} .wp-block-navigation .wp-block-page-list,.wp-block-navigation .wp-block-page-list>div{background-color:inherit}.wp-block-navigation.items-justified-space-between .wp-block-page-list,.wp-block-navigation.items-justified-space-between .wp-block-page-list>div{display:contents;flex:1}.wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list,.wp-block-navigation.items-justified-space-between.has-child-selected .wp-block-page-list>div,.wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list,.wp-block-navigation.items-justified-space-between.is-selected .wp-block-page-list>div{flex:inherit}.wp-block-navigation .wp-block-navigation__submenu-container>.wp-block-page-list{display:block}.wp-block-pages-list__item__link{pointer-events:none}@media (min-width:600px){.wp-block-page-list-modal{max-width:480px}}.wp-block-page-list-modal-buttons{display:flex;gap:12px;justify-content:flex-end}.wp-block-page-list .open-on-click:focus-within>.wp-block-navigation__submenu-container{height:auto;min-width:200px;opacity:1;visibility:visible;width:auto}.wp-block-page-list__loading-indicator-container{padding:8px 12px}

View File

@ -7,16 +7,15 @@
"description": "Start with the basic building block of all narrative.", "description": "Start with the basic building block of all narrative.",
"keywords": [ "text" ], "keywords": [ "text" ],
"textdomain": "default", "textdomain": "default",
"usesContext": [ "postId" ], "usesContext": [ "postId", "pattern/overrides" ],
"attributes": { "attributes": {
"align": { "align": {
"type": "string" "type": "string"
}, },
"content": { "content": {
"type": "string", "type": "rich-text",
"source": "html", "source": "rich-text",
"selector": "p", "selector": "p",
"default": "",
"__experimentalRole": "content" "__experimentalRole": "content"
}, },
"dropCap": { "dropCap": {
@ -42,7 +41,6 @@
"text": true "text": true
} }
}, },
"__experimentalConnections": true,
"spacing": { "spacing": {
"margin": true, "margin": true,
"padding": true, "padding": true,

View File

@ -27,6 +27,8 @@ function register_block_core_pattern() {
* @return string Returns the output of the pattern. * @return string Returns the output of the pattern.
*/ */
function render_block_core_pattern( $attributes ) { function render_block_core_pattern( $attributes ) {
static $seen_refs = array();
if ( empty( $attributes['slug'] ) ) { if ( empty( $attributes['slug'] ) ) {
return ''; return '';
} }
@ -38,6 +40,17 @@ function render_block_core_pattern( $attributes ) {
return ''; return '';
} }
if ( isset( $seen_refs[ $attributes['slug'] ] ) ) {
// WP_DEBUG_DISPLAY must only be honored when WP_DEBUG. This precedent
// is set in `wp_debug_mode()`.
$is_debug = WP_DEBUG && WP_DEBUG_DISPLAY;
return $is_debug ?
// translators: Visible only in the front end, this warning takes the place of a faulty block. %s represents a pattern's slug.
sprintf( __( '[block rendering halted for pattern "%s"]' ), $slug ) :
'';
}
$pattern = $registry->get_registered( $slug ); $pattern = $registry->get_registered( $slug );
$content = $pattern['content']; $content = $pattern['content'];
@ -48,7 +61,15 @@ function render_block_core_pattern( $attributes ) {
$content = gutenberg_serialize_blocks( $blocks ); $content = gutenberg_serialize_blocks( $blocks );
} }
return do_blocks( $content ); $seen_refs[ $attributes['slug'] ] = true;
$content = do_blocks( $content );
global $wp_embed;
$content = $wp_embed->autoembed( $content );
unset( $seen_refs[ $attributes['slug'] ] );
return $content;
} }
add_action( 'init', 'register_block_core_pattern' ); add_action( 'init', 'register_block_core_pattern' );

View File

@ -7,7 +7,8 @@
"description": "Show a block pattern.", "description": "Show a block pattern.",
"supports": { "supports": {
"html": false, "html": false,
"inserter": false "inserter": false,
"renaming": false
}, },
"textdomain": "default", "textdomain": "default",
"attributes": { "attributes": {

View File

@ -54,9 +54,40 @@ function render_block_core_post_featured_image( $attributes, $content, $block )
} }
$featured_image = get_the_post_thumbnail( $post_ID, $size_slug, $attr ); $featured_image = get_the_post_thumbnail( $post_ID, $size_slug, $attr );
// Get the first image from the post.
if ( $attributes['useFirstImageFromPost'] && ! $featured_image ) {
$content_post = get_post( $post_ID );
$content = $content_post->post_content;
$processor = new WP_HTML_Tag_Processor( $content );
/*
* Transfer the image tag from the post into a new text snippet.
* Because the HTML API doesn't currently expose a way to extract
* HTML substrings this is necessary as a workaround. Of note, this
* is different than directly extracting the IMG tag:
* - If there are duplicate attributes in the source there will only be one in the output.
* - If there are single-quoted or unquoted attributes they will be double-quoted in the output.
* - If there are named character references in the attribute values they may be replaced with their direct code points. E.g. `&hellip;` becomes `…`.
* In the future there will likely be a mechanism to copy snippets of HTML from
* one document into another, via the HTML Processor's `get_outer_html()` or
* equivalent. When that happens it would be appropriate to replace this custom
* code with that canonical code.
*/
if ( $processor->next_tag( 'img' ) ) {
$tag_html = new WP_HTML_Tag_Processor( '<img>' );
$tag_html->next_tag();
foreach ( $processor->get_attribute_names_with_prefix( '' ) as $name ) {
$tag_html->set_attribute( $name, $processor->get_attribute( $name ) );
}
$featured_image = $tag_html->get_updated_html();
}
}
if ( ! $featured_image ) { if ( ! $featured_image ) {
return ''; return '';
} }
if ( $is_link ) { if ( $is_link ) {
$link_target = $attributes['linkTarget']; $link_target = $attributes['linkTarget'];
$rel = ! empty( $attributes['rel'] ) ? 'rel="' . esc_attr( $attributes['rel'] ) . '"' : ''; $rel = ! empty( $attributes['rel'] ) ? 'rel="' . esc_attr( $attributes['rel'] ) . '"' : '';

View File

@ -51,6 +51,10 @@
}, },
"customGradient": { "customGradient": {
"type": "string" "type": "string"
},
"useFirstImageFromPost": {
"type": "boolean",
"default": false
} }
}, },
"usesContext": [ "postId", "postType", "queryId" ], "usesContext": [ "postId", "postType", "queryId" ],

View File

@ -66,6 +66,13 @@
min-width:48px; min-width:48px;
width:100%; width:100%;
} }
.wp-block-post-featured-image>a{
cursor:default;
}
.wp-block-post-featured-image.is-selected .components-placeholder.has-illustration .components-button,.wp-block-post-featured-image.is-selected .components-placeholder.has-illustration .components-placeholder__instructions,.wp-block-post-featured-image.is-selected .components-placeholder.has-illustration .components-placeholder__label{
opacity:1;
pointer-events:auto;
}
div[data-type="core/post-featured-image"] img{ div[data-type="core/post-featured-image"] img{
display:block; display:block;

View File

@ -1 +1 @@
.wp-block-post-featured-image .block-editor-media-placeholder{-webkit-backdrop-filter:none;backdrop-filter:none;z-index:1}.wp-block-post-featured-image .components-placeholder,.wp-block-post-featured-image .wp-block-post-featured-image__placeholder{align-items:center;display:flex;justify-content:center;min-height:200px;padding:0}.wp-block-post-featured-image .components-placeholder .components-form-file-upload,.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-form-file-upload{display:none}.wp-block-post-featured-image .components-placeholder .components-button,.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button{align-items:center;background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-radius:50%;border-style:solid;color:#fff;display:flex;height:48px;justify-content:center;padding:0;position:relative;width:48px}.wp-block-post-featured-image .components-placeholder .components-button>svg,.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button>svg{color:inherit}.wp-block-post-featured-image .components-placeholder:where(.has-border-color),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where(.has-border-color),.wp-block-post-featured-image img:where(.has-border-color){border-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-top-color]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-top-color]),.wp-block-post-featured-image img:where([style*=border-top-color]){border-top-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-right-color]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-right-color]),.wp-block-post-featured-image img:where([style*=border-right-color]){border-left-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-bottom-color]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-bottom-color]),.wp-block-post-featured-image img:where([style*=border-bottom-color]){border-bottom-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-left-color]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-left-color]),.wp-block-post-featured-image img:where([style*=border-left-color]){border-right-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-width]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-width]),.wp-block-post-featured-image img:where([style*=border-width]){border-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-top-width]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-top-width]),.wp-block-post-featured-image img:where([style*=border-top-width]){border-top-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-right-width]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-right-width]),.wp-block-post-featured-image img:where([style*=border-right-width]){border-left-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-bottom-width]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-bottom-width]),.wp-block-post-featured-image img:where([style*=border-bottom-width]){border-bottom-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-left-width]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-left-width]),.wp-block-post-featured-image img:where([style*=border-left-width]){border-right-style:solid}.wp-block-post-featured-image[style*=height] .components-placeholder{height:100%;min-height:48px;min-width:48px;width:100%}div[data-type="core/post-featured-image"] img{display:block;height:auto;max-width:100%} .wp-block-post-featured-image .block-editor-media-placeholder{-webkit-backdrop-filter:none;backdrop-filter:none;z-index:1}.wp-block-post-featured-image .components-placeholder,.wp-block-post-featured-image .wp-block-post-featured-image__placeholder{align-items:center;display:flex;justify-content:center;min-height:200px;padding:0}.wp-block-post-featured-image .components-placeholder .components-form-file-upload,.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-form-file-upload{display:none}.wp-block-post-featured-image .components-placeholder .components-button,.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button{align-items:center;background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-radius:50%;border-style:solid;color:#fff;display:flex;height:48px;justify-content:center;padding:0;position:relative;width:48px}.wp-block-post-featured-image .components-placeholder .components-button>svg,.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button>svg{color:inherit}.wp-block-post-featured-image .components-placeholder:where(.has-border-color),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where(.has-border-color),.wp-block-post-featured-image img:where(.has-border-color){border-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-top-color]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-top-color]),.wp-block-post-featured-image img:where([style*=border-top-color]){border-top-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-right-color]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-right-color]),.wp-block-post-featured-image img:where([style*=border-right-color]){border-left-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-bottom-color]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-bottom-color]),.wp-block-post-featured-image img:where([style*=border-bottom-color]){border-bottom-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-left-color]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-left-color]),.wp-block-post-featured-image img:where([style*=border-left-color]){border-right-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-width]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-width]),.wp-block-post-featured-image img:where([style*=border-width]){border-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-top-width]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-top-width]),.wp-block-post-featured-image img:where([style*=border-top-width]){border-top-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-right-width]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-right-width]),.wp-block-post-featured-image img:where([style*=border-right-width]){border-left-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-bottom-width]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-bottom-width]),.wp-block-post-featured-image img:where([style*=border-bottom-width]){border-bottom-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-left-width]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-left-width]),.wp-block-post-featured-image img:where([style*=border-left-width]){border-right-style:solid}.wp-block-post-featured-image[style*=height] .components-placeholder{height:100%;min-height:48px;min-width:48px;width:100%}.wp-block-post-featured-image>a{cursor:default}.wp-block-post-featured-image.is-selected .components-placeholder.has-illustration .components-button,.wp-block-post-featured-image.is-selected .components-placeholder.has-illustration .components-placeholder__instructions,.wp-block-post-featured-image.is-selected .components-placeholder.has-illustration .components-placeholder__label{opacity:1;pointer-events:auto}div[data-type="core/post-featured-image"] img{display:block;height:auto;max-width:100%}

View File

@ -66,6 +66,13 @@
min-width:48px; min-width:48px;
width:100%; width:100%;
} }
.wp-block-post-featured-image>a{
cursor:default;
}
.wp-block-post-featured-image.is-selected .components-placeholder.has-illustration .components-button,.wp-block-post-featured-image.is-selected .components-placeholder.has-illustration .components-placeholder__instructions,.wp-block-post-featured-image.is-selected .components-placeholder.has-illustration .components-placeholder__label{
opacity:1;
pointer-events:auto;
}
div[data-type="core/post-featured-image"] img{ div[data-type="core/post-featured-image"] img{
display:block; display:block;

View File

@ -1 +1 @@
.wp-block-post-featured-image .block-editor-media-placeholder{-webkit-backdrop-filter:none;backdrop-filter:none;z-index:1}.wp-block-post-featured-image .components-placeholder,.wp-block-post-featured-image .wp-block-post-featured-image__placeholder{align-items:center;display:flex;justify-content:center;min-height:200px;padding:0}.wp-block-post-featured-image .components-placeholder .components-form-file-upload,.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-form-file-upload{display:none}.wp-block-post-featured-image .components-placeholder .components-button,.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button{align-items:center;background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-radius:50%;border-style:solid;color:#fff;display:flex;height:48px;justify-content:center;padding:0;position:relative;width:48px}.wp-block-post-featured-image .components-placeholder .components-button>svg,.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button>svg{color:inherit}.wp-block-post-featured-image .components-placeholder:where(.has-border-color),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where(.has-border-color),.wp-block-post-featured-image img:where(.has-border-color){border-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-top-color]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-top-color]),.wp-block-post-featured-image img:where([style*=border-top-color]){border-top-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-right-color]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-right-color]),.wp-block-post-featured-image img:where([style*=border-right-color]){border-right-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-bottom-color]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-bottom-color]),.wp-block-post-featured-image img:where([style*=border-bottom-color]){border-bottom-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-left-color]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-left-color]),.wp-block-post-featured-image img:where([style*=border-left-color]){border-left-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-width]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-width]),.wp-block-post-featured-image img:where([style*=border-width]){border-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-top-width]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-top-width]),.wp-block-post-featured-image img:where([style*=border-top-width]){border-top-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-right-width]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-right-width]),.wp-block-post-featured-image img:where([style*=border-right-width]){border-right-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-bottom-width]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-bottom-width]),.wp-block-post-featured-image img:where([style*=border-bottom-width]){border-bottom-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-left-width]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-left-width]),.wp-block-post-featured-image img:where([style*=border-left-width]){border-left-style:solid}.wp-block-post-featured-image[style*=height] .components-placeholder{height:100%;min-height:48px;min-width:48px;width:100%}div[data-type="core/post-featured-image"] img{display:block;height:auto;max-width:100%} .wp-block-post-featured-image .block-editor-media-placeholder{-webkit-backdrop-filter:none;backdrop-filter:none;z-index:1}.wp-block-post-featured-image .components-placeholder,.wp-block-post-featured-image .wp-block-post-featured-image__placeholder{align-items:center;display:flex;justify-content:center;min-height:200px;padding:0}.wp-block-post-featured-image .components-placeholder .components-form-file-upload,.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-form-file-upload{display:none}.wp-block-post-featured-image .components-placeholder .components-button,.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button{align-items:center;background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-radius:50%;border-style:solid;color:#fff;display:flex;height:48px;justify-content:center;padding:0;position:relative;width:48px}.wp-block-post-featured-image .components-placeholder .components-button>svg,.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button>svg{color:inherit}.wp-block-post-featured-image .components-placeholder:where(.has-border-color),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where(.has-border-color),.wp-block-post-featured-image img:where(.has-border-color){border-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-top-color]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-top-color]),.wp-block-post-featured-image img:where([style*=border-top-color]){border-top-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-right-color]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-right-color]),.wp-block-post-featured-image img:where([style*=border-right-color]){border-right-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-bottom-color]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-bottom-color]),.wp-block-post-featured-image img:where([style*=border-bottom-color]){border-bottom-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-left-color]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-left-color]),.wp-block-post-featured-image img:where([style*=border-left-color]){border-left-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-width]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-width]),.wp-block-post-featured-image img:where([style*=border-width]){border-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-top-width]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-top-width]),.wp-block-post-featured-image img:where([style*=border-top-width]){border-top-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-right-width]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-right-width]),.wp-block-post-featured-image img:where([style*=border-right-width]){border-right-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-bottom-width]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-bottom-width]),.wp-block-post-featured-image img:where([style*=border-bottom-width]){border-bottom-style:solid}.wp-block-post-featured-image .components-placeholder:where([style*=border-left-width]),.wp-block-post-featured-image .wp-block-post-featured-image__placeholder:where([style*=border-left-width]),.wp-block-post-featured-image img:where([style*=border-left-width]){border-left-style:solid}.wp-block-post-featured-image[style*=height] .components-placeholder{height:100%;min-height:48px;min-width:48px;width:100%}.wp-block-post-featured-image>a{cursor:default}.wp-block-post-featured-image.is-selected .components-placeholder.has-illustration .components-button,.wp-block-post-featured-image.is-selected .components-placeholder.has-illustration .components-placeholder__instructions,.wp-block-post-featured-image.is-selected .components-placeholder.has-illustration .components-placeholder__label{opacity:1;pointer-events:auto}div[data-type="core/post-featured-image"] img{display:block;height:auto;max-width:100%}

View File

@ -99,10 +99,24 @@ function render_block_core_post_navigation_link( $attributes, $content ) {
} }
} }
// The dynamic portion of the function name, `$navigation_type`, $in_same_term = isset( $attributes['inSameTerm'] ) ? $attributes['inSameTerm'] : false;
// refers to the type of adjacency, 'next' or 'previous'. $taxonomy = isset( $attributes['taxonomy'] ) && $in_same_term ? $attributes['taxonomy'] : '';
/**
* The dynamic portion of the function name, `$navigation_type`,
* Refers to the type of adjacency, 'next' or 'previous'.
*
* @See https://developer.wordpress.org/reference/functions/get_previous_post_link/
* @See https://developer.wordpress.org/reference/functions/get_next_post_link/
*/
$get_link_function = "get_{$navigation_type}_post_link"; $get_link_function = "get_{$navigation_type}_post_link";
$content = $get_link_function( $format, $link );
if ( $in_same_term ) {
$content = $get_link_function( $format, $link, $in_same_term, '', $taxonomy );
} else {
$content = $get_link_function( $format, $link );
}
return sprintf( return sprintf(
'<div %1$s>%2$s</div>', '<div %1$s>%2$s</div>',
$wrapper_attributes, $wrapper_attributes,

Some files were not shown because too many files have changed in this diff Show More