diff --git a/styles/syntaxhighlighter-editor-style.css b/styles/syntaxhighlighter-editor-style.css new file mode 100644 index 0000000..6911837 --- /dev/null +++ b/styles/syntaxhighlighter-editor-style.css @@ -0,0 +1,22 @@ +/** + * SyntaxHighlighter Evolved + * + * A
specific reset for the WordPress tinymce visual editor + * Syntax Hightlighter Evolved passes unescaped output + * to the tiny mce editor withinwrapped shortcodes. + * + * This protects the shortcode content in this instance + * from being styled by user-agent styles + * and/or the theme's editor styles. + * + */ + +pre * +{ +background:inherit; +color: inherit; +font: inherit; +line-height: inherit; +margin:0; +padding:0; +} \ No newline at end of file diff --git a/syntaxhighlighter.php b/syntaxhighlighter.php index 07e3e67..5ad76c4 100644 --- a/syntaxhighlighter.php +++ b/syntaxhighlighter.php @@ -76,6 +76,7 @@ function __construct() { add_filter( 'tiny_mce_version', array( $this, 'break_tinymce_cache' ) ); add_filter( 'save_post', array( $this, 'mark_as_encoded' ), 10, 2 ); add_filter( 'plugin_action_links', array( $this, 'settings_link' ), 10, 2 ); + add_filter( 'mce_css', array( $this, 'editor_style' ) ); // Register widget hooks // Requires change added in WordPress 2.9 @@ -305,6 +306,14 @@ function settings_link( $links, $file ) { return $links; } + function editor_style( $mce_css ) { + if ( ! empty( $mce_css ) ) + $mce_css .= ','; + + $mce_css .= plugins_url( 'syntaxhighlighter/styles/syntaxhighlighter-editor-style.css' ); + + return $mce_css; + } // Output list of shortcode tags for the TinyMCE plugin function output_shortcodes_for_tinymce() {