From 1f1f49dd3cafe24b952ed8f1a26f80c8c893f7e5 Mon Sep 17 00:00:00 2001
From: Miguel Fonseca <miguelcsf@gmail.com>
Date: Tue, 20 Mar 2018 09:47:00 +0000
Subject: [PATCH] Ignore "Disable visual editor" setting (#5670)

Fixes #5667

See wp-includes/class-wp-editor's behavior around self::$this_tinymce:
https://github.com/WordPress/WordPress/blob/176a28905041fd79c439946a4ba290a87db5991f/wp-includes/class-wp-editor.php#L360
---
 lib/client-assets.php | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/client-assets.php b/lib/client-assets.php
index a27fc7f1874f8c..9bfc22bb1d95a2 100644
--- a/lib/client-assets.php
+++ b/lib/client-assets.php
@@ -802,6 +802,12 @@ function gutenberg_editor_scripts_and_styles( $hook ) {
 	// to disable it outright.
 	wp_enqueue_script( 'heartbeat' );
 
+	// Ignore Classic Editor's `rich_editing` user option, aka "Disable visual
+	// editor". Forcing this to be true guarantees that TinyMCE and its plugins
+	// are available in Gutenberg. Fixes
+	// https://github.com/WordPress/gutenberg/issues/5667.
+	add_filter( 'user_can_richedit', '__return_true' );
+
 	wp_enqueue_script( 'wp-edit-post' );
 
 	// Register `wp-utils` as a dependency of `word-count` to ensure that