Make WordPress Core

Ticket #13070: 13070.1.patch

File 13070.1.patch, 2.0 KB (added by yoavf, 13 years ago)

Refreshed patch

  • wp-includes/script-loader.php

     
    7979                'enterImageURL' => __('Enter the URL of the image'),
    8080                'enterImageDescription' => __('Enter a description of the image'),
    8181                'fullscreen' => __('fullscreen'),
    82                 'toggleFullscreen' => esc_attr( __('Toggle fullscreen mode') )
     82                'toggleFullscreen' => esc_attr( __('Toggle fullscreen mode') ),
     83                'textdirection' => esc_attr( __('text direction') ),
     84                'toggleTextdirection' => esc_attr( __('Toggle Editor Text Direction') )
    8385        ) );
    8486
    8587        $scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' );
  • wp-includes/js/quicktags.dev.js

     
    264264                                html += theButtons['fullscreen'].html(name + '_');
    265265                        }
    266266
     267                        if ( !( 'undefined' == typeof isRtl || !isRtl ) ) {
     268                                theButtons['textdirection'] = new qt.TextDirectionButton();
     269                                html += theButtons['textdirection'].html(name + '_');
     270                        }
     271
    267272                        ed.toolbar.innerHTML = html;
    268273                        ed.theButtons = theButtons;
    269274                }
     
    605610                fullscreen.on();
    606611        };
    607612
     613        qt.TextDirectionButton = function() {
     614                qt.Button.call(this, 'textdirection', quicktagsL10n.textdirection, '', quicktagsL10n.toggleTextdirection)
     615        };
     616        qt.TextDirectionButton.prototype = new qt.Button();
     617        qt.TextDirectionButton.prototype.callback = function(e, c) {
     618       
     619                var isRTL =  !( 'undefined' == typeof isRtl || !isRtl );
     620                currentDirection  = c.style.direction;
     621
     622                if ( '' == currentDirection )
     623                        currentDirection = ( isRTL ) ?  'rtl' : 'ltr' ;
     624
     625                c.style.direction = ( 'rtl' == currentDirection ) ? 'ltr' : 'rtl';
     626
     627                c.focus();
     628        }
     629
    608630        // ensure backward compatibility
    609631        edButtons[10] = new qt.TagButton('strong','b','<strong>','</strong>','b');
    610632        edButtons[20] = new qt.TagButton('em','i','<em>','</em>','i'),