WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#31578 closed defect (bug) (fixed)

Any wp_editor instances would break on RTL languages

Reported by: maimairel Owned by: azaozz
Milestone: 4.2 Priority: normal
Severity: normal Version: 4.1.1
Component: TinyMCE Keywords:
Focuses: Cc:

Description

Hi there, there's an issue with RTL languages and additional wp_editor instances. I'll describe the two things that happened on this ticket.

  1. When adding any additional wp_editor instances on RTL languages, the function _mce_set_direction would produce a PHP warning.

This is caused by wp-includes/functions.php, line 2904 on WP 4.1.1:

$input['plugins'] .= ',directionality';

This is because the settings array in _WP_Editors::editor_settings does not have the plugins property anymore after the first init.

  1. The fatal issue would be this one, where the code in step 1 caused another issue on the following initialization JS code.

init = tinyMCEPreInit.mceInit[edId] = tinymce.extend( {}, firstInit, tinyMCEPreInit.mceInit[edId] );

tinymce.extend would normally extend the editor settings object with a plugins property, but because of the code in _mce_set_direction the settings object already has the plugins property with a value of ,directionality

This caused the additional tinymce instance to display the default buttons.

I hope this gets resolved soon!

Thank you!

Change History (5)

#1 @azaozz
5 years ago

  • Milestone changed from Awaiting Review to 4.2

Seems we need isset( $input['plugins'] ) there.

#2 @samuelsidler
4 years ago

  • Priority changed from normal to high

#3 follow-up: @azaozz
4 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 31874:

TinyMCE: fix error and PHP warning when adding more than one instance in RTL mode.
Part props maimairel. Fixes #31578.

#4 @DrewAPicture
4 years ago

  • Priority changed from high to normal

#5 in reply to: ↑ 3 @nacin
4 years ago

Replying to azaozz:

In 31874:

TinyMCE: fix error and PHP warning when adding more than one instance in RTL mode.
Part props maimairel. Fixes #31578.

Is there a reason one of these is an strpos and the other is a regex?

Note: See TracTickets for help on using tickets.