Commits

Luke Plant  committed a5f4fdd

Added 'used' class to container buttons, as per class/command buttons

  • Participants
  • Parent commits 6eedb89

Comments (0)

Files changed (1)

File semanticeditor/media/semanticeditor/javascript/wymeditor/plugins/semantic/wymeditor.semantic.js

         .bind("mouseup", function(evt) {
                   // In case the user clicked somewhere else
                   // in the document, we have to update class list
-                  self.updateClassListItemAll();
+                  self.updateAppliedButtons();
               });
     jQuery(this.wym._options.containersSelector).find("a")
         .bind("mousedown", function(evt) {
                   // Need to restore the element id before anything else
                   // runs and calls ensureId
                   self.restoreCurrentElemId();
-                  self.updateClassListItemAll();
+                  self.updateAppliedButtons();
               });
 
     // Insert rewriting of HTML before the WYMeditor updates the textarea.
                      });
         }
     }
-    this.updateClassListItemAll(container);
+    this.updateAppliedButtons(container);
 };
 
 PresentationControls.prototype.docKeydown = function(evt) {
     }
 };
 
-PresentationControls.prototype.updateClassListItemAll = function(curContainer) {
+PresentationControls.prototype.updateAppliedButtons = function(curContainer) {
     var self = this;
     if (curContainer == undefined) {
         curContainer = jQuery(this.wym.selected()).parentsOrSelf(this.blockdefSelector);
                                             self.updateClassListItem(jQuery(this), styles[k]);
                                         });
         }
+
+        // We also update the container list to set the class="used" for
+        // consistent styling between that list and the command/class lists.
+        jQuery(this.wym._options.containersSelector).find("a").each(function(k) {
+            var name = this.name; // stores 'P', 'H1' etc
+            if (name.toLowerCase() == node.tagName.toLowerCase()) {
+                jQuery(this).addClass("used");
+            } else {
+                jQuery(this).removeClass("used");
+            }
+        });
+
     }
 };