Make WordPress Core

Ticket #13070: 13070.2.patch

File 13070.2.patch, 2.1 KB (added by yoavf, 13 years ago)
  • 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
     268                        if ( 'rtl' == document.getElementsByTagName('html')[0].dir ) {
     269                                theButtons['textdirection'] = new qt.TextDirectionButton();
     270                                html += theButtons['textdirection'].html(name + '_');
     271                        }
     272
    267273                        ed.toolbar.innerHTML = html;
    268274                        ed.theButtons = theButtons;
    269275                }
     
    605611                fullscreen.on();
    606612        };
    607613
     614        qt.TextDirectionButton = function() {
     615                qt.Button.call(this, 'textdirection', quicktagsL10n.textdirection, '', quicktagsL10n.toggleTextdirection)
     616        };
     617        qt.TextDirectionButton.prototype = new qt.Button();
     618        qt.TextDirectionButton.prototype.callback = function(e, c) {
     619       
     620                var isRTL =  ( 'rtl' == document.getElementsByTagName('html')[0].dir );
     621               
     622                currentDirection  = c.style.direction;
     623
     624                if ( '' == currentDirection )
     625                        currentDirection = ( isRTL ) ?  'rtl' : 'ltr' ;
     626
     627                c.style.direction = ( 'rtl' == currentDirection ) ? 'ltr' : 'rtl';
     628
     629                c.focus();
     630        }
     631
    608632        // ensure backward compatibility
    609633        edButtons[10] = new qt.TagButton('strong','b','<strong>','</strong>','b');
    610634        edButtons[20] = new qt.TagButton('em','i','<em>','</em>','i'),