Commits

Konstantin Semenov committed ab3af53

EM tag support

  • Participants
  • Parent commits a402bc6

Comments (0)

Files changed (5)

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

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

                 "<li><a data-wysihtml5-command='formatBlock' data-wysihtml5-command-value='h4' tabindex='-1'>" + locale.font_styles.h4 + "</a></li>" +
                 "<li><a data-wysihtml5-command='formatBlock' data-wysihtml5-command-value='legend' tabindex='-1'>" + locale.font_styles.legend + "</a></li>" +
                 "<li><a data-wysihtml5-command='formatBlock' data-wysihtml5-command-value='blockquote' tabindex='-1'>" + locale.font_styles.blockquote + "</a></li>" +
+                "<li><a data-wysihtml5-command='formatBlock' data-wysihtml5-command-value='em' tabindex='-1'>" + locale.font_styles.em + "</a></li>" +
               "</ul>" +
               "<a class='btn dropdown-toggle" + size + "' data-toggle='dropdown' href='#' title='" + locale.font_styles.title + "'>" +
               "<i class='icon-font'></i>&nbsp;" +
                 "<span class='wysihtml5-display' onclick='return false' data-wysihtml5-command='formatBlock' data-wysihtml5-command-value='h4'>" + locale.font_styles.h4 + "</span>" +
                 "<span class='wysihtml5-display' onclick='return false' data-wysihtml5-command='formatBlock' data-wysihtml5-command-value='legend'>" + locale.font_styles.legend + "</span>" +
                 "<span class='wysihtml5-display' onclick='return false' data-wysihtml5-command='formatBlock' data-wysihtml5-command-value='blockquote'>" + locale.font_styles.blockquote + "</span>" +
+                "<span class='wysihtml5-display' onclick='return false' data-wysihtml5-command='formatBlock' data-wysihtml5-command-value='em'>" + locale.font_styles.em + "</span>" +
                 "&nbsp;<b class='caret'></b>" +
               "</a>" +
             "</li>";
                 "h2": {},
                 "h3": {},
                 "blockquote": {},
+                "em": {},
                 "u": 1,
                 "img": {
                     "check_attributes": {
                 h4: "Heading 4",
                 h5: "Heading 5",
                 blockquote: "Blockquote",
+                em: "Yellow",
                 legend: "Legend"
             },
             emphasis: {

app/assets/javascripts/bootsy/editor_options.js

       "small": {},
       "p": {},
       "blockquote": {},
+      "em": {},
       "legend": {},
       "u": 1,
       "cite": {

app/assets/javascripts/bootsy/wysihtml5.js

       }
     } else {
       while (listItem = (list.firstElementChild || list.firstChild)) {
-        if (listItem.querySelector && listItem.querySelector("div, p, ul, ol, menu, legend, blockquote, h1, h2, h3, h4, h5, h6")) {
+        if (listItem.querySelector && listItem.querySelector("div, p, ul, ol, menu, legend, em, blockquote, h1, h2, h3, h4, h5, h6")) {
           while (firstChild = listItem.firstChild) {
             fragment.appendChild(firstChild);
           }
     }
 };
 
+wysihtml5.commands.em = {
+    exec: function(composer, command) {
+        return wysihtml5.commands.formatInline.exec(composer, command, "em");
+    },
+
+    state: function(composer, command) {
+        return wysihtml5.commands.formatInline.state(composer, command, "em");
+    }
+};
+
 wysihtml5.commands.legend = {
     exec: function(composer, command) {
         return wysihtml5.commands.formatInline.exec(composer, command, "legend");
       // 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", "LEGEND", "DIV"];
+      BLOCK_ELEMENTS_GROUP    = ["H1", "H2", "H3", "H4", "H5", "H6", "P", "BLOCKQUOTE", "EM", "LEGEND", "DIV"];
   
   /**
    * Remove similiar classes (based on classRegExp)

lib/bootsy/version.rb

 module Bootsy
-  VERSION = '1.2.7'
+  VERSION = '1.2.8'
 end