mirror of
git://develop.git.wordpress.org/
synced 2025-04-13 08:32:10 +02:00
Block Editor: Update the WordPress Packages based on Gutenberg 11.9 RC1.
This brings the JS packages up to date and is the first step that will allow us to include the other block editor updates for WordPress 5.9: FSE infrastrucutre, site editor and global styles. Props noisysocks. See #54337. git-svn-id: https://develop.svn.wordpress.org/trunk@52042 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
7bbee20833
commit
fdb2dacc19
27
Gruntfile.js
27
Gruntfile.js
@ -1549,6 +1549,9 @@ module.exports = function(grunt) {
|
||||
* @ticket 46218
|
||||
*/
|
||||
grunt.registerTask( 'verify:source-maps', function() {
|
||||
const ignoredFiles = [
|
||||
'build/wp-includes/js/dist/components.js'
|
||||
];
|
||||
const files = buildFiles.reduce( ( acc, path ) => {
|
||||
// Skip excluded paths and any path that isn't a file.
|
||||
if ( '!' === path[0] || '**' !== path.substr( -2 ) ) {
|
||||
@ -1563,18 +1566,20 @@ module.exports = function(grunt) {
|
||||
'No JavaScript files found in the build directory.'
|
||||
);
|
||||
|
||||
files.forEach( function( file ) {
|
||||
const contents = fs.readFileSync( file, {
|
||||
encoding: 'utf8',
|
||||
} );
|
||||
// `data:` URLs are allowed:
|
||||
const match = contents.match( /sourceMappingURL=((?!data:).)/ );
|
||||
files
|
||||
.filter(file => ! ignoredFiles.includes( file) )
|
||||
.forEach( function( file ) {
|
||||
const contents = fs.readFileSync( file, {
|
||||
encoding: 'utf8',
|
||||
} );
|
||||
// `data:` URLs are allowed:
|
||||
const match = contents.match( /sourceMappingURL=((?!data:).)/ );
|
||||
|
||||
assert(
|
||||
match === null,
|
||||
`The ${ file } file must not contain a sourceMappingURL.`
|
||||
);
|
||||
} );
|
||||
assert(
|
||||
match === null,
|
||||
`The ${ file } file must not contain a sourceMappingURL.`
|
||||
);
|
||||
} );
|
||||
} );
|
||||
|
||||
grunt.registerTask( 'build', function() {
|
||||
|
7316
package-lock.json
generated
7316
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
116
package.json
116
package.json
@ -24,12 +24,12 @@
|
||||
"last 2 Opera versions"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@wordpress/babel-preset-default": "6.2.1",
|
||||
"@wordpress/custom-templated-path-webpack-plugin": "2.0.5",
|
||||
"@wordpress/dependency-extraction-webpack-plugin": "3.1.4",
|
||||
"@wordpress/e2e-test-utils": "5.4.3",
|
||||
"@wordpress/library-export-default-webpack-plugin": "2.0.5",
|
||||
"@wordpress/scripts": "16.1.5",
|
||||
"@wordpress/babel-preset-default": "6.3.4",
|
||||
"@wordpress/custom-templated-path-webpack-plugin": "2.1.0",
|
||||
"@wordpress/dependency-extraction-webpack-plugin": "3.2.1",
|
||||
"@wordpress/e2e-test-utils": "5.4.6",
|
||||
"@wordpress/library-export-default-webpack-plugin": "2.2.0",
|
||||
"@wordpress/scripts": "19.1.0",
|
||||
"autoprefixer": "^9.8.6",
|
||||
"chalk": "4.1.1",
|
||||
"check-node-version": "4.1.0",
|
||||
@ -78,58 +78,58 @@
|
||||
"webpack-livereload-plugin": "2.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@wordpress/a11y": "3.1.2",
|
||||
"@wordpress/annotations": "2.1.6",
|
||||
"@wordpress/api-fetch": "5.1.2",
|
||||
"@wordpress/autop": "3.1.2",
|
||||
"@wordpress/blob": "3.1.2",
|
||||
"@wordpress/block-directory": "2.1.21",
|
||||
"@wordpress/block-editor": "6.1.14",
|
||||
"@wordpress/block-library": "3.2.19",
|
||||
"@wordpress/block-serialization-default-parser": "4.1.2",
|
||||
"@wordpress/blocks": "9.1.8",
|
||||
"@wordpress/components": "14.1.11",
|
||||
"@wordpress/compose": "4.1.6",
|
||||
"@wordpress/core-data": "3.1.12",
|
||||
"@wordpress/customize-widgets": "1.0.20",
|
||||
"@wordpress/data": "5.1.6",
|
||||
"@wordpress/data-controls": "2.1.6",
|
||||
"@wordpress/date": "4.1.2",
|
||||
"@wordpress/deprecated": "3.1.2",
|
||||
"@wordpress/dom": "3.1.5",
|
||||
"@wordpress/dom-ready": "3.1.2",
|
||||
"@wordpress/edit-post": "4.1.21",
|
||||
"@wordpress/edit-widgets": "2.1.21",
|
||||
"@wordpress/editor": "10.1.17",
|
||||
"@wordpress/element": "3.1.2",
|
||||
"@wordpress/escape-html": "2.1.2",
|
||||
"@wordpress/format-library": "2.1.14",
|
||||
"@wordpress/hooks": "3.1.1",
|
||||
"@wordpress/html-entities": "3.1.2",
|
||||
"@wordpress/i18n": "4.1.2",
|
||||
"@wordpress/icons": "4.0.3",
|
||||
"@wordpress/interface": "3.1.12",
|
||||
"@wordpress/is-shallow-equal": "4.1.1",
|
||||
"@wordpress/keyboard-shortcuts": "2.1.7",
|
||||
"@wordpress/keycodes": "3.1.2",
|
||||
"@wordpress/list-reusable-blocks": "2.1.11",
|
||||
"@wordpress/media-utils": "2.1.2",
|
||||
"@wordpress/notices": "3.1.6",
|
||||
"@wordpress/nux": "4.1.11",
|
||||
"@wordpress/plugins": "3.1.6",
|
||||
"@wordpress/primitives": "2.1.2",
|
||||
"@wordpress/priority-queue": "2.1.2",
|
||||
"@wordpress/redux-routine": "4.1.2",
|
||||
"@wordpress/reusable-blocks": "2.1.17",
|
||||
"@wordpress/rich-text": "4.1.6",
|
||||
"@wordpress/server-side-render": "2.1.12",
|
||||
"@wordpress/shortcode": "3.1.2",
|
||||
"@wordpress/token-list": "2.1.1",
|
||||
"@wordpress/url": "3.1.2",
|
||||
"@wordpress/viewport": "3.1.6",
|
||||
"@wordpress/warning": "2.1.2",
|
||||
"@wordpress/widgets": "1.1.19",
|
||||
"@wordpress/wordcount": "3.1.2",
|
||||
"@wordpress/a11y": "3.2.3",
|
||||
"@wordpress/annotations": "2.2.6",
|
||||
"@wordpress/api-fetch": "5.2.5",
|
||||
"@wordpress/autop": "3.2.2",
|
||||
"@wordpress/blob": "3.2.1",
|
||||
"@wordpress/block-directory": "3.0.5",
|
||||
"@wordpress/block-editor": "8.0.0",
|
||||
"@wordpress/block-library": "6.0.3",
|
||||
"@wordpress/block-serialization-default-parser": "4.2.2",
|
||||
"@wordpress/blocks": "11.1.3",
|
||||
"@wordpress/components": "19.0.1",
|
||||
"@wordpress/compose": "5.0.5",
|
||||
"@wordpress/core-data": "4.0.5",
|
||||
"@wordpress/customize-widgets": "2.0.5",
|
||||
"@wordpress/data": "6.1.3",
|
||||
"@wordpress/data-controls": "2.2.6",
|
||||
"@wordpress/date": "4.2.2",
|
||||
"@wordpress/deprecated": "3.2.2",
|
||||
"@wordpress/dom": "3.2.6",
|
||||
"@wordpress/dom-ready": "3.2.2",
|
||||
"@wordpress/edit-post": "5.0.5",
|
||||
"@wordpress/edit-widgets": "3.1.0",
|
||||
"@wordpress/editor": "12.0.2",
|
||||
"@wordpress/element": "4.0.3",
|
||||
"@wordpress/escape-html": "2.2.2",
|
||||
"@wordpress/format-library": "3.0.5",
|
||||
"@wordpress/hooks": "3.2.1",
|
||||
"@wordpress/html-entities": "3.2.2",
|
||||
"@wordpress/i18n": "4.2.3",
|
||||
"@wordpress/icons": "6.1.0",
|
||||
"@wordpress/interface": "4.1.3",
|
||||
"@wordpress/is-shallow-equal": "4.2.0",
|
||||
"@wordpress/keyboard-shortcuts": "3.0.5",
|
||||
"@wordpress/keycodes": "3.2.3",
|
||||
"@wordpress/list-reusable-blocks": "3.0.5",
|
||||
"@wordpress/media-utils": "3.0.4",
|
||||
"@wordpress/notices": "3.2.6",
|
||||
"@wordpress/nux": "5.0.5",
|
||||
"@wordpress/plugins": "4.0.5",
|
||||
"@wordpress/primitives": "3.0.3",
|
||||
"@wordpress/priority-queue": "2.2.2",
|
||||
"@wordpress/redux-routine": "4.2.1",
|
||||
"@wordpress/reusable-blocks": "3.0.5",
|
||||
"@wordpress/rich-text": "5.0.5",
|
||||
"@wordpress/server-side-render": "3.0.5",
|
||||
"@wordpress/shortcode": "3.2.2",
|
||||
"@wordpress/token-list": "2.2.1",
|
||||
"@wordpress/url": "3.3.0",
|
||||
"@wordpress/viewport": "4.0.5",
|
||||
"@wordpress/warning": "2.2.2",
|
||||
"@wordpress/widgets": "2.0.5",
|
||||
"@wordpress/wordcount": "3.2.2",
|
||||
"backbone": "1.4.0",
|
||||
"clipboard": "2.0.8",
|
||||
"core-js-url-browser": "3.6.4",
|
||||
|
File diff suppressed because one or more lines are too long
@ -187,10 +187,22 @@ function get_default_block_editor_settings() {
|
||||
}
|
||||
}
|
||||
|
||||
// These styles are used if the "no theme styles" options is triggered or on
|
||||
// themes without their own editor styles.
|
||||
$default_editor_styles_file = ABSPATH . WPINC . '/css/dist/block-editor/default-editor-styles.css';
|
||||
if ( file_exists( $default_editor_styles_file ) ) {
|
||||
$default_editor_styles = array(
|
||||
array( 'css' => file_get_contents( $default_editor_styles_file ) ),
|
||||
);
|
||||
} else {
|
||||
$default_editor_styles = array();
|
||||
}
|
||||
|
||||
$editor_settings = array(
|
||||
'alignWide' => get_theme_support( 'align-wide' ),
|
||||
'allowedBlockTypes' => true,
|
||||
'allowedMimeTypes' => get_allowed_mime_types(),
|
||||
'defaultEditorStyles' => $default_editor_styles,
|
||||
'blockCategories' => get_default_block_categories(),
|
||||
'disableCustomColors' => get_theme_support( 'disable-custom-colors' ),
|
||||
'disableCustomFontSizes' => get_theme_support( 'disable-custom-font-sizes' ),
|
||||
@ -464,22 +476,12 @@ function block_editor_rest_api_preload( array $preload_paths, $block_editor_cont
|
||||
*
|
||||
* @global array $editor_styles
|
||||
*
|
||||
* @return array An array of theme styles for the block editor. Includes default font family
|
||||
* style and theme stylesheets.
|
||||
* @return array An array of theme styles for the block editor.
|
||||
*/
|
||||
function get_block_editor_theme_styles() {
|
||||
global $editor_styles;
|
||||
|
||||
if ( ! WP_Theme_JSON_Resolver::theme_has_support() ) {
|
||||
$styles = array(
|
||||
array(
|
||||
'css' => 'body { font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif }',
|
||||
'__unstableType' => 'core',
|
||||
),
|
||||
);
|
||||
} else {
|
||||
$styles = array();
|
||||
}
|
||||
$styles = array();
|
||||
|
||||
if ( $editor_styles && current_theme_supports( 'editor-styles' ) ) {
|
||||
foreach ( $editor_styles as $style ) {
|
||||
|
@ -40,6 +40,10 @@ function render_block_core_archives( $attributes ) {
|
||||
|
||||
$archives = wp_get_archives( $dropdown_args );
|
||||
|
||||
$classnames = esc_attr( $class );
|
||||
|
||||
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) );
|
||||
|
||||
switch ( $dropdown_args['type'] ) {
|
||||
case 'yearly':
|
||||
$label = __( 'Select Year' );
|
||||
@ -60,13 +64,13 @@ function render_block_core_archives( $attributes ) {
|
||||
|
||||
$label = esc_html( $label );
|
||||
|
||||
$block_content = '<label class="screen-reader-text" for="' . $dropdown_id . '">' . $title . '</label>
|
||||
$block_content = '<label for="' . $dropdown_id . '">' . $title . '</label>
|
||||
<select id="' . $dropdown_id . '" name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;">
|
||||
<option value="">' . $label . '</option>' . $archives . '</select>';
|
||||
|
||||
return sprintf(
|
||||
'<div class="%1$s">%2$s</div>',
|
||||
esc_attr( $class ),
|
||||
'<div %1$s>%2$s</div>',
|
||||
$wrapper_attributes,
|
||||
$block_content
|
||||
);
|
||||
}
|
||||
|
@ -63,9 +63,19 @@
|
||||
},
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
"__experimentalFontFamily": true
|
||||
"__experimentalFontFamily": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"reusable": false,
|
||||
"spacing": {
|
||||
"__experimentalSkipSerialization": true,
|
||||
"padding": [ "horizontal", "vertical" ],
|
||||
"__experimentalDefaultControls": {
|
||||
"padding": true
|
||||
}
|
||||
},
|
||||
"__experimentalBorder": {
|
||||
"radius": true,
|
||||
"__experimentalSkipSerialization": true
|
||||
|
@ -6,18 +6,24 @@
|
||||
"description": "Prompt visitors to take action with a group of button-style links.",
|
||||
"keywords": [ "link" ],
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
"contentJustification": {
|
||||
"type": "string"
|
||||
},
|
||||
"orientation": {
|
||||
"type": "string",
|
||||
"default": "horizontal"
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
"anchor": true,
|
||||
"align": [ "wide", "full" ]
|
||||
"align": [ "wide", "full" ],
|
||||
"__experimentalExposeControlsToChildren": true,
|
||||
"spacing": {
|
||||
"blockGap": true,
|
||||
"margin": ["top", "bottom" ],
|
||||
"__experimentalDefaultControls": {
|
||||
"blockGap": true
|
||||
}
|
||||
},
|
||||
"__experimentalLayout": {
|
||||
"allowSwitching": false,
|
||||
"allowInheriting": false,
|
||||
"default": {
|
||||
"type": "flex"
|
||||
}
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-buttons-editor",
|
||||
"style": "wp-block-buttons"
|
||||
|
@ -15,6 +15,15 @@
|
||||
function render_block_core_calendar( $attributes ) {
|
||||
global $monthnum, $year;
|
||||
|
||||
// Calendar shouldn't be rendered
|
||||
// when there are no published posts on the site.
|
||||
if ( ! block_core_calendar_has_published_posts() ) {
|
||||
if ( is_user_logged_in() ) {
|
||||
return '<div>' . __( 'The calendar block is hidden because there are no published posts.', 'gutenberg' ) . '</div>';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
$previous_monthnum = $monthnum;
|
||||
$previous_year = $year;
|
||||
|
||||
@ -59,3 +68,86 @@ function register_block_core_calendar() {
|
||||
}
|
||||
|
||||
add_action( 'init', 'register_block_core_calendar' );
|
||||
|
||||
/**
|
||||
* Returns whether or not there are any published posts.
|
||||
*
|
||||
* Used to hide the calendar block when there are no published posts.
|
||||
* This compensates for a known Core bug: https://core.trac.wordpress.org/ticket/12016
|
||||
*
|
||||
* @return bool Has any published posts or not.
|
||||
*/
|
||||
function block_core_calendar_has_published_posts() {
|
||||
// Multisite already has an option that stores the count of the published posts.
|
||||
// Let's use that for multisites.
|
||||
if ( is_multisite() ) {
|
||||
return 0 < (int) get_option( 'post_count' );
|
||||
}
|
||||
|
||||
// On single sites we try our own cached option first.
|
||||
$has_published_posts = get_option( 'gutenberg_calendar_block_has_published_posts', null );
|
||||
if ( null !== $has_published_posts ) {
|
||||
return (bool) $has_published_posts;
|
||||
}
|
||||
|
||||
// No cache hit, let's update the cache and return the cached value.
|
||||
return block_core_calendar_update_has_published_posts();
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries the database for any published post and saves
|
||||
* a flag whether any published post exists or not.
|
||||
*
|
||||
* @return bool Has any published posts or not.
|
||||
*/
|
||||
function block_core_calendar_update_has_published_posts() {
|
||||
global $wpdb;
|
||||
$has_published_posts = (bool) $wpdb->get_var( "SELECT 1 as test FROM {$wpdb->posts} WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1" );
|
||||
update_option( 'gutenberg_calendar_block_has_published_posts', $has_published_posts );
|
||||
return $has_published_posts;
|
||||
}
|
||||
|
||||
// We only want to register these functions and actions when
|
||||
// we are on single sites. On multi sites we use `post_count` option.
|
||||
if ( ! is_multisite() ) {
|
||||
/**
|
||||
* Handler for updating the has published posts flag when a post is deleted.
|
||||
*
|
||||
* @param int $post_id Deleted post ID.
|
||||
*/
|
||||
function block_core_calendar_update_has_published_post_on_delete( $post_id ) {
|
||||
$post = get_post( $post_id );
|
||||
|
||||
if ( ! $post || 'publish' !== $post->post_status || 'post' !== $post->post_type ) {
|
||||
return;
|
||||
}
|
||||
|
||||
block_core_calendar_update_has_published_posts();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for updating the has published posts flag when a post status changes.
|
||||
*
|
||||
* @param string $new_status The status the post is changing to.
|
||||
* @param string $old_status The status the post is changing from.
|
||||
* @param WP_Post $post Post object.
|
||||
*/
|
||||
function block_core_calendar_update_has_published_post_on_transition_post_status( $new_status, $old_status, $post ) {
|
||||
if ( $new_status === $old_status ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'post' !== get_post_type( $post ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'publish' !== $new_status && 'publish' !== $old_status ) {
|
||||
return;
|
||||
}
|
||||
|
||||
block_core_calendar_update_has_published_posts();
|
||||
}
|
||||
|
||||
add_action( 'delete_post', 'block_core_calendar_update_has_published_post_on_delete' );
|
||||
add_action( 'transition_post_status', 'block_core_calendar_update_has_published_post_on_transition_post_status', 10, 3 );
|
||||
}
|
||||
|
@ -23,6 +23,9 @@ function render_block_core_categories( $attributes ) {
|
||||
'show_count' => ! empty( $attributes['showPostCounts'] ),
|
||||
'title_li' => '',
|
||||
);
|
||||
if ( ! empty( $attributes['showOnlyTopLevel'] ) && $attributes['showOnlyTopLevel'] ) {
|
||||
$args['parent'] = 0;
|
||||
}
|
||||
|
||||
if ( ! empty( $attributes['displayAsDropdown'] ) ) {
|
||||
$id = 'wp-block-categories-' . $block_id;
|
||||
|
@ -17,6 +17,10 @@
|
||||
"showPostCounts": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"showOnlyTopLevel": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
|
@ -14,8 +14,32 @@
|
||||
},
|
||||
"supports": {
|
||||
"anchor": true,
|
||||
"__experimentalSelector": ".wp-block-code > code",
|
||||
"typography": {
|
||||
"fontSize": true
|
||||
"fontSize": true,
|
||||
"lineHeight": true,
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"spacing": {
|
||||
"margin": [ "top", "bottom" ],
|
||||
"padding": true
|
||||
},
|
||||
"__experimentalBorder": {
|
||||
"radius": true,
|
||||
"color": true,
|
||||
"width": true,
|
||||
"style": true
|
||||
},
|
||||
"color": {
|
||||
"text": true,
|
||||
"background": true,
|
||||
"gradients": true
|
||||
}
|
||||
},
|
||||
"style": "wp-block-code"
|
||||
|
@ -13,7 +13,11 @@
|
||||
"width": {
|
||||
"type": "string"
|
||||
},
|
||||
"allowedBlocks": {
|
||||
"type": "array"
|
||||
},
|
||||
"templateLock": {
|
||||
"type": "string",
|
||||
"enum": [ "all", "insert", false ]
|
||||
}
|
||||
},
|
||||
@ -26,7 +30,10 @@
|
||||
"link": true
|
||||
},
|
||||
"spacing": {
|
||||
"padding": true
|
||||
"padding": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"padding": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,15 @@
|
||||
"name": "core/columns",
|
||||
"title": "Columns",
|
||||
"category": "design",
|
||||
"description": "Add a block that displays content in multiple columns, then add whatever content blocks you’d like.",
|
||||
"description": "Display content in multiple columns, with blocks added to each column.",
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
"verticalAlignment": {
|
||||
"type": "string"
|
||||
},
|
||||
"isStackedOnMobile": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
@ -17,6 +21,14 @@
|
||||
"color": {
|
||||
"gradients": true,
|
||||
"link": true
|
||||
},
|
||||
"spacing": {
|
||||
"blockGap": true,
|
||||
"margin": [ "top", "bottom" ],
|
||||
"padding": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"blockGap": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-columns-editor",
|
||||
|
@ -12,6 +12,13 @@
|
||||
"id": {
|
||||
"type": "number"
|
||||
},
|
||||
"alt": {
|
||||
"type": "string",
|
||||
"source": "attribute",
|
||||
"selector": "img",
|
||||
"attribute": "alt",
|
||||
"default": ""
|
||||
},
|
||||
"hasParallax": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
@ -22,7 +29,7 @@
|
||||
},
|
||||
"dimRatio": {
|
||||
"type": "number",
|
||||
"default": 50
|
||||
"default": 100
|
||||
},
|
||||
"overlayColor": {
|
||||
"type": "string"
|
||||
@ -51,6 +58,17 @@
|
||||
},
|
||||
"contentPosition": {
|
||||
"type": "string"
|
||||
},
|
||||
"isDark": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"allowedBlocks": {
|
||||
"type": "array"
|
||||
},
|
||||
"templateLock": {
|
||||
"type": "string",
|
||||
"enum": [ "all", "insert", false ]
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
@ -58,7 +76,10 @@
|
||||
"align": true,
|
||||
"html": false,
|
||||
"spacing": {
|
||||
"padding": true
|
||||
"padding": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"padding": true
|
||||
}
|
||||
},
|
||||
"color": {
|
||||
"__experimentalDuotone": "> .wp-block-cover__image-background, > .wp-block-cover__video-background",
|
||||
|
@ -3,7 +3,7 @@
|
||||
"name": "core/embed",
|
||||
"title": "Embed",
|
||||
"category": "embed",
|
||||
"description": "Add a block that displays content pulled from other sites, like Twitter, Instagram or YouTube.",
|
||||
"description": "Add a block that displays content pulled from other sites, like Twitter or YouTube.",
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
"url": {
|
||||
|
@ -13,6 +13,12 @@
|
||||
"href": {
|
||||
"type": "string"
|
||||
},
|
||||
"fileId": {
|
||||
"type": "string",
|
||||
"source": "attribute",
|
||||
"selector": "a:not([download])",
|
||||
"attribute": "id"
|
||||
},
|
||||
"fileName": {
|
||||
"type": "string",
|
||||
"source": "html",
|
||||
|
@ -58,6 +58,13 @@
|
||||
},
|
||||
"default": []
|
||||
},
|
||||
"shortCodeTransforms": {
|
||||
"type": "array",
|
||||
"default": [],
|
||||
"items": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"columns": {
|
||||
"type": "number",
|
||||
"minimum": 1,
|
||||
@ -72,14 +79,30 @@
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"fixedHeight": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"linkTarget": {
|
||||
"type": "string"
|
||||
},
|
||||
"linkTo": {
|
||||
"type": "string"
|
||||
},
|
||||
"sizeSlug": {
|
||||
"type": "string",
|
||||
"default": "large"
|
||||
},
|
||||
"allowResize": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
"providesContext": {
|
||||
"allowResize": "allowResize",
|
||||
"imageCrop": "imageCrop",
|
||||
"fixedHeight": "fixedHeight"
|
||||
},
|
||||
"supports": {
|
||||
"anchor": true,
|
||||
"align": true
|
||||
|
@ -12,6 +12,7 @@
|
||||
"default": "div"
|
||||
},
|
||||
"templateLock": {
|
||||
"type": "string",
|
||||
"enum": [ "all", "insert", false ]
|
||||
}
|
||||
},
|
||||
@ -24,7 +25,10 @@
|
||||
"link": true
|
||||
},
|
||||
"spacing": {
|
||||
"padding": true
|
||||
"padding": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"padding": true
|
||||
}
|
||||
},
|
||||
"__experimentalBorder": {
|
||||
"color": true,
|
||||
|
@ -32,13 +32,25 @@
|
||||
"color": {
|
||||
"link": true
|
||||
},
|
||||
"spacing": {
|
||||
"margin": true
|
||||
},
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
"lineHeight": true,
|
||||
"__experimentalFontWeight": true
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true,
|
||||
"fontAppearance": true,
|
||||
"textTransform": true
|
||||
}
|
||||
},
|
||||
"__experimentalSelector": "h1,h2,h3,h4,h5,h6",
|
||||
"__unstablePasteTextInline": true
|
||||
"__unstablePasteTextInline": true,
|
||||
"__experimentalSlashInserter": true
|
||||
},
|
||||
"editorStyle": "wp-block-heading-editor",
|
||||
"style": "wp-block-heading"
|
||||
|
@ -3,6 +3,7 @@
|
||||
"name": "core/image",
|
||||
"title": "Image",
|
||||
"category": "media",
|
||||
"usesContext": [ "allowResize", "imageCrop", "fixedHeight" ],
|
||||
"description": "Insert an image to make a visual statement.",
|
||||
"keywords": [ "img", "photo", "picture" ],
|
||||
"textdomain": "default",
|
||||
|
@ -42,14 +42,15 @@ function wp_latest_comments_draft_or_post_title( $post = 0 ) {
|
||||
*/
|
||||
function render_block_core_latest_comments( $attributes = array() ) {
|
||||
$comments = get_comments(
|
||||
// This filter is documented in wp-includes/widgets/class-wp-widget-recent-comments.php.
|
||||
/** This filter is documented in wp-includes/widgets/class-wp-widget-recent-comments.php */
|
||||
apply_filters(
|
||||
'widget_comments_args',
|
||||
array(
|
||||
'number' => $attributes['commentsToShow'],
|
||||
'status' => 'approve',
|
||||
'post_status' => 'publish',
|
||||
)
|
||||
),
|
||||
array()
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -39,13 +39,23 @@
|
||||
"className": false,
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
"__experimentalFontFamily": true
|
||||
"__experimentalFontFamily": true,
|
||||
"lineHeight": true,
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"color": {
|
||||
"gradients": true
|
||||
"gradients": true,
|
||||
"link": true
|
||||
},
|
||||
"__unstablePasteTextInline": true,
|
||||
"__experimentalSelector": "ol,ul"
|
||||
"__experimentalSelector": "ol,ul",
|
||||
"__experimentalSlashInserter": true
|
||||
},
|
||||
"editorStyle": "wp-block-list-editor",
|
||||
"style": "wp-block-list"
|
||||
|
@ -38,7 +38,7 @@ function render_block_core_loginout( $attributes ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the `core/latest-posts` block on server.
|
||||
* Registers the `core/loginout` block on server.
|
||||
*/
|
||||
function register_block_core_loginout() {
|
||||
register_block_type_from_metadata(
|
||||
|
@ -9,28 +9,34 @@
|
||||
* Build an array with CSS classes and inline styles defining the colors
|
||||
* which will be applied to the pages markup in the front-end when it is a descendant of navigation.
|
||||
*
|
||||
* @param array $context Navigation block context.
|
||||
* @param array $attributes Block attributes.
|
||||
* @param array $context Navigation block context.
|
||||
* @return array Colors CSS classes and inline styles.
|
||||
*/
|
||||
function block_core_page_list_build_css_colors( $context ) {
|
||||
function block_core_page_list_build_css_colors( $attributes, $context ) {
|
||||
$colors = array(
|
||||
'css_classes' => array(),
|
||||
'inline_styles' => '',
|
||||
'css_classes' => array(),
|
||||
'inline_styles' => '',
|
||||
'overlay_css_classes' => array(),
|
||||
'overlay_inline_styles' => '',
|
||||
);
|
||||
|
||||
// Text color.
|
||||
$has_named_text_color = array_key_exists( 'textColor', $context );
|
||||
$has_picked_text_color = array_key_exists( 'customTextColor', $context );
|
||||
$has_custom_text_color = isset( $context['style']['color']['text'] );
|
||||
|
||||
// If has text color.
|
||||
if ( $has_custom_text_color || $has_named_text_color ) {
|
||||
if ( $has_custom_text_color || $has_picked_text_color || $has_named_text_color ) {
|
||||
// Add has-text-color class.
|
||||
$colors['css_classes'][] = 'has-text-color';
|
||||
}
|
||||
|
||||
if ( $has_named_text_color ) {
|
||||
// Add the color class.
|
||||
$colors['css_classes'][] = sprintf( 'has-%s-color', $context['textColor'] );
|
||||
$colors['css_classes'][] = sprintf( 'has-%s-color', gutenberg_experimental_to_kebab_case( $context['textColor'] ) );
|
||||
} elseif ( $has_picked_text_color ) {
|
||||
$colors['inline_styles'] .= sprintf( 'color: %s;', $context['customTextColor'] );
|
||||
} elseif ( $has_custom_text_color ) {
|
||||
// Add the custom color inline style.
|
||||
$colors['inline_styles'] .= sprintf( 'color: %s;', $context['style']['color']['text'] );
|
||||
@ -38,22 +44,56 @@ function block_core_page_list_build_css_colors( $context ) {
|
||||
|
||||
// Background color.
|
||||
$has_named_background_color = array_key_exists( 'backgroundColor', $context );
|
||||
$has_picked_background_color = array_key_exists( 'customBackgroundColor', $context );
|
||||
$has_custom_background_color = isset( $context['style']['color']['background'] );
|
||||
|
||||
// If has background color.
|
||||
if ( $has_custom_background_color || $has_named_background_color ) {
|
||||
if ( $has_custom_background_color || $has_picked_background_color || $has_named_background_color ) {
|
||||
// Add has-background class.
|
||||
$colors['css_classes'][] = 'has-background';
|
||||
}
|
||||
|
||||
if ( $has_named_background_color ) {
|
||||
// Add the background-color class.
|
||||
$colors['css_classes'][] = sprintf( 'has-%s-background-color', $context['backgroundColor'] );
|
||||
$colors['css_classes'][] = sprintf( 'has-%s-background-color', gutenberg_experimental_to_kebab_case( $context['backgroundColor'] ) );
|
||||
} elseif ( $has_picked_background_color ) {
|
||||
$colors['inline_styles'] .= sprintf( 'background-color: %s;', $context['customBackgroundColor'] );
|
||||
} elseif ( $has_custom_background_color ) {
|
||||
// Add the custom background-color inline style.
|
||||
$colors['inline_styles'] .= sprintf( 'background-color: %s;', $context['style']['color']['background'] );
|
||||
}
|
||||
|
||||
// Overlay text color.
|
||||
$has_named_overlay_text_color = array_key_exists( 'overlayTextColor', $context );
|
||||
$has_picked_overlay_text_color = array_key_exists( 'customOverlayTextColor', $context );
|
||||
|
||||
// If it has a text color.
|
||||
if ( $has_named_overlay_text_color || $has_picked_overlay_text_color ) {
|
||||
$colors['overlay_css_classes'][] = 'has-text-color';
|
||||
}
|
||||
|
||||
// Give overlay colors priority, fall back to Navigation block colors, then global styles.
|
||||
if ( $has_named_overlay_text_color ) {
|
||||
$colors['overlay_css_classes'][] = sprintf( 'has-%s-color', gutenberg_experimental_to_kebab_case( $context['overlayTextColor'] ) );
|
||||
} elseif ( $has_picked_overlay_text_color ) {
|
||||
$colors['overlay_inline_styles'] .= sprintf( 'color: %s;', $context['customOverlayTextColor'] );
|
||||
}
|
||||
|
||||
// Overlay background colors.
|
||||
$has_named_overlay_background_color = array_key_exists( 'overlayBackgroundColor', $context );
|
||||
$has_picked_overlay_background_color = array_key_exists( 'customOverlayBackgroundColor', $context );
|
||||
|
||||
// If has background color.
|
||||
if ( $has_named_overlay_background_color || $has_picked_overlay_background_color ) {
|
||||
$colors['overlay_css_classes'][] = 'has-background';
|
||||
}
|
||||
|
||||
if ( $has_named_overlay_background_color ) {
|
||||
$colors['overlay_css_classes'][] = sprintf( 'has-%s-background-color', gutenberg_experimental_to_kebab_case( $context['overlayBackgroundColor'] ) );
|
||||
} elseif ( $has_picked_overlay_background_color ) {
|
||||
$colors['overlay_inline_styles'] .= sprintf( 'background-color: %s;', $context['customOverlayBackgroundColor'] );
|
||||
}
|
||||
|
||||
return $colors;
|
||||
}
|
||||
|
||||
@ -88,28 +128,78 @@ function block_core_page_list_build_css_font_sizes( $context ) {
|
||||
/**
|
||||
* Outputs Page list markup from an array of pages with nested children.
|
||||
*
|
||||
* @param array $nested_pages The array of nested pages.
|
||||
* @param boolean $open_submenus_on_click Whether to open submenus on click instead of hover.
|
||||
* @param boolean $show_submenu_icons Whether to show submenu indicator icons.
|
||||
* @param boolean $is_navigation_child If block is a child of Navigation block.
|
||||
* @param array $nested_pages The array of nested pages.
|
||||
* @param array $active_page_ancestor_ids An array of ancestor ids for active page.
|
||||
* @param array $colors Color information for overlay styles.
|
||||
* @param integer $depth The nesting depth.
|
||||
*
|
||||
* @return string List markup.
|
||||
*/
|
||||
function block_core_page_list_render_nested_page_list( $nested_pages ) {
|
||||
function block_core_page_list_render_nested_page_list( $open_submenus_on_click, $show_submenu_icons, $is_navigation_child, $nested_pages, $active_page_ancestor_ids = array(), $colors = array(), $depth = 0 ) {
|
||||
if ( empty( $nested_pages ) ) {
|
||||
return;
|
||||
}
|
||||
$markup = '';
|
||||
foreach ( (array) $nested_pages as $page ) {
|
||||
$css_class = 'wp-block-pages-list__item';
|
||||
$css_class = $page['is_active'] ? ' current-menu-item' : '';
|
||||
$aria_current = $page['is_active'] ? ' aria-current="page"' : '';
|
||||
$style_attribute = '';
|
||||
|
||||
$css_class .= in_array( $page['page_id'], $active_page_ancestor_ids, true ) ? ' current-menu-ancestor' : '';
|
||||
if ( isset( $page['children'] ) ) {
|
||||
$css_class .= ' has-child';
|
||||
}
|
||||
$markup .= '<li class="' . $css_class . '">';
|
||||
$markup .= '<a class="wp-block-pages-list__item__link" href="' . esc_url( $page['link'] ) . '">' . wp_kses(
|
||||
$page['title'],
|
||||
wp_kses_allowed_html( 'post' )
|
||||
) . '</a>';
|
||||
|
||||
if ( $is_navigation_child ) {
|
||||
$css_class .= ' wp-block-navigation-item';
|
||||
|
||||
if ( $open_submenus_on_click ) {
|
||||
$css_class .= ' open-on-click';
|
||||
} elseif ( $show_submenu_icons ) {
|
||||
$css_class .= ' open-on-hover-click';
|
||||
}
|
||||
}
|
||||
|
||||
$navigation_child_content_class = $is_navigation_child ? ' wp-block-navigation-item__content' : '';
|
||||
|
||||
// If this is the first level of submenus, include the overlay colors.
|
||||
if ( 1 === $depth && isset( $colors['overlay_css_classes'], $colors['overlay_inline_styles'] ) ) {
|
||||
$css_class .= ' ' . trim( implode( ' ', $colors['overlay_css_classes'] ) );
|
||||
if ( '' !== $colors['overlay_inline_styles'] ) {
|
||||
$style_attribute = sprintf( ' style="%s"', esc_attr( $colors['overlay_inline_styles'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
$markup .= '<li class="wp-block-pages-list__item' . $css_class . '"' . $style_attribute . '>';
|
||||
|
||||
if ( isset( $page['children'] ) && $is_navigation_child && $open_submenus_on_click ) {
|
||||
$markup .= '<button class="' . $navigation_child_content_class . ' wp-block-navigation-submenu__toggle" aria-expanded="false">' . wp_kses(
|
||||
$page['title'],
|
||||
wp_kses_allowed_html( 'post' )
|
||||
) . '<span class="wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" role="img" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg></span>' .
|
||||
'</button>';
|
||||
} else {
|
||||
$markup .= '<a class="wp-block-pages-list__item__link' . $navigation_child_content_class . ' "href="' . esc_url( $page['link'] ) . '"' . $aria_current . '>' . wp_kses(
|
||||
$page['title'],
|
||||
wp_kses_allowed_html( 'post' )
|
||||
) . '</a>';
|
||||
}
|
||||
|
||||
if ( isset( $page['children'] ) ) {
|
||||
$markup .= '<span class="wp-block-page-list__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" role="img" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg></span>';
|
||||
$markup .= '<ul class="submenu-container">' . block_core_page_list_render_nested_page_list( $page['children'] ) . '</ul>';
|
||||
if ( $is_navigation_child && $show_submenu_icons && ! $open_submenus_on_click ) {
|
||||
$markup .= '<button class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">';
|
||||
$markup .= '<span class="wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" role="img" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg></span>';
|
||||
$markup .= '</button>';
|
||||
}
|
||||
$markup .= '<ul class="submenu-container';
|
||||
// Extra classname is added when the block is a child of Navigation.
|
||||
if ( $is_navigation_child ) {
|
||||
$markup .= ' wp-block-navigation__submenu-container';
|
||||
}
|
||||
$markup .= '">' . block_core_page_list_render_nested_page_list( $open_submenus_on_click, $show_submenu_icons, $is_navigation_child, $page['children'], $active_page_ancestor_ids, $colors, $depth + 1 ) . '</ul>';
|
||||
}
|
||||
$markup .= '</li>';
|
||||
}
|
||||
@ -149,44 +239,50 @@ function render_block_core_page_list( $attributes, $content, $block ) {
|
||||
static $block_id = 0;
|
||||
$block_id++;
|
||||
|
||||
// TODO: When https://core.trac.wordpress.org/ticket/39037 REST API support for multiple orderby values is resolved,
|
||||
// update 'sort_column' to 'menu_order, post_title'. Sorting by both menu_order and post_title ensures a stable sort.
|
||||
// Otherwise with pages that have the same menu_order value, we can see different ordering depending on how DB
|
||||
// queries are constructed internally. For example we might see a different order when a limit is set to <499
|
||||
// versus >= 500.
|
||||
$all_pages = get_pages(
|
||||
array(
|
||||
'sort_column' => 'menu_order',
|
||||
'sort_column' => 'menu_order,post_title',
|
||||
'order' => 'asc',
|
||||
)
|
||||
);
|
||||
|
||||
// If thare are no pages, there is nothing to show.
|
||||
if ( empty( $all_pages ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$top_level_pages = array();
|
||||
|
||||
$pages_with_children = array();
|
||||
|
||||
$active_page_ancestor_ids = array();
|
||||
|
||||
foreach ( (array) $all_pages as $page ) {
|
||||
$is_active = ! empty( $page->ID ) && ( get_the_ID() === $page->ID );
|
||||
|
||||
if ( $is_active ) {
|
||||
$active_page_ancestor_ids = get_post_ancestors( $page->ID );
|
||||
}
|
||||
|
||||
if ( $page->post_parent ) {
|
||||
$pages_with_children[ $page->post_parent ][ $page->ID ] = array(
|
||||
'title' => $page->post_title,
|
||||
'link' => get_permalink( $page->ID ),
|
||||
'page_id' => $page->ID,
|
||||
'title' => $page->post_title,
|
||||
'link' => get_permalink( $page->ID ),
|
||||
'is_active' => $is_active,
|
||||
);
|
||||
} else {
|
||||
$top_level_pages[ $page->ID ] = array(
|
||||
'title' => $page->post_title,
|
||||
'link' => get_permalink( $page->ID ),
|
||||
'page_id' => $page->ID,
|
||||
'title' => $page->post_title,
|
||||
'link' => get_permalink( $page->ID ),
|
||||
'is_active' => $is_active,
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$nested_pages = block_core_page_list_nest_pages( $top_level_pages, $pages_with_children );
|
||||
|
||||
$wrapper_markup = '<ul %1$s>%2$s</ul>';
|
||||
|
||||
$items_markup = block_core_page_list_render_nested_page_list( $nested_pages );
|
||||
|
||||
$colors = block_core_page_list_build_css_colors( $block->context );
|
||||
$colors = block_core_page_list_build_css_colors( $attributes, $block->context );
|
||||
$font_sizes = block_core_page_list_build_css_font_sizes( $block->context );
|
||||
$classes = array_merge(
|
||||
$colors['css_classes'],
|
||||
@ -195,9 +291,17 @@ function render_block_core_page_list( $attributes, $content, $block ) {
|
||||
$style_attribute = ( $colors['inline_styles'] . $font_sizes['inline_styles'] );
|
||||
$css_classes = trim( implode( ' ', $classes ) );
|
||||
|
||||
if ( $block->context && $block->context['showSubmenuIcon'] ) {
|
||||
$css_classes .= ' show-submenu-icons';
|
||||
}
|
||||
$nested_pages = block_core_page_list_nest_pages( $top_level_pages, $pages_with_children );
|
||||
|
||||
$is_navigation_child = array_key_exists( 'showSubmenuIcon', $block->context );
|
||||
|
||||
$open_submenus_on_click = array_key_exists( 'openSubmenusOnClick', $block->context ) ? $block->context['openSubmenusOnClick'] : false;
|
||||
|
||||
$show_submenu_icons = array_key_exists( 'showSubmenuIcon', $block->context ) ? $block->context['showSubmenuIcon'] : false;
|
||||
|
||||
$wrapper_markup = '<ul %1$s>%2$s</ul>';
|
||||
|
||||
$items_markup = block_core_page_list_render_nested_page_list( $open_submenus_on_click, $show_submenu_icons, $is_navigation_child, $nested_pages, $active_page_ancestor_ids, $colors );
|
||||
|
||||
$wrapper_attributes = get_block_wrapper_attributes(
|
||||
array(
|
||||
|
@ -6,15 +6,22 @@
|
||||
"description": "Display a list of all pages.",
|
||||
"keywords": [ "menu", "navigation" ],
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
},
|
||||
"usesContext": [
|
||||
"textColor",
|
||||
"customTextColor",
|
||||
"backgroundColor",
|
||||
"customBackgroundColor",
|
||||
"overlayTextColor",
|
||||
"customOverlayTextColor",
|
||||
"overlayBackgroundColor",
|
||||
"customOverlayBackgroundColor",
|
||||
"fontSize",
|
||||
"customFontSize",
|
||||
"showSubmenuIcon",
|
||||
"style"
|
||||
"style",
|
||||
"openSubmenusOnClick"
|
||||
],
|
||||
"supports": {
|
||||
"reusable": false,
|
||||
|
@ -37,7 +37,14 @@
|
||||
},
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
"lineHeight": true
|
||||
"lineHeight": true,
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"__experimentalSelector": "p",
|
||||
"__unstablePasteTextInline": true
|
||||
|
@ -26,7 +26,15 @@
|
||||
},
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
"lineHeight": true
|
||||
"lineHeight": true,
|
||||
"__experimentalFontFamily": true,
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,12 @@ function render_block_core_post_excerpt( $attributes, $content, $block ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$excerpt = get_the_excerpt( $block->context['postId'] );
|
||||
|
||||
if ( empty( $excerpt ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$more_text = ! empty( $attributes['moreText'] ) ? '<a class="wp-block-post-excerpt__more-link" href="' . esc_url( get_the_permalink( $block->context['postId'] ) ) . '">' . $attributes['moreText'] . '</a>' : '';
|
||||
$filter_excerpt_more = function( $more ) use ( $more_text ) {
|
||||
return empty( $more_text ) ? $more : '';
|
||||
@ -38,7 +44,7 @@ function render_block_core_post_excerpt( $attributes, $content, $block ) {
|
||||
}
|
||||
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
||||
|
||||
$content = '<p class="wp-block-post-excerpt__excerpt">' . get_the_excerpt( $block->context['postId'] );
|
||||
$content = '<p class="wp-block-post-excerpt__excerpt">' . $excerpt;
|
||||
$show_more_on_new_line = ! isset( $attributes['showMoreOnNewLine'] ) || $attributes['showMoreOnNewLine'];
|
||||
if ( $show_more_on_new_line && ! empty( $more_text ) ) {
|
||||
$content .= '</p><p class="wp-block-post-excerpt__more-text">' . $more_text . '</p>';
|
||||
|
@ -24,9 +24,20 @@
|
||||
"gradients": true,
|
||||
"link": true
|
||||
},
|
||||
"spacing": {
|
||||
"margin": true,
|
||||
"padding": true
|
||||
},
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
"lineHeight": true
|
||||
"lineHeight": true,
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-post-excerpt-editor",
|
||||
|
@ -23,14 +23,30 @@ function render_block_core_post_featured_image( $attributes, $content, $block )
|
||||
if ( ! $featured_image ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$wrapper_attributes = get_block_wrapper_attributes();
|
||||
if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) {
|
||||
$featured_image = sprintf( '<a href="%1s">%2s</a>', get_the_permalink( $post_ID ), $featured_image );
|
||||
}
|
||||
|
||||
$wrapper_attributes = get_block_wrapper_attributes();
|
||||
$has_width = ! empty( $attributes['width'] );
|
||||
$has_height = ! empty( $attributes['height'] );
|
||||
if ( ! $has_height && ! $has_width ) {
|
||||
return "<figure $wrapper_attributes>$featured_image</figure>";
|
||||
}
|
||||
|
||||
return '<figure ' . $wrapper_attributes . '>' . $featured_image . '</figure>';
|
||||
if ( $has_width ) {
|
||||
$wrapper_attributes = get_block_wrapper_attributes( array( 'style' => "width:{$attributes['width']};" ) );
|
||||
}
|
||||
|
||||
if ( $has_height ) {
|
||||
$image_styles = "height:{$attributes['height']};";
|
||||
if ( ! empty( $attributes['scale'] ) ) {
|
||||
$image_styles .= "object-fit:{$attributes['scale']};";
|
||||
}
|
||||
$featured_image = str_replace( 'src=', "style='$image_styles' src=", $featured_image );
|
||||
}
|
||||
|
||||
return "<figure $wrapper_attributes>$featured_image</figure>";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9,12 +9,31 @@
|
||||
"isLink": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"width": {
|
||||
"type": "string"
|
||||
},
|
||||
"height": {
|
||||
"type": "string"
|
||||
},
|
||||
"scale": {
|
||||
"type": "string",
|
||||
"default": "cover"
|
||||
}
|
||||
},
|
||||
"usesContext": [ "postId", "postType", "queryId" ],
|
||||
"supports": {
|
||||
"align": [ "left", "right", "center", "wide", "full" ],
|
||||
"html": false
|
||||
"color": {
|
||||
"__experimentalDuotone": "img",
|
||||
"text": false,
|
||||
"background": false
|
||||
},
|
||||
"html": false,
|
||||
"spacing": {
|
||||
"margin": true,
|
||||
"padding": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-post-featured-image-editor",
|
||||
"style": "wp-block-post-featured-image"
|
||||
|
@ -61,7 +61,8 @@ function render_block_core_post_template( $attributes, $content, $block ) {
|
||||
)
|
||||
)
|
||||
)->render( array( 'dynamic' => false ) );
|
||||
$content .= "<li>{$block_content}</li>";
|
||||
$post_classes = esc_attr( implode( ' ', get_post_class( 'wp-block-post' ) ) );
|
||||
$content .= '<li class="' . $post_classes . '">' . $block_content . '</li>';
|
||||
}
|
||||
|
||||
wp_reset_postdata();
|
||||
|
@ -16,7 +16,10 @@
|
||||
"supports": {
|
||||
"reusable": false,
|
||||
"html": false,
|
||||
"align": true
|
||||
"align": true,
|
||||
"__experimentalLayout": {
|
||||
"allowEditing": false
|
||||
}
|
||||
},
|
||||
"style": "wp-block-post-template",
|
||||
"editorStyle": "wp-block-post-template-editor"
|
||||
|
@ -23,30 +23,25 @@ function render_block_core_post_terms( $attributes, $content, $block ) {
|
||||
}
|
||||
|
||||
$post_terms = get_the_terms( $block->context['postId'], $attributes['term'] );
|
||||
if ( is_wp_error( $post_terms ) ) {
|
||||
return '';
|
||||
}
|
||||
if ( empty( $post_terms ) ) {
|
||||
if ( is_wp_error( $post_terms ) || empty( $post_terms ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$align_class_name = empty( $attributes['textAlign'] ) ? '' : ' ' . "has-text-align-{$attributes['textAlign']}";
|
||||
|
||||
$terms_links = '';
|
||||
foreach ( $post_terms as $term ) {
|
||||
$terms_links .= sprintf(
|
||||
'<a href="%1$s">%2$s</a> | ',
|
||||
get_term_link( $term->term_id ),
|
||||
esc_html( $term->name )
|
||||
);
|
||||
$classes = 'taxonomy-' . $attributes['term'];
|
||||
if ( isset( $attributes['textAlign'] ) ) {
|
||||
$classes .= ' has-text-align-' . $attributes['textAlign'];
|
||||
}
|
||||
$terms_links = trim( $terms_links, ' | ' );
|
||||
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) );
|
||||
|
||||
return sprintf(
|
||||
'<div %1$s>%2$s</div>',
|
||||
$wrapper_attributes,
|
||||
$terms_links
|
||||
$separator = empty( $attributes['separator'] ) ? ' ' : $attributes['separator'];
|
||||
|
||||
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
||||
|
||||
return get_the_term_list(
|
||||
$block->context['postId'],
|
||||
$attributes['term'],
|
||||
"<div $wrapper_attributes>",
|
||||
'<span class="wp-block-post-terms__separator">' . $separator . '</span>',
|
||||
'</div>'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,10 @@
|
||||
},
|
||||
"textAlign": {
|
||||
"type": "string"
|
||||
},
|
||||
"separator": {
|
||||
"type": "string",
|
||||
"default": ", "
|
||||
}
|
||||
},
|
||||
"usesContext": [ "postId", "postType" ],
|
||||
@ -22,7 +26,15 @@
|
||||
},
|
||||
"typography": {
|
||||
"lineHeight": true,
|
||||
"fontSize": true
|
||||
"fontSize": true,
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"style": "wp-block-post-terms"
|
||||
}
|
||||
|
@ -19,7 +19,13 @@ function render_block_core_post_title( $attributes, $content, $block ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$post_ID = $block->context['postId'];
|
||||
$post_ID = $block->context['postId'];
|
||||
$title = get_the_title( $post_ID );
|
||||
|
||||
if ( ! $title ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$tag_name = 'h2';
|
||||
$align_class_name = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}";
|
||||
|
||||
@ -27,9 +33,8 @@ function render_block_core_post_title( $attributes, $content, $block ) {
|
||||
$tag_name = 0 === $attributes['level'] ? 'p' : 'h' . $attributes['level'];
|
||||
}
|
||||
|
||||
$title = get_the_title( $post_ID );
|
||||
if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) {
|
||||
$title = sprintf( '<a href="%1s" target="%2s" rel="%3s">%4s</a>', get_the_permalink( $post_ID ), $attributes['linkTarget'], $attributes['rel'], $title );
|
||||
$title = sprintf( '<a href="%1$s" target="%2$s" rel="%3$s">%4$s</a>', get_the_permalink( $post_ID ), $attributes['linkTarget'], $attributes['rel'], $title );
|
||||
}
|
||||
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) );
|
||||
|
||||
|
@ -35,10 +35,22 @@
|
||||
"gradients": true,
|
||||
"link": true
|
||||
},
|
||||
"spacing": {
|
||||
"margin": true
|
||||
},
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
"lineHeight": true,
|
||||
"__experimentalFontFamily": true
|
||||
"__experimentalFontFamily": true,
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true,
|
||||
"fontAppearance": true,
|
||||
"textTransform": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"style": "wp-block-post-title"
|
||||
|
@ -21,7 +21,15 @@
|
||||
"gradients": true
|
||||
},
|
||||
"typography": {
|
||||
"fontSize": true
|
||||
"fontSize": true,
|
||||
"lineHeight": true,
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"style": "wp-block-preformatted"
|
||||
|
@ -20,31 +20,37 @@
|
||||
"default": "",
|
||||
"__experimentalRole": "content"
|
||||
},
|
||||
"mainColor": {
|
||||
"type": "string"
|
||||
},
|
||||
"customMainColor": {
|
||||
"type": "string"
|
||||
},
|
||||
"textColor": {
|
||||
"type": "string"
|
||||
},
|
||||
"customTextColor": {
|
||||
"textAlign": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
"anchor": true,
|
||||
"align": [ "left", "right", "wide", "full" ]
|
||||
},
|
||||
"styles": [
|
||||
{
|
||||
"name": "default",
|
||||
"label": "Default",
|
||||
"isDefault": true
|
||||
"align": [ "left", "right", "wide", "full" ],
|
||||
"color": {
|
||||
"gradients": true,
|
||||
"background": true,
|
||||
"link": true
|
||||
},
|
||||
{ "name": "solid-color", "label": "Solid color" }
|
||||
],
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
"lineHeight": true,
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true,
|
||||
"fontAppearance": true
|
||||
}
|
||||
},
|
||||
"__experimentalBorder": {
|
||||
"color": true,
|
||||
"radius": true,
|
||||
"style": true,
|
||||
"width": true
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-pullquote-editor",
|
||||
"style": "wp-block-pullquote"
|
||||
}
|
||||
|
@ -20,9 +20,13 @@ function render_block_core_query_pagination_next( $attributes, $content, $block
|
||||
$max_page = isset( $block->context['query']['pages'] ) ? (int) $block->context['query']['pages'] : 0;
|
||||
|
||||
$wrapper_attributes = get_block_wrapper_attributes();
|
||||
$default_label = __( 'Next Page »' );
|
||||
$default_label = __( 'Next Page' );
|
||||
$label = isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ? $attributes['label'] : $default_label;
|
||||
$content = '';
|
||||
$pagination_arrow = get_query_pagination_arrow( $block, true );
|
||||
if ( $pagination_arrow ) {
|
||||
$label .= $pagination_arrow;
|
||||
}
|
||||
$content = '';
|
||||
|
||||
// Check if the pagination is for Query that inherits the global context.
|
||||
if ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] ) {
|
||||
|
@ -11,7 +11,7 @@
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"usesContext": [ "queryId", "query" ],
|
||||
"usesContext": [ "queryId", "query", "paginationArrow" ],
|
||||
"supports": {
|
||||
"reusable": false,
|
||||
"html": false,
|
||||
@ -21,7 +21,14 @@
|
||||
},
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
"lineHeight": true
|
||||
"lineHeight": true,
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,28 @@ function render_block_core_query_pagination_numbers( $attributes, $content, $blo
|
||||
'total' => $total,
|
||||
'prev_next' => false,
|
||||
);
|
||||
if ( 1 !== $page ) {
|
||||
/**
|
||||
* `paginate_links` doesn't use the provided `format` when the page is `1`.
|
||||
* This is great for the main query as it removes the extra query params
|
||||
* making the URL shorter, but in the case of multiple custom queries is
|
||||
* problematic. It results in returning an empty link which ends up with
|
||||
* a link to the current page.
|
||||
*
|
||||
* A way to address this is to add a `fake` query arg with no value that
|
||||
* is the same for all custom queries. This way the link is not empty and
|
||||
* preserves all the other existent query args.
|
||||
*
|
||||
* @see https://developer.wordpress.org/reference/functions/paginate_links/
|
||||
*
|
||||
* The proper fix of this should be in core. Track Ticket:
|
||||
* @see https://core.trac.wordpress.org/ticket/53868
|
||||
*
|
||||
* TODO: After two WP versions (starting from the WP version the core patch landed),
|
||||
* we should remove this and call `paginate_links` with the proper new arg.
|
||||
*/
|
||||
$paginate_args['add_args'] = array( 'cst' => '' );
|
||||
}
|
||||
// We still need to preserve `paged` query param if exists, as is used
|
||||
// for Queries that inherit from global context.
|
||||
$paged = empty( $_GET['paged'] ) ? null : (int) $_GET['paged'];
|
||||
|
@ -19,9 +19,13 @@ function render_block_core_query_pagination_previous( $attributes, $content, $bl
|
||||
$page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ];
|
||||
|
||||
$wrapper_attributes = get_block_wrapper_attributes();
|
||||
$default_label = __( '« Previous Page' );
|
||||
$default_label = __( 'Previous Page' );
|
||||
$label = isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ? $attributes['label'] : $default_label;
|
||||
$content = '';
|
||||
$pagination_arrow = get_query_pagination_arrow( $block, false );
|
||||
if ( $pagination_arrow ) {
|
||||
$label = $pagination_arrow . $label;
|
||||
}
|
||||
$content = '';
|
||||
// Check if the pagination is for Query that inherits the global context
|
||||
// and handle appropriately.
|
||||
if ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] ) {
|
||||
|
@ -11,7 +11,7 @@
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"usesContext": [ "queryId", "query" ],
|
||||
"usesContext": [ "queryId", "query", "paginationArrow" ],
|
||||
"supports": {
|
||||
"reusable": false,
|
||||
"html": false,
|
||||
@ -21,7 +21,14 @@
|
||||
},
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
"lineHeight": true
|
||||
"lineHeight": true,
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,12 +5,35 @@
|
||||
* @package WordPress
|
||||
*/
|
||||
|
||||
/**
|
||||
* Renders the `core/query-pagination` block on the server.
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
* @param string $content Block default content.
|
||||
*
|
||||
* @return string Returns the wrapper for the Query pagination.
|
||||
*/
|
||||
function render_block_core_query_pagination( $attributes, $content ) {
|
||||
if ( empty( trim( $content ) ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
'<div %1$s>%2$s</div>',
|
||||
get_block_wrapper_attributes(),
|
||||
$content
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the `core/query-pagination` block on the server.
|
||||
*/
|
||||
function register_block_core_query_pagination() {
|
||||
register_block_type_from_metadata(
|
||||
__DIR__ . '/query-pagination'
|
||||
__DIR__ . '/query-pagination',
|
||||
array(
|
||||
'render_callback' => 'render_block_core_query_pagination',
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'init', 'register_block_core_query_pagination' );
|
||||
|
@ -6,7 +6,16 @@
|
||||
"parent": [ "core/query" ],
|
||||
"description": "Displays a paginated navigation to next/previous set of posts, when applicable.",
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
"paginationArrow": {
|
||||
"type": "string",
|
||||
"default": "none"
|
||||
}
|
||||
},
|
||||
"usesContext": [ "queryId", "query" ],
|
||||
"providesContext": {
|
||||
"paginationArrow": "paginationArrow"
|
||||
},
|
||||
"supports": {
|
||||
"align": true,
|
||||
"reusable": false,
|
||||
@ -14,6 +23,13 @@
|
||||
"color": {
|
||||
"gradients": true,
|
||||
"link": true
|
||||
},
|
||||
"__experimentalLayout": {
|
||||
"allowSwitching": false,
|
||||
"allowInheriting": false,
|
||||
"default": {
|
||||
"type": "flex"
|
||||
}
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-query-pagination-editor",
|
||||
|
@ -23,10 +23,22 @@
|
||||
"color": {
|
||||
"gradients": true
|
||||
},
|
||||
"spacing": {
|
||||
"margin": true
|
||||
},
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
"lineHeight": true,
|
||||
"__experimentalFontFamily": true
|
||||
"__experimentalFontFamily": true,
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true,
|
||||
"fontAppearance": true,
|
||||
"textTransform": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-query-title-editor"
|
||||
|
@ -27,7 +27,20 @@
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
"anchor": true
|
||||
"anchor": true,
|
||||
"__experimentalSlashInserter": true,
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
"lineHeight": true,
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true,
|
||||
"fontAppearance": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"styles": [
|
||||
{
|
||||
@ -35,6 +48,7 @@
|
||||
"label": "Default",
|
||||
"isDefault": true
|
||||
},
|
||||
{ "name": "plain", "label": "Plain" },
|
||||
{ "name": "large", "label": "Large" }
|
||||
],
|
||||
"editorStyle": "wp-block-quote-editor",
|
||||
|
@ -27,53 +27,60 @@ function render_block_core_search( $attributes ) {
|
||||
)
|
||||
);
|
||||
|
||||
$input_id = 'wp-block-search__input-' . ++$instance_id;
|
||||
$classnames = classnames_for_block_core_search( $attributes );
|
||||
$show_label = ( ! empty( $attributes['showLabel'] ) ) ? true : false;
|
||||
$use_icon_button = ( ! empty( $attributes['buttonUseIcon'] ) ) ? true : false;
|
||||
$show_input = ( ! empty( $attributes['buttonPosition'] ) && 'button-only' === $attributes['buttonPosition'] ) ? false : true;
|
||||
$show_button = ( ! empty( $attributes['buttonPosition'] ) && 'no-button' === $attributes['buttonPosition'] ) ? false : true;
|
||||
$label_markup = '';
|
||||
$input_markup = '';
|
||||
$button_markup = '';
|
||||
$inline_styles = styles_for_block_core_search( $attributes );
|
||||
$input_id = 'wp-block-search__input-' . ++$instance_id;
|
||||
$classnames = classnames_for_block_core_search( $attributes );
|
||||
$show_label = ( ! empty( $attributes['showLabel'] ) ) ? true : false;
|
||||
$use_icon_button = ( ! empty( $attributes['buttonUseIcon'] ) ) ? true : false;
|
||||
$show_input = ( ! empty( $attributes['buttonPosition'] ) && 'button-only' === $attributes['buttonPosition'] ) ? false : true;
|
||||
$show_button = ( ! empty( $attributes['buttonPosition'] ) && 'no-button' === $attributes['buttonPosition'] ) ? false : true;
|
||||
$label_markup = '';
|
||||
$input_markup = '';
|
||||
$button_markup = '';
|
||||
$inline_styles = styles_for_block_core_search( $attributes );
|
||||
$color_classes = get_color_classes_for_block_core_search( $attributes );
|
||||
$is_button_inside = ! empty( $attributes['buttonPosition'] ) &&
|
||||
'button-inside' === $attributes['buttonPosition'];
|
||||
// Border color classes need to be applied to the elements that have a border color.
|
||||
$border_color_classes = get_border_color_classes_for_block_core_search( $attributes );
|
||||
|
||||
if ( $show_label ) {
|
||||
if ( ! empty( $attributes['label'] ) ) {
|
||||
$label_markup = sprintf(
|
||||
'<label for="%s" class="wp-block-search__label">%s</label>',
|
||||
$input_id,
|
||||
$attributes['label']
|
||||
);
|
||||
} else {
|
||||
$label_markup = sprintf(
|
||||
'<label for="%s" class="wp-block-search__label screen-reader-text">%s</label>',
|
||||
$input_id,
|
||||
__( 'Search' )
|
||||
);
|
||||
}
|
||||
$label_markup = sprintf(
|
||||
'<label for="%1$s" class="wp-block-search__label screen-reader-text">%2$s</label>',
|
||||
$input_id,
|
||||
empty( $attributes['label'] ) ? __( 'Search' ) : $attributes['label']
|
||||
);
|
||||
if ( $show_label && ! empty( $attributes['label'] ) ) {
|
||||
$label_markup = sprintf(
|
||||
'<label for="%1$s" class="wp-block-search__label">%2$s</label>',
|
||||
$input_id,
|
||||
$attributes['label']
|
||||
);
|
||||
}
|
||||
|
||||
if ( $show_input ) {
|
||||
$input_markup = sprintf(
|
||||
'<input type="search" id="%s" class="wp-block-search__input" name="s" value="%s" placeholder="%s" %s required />',
|
||||
$input_classes = ! $is_button_inside ? $border_color_classes : '';
|
||||
$input_markup = sprintf(
|
||||
'<input type="search" id="%s" class="wp-block-search__input %s" name="s" value="%s" placeholder="%s" %s required />',
|
||||
$input_id,
|
||||
$input_classes,
|
||||
esc_attr( get_search_query() ),
|
||||
esc_attr( $attributes['placeholder'] ),
|
||||
$inline_styles['shared']
|
||||
$inline_styles['input']
|
||||
);
|
||||
}
|
||||
|
||||
if ( $show_button ) {
|
||||
$button_internal_markup = '';
|
||||
$button_classes = '';
|
||||
$button_classes = $color_classes;
|
||||
|
||||
if ( ! $is_button_inside ) {
|
||||
$button_classes .= ' ' . $border_color_classes;
|
||||
}
|
||||
if ( ! $use_icon_button ) {
|
||||
if ( ! empty( $attributes['buttonText'] ) ) {
|
||||
$button_internal_markup = $attributes['buttonText'];
|
||||
}
|
||||
} else {
|
||||
$button_classes .= 'has-icon';
|
||||
$button_classes .= ' has-icon';
|
||||
$button_internal_markup =
|
||||
'<svg id="search-icon" class="search-icon" viewBox="0 0 24 24" width="24" height="24">
|
||||
<path d="M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"></path>
|
||||
@ -81,19 +88,21 @@ function render_block_core_search( $attributes ) {
|
||||
}
|
||||
|
||||
$button_markup = sprintf(
|
||||
'<button type="submit" class="wp-block-search__button %s"%s>%s</button>',
|
||||
'<button type="submit" class="wp-block-search__button %s" %s>%s</button>',
|
||||
$button_classes,
|
||||
$inline_styles['shared'],
|
||||
$inline_styles['button'],
|
||||
$button_internal_markup
|
||||
);
|
||||
}
|
||||
|
||||
$field_markup = sprintf(
|
||||
'<div class="wp-block-search__inside-wrapper"%s>%s</div>',
|
||||
$field_markup_classes = $is_button_inside ? $border_color_classes : '';
|
||||
$field_markup = sprintf(
|
||||
'<div class="wp-block-search__inside-wrapper %s" %s>%s</div>',
|
||||
$field_markup_classes,
|
||||
$inline_styles['wrapper'],
|
||||
$input_markup . $button_markup
|
||||
);
|
||||
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) );
|
||||
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) );
|
||||
|
||||
return sprintf(
|
||||
'<form role="search" method="get" action="%s" %s>%s</form>',
|
||||
@ -169,8 +178,9 @@ function classnames_for_block_core_search( $attributes ) {
|
||||
* @return array Style HTML attribute.
|
||||
*/
|
||||
function styles_for_block_core_search( $attributes ) {
|
||||
$shared_styles = array();
|
||||
$wrapper_styles = array();
|
||||
$button_styles = array();
|
||||
$input_styles = array();
|
||||
|
||||
// Add width styles.
|
||||
$has_width = ! empty( $attributes['width'] ) && ! empty( $attributes['widthUnit'] );
|
||||
@ -188,26 +198,155 @@ function styles_for_block_core_search( $attributes ) {
|
||||
$has_border_radius = ! empty( $attributes['style']['border']['radius'] );
|
||||
|
||||
if ( $has_border_radius ) {
|
||||
// Shared style for button and input radius values.
|
||||
$default_padding = '4px';
|
||||
$border_radius = $attributes['style']['border']['radius'];
|
||||
$shared_styles[] = sprintf( 'border-radius: %spx;', esc_attr( $border_radius ) );
|
||||
|
||||
// Apply wrapper border radius if button placed inside.
|
||||
$button_inside = ! empty( $attributes['buttonPosition'] ) &&
|
||||
$is_button_inside = ! empty( $attributes['buttonPosition'] ) &&
|
||||
'button-inside' === $attributes['buttonPosition'];
|
||||
|
||||
if ( $button_inside ) {
|
||||
// We adjust the border radius value for the outer wrapper element
|
||||
// to make it visually consistent with the radius applied to inner
|
||||
// elements.
|
||||
$default_padding = 4;
|
||||
$adjusted_radius = $border_radius + $default_padding;
|
||||
$wrapper_styles[] = sprintf( 'border-radius: %dpx;', esc_attr( $adjusted_radius ) );
|
||||
if ( is_array( $border_radius ) ) {
|
||||
// Apply styles for individual corner border radii.
|
||||
foreach ( $border_radius as $key => $value ) {
|
||||
if ( null !== $value ) {
|
||||
// Convert camelCase key to kebab-case.
|
||||
$name = strtolower( preg_replace( '/(?<!^)[A-Z]/', '-$0', $key ) );
|
||||
|
||||
// Add shared styles for individual border radii for input & button.
|
||||
$border_style = sprintf(
|
||||
'border-%s-radius: %s;',
|
||||
esc_attr( $name ),
|
||||
esc_attr( $value )
|
||||
);
|
||||
$input_styles[] = $border_style;
|
||||
$button_styles[] = $border_style;
|
||||
|
||||
// Add adjusted border radius styles for the wrapper element
|
||||
// if button is positioned inside.
|
||||
if ( $is_button_inside && intval( $value ) !== 0 ) {
|
||||
$wrapper_styles[] = sprintf(
|
||||
'border-%s-radius: calc(%s + %s);',
|
||||
esc_attr( $name ),
|
||||
esc_attr( $value ),
|
||||
$default_padding
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Numeric check is for backwards compatibility purposes.
|
||||
$border_radius = is_numeric( $border_radius ) ? $border_radius . 'px' : $border_radius;
|
||||
$border_style = sprintf( 'border-radius: %s;', esc_attr( $border_radius ) );
|
||||
$input_styles[] = $border_style;
|
||||
$button_styles[] = $border_style;
|
||||
|
||||
if ( $is_button_inside && intval( $border_radius ) !== 0 ) {
|
||||
// Adjust wrapper border radii to maintain visual consistency
|
||||
// with inner elements when button is positioned inside.
|
||||
$wrapper_styles[] = sprintf(
|
||||
'border-radius: calc(%s + %s);',
|
||||
esc_attr( $border_radius ),
|
||||
$default_padding
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add border color styles.
|
||||
$has_border_color = ! empty( $attributes['style']['border']['color'] );
|
||||
|
||||
if ( $has_border_color ) {
|
||||
$border_color = $attributes['style']['border']['color'];
|
||||
$is_button_inside = ! empty( $attributes['buttonPosition'] ) &&
|
||||
'button-inside' === $attributes['buttonPosition'];
|
||||
|
||||
// Apply wrapper border color if button placed inside.
|
||||
if ( $is_button_inside ) {
|
||||
$wrapper_styles[] = sprintf( 'border-color: %s;', esc_attr( $border_color ) );
|
||||
} else {
|
||||
$button_styles[] = sprintf( 'border-color: %s;', esc_attr( $border_color ) );
|
||||
$input_styles[] = sprintf( 'border-color: %s;', esc_attr( $border_color ) );
|
||||
}
|
||||
}
|
||||
|
||||
// Add color styles.
|
||||
$has_text_color = ! empty( $attributes['style']['color']['text'] );
|
||||
if ( $has_text_color ) {
|
||||
$button_styles[] = sprintf( 'color: %s;', esc_attr( $attributes['style']['color']['text'] ) );
|
||||
}
|
||||
|
||||
$has_background_color = ! empty( $attributes['style']['color']['background'] );
|
||||
if ( $has_background_color ) {
|
||||
$button_styles[] = sprintf( 'background-color: %s;', esc_attr( $attributes['style']['color']['background'] ) );
|
||||
}
|
||||
|
||||
$has_custom_gradient = ! empty( $attributes['style']['color']['gradient'] );
|
||||
if ( $has_custom_gradient ) {
|
||||
$button_styles[] = sprintf( 'background: %s;', $attributes['style']['color']['gradient'] );
|
||||
}
|
||||
|
||||
return array(
|
||||
'shared' => ! empty( $shared_styles ) ? sprintf( ' style="%s"', implode( ' ', $shared_styles ) ) : '',
|
||||
'input' => ! empty( $input_styles ) ? sprintf( ' style="%s"', implode( ' ', $input_styles ) ) : '',
|
||||
'button' => ! empty( $button_styles ) ? sprintf( ' style="%s"', implode( ' ', $button_styles ) ) : '',
|
||||
'wrapper' => ! empty( $wrapper_styles ) ? sprintf( ' style="%s"', implode( ' ', $wrapper_styles ) ) : '',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns border color classnames depending on whether there are named or custom border colors.
|
||||
*
|
||||
* @param array $attributes The block attributes.
|
||||
*
|
||||
* @return string The border color classnames to be applied to the block elements.
|
||||
*/
|
||||
function get_border_color_classes_for_block_core_search( $attributes ) {
|
||||
$has_custom_border_color = ! empty( $attributes['style']['border']['color'] );
|
||||
$border_color_classes = ! empty( $attributes['borderColor'] ) ? sprintf( 'has-border-color has-%s-border-color', $attributes['borderColor'] ) : '';
|
||||
// If there's a border color style and no `borderColor` text string, we still want to add the generic `has-border-color` class name to the element.
|
||||
if ( $has_custom_border_color && empty( $attributes['borderColor'] ) ) {
|
||||
$border_color_classes = 'has-border-color';
|
||||
}
|
||||
return $border_color_classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns color classnames depending on whether there are named or custom text and background colors.
|
||||
*
|
||||
* @param array $attributes The block attributes.
|
||||
*
|
||||
* @return string The color classnames to be applied to the block elements.
|
||||
*/
|
||||
function get_color_classes_for_block_core_search( $attributes ) {
|
||||
$classnames = array();
|
||||
|
||||
// Text color.
|
||||
$has_named_text_color = ! empty( $attributes['textColor'] );
|
||||
$has_custom_text_color = ! empty( $attributes['style']['color']['text'] );
|
||||
if ( $has_named_text_color ) {
|
||||
$classnames[] = sprintf( 'has-text-color has-%s-color', $attributes['textColor'] );
|
||||
} elseif ( $has_custom_text_color ) {
|
||||
// If a custom 'textColor' was selected instead of a preset, still add the generic `has-text-color` class.
|
||||
$classnames[] = 'has-text-color';
|
||||
}
|
||||
|
||||
// Background color.
|
||||
$has_named_background_color = ! empty( $attributes['backgroundColor'] );
|
||||
$has_custom_background_color = ! empty( $attributes['style']['color']['background'] );
|
||||
$has_named_gradient = ! empty( $attributes['gradient'] );
|
||||
$has_custom_gradient = ! empty( $attributes['style']['color']['gradient'] );
|
||||
if (
|
||||
$has_named_background_color ||
|
||||
$has_custom_background_color ||
|
||||
$has_named_gradient ||
|
||||
$has_custom_gradient
|
||||
) {
|
||||
$classnames[] = 'has-background';
|
||||
}
|
||||
if ( $has_named_background_color ) {
|
||||
$classnames[] = sprintf( 'has-%s-background-color', $attributes['backgroundColor'] );
|
||||
}
|
||||
if ( $has_named_gradient ) {
|
||||
$classnames[] = sprintf( 'has-%s-gradient-background', $attributes['gradient'] );
|
||||
}
|
||||
|
||||
return implode( ' ', $classnames );
|
||||
}
|
||||
|
@ -41,7 +41,12 @@
|
||||
},
|
||||
"supports": {
|
||||
"align": [ "left", "center", "right" ],
|
||||
"color": {
|
||||
"gradients": true,
|
||||
"__experimentalSkipSerialization": true
|
||||
},
|
||||
"__experimentalBorder": {
|
||||
"color": true,
|
||||
"radius": true,
|
||||
"__experimentalSkipSerialization": true
|
||||
},
|
||||
|
@ -133,6 +133,12 @@ add_filter( 'pre_set_theme_mod_custom_logo', '_sync_custom_logo_to_site_logo' );
|
||||
* @param array $value Updated theme mod settings.
|
||||
*/
|
||||
function _delete_site_logo_on_remove_custom_logo( $old_value, $value ) {
|
||||
global $_ignore_site_logo_changes;
|
||||
|
||||
if ( $_ignore_site_logo_changes ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the custom_logo is being unset, it's being removed from theme mods.
|
||||
if ( isset( $old_value['custom_logo'] ) && ! isset( $value['custom_logo'] ) ) {
|
||||
delete_option( 'site_logo' );
|
||||
@ -143,6 +149,12 @@ function _delete_site_logo_on_remove_custom_logo( $old_value, $value ) {
|
||||
* Deletes the site logo when all theme mods are being removed.
|
||||
*/
|
||||
function _delete_site_logo_on_remove_theme_mods() {
|
||||
global $_ignore_site_logo_changes;
|
||||
|
||||
if ( $_ignore_site_logo_changes ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( false !== get_theme_support( 'custom-logo' ) ) {
|
||||
delete_option( 'site_logo' );
|
||||
}
|
||||
@ -160,3 +172,21 @@ function _delete_site_logo_on_remove_custom_logo_on_setup_theme() {
|
||||
add_action( "delete_option_theme_mods_$theme", '_delete_site_logo_on_remove_theme_mods' );
|
||||
}
|
||||
add_action( 'setup_theme', '_delete_site_logo_on_remove_custom_logo_on_setup_theme', 11 );
|
||||
|
||||
/**
|
||||
* Removes the custom_logo theme-mod when the site_logo option gets deleted.
|
||||
*/
|
||||
function _delete_custom_logo_on_remove_site_logo() {
|
||||
global $_ignore_site_logo_changes;
|
||||
|
||||
// Prevent _delete_site_logo_on_remove_custom_logo and
|
||||
// _delete_site_logo_on_remove_theme_mods from firing and causing an
|
||||
// infinite loop.
|
||||
$_ignore_site_logo_changes = true;
|
||||
|
||||
// Remove the custom logo.
|
||||
remove_theme_mod( 'custom_logo' );
|
||||
|
||||
$_ignore_site_logo_changes = false;
|
||||
}
|
||||
add_action( 'delete_option_site_logo', '_delete_custom_logo_on_remove_site_logo' );
|
||||
|
@ -3,7 +3,7 @@
|
||||
"name": "core/site-logo",
|
||||
"title": "Site Logo",
|
||||
"category": "layout",
|
||||
"description": "Useful for displaying a graphic mark, design, or symbol to represent the site. Once a site logo is set, it can be reused in different places and templates. It should not be confused with the site icon, which is the small image used in the dashboard, browser tabs, public search results, etc, to help recognize a site.",
|
||||
"description": "Display a graphic to represent this site. Update the block, and the changes apply everywhere it’s used. This is different than the site icon, which is the smaller image visible in your dashboard, browser tabs, etc used to help others recognize this site.",
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
"align": {
|
||||
@ -21,10 +21,21 @@
|
||||
"default": "_self"
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"viewportWidth": 500,
|
||||
"attributes": {
|
||||
"width": 350
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
"html": false,
|
||||
"align": true,
|
||||
"alignWide": false
|
||||
"alignWide": false,
|
||||
"color": {
|
||||
"__experimentalDuotone": "img",
|
||||
"text": false,
|
||||
"background": false
|
||||
}
|
||||
},
|
||||
"styles": [
|
||||
{
|
||||
|
@ -40,6 +40,12 @@
|
||||
* React Native specific.
|
||||
* These variables do not appear to be used anywhere else.
|
||||
*/
|
||||
/**
|
||||
* Converts a hex value into the rgb equivalent.
|
||||
*
|
||||
* @param {string} hex - the hexadecimal value to convert
|
||||
* @return {string} comma separated rgb values
|
||||
*/
|
||||
/**
|
||||
* Breakpoint mixins
|
||||
*/
|
||||
@ -84,6 +90,7 @@
|
||||
width: 120px;
|
||||
}
|
||||
.wp-block-site-logo.is-default-size img {
|
||||
height: auto;
|
||||
width: 100%;
|
||||
}
|
||||
.wp-block-site-logo .custom-logo-link {
|
||||
@ -97,26 +104,34 @@
|
||||
}
|
||||
.wp-block-site-logo img {
|
||||
display: block;
|
||||
height: auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder {
|
||||
justify-content: flex-start;
|
||||
min-height: auto;
|
||||
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder,
|
||||
.wp-block-site-logo.wp-block-site-logo .components-resizable-box__container {
|
||||
border-radius: inherit;
|
||||
}
|
||||
.wp-block-site-logo.wp-block-site-logo.is-default-size .components-placeholder {
|
||||
height: 120px;
|
||||
padding: 12px;
|
||||
width: 120px;
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder .components-placeholder__label {
|
||||
margin-top: 12px;
|
||||
white-space: nowrap;
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
box-shadow: none;
|
||||
padding: 0;
|
||||
min-height: 48px;
|
||||
min-width: 48px;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
color: currentColor;
|
||||
background: transparent;
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder .components-placeholder__label .block-editor-block-icon,
|
||||
.wp-block-site-logo .components-placeholder .components-placeholder__label > svg {
|
||||
margin-left: 4px;
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder .components-form-file-upload {
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-form-file-upload {
|
||||
display: none;
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder .components-placeholder__preview {
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__preview {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
left: 4px;
|
||||
@ -127,6 +142,65 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder .components-drop-zone__content-text {
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-drop-zone__content-text {
|
||||
display: none;
|
||||
}
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder::before {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
border: 1px dashed currentColor;
|
||||
opacity: 0.3;
|
||||
pointer-events: none;
|
||||
border-radius: inherit;
|
||||
}
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__fieldset {
|
||||
width: auto;
|
||||
}
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button {
|
||||
color: inherit;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
visibility: hidden;
|
||||
background: transparent;
|
||||
transition: all 0.1s linear;
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button {
|
||||
transition-duration: 0s;
|
||||
transition-delay: 0s;
|
||||
}
|
||||
}
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button > svg {
|
||||
color: #fff;
|
||||
}
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__illustration {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
stroke: currentColor;
|
||||
stroke-dasharray: 3;
|
||||
opacity: 0.3;
|
||||
}
|
||||
.wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button {
|
||||
background: var(--wp-admin-theme-color);
|
||||
border-color: var(--wp-admin-theme-color);
|
||||
border-style: solid;
|
||||
color: #fff;
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
}
|
@ -1 +1 @@
|
||||
.wp-block[data-align=center]>.wp-block-site-logo{margin-right:auto;margin-left:auto;text-align:center}.wp-block-site-logo a{pointer-events:none}.wp-block-site-logo:not(.is-default-size){display:table}.wp-block-site-logo.is-default-size{width:120px}.wp-block-site-logo.is-default-size img{width:100%}.wp-block-site-logo .custom-logo-link{cursor:inherit}.wp-block-site-logo .custom-logo-link:focus{box-shadow:none}.wp-block-site-logo .custom-logo-link.is-transient img{opacity:.3}.wp-block-site-logo img{display:block;max-width:100%}.wp-block-site-logo .components-placeholder{justify-content:flex-start;min-height:auto;height:120px;padding:12px}.wp-block-site-logo .components-placeholder .components-placeholder__label{margin-top:12px;white-space:nowrap}.wp-block-site-logo .components-placeholder .components-placeholder__label .block-editor-block-icon,.wp-block-site-logo .components-placeholder .components-placeholder__label>svg{margin-left:4px}.wp-block-site-logo .components-placeholder .components-form-file-upload{display:none}.wp-block-site-logo .components-placeholder .components-placeholder__preview{position:absolute;top:4px;left:4px;bottom:4px;right:4px;background:hsla(0,0%,100%,.8);display:flex;align-items:center;justify-content:center}.wp-block-site-logo .components-placeholder .components-drop-zone__content-text{display:none}
|
||||
.wp-block[data-align=center]>.wp-block-site-logo{margin-right:auto;margin-left:auto;text-align:center}.wp-block-site-logo a{pointer-events:none}.wp-block-site-logo:not(.is-default-size){display:table}.wp-block-site-logo.is-default-size{width:120px}.wp-block-site-logo.is-default-size img{height:auto;width:100%}.wp-block-site-logo .custom-logo-link{cursor:inherit}.wp-block-site-logo .custom-logo-link:focus{box-shadow:none}.wp-block-site-logo .custom-logo-link.is-transient img{opacity:.3}.wp-block-site-logo img{display:block;height:auto;max-width:100%}.wp-block-site-logo.wp-block-site-logo .components-placeholder,.wp-block-site-logo.wp-block-site-logo .components-resizable-box__container{border-radius:inherit}.wp-block-site-logo.wp-block-site-logo.is-default-size .components-placeholder{height:120px;width:120px}.wp-block-site-logo.wp-block-site-logo .components-placeholder{justify-content:center;align-items:center;box-shadow:none;padding:0;min-height:48px;min-width:48px;height:100%;width:100%;color:currentColor;background:transparent}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-form-file-upload{display:none}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__preview{position:absolute;top:4px;left:4px;bottom:4px;right:4px;background:hsla(0,0%,100%,.8);display:flex;align-items:center;justify-content:center}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-drop-zone__content-text{display:none}.wp-block-site-logo.wp-block-site-logo .components-placeholder:before{content:"";display:block;position:absolute;top:0;left:0;bottom:0;right:0;border:1px dashed;opacity:.3;pointer-events:none;border-radius:inherit}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__fieldset{width:auto}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button{color:inherit;padding:0;display:flex;justify-content:center;align-items:center;width:48px;height:48px;border-radius:50%;position:relative;visibility:hidden;background:transparent;transition:all .1s linear}@media (prefers-reduced-motion:reduce){.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button{transition-duration:0s;transition-delay:0s}}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button>svg{color:#fff}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__illustration{position:absolute;top:0;left:0;bottom:0;right:0;width:100%;height:100%;stroke:currentColor;stroke-dasharray:3;opacity:.3}.wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-style:solid;color:#fff;opacity:1;visibility:visible}
|
@ -40,6 +40,12 @@
|
||||
* React Native specific.
|
||||
* These variables do not appear to be used anywhere else.
|
||||
*/
|
||||
/**
|
||||
* Converts a hex value into the rgb equivalent.
|
||||
*
|
||||
* @param {string} hex - the hexadecimal value to convert
|
||||
* @return {string} comma separated rgb values
|
||||
*/
|
||||
/**
|
||||
* Breakpoint mixins
|
||||
*/
|
||||
@ -84,6 +90,7 @@
|
||||
width: 120px;
|
||||
}
|
||||
.wp-block-site-logo.is-default-size img {
|
||||
height: auto;
|
||||
width: 100%;
|
||||
}
|
||||
.wp-block-site-logo .custom-logo-link {
|
||||
@ -97,26 +104,34 @@
|
||||
}
|
||||
.wp-block-site-logo img {
|
||||
display: block;
|
||||
height: auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder {
|
||||
justify-content: flex-start;
|
||||
min-height: auto;
|
||||
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder,
|
||||
.wp-block-site-logo.wp-block-site-logo .components-resizable-box__container {
|
||||
border-radius: inherit;
|
||||
}
|
||||
.wp-block-site-logo.wp-block-site-logo.is-default-size .components-placeholder {
|
||||
height: 120px;
|
||||
padding: 12px;
|
||||
width: 120px;
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder .components-placeholder__label {
|
||||
margin-top: 12px;
|
||||
white-space: nowrap;
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
box-shadow: none;
|
||||
padding: 0;
|
||||
min-height: 48px;
|
||||
min-width: 48px;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
color: currentColor;
|
||||
background: transparent;
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder .components-placeholder__label .block-editor-block-icon,
|
||||
.wp-block-site-logo .components-placeholder .components-placeholder__label > svg {
|
||||
margin-right: 4px;
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder .components-form-file-upload {
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-form-file-upload {
|
||||
display: none;
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder .components-placeholder__preview {
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__preview {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 4px;
|
||||
@ -127,6 +142,65 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.wp-block-site-logo .components-placeholder .components-drop-zone__content-text {
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-drop-zone__content-text {
|
||||
display: none;
|
||||
}
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder::before {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
border: 1px dashed currentColor;
|
||||
opacity: 0.3;
|
||||
pointer-events: none;
|
||||
border-radius: inherit;
|
||||
}
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__fieldset {
|
||||
width: auto;
|
||||
}
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button {
|
||||
color: inherit;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
visibility: hidden;
|
||||
background: transparent;
|
||||
transition: all 0.1s linear;
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button {
|
||||
transition-duration: 0s;
|
||||
transition-delay: 0s;
|
||||
}
|
||||
}
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button > svg {
|
||||
color: #fff;
|
||||
}
|
||||
.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__illustration {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
stroke: currentColor;
|
||||
stroke-dasharray: 3;
|
||||
opacity: 0.3;
|
||||
}
|
||||
.wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button {
|
||||
background: var(--wp-admin-theme-color);
|
||||
border-color: var(--wp-admin-theme-color);
|
||||
border-style: solid;
|
||||
color: #fff;
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
}
|
@ -1 +1 @@
|
||||
.wp-block[data-align=center]>.wp-block-site-logo{margin-left:auto;margin-right:auto;text-align:center}.wp-block-site-logo a{pointer-events:none}.wp-block-site-logo:not(.is-default-size){display:table}.wp-block-site-logo.is-default-size{width:120px}.wp-block-site-logo.is-default-size img{width:100%}.wp-block-site-logo .custom-logo-link{cursor:inherit}.wp-block-site-logo .custom-logo-link:focus{box-shadow:none}.wp-block-site-logo .custom-logo-link.is-transient img{opacity:.3}.wp-block-site-logo img{display:block;max-width:100%}.wp-block-site-logo .components-placeholder{justify-content:flex-start;min-height:auto;height:120px;padding:12px}.wp-block-site-logo .components-placeholder .components-placeholder__label{margin-top:12px;white-space:nowrap}.wp-block-site-logo .components-placeholder .components-placeholder__label .block-editor-block-icon,.wp-block-site-logo .components-placeholder .components-placeholder__label>svg{margin-right:4px}.wp-block-site-logo .components-placeholder .components-form-file-upload{display:none}.wp-block-site-logo .components-placeholder .components-placeholder__preview{position:absolute;top:4px;right:4px;bottom:4px;left:4px;background:hsla(0,0%,100%,.8);display:flex;align-items:center;justify-content:center}.wp-block-site-logo .components-placeholder .components-drop-zone__content-text{display:none}
|
||||
.wp-block[data-align=center]>.wp-block-site-logo{margin-left:auto;margin-right:auto;text-align:center}.wp-block-site-logo a{pointer-events:none}.wp-block-site-logo:not(.is-default-size){display:table}.wp-block-site-logo.is-default-size{width:120px}.wp-block-site-logo.is-default-size img{height:auto;width:100%}.wp-block-site-logo .custom-logo-link{cursor:inherit}.wp-block-site-logo .custom-logo-link:focus{box-shadow:none}.wp-block-site-logo .custom-logo-link.is-transient img{opacity:.3}.wp-block-site-logo img{display:block;height:auto;max-width:100%}.wp-block-site-logo.wp-block-site-logo .components-placeholder,.wp-block-site-logo.wp-block-site-logo .components-resizable-box__container{border-radius:inherit}.wp-block-site-logo.wp-block-site-logo.is-default-size .components-placeholder{height:120px;width:120px}.wp-block-site-logo.wp-block-site-logo .components-placeholder{justify-content:center;align-items:center;box-shadow:none;padding:0;min-height:48px;min-width:48px;height:100%;width:100%;color:currentColor;background:transparent}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-form-file-upload{display:none}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__preview{position:absolute;top:4px;right:4px;bottom:4px;left:4px;background:hsla(0,0%,100%,.8);display:flex;align-items:center;justify-content:center}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-drop-zone__content-text{display:none}.wp-block-site-logo.wp-block-site-logo .components-placeholder:before{content:"";display:block;position:absolute;top:0;right:0;bottom:0;left:0;border:1px dashed;opacity:.3;pointer-events:none;border-radius:inherit}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__fieldset{width:auto}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button{color:inherit;padding:0;display:flex;justify-content:center;align-items:center;width:48px;height:48px;border-radius:50%;position:relative;visibility:hidden;background:transparent;transition:all .1s linear}@media (prefers-reduced-motion:reduce){.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button{transition-duration:0s;transition-delay:0s}}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-button.components-button>svg{color:#fff}.wp-block-site-logo.wp-block-site-logo .components-placeholder .components-placeholder__illustration{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;stroke:currentColor;stroke-dasharray:3;opacity:.3}.wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button{background:var(--wp-admin-theme-color);border-color:var(--wp-admin-theme-color);border-style:solid;color:#fff;opacity:1;visibility:visible}
|
@ -40,6 +40,12 @@
|
||||
* React Native specific.
|
||||
* These variables do not appear to be used anywhere else.
|
||||
*/
|
||||
/**
|
||||
* Converts a hex value into the rgb equivalent.
|
||||
*
|
||||
* @param {string} hex - the hexadecimal value to convert
|
||||
* @return {string} comma separated rgb values
|
||||
*/
|
||||
/**
|
||||
* Breakpoint mixins
|
||||
*/
|
||||
@ -78,9 +84,13 @@
|
||||
width: 120px;
|
||||
height: auto;
|
||||
}
|
||||
.wp-block-site-logo .aligncenter {
|
||||
.wp-block-site-logo a,
|
||||
.wp-block-site-logo img {
|
||||
border-radius: inherit;
|
||||
}
|
||||
.wp-block-site-logo.aligncenter {
|
||||
display: table;
|
||||
}
|
||||
.wp-block-site-logo.is-style-rounded img {
|
||||
.wp-block-site-logo.is-style-rounded {
|
||||
border-radius: 9999px;
|
||||
}
|
@ -1 +1 @@
|
||||
.wp-block-site-logo{line-height:0}.wp-block-site-logo a{display:inline-block}.wp-block-site-logo.is-default-size img{width:120px;height:auto}.wp-block-site-logo .aligncenter{display:table}.wp-block-site-logo.is-style-rounded img{border-radius:9999px}
|
||||
.wp-block-site-logo{line-height:0}.wp-block-site-logo a{display:inline-block}.wp-block-site-logo.is-default-size img{width:120px;height:auto}.wp-block-site-logo a,.wp-block-site-logo img{border-radius:inherit}.wp-block-site-logo.aligncenter{display:table}.wp-block-site-logo.is-style-rounded{border-radius:9999px}
|
@ -40,6 +40,12 @@
|
||||
* React Native specific.
|
||||
* These variables do not appear to be used anywhere else.
|
||||
*/
|
||||
/**
|
||||
* Converts a hex value into the rgb equivalent.
|
||||
*
|
||||
* @param {string} hex - the hexadecimal value to convert
|
||||
* @return {string} comma separated rgb values
|
||||
*/
|
||||
/**
|
||||
* Breakpoint mixins
|
||||
*/
|
||||
@ -78,9 +84,13 @@
|
||||
width: 120px;
|
||||
height: auto;
|
||||
}
|
||||
.wp-block-site-logo .aligncenter {
|
||||
.wp-block-site-logo a,
|
||||
.wp-block-site-logo img {
|
||||
border-radius: inherit;
|
||||
}
|
||||
.wp-block-site-logo.aligncenter {
|
||||
display: table;
|
||||
}
|
||||
.wp-block-site-logo.is-style-rounded img {
|
||||
.wp-block-site-logo.is-style-rounded {
|
||||
border-radius: 9999px;
|
||||
}
|
@ -1 +1 @@
|
||||
.wp-block-site-logo{line-height:0}.wp-block-site-logo a{display:inline-block}.wp-block-site-logo.is-default-size img{width:120px;height:auto}.wp-block-site-logo .aligncenter{display:table}.wp-block-site-logo.is-style-rounded img{border-radius:9999px}
|
||||
.wp-block-site-logo{line-height:0}.wp-block-site-logo a{display:inline-block}.wp-block-site-logo.is-default-size img{width:120px;height:auto}.wp-block-site-logo a,.wp-block-site-logo img{border-radius:inherit}.wp-block-site-logo.aligncenter{display:table}.wp-block-site-logo.is-style-rounded{border-radius:9999px}
|
@ -12,6 +12,7 @@
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
"align": [ "wide", "full" ],
|
||||
"html": false,
|
||||
"color": {
|
||||
"gradients": true
|
||||
@ -24,7 +25,13 @@
|
||||
"fontSize": true,
|
||||
"lineHeight": true,
|
||||
"__experimentalFontFamily": true,
|
||||
"__experimentalTextTransform": true
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-site-tagline-editor"
|
||||
|
@ -21,18 +21,31 @@ function render_block_core_site_title( $attributes ) {
|
||||
$tag_name = 'h1';
|
||||
$align_class_name = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}";
|
||||
|
||||
$aria_current = is_home() || ( is_front_page() && 'page' === get_option( 'show_on_front' ) ) ? ' aria-current="page"' : '';
|
||||
|
||||
if ( isset( $attributes['level'] ) ) {
|
||||
$tag_name = 0 === $attributes['level'] ? 'p' : 'h' . $attributes['level'];
|
||||
}
|
||||
|
||||
$link = sprintf( '<a href="%1$s" rel="home">%2$s</a>', get_bloginfo( 'url' ), $site_title );
|
||||
if ( $attributes['isLink'] ) {
|
||||
$link_attrs = array(
|
||||
'href="' . get_bloginfo( 'url' ) . '"',
|
||||
'rel="home"',
|
||||
$aria_current,
|
||||
);
|
||||
if ( '_blank' === $attributes['linkTarget'] ) {
|
||||
$link_attrs[] = 'target="_blank"';
|
||||
$link_attrs[] = 'aria-label="' . esc_attr__( '(opens in a new tab)' ) . '"';
|
||||
}
|
||||
$site_title = sprintf( '<a %1$s>%2$s</a>', implode( ' ', $link_attrs ), $site_title );
|
||||
}
|
||||
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) );
|
||||
|
||||
return sprintf(
|
||||
'<%1$s %2$s>%3$s</%1$s>',
|
||||
$tag_name,
|
||||
$wrapper_attributes,
|
||||
$link
|
||||
$site_title
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
"name": "core/site-title",
|
||||
"title": "Site Title",
|
||||
"category": "design",
|
||||
"description": "Displays and allows editing the name of the site. The site title usually appears in the browser title bar, in search results, and more. Also available in Settings > General.",
|
||||
"description": "Displays the name of this site. Update the block, and the changes apply everywhere it’s used. This will also appear in the browser title bar and in search results.",
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
"level": {
|
||||
@ -12,14 +12,24 @@
|
||||
},
|
||||
"textAlign": {
|
||||
"type": "string"
|
||||
},
|
||||
"isLink": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"linkTarget": {
|
||||
"type": "string",
|
||||
"default": "_self"
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"viewportWidth": 500
|
||||
},
|
||||
"supports": {
|
||||
"align": [ "wide", "full" ],
|
||||
"html": false,
|
||||
"color": {
|
||||
"gradients": true,
|
||||
"text": false,
|
||||
"link": true
|
||||
},
|
||||
"spacing": {
|
||||
@ -32,7 +42,15 @@
|
||||
"__experimentalFontFamily": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalFontWeight": true
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true,
|
||||
"lineHeight": true,
|
||||
"fontAppearance": true,
|
||||
"letterSpacing": true,
|
||||
"textTransform": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-site-title-editor"
|
||||
|
@ -40,7 +40,29 @@
|
||||
},
|
||||
"supports": {
|
||||
"align": [ "left", "center", "right" ],
|
||||
"anchor": true
|
||||
"anchor": true,
|
||||
"__experimentalExposeControlsToChildren": true,
|
||||
"__experimentalLayout": {
|
||||
"allowSwitching": false,
|
||||
"allowInheriting": false,
|
||||
"default": {
|
||||
"type": "flex"
|
||||
}
|
||||
},
|
||||
"spacing": {
|
||||
"blockGap": true,
|
||||
"margin": [ "top", "bottom" ],
|
||||
"units": [
|
||||
"px",
|
||||
"em",
|
||||
"rem",
|
||||
"vh",
|
||||
"vw"
|
||||
],
|
||||
"__experimentalDefaultControls": {
|
||||
"blockGap": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"styles": [
|
||||
{ "name": "default", "label": "Default", "isDefault": true },
|
||||
|
@ -3,7 +3,7 @@
|
||||
"name": "core/table",
|
||||
"title": "Table",
|
||||
"category": "text",
|
||||
"description": "Insert a table — perfect for sharing charts and data.",
|
||||
"description": "Create structured content in rows and columns to display information.",
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
"hasFixedLayout": {
|
||||
@ -129,6 +129,17 @@
|
||||
"__experimentalSkipSerialization": true,
|
||||
"gradients": true
|
||||
},
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
"lineHeight": true,
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"__experimentalBorder": {
|
||||
"__experimentalSkipSerialization": true,
|
||||
"color": true,
|
||||
|
@ -17,6 +17,7 @@ function render_block_core_tag_cloud( $attributes ) {
|
||||
'echo' => false,
|
||||
'taxonomy' => $attributes['taxonomy'],
|
||||
'show_count' => $attributes['showTagCounts'],
|
||||
'number' => $attributes['numberOfTags'],
|
||||
);
|
||||
$tag_cloud = wp_tag_cloud( $args );
|
||||
|
||||
|
@ -6,6 +6,12 @@
|
||||
"description": "A cloud of your most used tags.",
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
"numberOfTags": {
|
||||
"type": "number",
|
||||
"default": 45,
|
||||
"minimum": 1,
|
||||
"maximum": 100
|
||||
},
|
||||
"taxonomy": {
|
||||
"type": "string",
|
||||
"default": "post_tag"
|
||||
|
@ -27,7 +27,16 @@
|
||||
},
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
"__experimentalFontFamily": true
|
||||
"__experimentalFontFamily": true,
|
||||
"lineHeight": true,
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true,
|
||||
"fontAppearance": true
|
||||
}
|
||||
},
|
||||
"spacing": {
|
||||
"padding": true
|
||||
|
3
tests/e2e/config/bootstrap.js
vendored
3
tests/e2e/config/bootstrap.js
vendored
@ -129,6 +129,9 @@ beforeAll( async () => {
|
||||
capturePageEventsForTearDown();
|
||||
enablePageDialogAccept();
|
||||
observeConsoleLogging();
|
||||
await page.emulateMediaFeatures( [
|
||||
{ name: 'prefers-reduced-motion', value: 'reduce' },
|
||||
] );
|
||||
await setBrowserViewport( 'large' );
|
||||
} );
|
||||
|
||||
|
@ -62,7 +62,7 @@ describe( 'Edit Posts', () => {
|
||||
|
||||
// Expect to now be in the editor with the correct post title shown.
|
||||
const editorPostTitleInput = await page.$x(
|
||||
`//textarea[contains(@class, "editor-post-title__input")][contains(text(), "${ title }")]`
|
||||
`//h1[contains(@class, "editor-post-title__input")][contains(text(), "${ title }")]`
|
||||
);
|
||||
expect( editorPostTitleInput.length ).toBe( 1 );
|
||||
} );
|
||||
|
@ -170,7 +170,7 @@ class Tests_Blocks_Editor extends WP_UnitTestCase {
|
||||
public function test_get_default_block_editor_settings() {
|
||||
$settings = get_default_block_editor_settings();
|
||||
|
||||
$this->assertCount( 16, $settings );
|
||||
$this->assertCount( 17, $settings );
|
||||
$this->assertFalse( $settings['alignWide'] );
|
||||
$this->assertIsArray( $settings['allowedMimeTypes'] );
|
||||
$this->assertTrue( $settings['allowedBlockTypes'] );
|
||||
@ -493,19 +493,4 @@ class Tests_Blocks_Editor extends WP_UnitTestCase {
|
||||
$this->assertStringContainsString( '"\/wp\/v2\/blocks"', $after );
|
||||
$this->assertStringContainsString( '"\/wp\/v2\/types"', $after );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 53344
|
||||
*/
|
||||
public function test_get_block_editor_theme_styles() {
|
||||
$theme_styles = get_block_editor_theme_styles();
|
||||
$this->assertCount( 1, $theme_styles );
|
||||
$this->assertSameSets(
|
||||
array(
|
||||
'css' => 'body { font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif }',
|
||||
'__unstableType' => 'core',
|
||||
),
|
||||
$theme_styles[0]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user