WordPress.org

Make WordPress Core

Ticket #13070: quicktags-rtl.patch

File quicktags-rtl.patch, 2.0 KB (added by yoavf, 5 years ago)
  • wp-includes/script-loader.php

     
    7171        $scripts->add_data( 'sack', 'group', 1 ); 
    7272 
    7373        $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", false, '20090307' ); 
     74        $scripts->add( 'quicktags-rtl', "/wp-includes/js/quicktags-rtl$suffix.js", array('quicktags'), '20100421'); 
     75        $scripts->add_data( 'quicktags-rtl', 'group', 1 ); 
     76         
    7477        $scripts->localize( 'quicktags', 'quicktagsL10n', array( 
    7578                'quickLinks' => __('(Quick Links)'), 
    7679                'wordLookup' => __('Enter a word to look up:'), 
  • wp-admin/admin-header.php

     
    5252if ( in_array( $pagenow, array('post.php', 'post-new.php') ) ) { 
    5353        add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 ); 
    5454        wp_enqueue_script('quicktags'); 
     55        if ( 'rtl' == get_bloginfo( 'text_direction' ) ) 
     56                wp_enqueue_script('quicktags-rtl'); 
    5557} 
    5658 
    5759do_action('admin_enqueue_scripts', $hook_suffix); 
  • wp-includes/js/quicktags-rtl.dev.js

     
     1function edToggleRTL(myField) { 
     2        myField.focus(); 
     3        var currentDirection = myField.style.direction; 
     4        if (currentDirection == 'ltr') 
     5                myField.style.direction = 'rtl' 
     6        else 
     7                myField.style.direction = 'ltr' 
     8} 
     9 
     10var ed_toolbar = document.getElementById("ed_toolbar"); 
     11if (ed_toolbar) { 
     12  var RTLButton = document.createElement('input'); 
     13  RTLButton.type = 'button'; 
     14  RTLButton.value = 'RTL/LTR'; 
     15  RTLButton.onclick = function(){edToggleRTL(edCanvas)}; 
     16  RTLButton.className = 'ed_button'; 
     17  RTLButton.title = 'Toogle RTL/LTR'; 
     18  RTLButton.id = 'ed_ToggleRTL'; 
     19  ed_toolbar.appendChild(RTLButton); 
     20} 
     21 No newline at end of file