Skip to content

Commit

Permalink
More CS
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed May 8, 2023
1 parent 934ac59 commit 0687bc7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function gutenberg_register_packages_scripts( $scripts ) {
if (
! $gutenberg_experiments ||
! array_key_exists( 'gutenberg-no-tinymce', $gutenberg_experiments ) ||
isset( $_COOKIE[ 'requiresTinymce' ] )
isset( $_COOKIE['requiresTinymce'] )
) {
array_push( $dependencies, 'editor' );
}
Expand Down
15 changes: 13 additions & 2 deletions lib/experimental/class--wp-editors.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
<?php
/**
* Placeholder class to replace the default `_WP_Editors`.
* Used to disable loading of TinyMCE assets.
* Contains the placeholder class to replace the default `_WP_Editors`.
*
* @package gutenberg
* @since 6.3.0
*/

// phpcs:disable PEAR.NamingConventions.ValidClassName.StartWithCapital

/**
* Placeholder class.
* Used to disable loading of TinyMCE assets.
*
* @access public
*/
final class _WP_Editors {
/**
* Necessary to ensure no additional TinyMcE assets are enqueued.
*/
public static function enqueue_default_editor() {}
}
9 changes: 4 additions & 5 deletions lib/experimental/disable-tinymce.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,20 @@ function gutenberg_disable_tinymce() {

/**
* Enqueue TinyMCE proxy script.
* Detects TinyMCE usage and sets the `requiresTinymce` cookie to stop disabling TinyMCE loading.
* Detects TinyMCE usage and sets the `requiresTinymce` cookie to stop disabling TinyMCE loading.
*/
function gutenberg_enqueue_tinymce_proxy() {
wp_enqueue_script( 'gutenberg-tinymce-proxy', plugins_url( 'assets/tinymce-proxy.js' , __FILE__ ) );
wp_enqueue_script( 'gutenberg-tinymce-proxy', plugins_url( 'assets/tinymce-proxy.js', __FILE__ ) );
}

add_action( 'admin_enqueue_scripts', 'gutenberg_enqueue_tinymce_proxy' );

/**
* Example TinyMCE usage used for testing.
* Uncomment the last line of this file to enable.
* Uncomment the last line of this file to enable.
*/
function gutenberg_test_tinymce_access() {
echo '<script type="text/javascript">const a = window.tinymce.$;</script>';
}

// Uncomment the following line to force an external TinyMCE usage.
// add_action( 'admin_footer', 'gutenberg_test_tinymce_access' );
// add_action( 'admin_footer', 'gutenberg_test_tinymce_access' ); // Uncomment the following line to force an external TinyMCE usage.

0 comments on commit 0687bc7

Please sign in to comment.