TinyMCE: fix toolbars alignment in RTL.

Fixes #37760 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@38349 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2016-08-25 01:19:24 +00:00
parent 8d490e9d83
commit 861bdc722f
3 changed files with 23 additions and 9 deletions

View File

@ -1259,6 +1259,14 @@ final class _WP_Editors {
var init, id, $wrap;
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 ) {
init = tinyMCEPreInit.mceInit[id];
$wrap = tinymce.$( '#wp-' + id + '-wrap' );

View File

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

View File

@ -3220,28 +3220,29 @@ function _config_wp_siteurl( $url = '' ) {
* Fills in the 'directionality' setting, enables the 'directionality'
* plugin, and adds the 'ltr' button to 'toolbar1', formerly
* '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
* @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.
*/
function _mce_set_direction( $input ) {
function _mce_set_direction( $mce_init ) {
if ( is_rtl() ) {
$input['directionality'] = 'rtl';
$mce_init['directionality'] = 'rtl';
$mce_init['rtl_ui'] = true;
if ( ! empty( $input['plugins'] ) && strpos( $input['plugins'], 'directionality' ) === false ) {
$input['plugins'] .= ',directionality';
if ( ! empty( $mce_init['plugins'] ) && strpos( $mce_init['plugins'], 'directionality' ) === false ) {
$mce_init['plugins'] .= ',directionality';
}
if ( ! empty( $input['toolbar1'] ) && ! preg_match( '/\bltr\b/', $input['toolbar1'] ) ) {
$input['toolbar1'] .= ',ltr';
if ( ! empty( $mce_init['toolbar1'] ) && ! preg_match( '/\bltr\b/', $mce_init['toolbar1'] ) ) {
$mce_init['toolbar1'] .= ',ltr';
}
}
return $input;
return $mce_init;
}