Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions src/wp-includes/block-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,21 +194,18 @@ 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';

static $default_editor_styles_file_contents = false;
if ( ! $default_editor_styles_file_contents && file_exists( $default_editor_styles_file ) ) {
$default_editor_styles_file_contents = file_get_contents( $default_editor_styles_file );
}

$default_editor_styles = array();
if ( $default_editor_styles_file_contents ) {
$default_editor_styles = array(
array( 'css' => $default_editor_styles_file_contents ),
);
}
/*
* These styles are used when the "Use theme styles" preference is turned off
* and in the Customizer widgets editor.
*
* They were previously read from `css/dist/block-editor/default-editor-styles.css`,
* which the block editor package no longer ships.
*/
$default_editor_styles = array(
array(
'css' => 'body{font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:18px;line-height:1.5;--wp--style--block-gap:2em}p{line-height:1.8}',
),
);

$editor_settings = array(
'alignWide' => get_theme_support( 'align-wide' ),
Expand Down
3 changes: 3 additions & 0 deletions tests/phpunit/tests/blocks/editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ public function test_get_allowed_block_types_deprecated_filter_post_editor() {

/**
* @ticket 52920
* @ticket 66762
*/
public function test_get_default_block_editor_settings() {
$settings = get_default_block_editor_settings();
Expand Down Expand Up @@ -300,6 +301,8 @@ public function test_get_default_block_editor_settings() {
$this->assertFalse( $settings['disableCustomFontSizes'] );
$this->assertFalse( $settings['disableCustomGradients'] );
$this->assertFalse( $settings['disableLayoutStyles'] );
$this->assertCount( 1, $settings['defaultEditorStyles'] );
$this->assertStringContainsString( 'font-size:18px', $settings['defaultEditorStyles'][0]['css'] );
$this->assertFalse( $settings['enableCustomLineHeight'] );
$this->assertFalse( $settings['enableCustomSpacing'] );
$this->assertFalse( $settings['enableCustomUnits'] );
Expand Down
Loading