Luke Plant avatar Luke Plant committed 3f04aba

Grey out invalid choices when hovering.

Comments (0)

Files changed (2)

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

 
     // Event handlers
     this.headingscontrol.change(function(event) {
-                                    self.update_classlist();
+
     });
     this.refreshbutton.click(function(event) {
                                  self.refresh_headings();
                   self.form_submit(event);
               });
 
-    // Other event handlers added in update_classlist
 };
 
 PresentationControls.prototype.set_html = function(html) {
 
     var self = this;
     jQuery.each(this.available_styles, function(i, item) {
-        var val = flattenPresStyle(item);
         var btn = jQuery("<li><a href='#'>" + escapeHtml(item.verbose_name) + "</a></li>").appendTo(self.classlist).find("a");
-        // event handler
+        // event handlers
+        var style = self.available_styles[i];
         btn.click(function(event) {
-                      self.toggle_style(self.available_styles[i]);
+                      self.toggle_style(style);
+                  });
+        btn.hover(function(event) {
+                     self.update_classlist_item(btn, style);
                   });
 
         // Attach tooltip to label we just added:
     this.update_style_display(sect_id);
 };
 
-PresentationControls.prototype.update_classlist = function() {
+PresentationControls.prototype.update_classlist_item = function(btn, style) {
     var self = this;
-    this.unbind_classlist();
-    // Currently selected heading?
-    var headingIndex = self.get_heading_index();
-    if (headingIndex == null) return;
-    var sect = this.active_heading_list[headingIndex];
-    var sect_id = sect.sect_id;
-    var section_styles = this.presentation_info[sect_id];
-    if (section_styles == null) {
-        section_styles = new Array();
-        this.presentation_info[sect_id] = section_styles;
+    var sect_id = this.get_current_section(style);
+    if (sect_id == undefined) {
+        // Can't use it.
+        btn.addClass("disabled");
+    } else {
+        btn.removeClass("disabled");
     }
-    this.classlist.find("a").each(
-        function(i, item) {
-            var item_style = self.available_styles[i];
-            // Set state
-            if (jQuery.inArray(sect.tag.toLowerCase(), item_style.allowed_elements) != -1) {
-                item.removeClass("disabled");
-            } else {
-                item.addClass("disabled");
-            }
-        });
 };
 
 PresentationControls.prototype.show_preview = function() {

semanticeditor/media/semanticeditor/javascript/wymeditor/skins/semanticeditor/skin.css

         }
         .wym_skin_semanticeditor .wym_section a:hover    { background-color: #903; color: #cde8cd;}
 
-        .wym_skin_semanticeditor .wym_section a.disabled { color: #888; cursor: default; }
-        .wym_skin_semanticeditor .wym_section a.disabled:hover    { color: #888; background-color: #cde8cd; }
+        .wym_skin_semanticeditor .wym_section a.disabled { color: #888; cursor: default; background-color: #dde8dd; }
+        .wym_skin_semanticeditor .wym_section a.disabled:hover    { color: #888; background-color: #dde8dd; }
       /*hide section titles by default*/
         .wym_skin_semanticeditor .wym_section h2         { display: none; }
       /*disable any margin-collapse*/
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.