WordPress.org

Make WordPress Core

Changeset 38488


Ignore:
Timestamp:
08/31/2016 11:42:15 PM (3 years ago)
Author:
jeremyfelt
Message:

TinyMCE: fix toolbars alignment in RTL.

Merge of [38349] to the 4.6 branch.

Props azaozz, geminorum for testing.
Fixes #37760.

Location:
branches/4.6
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/4.6

  • branches/4.6/src/wp-includes/class-wp-editor.php

    r38159 r38488  
    12601260
    12611261            if ( typeof tinymce !== 'undefined' ) {
     1262                // Fix RTL
     1263                tinymce.on( 'addeditor', function( event ) {
     1264                    event.editor.rtl = event.editor.settings.rtl_ui ||
     1265                        ( event.editor.editorManager &&
     1266                        event.editor.editorManager.i18n &&
     1267                        event.editor.editorManager.i18n.rtl );
     1268                }, true );
     1269
    12621270                for ( id in tinyMCEPreInit.mceInit ) {
    12631271                    init = tinyMCEPreInit.mceInit[id];
  • branches/4.6/src/wp-includes/css/editor.css

    r37751 r38488  
    391391    text-shadow: none;
    392392    cursor: pointer;
     393}
     394
     395.mce-btn .mce-txt {
     396    direction: inherit;
     397    text-align: inherit;
    393398}
    394399
  • branches/4.6/src/wp-includes/functions.php

    r38152 r38488  
    31913191 * plugin, and adds the 'ltr' button to 'toolbar1', formerly
    31923192 * 'theme_advanced_buttons1' array keys. These keys are then returned
    3193  * in the $input (TinyMCE settings) array.
     3193 * in the $mce_init (TinyMCE settings) array.
    31943194 *
    31953195 * @since 2.1.0
    31963196 * @access private
    31973197 *
    3198  * @param array $input MCE settings array.
     3198 * @param array $mce_init MCE settings array.
    31993199 * @return array Direction set for 'rtl', if needed by locale.
    32003200 */
    3201 function _mce_set_direction( $input ) {
     3201function _mce_set_direction( $mce_init ) {
    32023202    if ( is_rtl() ) {
    3203         $input['directionality'] = 'rtl';
    3204 
    3205         if ( ! empty( $input['plugins'] ) && strpos( $input['plugins'], 'directionality' ) === false ) {
    3206             $input['plugins'] .= ',directionality';
    3207         }
    3208 
    3209         if ( ! empty( $input['toolbar1'] ) && ! preg_match( '/\bltr\b/', $input['toolbar1'] ) ) {
    3210             $input['toolbar1'] .= ',ltr';
    3211         }
    3212     }
    3213 
    3214     return $input;
     3203        $mce_init['directionality'] = 'rtl';
     3204        $mce_init['rtl_ui'] = true;
     3205
     3206        if ( ! empty( $mce_init['plugins'] ) && strpos( $mce_init['plugins'], 'directionality' ) === false ) {
     3207            $mce_init['plugins'] .= ',directionality';
     3208        }
     3209
     3210        if ( ! empty( $mce_init['toolbar1'] ) && ! preg_match( '/\bltr\b/', $mce_init['toolbar1'] ) ) {
     3211            $mce_init['toolbar1'] .= ',ltr';
     3212        }
     3213    }
     3214
     3215    return $mce_init;
    32153216}
    32163217
Note: See TracChangeset for help on using the changeset viewer.