WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 4 days ago

#52050 new defect (bug)

White TinyMce editor from wp_editor function on a meta box on WP 5.6

Reported by: sweetheatmn Owned by:
Milestone: 5.8 Priority: normal
Severity: normal Version: 5.6
Component: Editor Keywords: needs-patch needs-testing
Focuses: Cc:

Description

wp_editor function returns a white TinyMCE that is not responding on metabox when quicktags is disabled or when the default_editor is set to tinyMCE

test code

function wporg_add_custom_box() {
	$screens = [ 'post', 'wporg_cpt' ];
	foreach ( $screens as $screen ) {
		add_meta_box(
				'wporg_box_id',                 // Unique ID
				'Custom Meta Box Title',      // Box title
				'wporg_custom_box_html',  // Content callback, must be of type callable
				$screen                            // Post type
				);
	}
}
add_action( 'add_meta_boxes', 'wporg_add_custom_box' );

function wporg_custom_box_html( $post ) {
	 $args = array('quicktags' => false);
	 wp_editor(  'Welcome to WP'  , 'test-editor', $args );
}

returned editor that does not contain the content or is editable

https://monosnap.com/file/5FY44sq063vHgPMp6Ib50mKGZsTCQx

Expected result: normal TinyMCE editor that contains the content and is editable

Regards,
Atef

Attachments (2)

Capture d’écran 2021-02-13 à 22.27.31.png (56.3 KB) - added by audrasjb 3 weeks ago.
Apply the example code: the metabox WYSIWYG editor is broken
Capture d’écran 2021-02-13 à 22.27.48.png (70.4 KB) - added by audrasjb 3 weeks ago.
set SCRIPT_DEBUG constant to true: it works fine 🤔

Download all attachments as: .zip

Change History (19)

#1 @dway
3 months ago

  • Severity changed from normal to major

Same problem here.
Just did a simple metabox with a wp_editor call : no focus inside the editor, in any configuration (teeny or quicktags variations).

This ticket was mentioned in Slack in #core by metalandcoffee. View the logs.


3 months ago

#3 @johnbillion
3 months ago

  • Milestone changed from Awaiting Review to 5.6.1

This ticket was mentioned in Slack in #core by metalandcoffee. View the logs.


2 months ago

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


6 weeks ago

#6 @audrasjb
6 weeks ago

  • Milestone changed from 5.6.1 to 5.6.2

Given 5.6.1 is slated to next week, let's move this ticket to 5.6.2 to give it some more time.

#7 @lumpysimon
6 weeks ago

If there's any chance to get this into 5.6.1 it would be hugely appreciated - this is causing major issues for a couple of clients of mine who have several WYSIWYG editors for various postmeta fields (using CMB2) and the block editor enabled for the main post content.

See https://github.com/CMB2/CMB2/issues/1397

Anyone using CMB2 or similar postmeta plugins who have a WYSIWYG field are going to be affected by this issue.

#8 @audrasjb
6 weeks ago

  • Keywords needs-patch added

There is still a small chance to get this fixed in 5.6.1, but it will need a patch today.

Anyone interested is welcome to work on a patch and to upload it in this ticket.

I'm leaving the ticket in the next point release for now, waiting for a first patch.

#9 @jeremycaris
4 weeks ago

I posted about this on Stack Exchange before I realized it was a WordPress 5.6 issue. In a comment, someone noted that if you install the Enable jQuery Migrate Helper plugin, this issue is resolved. I can confirm that it does resolve the issue.

The plugin downgrades jQuery to the version that was previously included in Wordpress 5.5. Or, if you install the Classic Editor plugin (which disables Gutenberg) the metaboxc issue is resolved also.

Hopefully, this helps someone isolate the bug to create a patch.

https://wordpress.stackexchange.com/questions/382306/wp-editor-visual-tab-in-meta-box-doesnt-show-content/382310#382310

Last edited 4 weeks ago by jeremycaris (previous) (diff)

#10 @audrasjb
3 weeks ago

Hi,

Looking at this issue again and doing some tests, I went to a very strange behavior: using the wp_editor function usage provided in the ticket description, I can reproduce the issue on the wp_editor added in the meta box. But there is a strange fact: if I set SCRIPT_DEBUG constant to true, the issue is fixed… 🤯

@audrasjb
3 weeks ago

Apply the example code: the metabox WYSIWYG editor is broken

@audrasjb
3 weeks ago

set SCRIPT_DEBUG constant to true: it works fine 🤔

#11 @desrosj
3 weeks ago

  • Component changed from General to Editor
  • Milestone changed from 5.6.2 to Future Release

5.6.2 RC is going to be packaged in a few hours. Since this one still requires some investigation and lacks a patch, I'm going to punt to Future Release.

#12 @dway
3 weeks ago

Hope this will addressed soon !

#13 @dway
9 days ago

  • Severity changed from major to critical

Any update on this ?
5.7 is coming and it seems that's not planned to it.
Lots of wordpress site blocked in 5.5.3 so far until this bug is resolved.
On my side, I can't debug this, I'm not familiar with TinyMCE...

Last edited 9 days ago by dway (previous) (diff)

#14 @dway
6 days ago

Further tests show that wpeditor is initialised correctly when inserted in a taxonomy term form, in 5.6 and 5.7, so the problem is really limited to wpeditor in a metabox below the blocks editor.

I thought it was a problem of mis-loading or mis-init, so I try to insert a classic editor as a block, saved the content, and reload the page.
The wpeditor in the metabox still does not init totally and we can't write in it.

Last edited 6 days ago by dway (previous) (diff)

#15 @dway
6 days ago

  • Keywords needs-testing added

#16 @audrasjb
4 days ago

  • Milestone changed from Future Release to 5.8
  • Severity changed from critical to normal

Hello,

5.7 is coming and it seems that's not planned to it.

Yes I can confirm this is not going to be addressed in WP 5.7. It still needs a patch. Everyone is welcome to jump on this issue and to propose a first patch to help it to move forward.

Moving this to milestone 5.8, but removing critical workflow keyword as it doesn't look to be globally reported in the support forums.

#17 @dway
4 days ago

Yes I can confirm this is not going to be addressed in WP 5.7. It still needs a patch. Everyone is welcome to jump on this issue and to propose a first patch to help it to move forward.

Unfortunatly Gutenberg and JS stuff are not my area of work, I can't debug that :'(

as it doesn't look to be globally reported in the support forums.

Yes @audrasjb I can understand that it's an edge case. But this is still a regression since 5.5, and authors of this may be warned. Using a tiny wpeditor in metabox is a common case in many plugins, and thousands of website may face this bug. But sadly, a few knows how to report this here in my opinion : I know a lot of people impacted, just users, no developpers.

Do you know people that may be warned for this ticket to look more deeply ?

Besides, I think this should be a major severity

Note: See TracTickets for help on using tickets.