Editor: Make registered editor stylesheets (editor-style.css) available to the front-end.
Props webmandesign, azaozz. Fixes #34882. Built from https://develop.svn.wordpress.org/trunk@45621 git-svn-id: http://core.svn.wordpress.org/trunk@45432 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
969699260d
commit
ff723a2fba
|
@ -540,18 +540,24 @@ final class _WP_Editors {
|
||||||
$settings['wpeditimage_disable_captions'] = true;
|
$settings['wpeditimage_disable_captions'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mce_css = $settings['content_css'];
|
$mce_css = $settings['content_css'];
|
||||||
$editor_styles = get_editor_stylesheets();
|
|
||||||
|
|
||||||
if ( ! empty( $editor_styles ) ) {
|
// The `editor-style.css` added by the theme is generally intended for the editor instance on the Edit Post screen.
|
||||||
// Force urlencoding of commas.
|
// Plugins that use wp_editor() on the front-end can decide whether to add the theme stylesheet
|
||||||
foreach ( $editor_styles as $key => $url ) {
|
// by using `get_editor_stylesheets()` and the `mce_css` or `tiny_mce_before_init` filters, see below.
|
||||||
if ( strpos( $url, ',' ) !== false ) {
|
if ( is_admin() ) {
|
||||||
$editor_styles[ $key ] = str_replace( ',', '%2C', $url );
|
$editor_styles = get_editor_stylesheets();
|
||||||
|
|
||||||
|
if ( ! empty( $editor_styles ) ) {
|
||||||
|
// Force urlencoding of commas.
|
||||||
|
foreach ( $editor_styles as $key => $url ) {
|
||||||
|
if ( strpos( $url, ',' ) !== false ) {
|
||||||
|
$editor_styles[ $key ] = str_replace( ',', '%2C', $url );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$mce_css .= ',' . implode( ',', $editor_styles );
|
$mce_css .= ',' . implode( ',', $editor_styles );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1924,15 +1924,13 @@ function wp_update_custom_css_post( $css, $args = array() ) {
|
||||||
* Defaults to 'editor-style.css'
|
* Defaults to 'editor-style.css'
|
||||||
*/
|
*/
|
||||||
function add_editor_style( $stylesheet = 'editor-style.css' ) {
|
function add_editor_style( $stylesheet = 'editor-style.css' ) {
|
||||||
|
global $editor_styles;
|
||||||
|
|
||||||
add_theme_support( 'editor-style' );
|
add_theme_support( 'editor-style' );
|
||||||
|
|
||||||
if ( ! is_admin() ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
global $editor_styles;
|
|
||||||
$editor_styles = (array) $editor_styles;
|
$editor_styles = (array) $editor_styles;
|
||||||
$stylesheet = (array) $stylesheet;
|
$stylesheet = (array) $stylesheet;
|
||||||
|
|
||||||
if ( is_rtl() ) {
|
if ( is_rtl() ) {
|
||||||
$rtl_stylesheet = str_replace( '.css', '-rtl.css', $stylesheet[0] );
|
$rtl_stylesheet = str_replace( '.css', '-rtl.css', $stylesheet[0] );
|
||||||
$stylesheet[] = $rtl_stylesheet;
|
$stylesheet[] = $rtl_stylesheet;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.3-alpha-45620';
|
$wp_version = '5.3-alpha-45621';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue