mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-20 05:25:33 +00:00
TinyMCE: Improve the previews for shortcodes.
Merge of [41395] to the 4.1 branch. Built from https://develop.svn.wordpress.org/branches/4.1@41442 git-svn-id: http://core.svn.wordpress.org/branches/4.1@41275 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8c8a907ba3
commit
acc424ed10
@ -131,6 +131,14 @@ window.wp = window.wp || {};
|
||||
importStyles = this.type === 'video' || this.type === 'audio' || this.type === 'playlist';
|
||||
|
||||
if ( head || body.indexOf( '<script' ) !== -1 ) {
|
||||
if ( body.indexOf( '[' ) !== -1 && body.indexOf( ']' ) !== -1 ) {
|
||||
var shortcodesRegExp = new RegExp( '\\[\\/?(?:' + window.mceViewL10n.shortcodes.join( '|' ) + ')[^\\]]*?\\]', 'g' );
|
||||
// Escape tags inside shortcode previews.
|
||||
body = body.replace( shortcodesRegExp, function( match ) {
|
||||
return match.replace( /</g, '<' ).replace( />/g, '>' );
|
||||
} );
|
||||
}
|
||||
|
||||
this.getNodes( function ( editor, node, content ) {
|
||||
var dom = editor.dom,
|
||||
styles = '',
|
||||
|
2
wp-includes/js/mce-view.min.js
vendored
2
wp-includes/js/mce-view.min.js
vendored
File diff suppressed because one or more lines are too long
@ -706,6 +706,9 @@ function wp_just_in_time_script_localization() {
|
||||
'blog_id' => get_current_blog_id(),
|
||||
) );
|
||||
|
||||
wp_localize_script( 'mce-view', 'mceViewL10n', array(
|
||||
'shortcodes' => ! empty( $GLOBALS['shortcode_tags'] ) ? array_keys( $GLOBALS['shortcode_tags'] ) : array()
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user