WordPress.org

Make WordPress Core

Changeset 38349


Ignore:
Timestamp:
08/25/2016 01:19:24 AM (3 years ago)
Author:
azaozz
Message:

TinyMCE: fix toolbars alignment in RTL.

Fixes #37760 for trunk.

Location:
trunk/src/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-editor.php

    r38159 r38349  
    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];
  • trunk/src/wp-includes/css/editor.css

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

    r38344 r38349  
    32213221 * plugin, and adds the 'ltr' button to 'toolbar1', formerly
    32223222 * 'theme_advanced_buttons1' array keys. These keys are then returned
    3223  * in the $input (TinyMCE settings) array.
     3223 * in the $mce_init (TinyMCE settings) array.
    32243224 *
    32253225 * @since 2.1.0
    32263226 * @access private
    32273227 *
    3228  * @param array $input MCE settings array.
     3228 * @param array $mce_init MCE settings array.
    32293229 * @return array Direction set for 'rtl', if needed by locale.
    32303230 */
    3231 function _mce_set_direction( $input ) {
     3231function _mce_set_direction( $mce_init ) {
    32323232    if ( is_rtl() ) {
    3233         $input['directionality'] = 'rtl';
    3234 
    3235         if ( ! empty( $input['plugins'] ) && strpos( $input['plugins'], 'directionality' ) === false ) {
    3236             $input['plugins'] .= ',directionality';
    3237         }
    3238 
    3239         if ( ! empty( $input['toolbar1'] ) && ! preg_match( '/\bltr\b/', $input['toolbar1'] ) ) {
    3240             $input['toolbar1'] .= ',ltr';
    3241         }
    3242     }
    3243 
    3244     return $input;
     3233        $mce_init['directionality'] = 'rtl';
     3234        $mce_init['rtl_ui'] = true;
     3235
     3236        if ( ! empty( $mce_init['plugins'] ) && strpos( $mce_init['plugins'], 'directionality' ) === false ) {
     3237            $mce_init['plugins'] .= ',directionality';
     3238        }
     3239
     3240        if ( ! empty( $mce_init['toolbar1'] ) && ! preg_match( '/\bltr\b/', $mce_init['toolbar1'] ) ) {
     3241            $mce_init['toolbar1'] .= ',ltr';
     3242        }
     3243    }
     3244
     3245    return $mce_init;
    32453246}
    32463247
Note: See TracChangeset for help on using the changeset viewer.