PluginProbe
Gutenberg / 12.1.0
Gutenberg v12.1.0
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / lib / compat / wordpress-5.9 / default-editor-styles.php

default-editor-styles.php in Gutenberg 12.1.0, at lib/compat/wordpress-5.9/default-editor-styles.php

42 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Loads the default editor styles.
4 *
5 * @package gutenberg
6 */
7
8 /**
9 * Load the default editor styles.
10 * These styles are used if the "no theme styles" options is triggered
11 * or on themes without their own editor styles.
12 *
13 * @param array $settings Default editor settings.
14 *
15 * @return array Filtered editor settings.
16 */
17 function gutenberg_extend_block_editor_settings_with_default_editor_styles( $settings ) {
18 $default_editor_styles_file = gutenberg_dir_path() . 'build/block-editor/default-editor-styles.css';
19 $settings['defaultEditorStyles'] = array(
20 array(
21 'css' => file_get_contents( $default_editor_styles_file ),
22 ),
23 );
24
25 // Remove the default font addition from Core Code.
26 $styles_without_core_styles = array();
27 if ( isset( $settings['styles'] ) ) {
28 foreach ( $settings['styles'] as $style ) {
29 if (
30 ! isset( $style['__unstableType'] ) ||
31 'core' !== $style['__unstableType']
32 ) {
33 $styles_without_core_styles[] = $style;
34 }
35 }
36 }
37 $settings['styles'] = $styles_without_core_styles;
38
39 return $settings;
40 }
41 add_filter( 'block_editor_settings_all', 'gutenberg_extend_block_editor_settings_with_default_editor_styles' );
42