* Added feature #7318: Text direction should be set with the dir attribute
authorStanislas Rolland <typo3@sjbr.ca>
Wed, 30 Jan 2008 05:11:47 +0000 (05:11 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Wed, 30 Jan 2008 05:11:47 +0000 (05:11 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2978 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/htmlarea/plugins/Language/language.js

index e2baa6e..4b8bd74 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
        * Feature/cleanup: Move colors, fonts, text direction, word cleaning and lists to extensions/plugins.
        * Feature #3633: Individual height of inline RTE. Thanks to Ralf Hettinger.
        * Fixed bug #5013: RTE Editor not working in Firefox 3.0 Granparadiso
+       * Added feature #7318: Text direction should be set with the dir attribute
 
 2008-01-28  Kasper Sk\8crh¿j <kasper2008@typo3.com>
 
index 382328f..bfd7a6c 100644 (file)
@@ -4,6 +4,7 @@
        * Feature/cleanup: Move colors, fonts, text direction, word cleaning and lists to extensions/plugins.
        * Feature #3633: Individual height of inline RTE. Thanks to Ralf Hettinger.
        * Fixed bug #5013: RTE Editor not working in Firefox 3.0 Granparadiso
+       * Added feature #7318: Text direction should be set with the dir attribute
 
 2008-01-26  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
 
index 338b939..7052f22 100644 (file)
@@ -94,11 +94,13 @@ Language = HTMLArea.Plugin.extend({
                
                var direction = (buttonId == "RightToLeft") ? "rtl" : "ltr";
                var el = this.editor.getParentElement();
-               while (el && !HTMLArea.isBlockElement(el)) {
-                       el = el.parentNode;
-               }
                if (el) {
-                       el.style.direction = (el.style.direction == direction) ? "" : direction;
+                       if (el.nodeName.toLowerCase() === "bdo") {
+                               el.dir = direction;
+                       } else {
+                               el.dir = (el.dir == direction || el.style.direction == direction) ? "" : direction;
+                       }
+                       el.style.direction = "";
                }
                
                return false;
@@ -114,11 +116,9 @@ Language = HTMLArea.Plugin.extend({
                                buttonId = buttonList[i][0];
                                if (this.isButtonInToolbar(buttonId)) {
                                        var el = this.editor.getParentElement();
-                                       while (el && !HTMLArea.isBlockElement(el)) {
-                                               el = el.parentNode;
-                                       }
                                        if (el) {
-                                               this.editor._toolbarObjects[buttonId].state("active",(el.style.direction == ((buttonId == "RightToLeft") ? "rtl" : "ltr")));
+                                               var direction = (buttonId === "RightToLeft") ? "rtl" : "ltr";
+                                               this.editor._toolbarObjects[buttonId].state("active",(el.dir == direction || el.style.direction == direction));
                                        }
                                }
                        }