TinyMCE: fix toolbars alignment in RTL.

Merge of [38349] to the 4.6 branch.

Props azaozz, geminorum for testing.
Fixes #37760.

Built from https://develop.svn.wordpress.org/branches/4.6@38488


git-svn-id: http://core.svn.wordpress.org/branches/4.6@38429 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Jeremy Felt 2016-08-31 23:43:29 +00:00
parent 0c064f4ed8
commit 9214ae47a6
7 changed files with 31 additions and 12 deletions

View File

@ -1259,6 +1259,14 @@ final class _WP_Editors {
var init, id, $wrap; var init, id, $wrap;
if ( typeof tinymce !== 'undefined' ) { if ( typeof tinymce !== 'undefined' ) {
// Fix RTL
tinymce.on( 'addeditor', function( event ) {
event.editor.rtl = event.editor.settings.rtl_ui ||
( event.editor.editorManager &&
event.editor.editorManager.i18n &&
event.editor.editorManager.i18n.rtl );
}, true );
for ( id in tinyMCEPreInit.mceInit ) { for ( id in tinyMCEPreInit.mceInit ) {
init = tinyMCEPreInit.mceInit[id]; init = tinyMCEPreInit.mceInit[id];
$wrap = tinymce.$( '#wp-' + id + '-wrap' ); $wrap = tinymce.$( '#wp-' + id + '-wrap' );

View File

@ -392,6 +392,11 @@ div.mce-path {
cursor: pointer; cursor: pointer;
} }
.mce-btn .mce-txt {
direction: inherit;
text-align: inherit;
}
.mce-toolbar .mce-btn-group .mce-btn, .mce-toolbar .mce-btn-group .mce-btn,
.qt-dfw { .qt-dfw {
border: 1px solid transparent; border: 1px solid transparent;

File diff suppressed because one or more lines are too long

View File

@ -392,6 +392,11 @@ div.mce-path {
cursor: pointer; cursor: pointer;
} }
.mce-btn .mce-txt {
direction: inherit;
text-align: inherit;
}
.mce-toolbar .mce-btn-group .mce-btn, .mce-toolbar .mce-btn-group .mce-btn,
.qt-dfw { .qt-dfw {
border: 1px solid transparent; border: 1px solid transparent;

File diff suppressed because one or more lines are too long

View File

@ -3190,28 +3190,29 @@ function _config_wp_siteurl( $url = '' ) {
* Fills in the 'directionality' setting, enables the 'directionality' * Fills in the 'directionality' setting, enables the 'directionality'
* plugin, and adds the 'ltr' button to 'toolbar1', formerly * plugin, and adds the 'ltr' button to 'toolbar1', formerly
* 'theme_advanced_buttons1' array keys. These keys are then returned * 'theme_advanced_buttons1' array keys. These keys are then returned
* in the $input (TinyMCE settings) array. * in the $mce_init (TinyMCE settings) array.
* *
* @since 2.1.0 * @since 2.1.0
* @access private * @access private
* *
* @param array $input MCE settings array. * @param array $mce_init MCE settings array.
* @return array Direction set for 'rtl', if needed by locale. * @return array Direction set for 'rtl', if needed by locale.
*/ */
function _mce_set_direction( $input ) { function _mce_set_direction( $mce_init ) {
if ( is_rtl() ) { if ( is_rtl() ) {
$input['directionality'] = 'rtl'; $mce_init['directionality'] = 'rtl';
$mce_init['rtl_ui'] = true;
if ( ! empty( $input['plugins'] ) && strpos( $input['plugins'], 'directionality' ) === false ) { if ( ! empty( $mce_init['plugins'] ) && strpos( $mce_init['plugins'], 'directionality' ) === false ) {
$input['plugins'] .= ',directionality'; $mce_init['plugins'] .= ',directionality';
} }
if ( ! empty( $input['toolbar1'] ) && ! preg_match( '/\bltr\b/', $input['toolbar1'] ) ) { if ( ! empty( $mce_init['toolbar1'] ) && ! preg_match( '/\bltr\b/', $mce_init['toolbar1'] ) ) {
$input['toolbar1'] .= ',ltr'; $mce_init['toolbar1'] .= ',ltr';
} }
} }
return $input; return $mce_init;
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.6.1-alpha-38487'; $wp_version = '4.6.1-alpha-38488';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.