Syntax_Highlighter::mce_before_init( array $options )

Description #

Modify tinyMCE options so that we can add our pre tags along with language code.

Our language code is stored in a custom attribute aplang. Also whitelist contenteditable attribute so that we can prevent editing pre tag in editor.

Parameters #

  • $options
    array (Required) TinyMCE options.

Changelog #

VersionDescription
4.1.8Introduced.

Source #

File: addons/syntaxhighlighter/syntaxhighlighter.php

	public function mce_before_init( $options ) {
		if ( ! isset( $options['extended_valid_elements'] ) ) {
			$options['extended_valid_elements'] = '';
		} else {
			$options['extended_valid_elements'] .= ',';
		}

		$options['extended_valid_elements'] = 'pre,code';

		return $options;
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment