Commits

Konstantin Semenov committed 8c540be

Legend support

Comments (0)

Files changed (3)

 PATH
   remote: .
   specs:
-    bootsy (1.2.5)
+    bootsy (1.2.6)
       carrierwave (~> 0.9.0)
       mini_magick (~> 3.6.0)
       remotipart (~> 1.2.1)

app/assets/javascripts/bootsy/bootstrap-wysihtml5.js

                 h3: "Heading 3",
                 h4: "Heading 4",
                 h5: "Heading 5",
-                blockquote: "Blockquote"
+                blockquote: "Blockquote",
+                legend: "Legend"
             },
             emphasis: {
                 bold: "Bold",

app/assets/javascripts/bootsy/wysihtml5.js

       }
     } else {
       while (listItem = (list.firstElementChild || list.firstChild)) {
-        if (listItem.querySelector && listItem.querySelector("div, p, ul, ol, menu, blockquote, h1, h2, h3, h4, h5, h6")) {
+        if (listItem.querySelector && listItem.querySelector("div, p, ul, ol, menu, legend, blockquote, h1, h2, h3, h4, h5, h6")) {
           while (firstChild = listItem.firstChild) {
             fragment.appendChild(firstChild);
           }
     }
 };
 
+wysihtml5.commands.legend = {
+    exec: function(composer, command) {
+        return wysihtml5.commands.formatInline.exec(composer, command, "legend");
+    },
+
+    state: function(composer, command) {
+        return wysihtml5.commands.formatInline.state(composer, command, "legend");
+    }
+};
+
 
 (function(wysihtml5) {
   var undef,
       // Following elements are grouped
       // when the caret is within a H1 and the H4 is invoked, the H1 should turn into H4
       // instead of creating a H4 within a H1 which would result in semantically invalid html
-      BLOCK_ELEMENTS_GROUP    = ["H1", "H2", "H3", "H4", "H5", "H6", "P", "BLOCKQUOTE", "DIV"];
+      BLOCK_ELEMENTS_GROUP    = ["H1", "H2", "H3", "H4", "H5", "H6", "P", "BLOCKQUOTE", "LEGEND", "DIV"];
   
   /**
    * Remove similiar classes (based on classRegExp)