WordPress.org

Make WordPress Core

Changeset 28094


Ignore:
Timestamp:
04/13/2014 12:22:56 AM (4 years ago)
Author:
azaozz
Message:

RTL for TinyMCE:

  • Add _dir: 'rtl' to the TinyMCE translation object.
  • Fix editor.css for RTL.
  • Fix the Edit and Delete buttons position for wpview and images.
  • For _mce_set_direction(), update documentation and fix adding the 'ltr' button.

Fixes #27773

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

Legend:

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

    r28091 r28094  
    982982        $baseurl = self::$baseurl;
    983983        $mce_locale = self::$mce_locale;
     984
     985        // Set direction
     986        if ( is_rtl() ) {
     987            $mce_translation['_dir'] = 'rtl';
     988        }
    984989
    985990        /**
  • trunk/src/wp-includes/css/editor.css

    r28045 r28094  
    18521852}
    18531853
     1854/* @noflip */
     1855.mce-rtl .mce-flow-layout .mce-flow-layout-item > div {
     1856    direction: rtl;
     1857}
     1858
     1859/* @noflip */
     1860.mce-rtl .mce-listbox i.mce-caret {
     1861    left: 6px;
     1862}
     1863
    18541864html:lang(he-il) .rtl .wp-switch-editor,
    18551865html:lang(he-il) .rtl .quicktags-toolbar input  {
  • trunk/src/wp-includes/functions.php

    r27855 r28094  
    24582458 * direction set to 'rtl'.
    24592459 *
    2460  * Fills in the 'directionality', 'plugins', and 'theme_advanced_button1' array
    2461  * keys. These keys are then returned in the $input array.
     2460 * Fills in the 'directionality' setting, enables the 'directionality' plugin,
     2461 * and adds the 'ltr' button to 'toolbar1', formerly 'theme_advanced_buttons1' array
     2462 * keys. These keys are then returned in the $input (TinyMCE settings) array.
    24622463 *
    24632464 * @access private
    24642465 * @since 2.1.0
    24652466 *
    2466  * @param array $input MCE plugin array.
     2467 * @param array $input MCE settings array.
    24672468 * @return array Direction set for 'rtl', if needed by locale.
    24682469 */
     
    24712472        $input['directionality'] = 'rtl';
    24722473        $input['plugins'] .= ',directionality';
    2473         $input['theme_advanced_buttons1'] .= ',ltr';
     2474        $input['toolbar1'] .= ',ltr';
    24742475    }
    24752476
  • trunk/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js

    r28032 r28094  
    280280        if ( editor.getParam( 'directionality' ) === 'rtl' ) {
    281281            bodyClass.push('rtl');
     282            dom.setAttrib( doc.documentElement, 'dir', 'rtl' );
    282283        }
    283284
  • trunk/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js

    r27942 r28094  
    404404
    405405    function addToolbar( node ) {
    406         var rectangle, toolbarHtml, toolbar, toolbarSize,
     406        var rectangle, toolbarHtml, toolbar, left,
    407407            dom = editor.dom;
    408408
     
    426426        }, toolbarHtml );
    427427
     428        if ( editor.rtl ) {
     429            left = rectangle.x + rectangle.w - 82;
     430        } else {
     431            left = rectangle.x;
     432        }
     433
    428434        editor.getBody().appendChild( toolbar );
    429         toolbarSize = dom.getSize( toolbar );
    430 
    431435        dom.setStyles( toolbar, {
    432436            top: rectangle.y,
    433             left: rectangle.x
     437            left: left
    434438        });
    435439
  • trunk/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css

    r28062 r28094  
    454454}
    455455
     456/* rtl */
     457.rtl .gallery .gallery-item {
     458    float: right;
     459}
     460
     461.rtl .wpview-wrap .toolbar {
     462    left: auto;
     463    right: 0;
     464}
     465
     466.rtl .wpview-wrap .toolbar div,
     467.rtl #wp-image-toolbar div {
     468    margin-left: auto;
     469    margin-right: 7px;
     470}
     471
    456472@media print,
    457473    (-o-min-device-pixel-ratio: 5/4),
Note: See TracChangeset for help on using the changeset viewer.