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 Built from https://develop.svn.wordpress.org/trunk@28094 git-svn-id: http://core.svn.wordpress.org/trunk@27925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
eca26bc5ae
commit
dc52e17417
|
@ -982,6 +982,11 @@ final class _WP_Editors {
|
||||||
$baseurl = self::$baseurl;
|
$baseurl = self::$baseurl;
|
||||||
$mce_locale = self::$mce_locale;
|
$mce_locale = self::$mce_locale;
|
||||||
|
|
||||||
|
// Set direction
|
||||||
|
if ( is_rtl() ) {
|
||||||
|
$mce_translation['_dir'] = 'rtl';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter translated strings prepared for TinyMCE.
|
* Filter translated strings prepared for TinyMCE.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1851,6 +1851,16 @@ i.mce-i-hr:before {
|
||||||
font-family: Tahoma, sans-serif;
|
font-family: Tahoma, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* @noflip */
|
||||||
|
.mce-rtl .mce-flow-layout .mce-flow-layout-item > div {
|
||||||
|
direction: rtl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @noflip */
|
||||||
|
.mce-rtl .mce-listbox i.mce-caret {
|
||||||
|
left: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
html:lang(he-il) .rtl .wp-switch-editor,
|
html:lang(he-il) .rtl .wp-switch-editor,
|
||||||
html:lang(he-il) .rtl .quicktags-toolbar input {
|
html:lang(he-il) .rtl .quicktags-toolbar input {
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1851,6 +1851,16 @@ i.mce-i-hr:before {
|
||||||
font-family: Tahoma, sans-serif;
|
font-family: Tahoma, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* @noflip */
|
||||||
|
.mce-rtl .mce-flow-layout .mce-flow-layout-item > div {
|
||||||
|
direction: rtl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @noflip */
|
||||||
|
.mce-rtl .mce-listbox i.mce-caret {
|
||||||
|
left: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
html:lang(he-il) .rtl .wp-switch-editor,
|
html:lang(he-il) .rtl .wp-switch-editor,
|
||||||
html:lang(he-il) .rtl .quicktags-toolbar input {
|
html:lang(he-il) .rtl .quicktags-toolbar input {
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2457,20 +2457,21 @@ function _config_wp_siteurl( $url = '' ) {
|
||||||
* Will only set the direction to 'rtl', if the WordPress locale has the text
|
* Will only set the direction to 'rtl', if the WordPress locale has the text
|
||||||
* direction set to 'rtl'.
|
* direction set to 'rtl'.
|
||||||
*
|
*
|
||||||
* Fills in the 'directionality', 'plugins', and 'theme_advanced_button1' array
|
* Fills in the 'directionality' setting, enables the 'directionality' plugin,
|
||||||
* keys. These keys are then returned in the $input array.
|
* and adds the 'ltr' button to 'toolbar1', formerly 'theme_advanced_buttons1' array
|
||||||
|
* keys. These keys are then returned in the $input (TinyMCE settings) array.
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @since 2.1.0
|
* @since 2.1.0
|
||||||
*
|
*
|
||||||
* @param array $input MCE plugin array.
|
* @param array $input MCE settings array.
|
||||||
* @return array Direction set for 'rtl', if needed by locale.
|
* @return array Direction set for 'rtl', if needed by locale.
|
||||||
*/
|
*/
|
||||||
function _mce_set_direction( $input ) {
|
function _mce_set_direction( $input ) {
|
||||||
if ( is_rtl() ) {
|
if ( is_rtl() ) {
|
||||||
$input['directionality'] = 'rtl';
|
$input['directionality'] = 'rtl';
|
||||||
$input['plugins'] .= ',directionality';
|
$input['plugins'] .= ',directionality';
|
||||||
$input['theme_advanced_buttons1'] .= ',ltr';
|
$input['toolbar1'] .= ',ltr';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $input;
|
return $input;
|
||||||
|
|
|
@ -279,6 +279,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
|
||||||
|
|
||||||
if ( editor.getParam( 'directionality' ) === 'rtl' ) {
|
if ( editor.getParam( 'directionality' ) === 'rtl' ) {
|
||||||
bodyClass.push('rtl');
|
bodyClass.push('rtl');
|
||||||
|
dom.setAttrib( doc.documentElement, 'dir', 'rtl' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( env.ie ) {
|
if ( env.ie ) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -403,7 +403,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function addToolbar( node ) {
|
function addToolbar( node ) {
|
||||||
var rectangle, toolbarHtml, toolbar, toolbarSize,
|
var rectangle, toolbarHtml, toolbar, left,
|
||||||
dom = editor.dom;
|
dom = editor.dom;
|
||||||
|
|
||||||
removeToolbar();
|
removeToolbar();
|
||||||
|
@ -425,12 +425,16 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
||||||
'contenteditable': false
|
'contenteditable': false
|
||||||
}, toolbarHtml );
|
}, toolbarHtml );
|
||||||
|
|
||||||
editor.getBody().appendChild( toolbar );
|
if ( editor.rtl ) {
|
||||||
toolbarSize = dom.getSize( toolbar );
|
left = rectangle.x + rectangle.w - 82;
|
||||||
|
} else {
|
||||||
|
left = rectangle.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.getBody().appendChild( toolbar );
|
||||||
dom.setStyles( toolbar, {
|
dom.setStyles( toolbar, {
|
||||||
top: rectangle.y,
|
top: rectangle.y,
|
||||||
left: rectangle.x
|
left: left
|
||||||
});
|
});
|
||||||
|
|
||||||
toolbarActive = true;
|
toolbarActive = true;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -453,6 +453,22 @@ img.wp-oembed {
|
||||||
outline: 0;
|
outline: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* rtl */
|
||||||
|
.rtl .gallery .gallery-item {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rtl .wpview-wrap .toolbar {
|
||||||
|
left: auto;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rtl .wpview-wrap .toolbar div,
|
||||||
|
.rtl #wp-image-toolbar div {
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
@media print,
|
@media print,
|
||||||
(-o-min-device-pixel-ratio: 5/4),
|
(-o-min-device-pixel-ratio: 5/4),
|
||||||
(-webkit-min-device-pixel-ratio: 1.25),
|
(-webkit-min-device-pixel-ratio: 1.25),
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue