Added feature #9362: htmlArea RTE: highlight active items in context menu as in toolbar
authorStanislas Rolland <typo3@sjbr.ca>
Wed, 17 Sep 2008 02:10:55 +0000 (02:10 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Wed, 17 Sep 2008 02:10:55 +0000 (02:10 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@4138 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/ContextMenu/context-menu.js
typo3/sysext/rtehtmlarea/htmlarea/skins/default/htmlarea.css
typo3/sysext/t3skin/rtehtmlarea/htmlarea.css

index 3cb9797..ee14133 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-09-16  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Added feature #9362: htmlArea RTE: highlight active items in context menu as in toolbar
+
 2008-09-16  Benjamin Mack  <benni@typo3.org>
 
        * Fixed bug #9360: TypoScript Object Browser interprets HTML Tags in comments (Thanks to Stefano Kowalke)
index 54bef0b..13b4bb2 100644 (file)
@@ -1,3 +1,7 @@
+2008-09-16  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Added feature #9362: htmlArea RTE: highlight active items in context menu as in toolbar
+
 2008-09-15  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #9310: table border colour popups appear only when textcolour button is shown
index c0f629b..c43453f 100644 (file)
@@ -444,9 +444,11 @@ HTMLArea.setButtonStatus = function(id,newval) {
                                if (newval) {
                                        HTMLArea._addClass(el, "buttonPressed");
                                        HTMLArea._addClass(el.parentNode, "buttonPressed");
+                                       el.active = true;
                                } else {
                                        HTMLArea._removeClass(el, "buttonPressed");
                                        HTMLArea._removeClass(el.parentNode, "buttonPressed");
+                                       el.active = false;
                                }
                                break;
                }
index a1242b2..39a8d85 100644 (file)
@@ -116,7 +116,7 @@ ContextMenu = HTMLArea.Plugin.extend({
                                list.appendChild(item);
                                var label = option[0];
                                if (separator) {
-                                       item.className += " separator";
+                                       HTMLArea._addClass(item, "separator");
                                        separator = false;
                                }
                                item.__msh = {
@@ -132,25 +132,25 @@ ContextMenu = HTMLArea.Plugin.extend({
                                if (label != option[0]) this.keys.push([ RegExp.$1, item ]);
                                label = label.replace(/__/, "_");
                                var button = doc.createElement("button");
-                               button.className = "button";
-                               if(item.__msh.cmd) {
-                                       button.className += " " + item.__msh.cmd;
-                                       if(typeof(editor.plugins["TYPO3Browsers"]) != "undefined" && (item.__msh.cmd == "CreateLink" || item.__msh.cmd == "UnLink" || item.__msh.cmd == "InsertImage")) button.className += "-TYPO3Browsers";
-                                       button.innerHTML = label;
-                               } else if(item.__msh.icon) {
-                                       button.innerHTML = "<img src='" + item.__msh.icon + "' />" + label;
-                               } else {
-                                       button.innerHTML = label;
+                               HTMLArea._addClass(button,  "button");
+                               if (item.__msh.cmd) {
+                                       HTMLArea._addClass(button,  item.__msh.cmd);
+                                       if (editor._toolbarObjects[item.__msh.cmd]  && editor._toolbarObjects[item.__msh.cmd].active) {
+                                               HTMLArea._addClass(button,  "buttonActive");
+                                       }
+                               } else if (item.__msh.icon) {
+                                       button.innerHTML = "<img src='" + item.__msh.icon + "' />";
                                }
                                item.appendChild(button);
-       
+                               item.innerHTML = item.innerHTML + label;
+                                       // Setting event handlers on the menu items
                                item.__msh.mouseover = ContextMenu.mouseOverHandler(editor, item);
                                HTMLArea._addEvent(item, "mouseover", item.__msh.mouseover);
                                item.__msh.mouseout = ContextMenu.mouseOutHandler(item);
                                HTMLArea._addEvent(item, "mouseout", item.__msh.mouseout);
                                item.__msh.contextmenu = ContextMenu.itemContextMenuHandler(item);
                                HTMLArea._addEvent(item, "contextmenu", item.__msh.contextmenu);
-                               if(!HTMLArea.is_ie) {
+                               if (!HTMLArea.is_ie) {
                                        item.__msh.mousedown = ContextMenu.mouseDownHandler(item);
                                        HTMLArea._addEvent(item, "mousedown", item.__msh.mousedown);
                                }
index 12d5bad..57e69e2 100644 (file)
        border:1px solid;border-color:#e4e0db #999999 #999999 #e4e0db;
 }
 .htmlarea .toolbar button.buttonActive {
-       border:1px solid;border-color:ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;padding:2px 0px 0px 2px;
+       border:1px solid;border-color:ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
+       padding:2px 0px 0px 2px;
 }
-.htmlarea .toolbar button.buttonPressed {
+.htmlarea .toolbar button.buttonPressed, .htmlarea-context-menu button.buttonActive {
        background-color:ButtonHighlight;
-       border:1px solid;border-color:#999999 #e4e0db #e4e0db #999999;  padding:2px 0px 0px 2px;
+       border:1px solid;border-color:#999999 #e4e0db #e4e0db #999999;
+       padding:2px 0px 0px 2px;
        text-decoration:none;
 }
 .htmlarea .toolbar div.indicator {
 .htmlarea-context-menu li {
        background-color:#cdf;
        border:1px solid #cdf;margin:1px 0;padding:0;
+       font-size:11px;
 }
-.htmlarea-context-menu li .button {
+.htmlarea-context-menu li button {
        text-align:left;vertical-align:middle;
-       background-color:transparent;background-repeat:no-repeat;background-position:2px 2px;
-       font-size:11px;
-       height:20px;
-       border-style:none;margin:0;padding:0 0 0 24px;
+       background-color:transparent;background-repeat:no-repeat;background-position:0px 0px;
+       height:19px;width:20px;
+       border-style:none;margin:0px 3px 0px 0;padding:0;
 }
 .htmlarea-context-menu li .button img {
        width:18px;height:18px;
index 13d0e3b..6e56c41 100644 (file)
        border:1px solid;border-color:white #C5C5D5 #C5C5D5 white;
        background-color: #E0E0E9;
 }
-.htmlarea .toolbar button.buttonActive, .htmlarea .toolbar button.buttonPressed {
+.htmlarea .toolbar button.buttonActive, .htmlarea .toolbar button.buttonPressed, .htmlarea-context-menu button.buttonActive {
        border:1px solid;border-color:#C5C5D5 white white #C5C5D5;
 }
-.htmlarea .toolbar button.buttonPressed {
+.htmlarea .toolbar button.buttonPressed, .htmlarea-context-menu button.buttonActive {
        background-color:ButtonHighlight;
        text-decoration:none;
 }
 .htmlarea .toolbar div.separator {
        background-color:transparent;background-image:url(separator.gif);background-repeat:no-repeat;
        width:7px;height:22px;
-       border:1px solid #EFEFF4;;margin:0;padding:0;
+       border:1px solid #EFEFF4;margin:0;padding:0;
 }
 .htmlarea .toolbar div.space {
        float:left;
 }
 .htmlarea .toolbar select.buttonDisabled {
        color:GrayText;
-       background-color:#EFEFF4;;
+       background-color:#EFEFF4;
 }
 .htmlarea .editorIframe {
        clear:both;
        padding: 0.2em;
 }
 .popupwin form {
-       background-color:#EFEFF4;;
+       background-color:#EFEFF4;
        border-style:none;margin:0;padding:0;
 }
 .popupwin form p {
 /* Selectors for the ContextMenu plugin */
 .htmlarea-context-menu {
        position:absolute;top:-1000px;left:-1000px;z-index:1000;
-       background-color:#EFEFF4;;cursor:default;
-       color: #212424;
+       background-color:#EFEFF4;cursor:default;
+       color:#212424;
        font-family: Verdana, Helvetica, Geneva, Arial, sans-serif;
-       font-size: 10px;
+       font-size:10px;
        list-style:none;
        border:1px solid #A2AAB8;margin:0;padding:2px;
 }
 .htmlarea-context-menu li {
-       background-color:#EFEFF4;;
-       border:1px solid #EFEFF4;;margin:0;padding:0;
+       background-color:#EFEFF4;
+       border:1px solid #EFEFF4;margin:0;padding:0;
+       font-size:10px;
 }
-.htmlarea-context-menu li .button {
+.htmlarea-context-menu li button {
        text-align:left;vertical-align:middle;
-       background-color:transparent;background-repeat:no-repeat;background-position:2px 2px;
-       font-size:10px;
-       height:20px;
-       border-style:none;margin:0;padding:0 0 0 24px;
+       background-color:transparent;background-repeat:no-repeat;background-position:0px 0px;
+       height:20px;width:21px;
+       border-style:none;margin:0 3px 0 0;padding:0;
 }
 .htmlarea-context-menu li .button img {
        width:18px;height:18px;