Add RTL/LTR button to the html editor, props yoavf, fixes #13070
git-svn-id: https://develop.svn.wordpress.org/trunk@20451 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
bae5393651
commit
fe2749eedd
@ -264,6 +264,12 @@ function edButton(id, display, tagStart, tagEnd, access, open) {
|
||||
html += theButtons['fullscreen'].html(name + '_');
|
||||
}
|
||||
|
||||
|
||||
if ( 'rtl' == document.getElementsByTagName('html')[0].dir ) {
|
||||
theButtons['textdirection'] = new qt.TextDirectionButton();
|
||||
html += theButtons['textdirection'].html(name + '_');
|
||||
}
|
||||
|
||||
ed.toolbar.innerHTML = html;
|
||||
ed.theButtons = theButtons;
|
||||
}
|
||||
@ -605,6 +611,21 @@ function edButton(id, display, tagStart, tagEnd, access, open) {
|
||||
fullscreen.on();
|
||||
};
|
||||
|
||||
qt.TextDirectionButton = function() {
|
||||
qt.Button.call(this, 'textdirection', quicktagsL10n.textdirection, '', quicktagsL10n.toggleTextdirection)
|
||||
};
|
||||
qt.TextDirectionButton.prototype = new qt.Button();
|
||||
qt.TextDirectionButton.prototype.callback = function(e, c) {
|
||||
var isRTL = ( 'rtl' == document.getElementsByTagName('html')[0].dir ),
|
||||
currentDirection = c.style.direction;
|
||||
|
||||
if ( ! currentDirection )
|
||||
currentDirection = ( isRTL ) ? 'rtl' : 'ltr';
|
||||
|
||||
c.style.direction = ( 'rtl' == currentDirection ) ? 'ltr' : 'rtl';
|
||||
c.focus();
|
||||
}
|
||||
|
||||
// ensure backward compatibility
|
||||
edButtons[10] = new qt.TagButton('strong','b','<strong>','</strong>','b');
|
||||
edButtons[20] = new qt.TagButton('em','i','<em>','</em>','i'),
|
||||
|
@ -79,7 +79,9 @@ function wp_default_scripts( &$scripts ) {
|
||||
'enterImageURL' => __('Enter the URL of the image'),
|
||||
'enterImageDescription' => __('Enter a description of the image'),
|
||||
'fullscreen' => __('fullscreen'),
|
||||
'toggleFullscreen' => esc_attr( __('Toggle fullscreen mode') )
|
||||
'toggleFullscreen' => esc_attr( __('Toggle fullscreen mode') ),
|
||||
'textdirection' => esc_attr( __('text direction') ),
|
||||
'toggleTextdirection' => esc_attr( __('Toggle Editor Text Direction') )
|
||||
) );
|
||||
|
||||
$scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' );
|
||||
|
Loading…
Reference in New Issue
Block a user