ap_ajax_tinymce_assets()

Description #

Include tinymce assets.

Changelog #

VersionDescription
4.1.0Introduced.

Source #

File: includes/functions.php

function ap_ajax_tinymce_assets() {
	if ( ! class_exists( '_WP_Editors' ) ) {
		require ABSPATH . WPINC . '/class-wp-editor.php';
	}

	\_WP_Editors::enqueue_scripts();

	// Enqueue wp-tinymce when Jetpack photon-cdn module is enabled,
	// since while user are trying to add an answer to the question,
	// creates JS console error and hence, the editor does not work.
	if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'photon-cdn' ) ) {
		wp_enqueue_script( 'wp-tinymce' );
	}

	ob_start();
	print_footer_scripts();
	$scripts = ob_get_clean();

	echo str_replace( 'jquery-core,', '', $scripts ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
	\_WP_Editors::editor_js();
}

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