| rev | 
   line source | 
| 
bsw/jbe@1309
 | 
     1 wysihtml.commands.alignCenterStyle = (function() {
 | 
| 
bsw/jbe@1309
 | 
     2   var nodeOptions = {
 | 
| 
bsw/jbe@1309
 | 
     3     styleProperty: "textAlign",
 | 
| 
bsw/jbe@1309
 | 
     4     styleValue: "center",
 | 
| 
bsw/jbe@1309
 | 
     5     toggle: true
 | 
| 
bsw/jbe@1309
 | 
     6   };
 | 
| 
bsw/jbe@1309
 | 
     7   
 | 
| 
bsw/jbe@1309
 | 
     8   return {
 | 
| 
bsw/jbe@1309
 | 
     9     exec: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
    10       return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
    11     },
 | 
| 
bsw/jbe@1309
 | 
    12 
 | 
| 
bsw/jbe@1309
 | 
    13     state: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
    14       return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
    15     }
 | 
| 
bsw/jbe@1309
 | 
    16   };
 | 
| 
bsw/jbe@1309
 | 
    17 })();
 | 
| 
bsw/jbe@1309
 | 
    18 
 | 
| 
bsw/jbe@1309
 | 
    19 wysihtml.commands.alignJustifyStyle = (function() {
 | 
| 
bsw/jbe@1309
 | 
    20   var nodeOptions = {
 | 
| 
bsw/jbe@1309
 | 
    21     styleProperty: "textAlign",
 | 
| 
bsw/jbe@1309
 | 
    22     styleValue: "justify",
 | 
| 
bsw/jbe@1309
 | 
    23     toggle: true
 | 
| 
bsw/jbe@1309
 | 
    24   };
 | 
| 
bsw/jbe@1309
 | 
    25 
 | 
| 
bsw/jbe@1309
 | 
    26   return {
 | 
| 
bsw/jbe@1309
 | 
    27     exec: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
    28       return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
    29     },
 | 
| 
bsw/jbe@1309
 | 
    30 
 | 
| 
bsw/jbe@1309
 | 
    31     state: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
    32       return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
    33     }
 | 
| 
bsw/jbe@1309
 | 
    34   };
 | 
| 
bsw/jbe@1309
 | 
    35 })();
 | 
| 
bsw/jbe@1309
 | 
    36 
 | 
| 
bsw/jbe@1309
 | 
    37 wysihtml.commands.alignLeftStyle = (function() {
 | 
| 
bsw/jbe@1309
 | 
    38   var nodeOptions = {
 | 
| 
bsw/jbe@1309
 | 
    39     styleProperty: "textAlign",
 | 
| 
bsw/jbe@1309
 | 
    40     styleValue: "left",
 | 
| 
bsw/jbe@1309
 | 
    41     toggle: true
 | 
| 
bsw/jbe@1309
 | 
    42   };
 | 
| 
bsw/jbe@1309
 | 
    43 
 | 
| 
bsw/jbe@1309
 | 
    44   return {
 | 
| 
bsw/jbe@1309
 | 
    45     exec: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
    46       return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
    47     },
 | 
| 
bsw/jbe@1309
 | 
    48 
 | 
| 
bsw/jbe@1309
 | 
    49     state: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
    50       return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
    51     }
 | 
| 
bsw/jbe@1309
 | 
    52   };
 | 
| 
bsw/jbe@1309
 | 
    53 })();
 | 
| 
bsw/jbe@1309
 | 
    54 
 | 
| 
bsw/jbe@1309
 | 
    55 wysihtml.commands.alignRightStyle = (function() {
 | 
| 
bsw/jbe@1309
 | 
    56   var nodeOptions = {
 | 
| 
bsw/jbe@1309
 | 
    57     styleProperty: "textAlign",
 | 
| 
bsw/jbe@1309
 | 
    58     styleValue: "right",
 | 
| 
bsw/jbe@1309
 | 
    59     toggle: true
 | 
| 
bsw/jbe@1309
 | 
    60   };
 | 
| 
bsw/jbe@1309
 | 
    61 
 | 
| 
bsw/jbe@1309
 | 
    62   return {
 | 
| 
bsw/jbe@1309
 | 
    63     exec: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
    64       return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
    65     },
 | 
| 
bsw/jbe@1309
 | 
    66 
 | 
| 
bsw/jbe@1309
 | 
    67     state: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
    68       return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
    69     }
 | 
| 
bsw/jbe@1309
 | 
    70   };
 | 
| 
bsw/jbe@1309
 | 
    71 })();
 | 
| 
bsw/jbe@1309
 | 
    72 
 | 
| 
bsw/jbe@1309
 | 
    73 /* Sets text background color by inline styles */
 | 
| 
bsw/jbe@1309
 | 
    74 wysihtml.commands.bgColorStyle = (function() {
 | 
| 
bsw/jbe@1309
 | 
    75   return {
 | 
| 
bsw/jbe@1309
 | 
    76     exec: function(composer, command, color) {
 | 
| 
bsw/jbe@1309
 | 
    77       var colorVals  = wysihtml.quirks.styleParser.parseColor("background-color:" + (color.color || color), "background-color"),
 | 
| 
bsw/jbe@1309
 | 
    78           colString;
 | 
| 
bsw/jbe@1309
 | 
    79 
 | 
| 
bsw/jbe@1309
 | 
    80       if (colorVals) {
 | 
| 
bsw/jbe@1309
 | 
    81         colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(', ') : "rgba(" + colorVals.join(', ')) + ')';
 | 
| 
bsw/jbe@1309
 | 
    82         wysihtml.commands.formatInline.exec(composer, command, {styleProperty: 'backgroundColor', styleValue: colString});
 | 
| 
bsw/jbe@1309
 | 
    83       }
 | 
| 
bsw/jbe@1309
 | 
    84     },
 | 
| 
bsw/jbe@1309
 | 
    85 
 | 
| 
bsw/jbe@1309
 | 
    86     state: function(composer, command, color) {
 | 
| 
bsw/jbe@1309
 | 
    87       var colorVals  = color ? wysihtml.quirks.styleParser.parseColor("background-color:" + (color.color || color), "background-color") : null,
 | 
| 
bsw/jbe@1309
 | 
    88           colString;
 | 
| 
bsw/jbe@1309
 | 
    89 
 | 
| 
bsw/jbe@1309
 | 
    90       if (colorVals) {
 | 
| 
bsw/jbe@1309
 | 
    91         colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(', ') : "rgba(" + colorVals.join(', ')) + ')';
 | 
| 
bsw/jbe@1309
 | 
    92       }
 | 
| 
bsw/jbe@1309
 | 
    93 
 | 
| 
bsw/jbe@1309
 | 
    94       return wysihtml.commands.formatInline.state(composer, command, {styleProperty: 'backgroundColor', styleValue: colString});
 | 
| 
bsw/jbe@1309
 | 
    95     },
 | 
| 
bsw/jbe@1309
 | 
    96 
 | 
| 
bsw/jbe@1309
 | 
    97     remove: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
    98       return wysihtml.commands.formatInline.remove(composer, command, {styleProperty: 'backgroundColor'});
 | 
| 
bsw/jbe@1309
 | 
    99     },
 | 
| 
bsw/jbe@1309
 | 
   100 
 | 
| 
bsw/jbe@1309
 | 
   101     stateValue: function(composer, command, props) {
 | 
| 
bsw/jbe@1309
 | 
   102       var st = this.state(composer, command),
 | 
| 
bsw/jbe@1309
 | 
   103           colorStr,
 | 
| 
bsw/jbe@1309
 | 
   104           val = false;
 | 
| 
bsw/jbe@1309
 | 
   105 
 | 
| 
bsw/jbe@1309
 | 
   106       if (st && wysihtml.lang.object(st).isArray()) {
 | 
| 
bsw/jbe@1309
 | 
   107         st = st[0];
 | 
| 
bsw/jbe@1309
 | 
   108       }
 | 
| 
bsw/jbe@1309
 | 
   109 
 | 
| 
bsw/jbe@1309
 | 
   110       if (st) {
 | 
| 
bsw/jbe@1309
 | 
   111         colorStr = st.getAttribute('style');
 | 
| 
bsw/jbe@1309
 | 
   112         if (colorStr) {
 | 
| 
bsw/jbe@1309
 | 
   113           val = wysihtml.quirks.styleParser.parseColor(colorStr, "background-color");
 | 
| 
bsw/jbe@1309
 | 
   114           return wysihtml.quirks.styleParser.unparseColor(val, props);
 | 
| 
bsw/jbe@1309
 | 
   115         }
 | 
| 
bsw/jbe@1309
 | 
   116       }
 | 
| 
bsw/jbe@1309
 | 
   117       return false;
 | 
| 
bsw/jbe@1309
 | 
   118     }
 | 
| 
bsw/jbe@1309
 | 
   119   };
 | 
| 
bsw/jbe@1309
 | 
   120 })();
 | 
| 
bsw/jbe@1309
 | 
   121 
 | 
| 
bsw/jbe@1309
 | 
   122 wysihtml.commands.bold = (function() {
 | 
| 
bsw/jbe@1309
 | 
   123   var nodeOptions = {
 | 
| 
bsw/jbe@1309
 | 
   124     nodeName: "B",
 | 
| 
bsw/jbe@1309
 | 
   125     toggle: true
 | 
| 
bsw/jbe@1309
 | 
   126   };
 | 
| 
bsw/jbe@1309
 | 
   127   
 | 
| 
bsw/jbe@1309
 | 
   128   return {
 | 
| 
bsw/jbe@1309
 | 
   129     exec: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   130       wysihtml.commands.formatInline.exec(composer, command, nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
   131     },
 | 
| 
bsw/jbe@1309
 | 
   132 
 | 
| 
bsw/jbe@1309
 | 
   133     state: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   134       return wysihtml.commands.formatInline.state(composer, command, nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
   135     }
 | 
| 
bsw/jbe@1309
 | 
   136   };
 | 
| 
bsw/jbe@1309
 | 
   137 })();
 | 
| 
bsw/jbe@1309
 | 
   138 
 | 
| 
bsw/jbe@1309
 | 
   139 /* Formats block for as a <pre><code class="classname"></code></pre> block
 | 
| 
bsw/jbe@1309
 | 
   140  * Useful in conjuction for sytax highlight utility: highlight.js
 | 
| 
bsw/jbe@1309
 | 
   141  *
 | 
| 
bsw/jbe@1309
 | 
   142  * Usage:
 | 
| 
bsw/jbe@1309
 | 
   143  *
 | 
| 
bsw/jbe@1309
 | 
   144  * editorInstance.composer.commands.exec("formatCode", "language-html");
 | 
| 
bsw/jbe@1309
 | 
   145 */
 | 
| 
bsw/jbe@1309
 | 
   146 wysihtml.commands.formatCode = (function() {
 | 
| 
bsw/jbe@1309
 | 
   147   return {
 | 
| 
bsw/jbe@1309
 | 
   148     exec: function(composer, command, classname) {
 | 
| 
bsw/jbe@1309
 | 
   149       var pre = this.state(composer)[0],
 | 
| 
bsw/jbe@1309
 | 
   150           code, range, selectedNodes;
 | 
| 
bsw/jbe@1309
 | 
   151 
 | 
| 
bsw/jbe@1309
 | 
   152       if (pre) {
 | 
| 
bsw/jbe@1309
 | 
   153         // caret is already within a <pre><code>...</code></pre>
 | 
| 
bsw/jbe@1309
 | 
   154         composer.selection.executeAndRestore(function() {
 | 
| 
bsw/jbe@1309
 | 
   155           code = pre.querySelector("code");
 | 
| 
bsw/jbe@1309
 | 
   156           wysihtml.dom.replaceWithChildNodes(pre);
 | 
| 
bsw/jbe@1309
 | 
   157           if (code) {
 | 
| 
bsw/jbe@1309
 | 
   158             wysihtml.dom.replaceWithChildNodes(code);
 | 
| 
bsw/jbe@1309
 | 
   159           }
 | 
| 
bsw/jbe@1309
 | 
   160         });
 | 
| 
bsw/jbe@1309
 | 
   161       } else {
 | 
| 
bsw/jbe@1309
 | 
   162         // Wrap in <pre><code>...</code></pre>
 | 
| 
bsw/jbe@1309
 | 
   163         range = composer.selection.getRange();
 | 
| 
bsw/jbe@1309
 | 
   164         selectedNodes = range.extractContents();
 | 
| 
bsw/jbe@1309
 | 
   165         pre = composer.doc.createElement("pre");
 | 
| 
bsw/jbe@1309
 | 
   166         code = composer.doc.createElement("code");
 | 
| 
bsw/jbe@1309
 | 
   167 
 | 
| 
bsw/jbe@1309
 | 
   168         if (classname) {
 | 
| 
bsw/jbe@1309
 | 
   169           code.className = classname;
 | 
| 
bsw/jbe@1309
 | 
   170         }
 | 
| 
bsw/jbe@1309
 | 
   171 
 | 
| 
bsw/jbe@1309
 | 
   172         pre.appendChild(code);
 | 
| 
bsw/jbe@1309
 | 
   173         code.appendChild(selectedNodes);
 | 
| 
bsw/jbe@1309
 | 
   174         range.insertNode(pre);
 | 
| 
bsw/jbe@1309
 | 
   175         composer.selection.selectNode(pre);
 | 
| 
bsw/jbe@1309
 | 
   176       }
 | 
| 
bsw/jbe@1309
 | 
   177     },
 | 
| 
bsw/jbe@1309
 | 
   178 
 | 
| 
bsw/jbe@1309
 | 
   179     state: function(composer) {
 | 
| 
bsw/jbe@1309
 | 
   180       var selectedNode = composer.selection.getSelectedNode(), node;
 | 
| 
bsw/jbe@1309
 | 
   181       if (selectedNode && selectedNode.nodeName && selectedNode.nodeName == "PRE"&&
 | 
| 
bsw/jbe@1309
 | 
   182           selectedNode.firstChild && selectedNode.firstChild.nodeName && selectedNode.firstChild.nodeName == "CODE") {
 | 
| 
bsw/jbe@1309
 | 
   183         return [selectedNode];
 | 
| 
bsw/jbe@1309
 | 
   184       } else {
 | 
| 
bsw/jbe@1309
 | 
   185         node = wysihtml.dom.getParentElement(selectedNode, { query: "pre code" });
 | 
| 
bsw/jbe@1309
 | 
   186         return node ? [node.parentNode] : false;
 | 
| 
bsw/jbe@1309
 | 
   187       }
 | 
| 
bsw/jbe@1309
 | 
   188     }
 | 
| 
bsw/jbe@1309
 | 
   189   };
 | 
| 
bsw/jbe@1309
 | 
   190 })();
 | 
| 
bsw/jbe@1309
 | 
   191 
 | 
| 
bsw/jbe@1309
 | 
   192 /**
 | 
| 
bsw/jbe@1309
 | 
   193  * Inserts an <img>
 | 
| 
bsw/jbe@1309
 | 
   194  * If selection is already an image link, it removes it
 | 
| 
bsw/jbe@1309
 | 
   195  *
 | 
| 
bsw/jbe@1309
 | 
   196  * @example
 | 
| 
bsw/jbe@1309
 | 
   197  *    // either ...
 | 
| 
bsw/jbe@1309
 | 
   198  *    wysihtml.commands.insertImage.exec(composer, "insertImage", "http://www.google.de/logo.jpg");
 | 
| 
bsw/jbe@1309
 | 
   199  *    // ... or ...
 | 
| 
bsw/jbe@1309
 | 
   200  *    wysihtml.commands.insertImage.exec(composer, "insertImage", { src: "http://www.google.de/logo.jpg", title: "foo" });
 | 
| 
bsw/jbe@1309
 | 
   201  */
 | 
| 
bsw/jbe@1309
 | 
   202 wysihtml.commands.insertImage = (function() {
 | 
| 
bsw/jbe@1309
 | 
   203   var NODE_NAME = "IMG";
 | 
| 
bsw/jbe@1309
 | 
   204   return {
 | 
| 
bsw/jbe@1309
 | 
   205     exec: function(composer, command, value) {
 | 
| 
bsw/jbe@1309
 | 
   206       value = typeof(value) === "object" ? value : { src: value };
 | 
| 
bsw/jbe@1309
 | 
   207 
 | 
| 
bsw/jbe@1309
 | 
   208       var doc     = composer.doc,
 | 
| 
bsw/jbe@1309
 | 
   209           image   = this.state(composer),
 | 
| 
bsw/jbe@1309
 | 
   210           textNode,
 | 
| 
bsw/jbe@1309
 | 
   211           parent;
 | 
| 
bsw/jbe@1309
 | 
   212 
 | 
| 
bsw/jbe@1309
 | 
   213       // If image is selected and src ie empty, set the caret before it and delete the image
 | 
| 
bsw/jbe@1309
 | 
   214       if (image && !value.src) {
 | 
| 
bsw/jbe@1309
 | 
   215         composer.selection.setBefore(image);
 | 
| 
bsw/jbe@1309
 | 
   216         parent = image.parentNode;
 | 
| 
bsw/jbe@1309
 | 
   217         parent.removeChild(image);
 | 
| 
bsw/jbe@1309
 | 
   218 
 | 
| 
bsw/jbe@1309
 | 
   219         // and it's parent <a> too if it hasn't got any other relevant child nodes
 | 
| 
bsw/jbe@1309
 | 
   220         wysihtml.dom.removeEmptyTextNodes(parent);
 | 
| 
bsw/jbe@1309
 | 
   221         if (parent.nodeName === "A" && !parent.firstChild) {
 | 
| 
bsw/jbe@1309
 | 
   222           composer.selection.setAfter(parent);
 | 
| 
bsw/jbe@1309
 | 
   223           parent.parentNode.removeChild(parent);
 | 
| 
bsw/jbe@1309
 | 
   224         }
 | 
| 
bsw/jbe@1309
 | 
   225 
 | 
| 
bsw/jbe@1309
 | 
   226         // firefox and ie sometimes don't remove the image handles, even though the image got removed
 | 
| 
bsw/jbe@1309
 | 
   227         wysihtml.quirks.redraw(composer.element);
 | 
| 
bsw/jbe@1309
 | 
   228         return;
 | 
| 
bsw/jbe@1309
 | 
   229       }
 | 
| 
bsw/jbe@1309
 | 
   230 
 | 
| 
bsw/jbe@1309
 | 
   231       // If image selected change attributes accordingly
 | 
| 
bsw/jbe@1309
 | 
   232       if (image) {
 | 
| 
bsw/jbe@1309
 | 
   233         for (var key in value) {
 | 
| 
bsw/jbe@1309
 | 
   234           if (value.hasOwnProperty(key)) {
 | 
| 
bsw/jbe@1309
 | 
   235             image.setAttribute(key === "className" ? "class" : key, value[key]);
 | 
| 
bsw/jbe@1309
 | 
   236           }
 | 
| 
bsw/jbe@1309
 | 
   237         }
 | 
| 
bsw/jbe@1309
 | 
   238         return;
 | 
| 
bsw/jbe@1309
 | 
   239       }
 | 
| 
bsw/jbe@1309
 | 
   240 
 | 
| 
bsw/jbe@1309
 | 
   241       // Otherwise lets create the image
 | 
| 
bsw/jbe@1309
 | 
   242       image = doc.createElement(NODE_NAME);
 | 
| 
bsw/jbe@1309
 | 
   243 
 | 
| 
bsw/jbe@1309
 | 
   244       for (var i in value) {
 | 
| 
bsw/jbe@1309
 | 
   245         image.setAttribute(i === "className" ? "class" : i, value[i]);
 | 
| 
bsw/jbe@1309
 | 
   246       }
 | 
| 
bsw/jbe@1309
 | 
   247 
 | 
| 
bsw/jbe@1309
 | 
   248       composer.selection.insertNode(image);
 | 
| 
bsw/jbe@1309
 | 
   249       if (wysihtml.browser.hasProblemsSettingCaretAfterImg()) {
 | 
| 
bsw/jbe@1309
 | 
   250         textNode = doc.createTextNode(wysihtml.INVISIBLE_SPACE);
 | 
| 
bsw/jbe@1309
 | 
   251         composer.selection.insertNode(textNode);
 | 
| 
bsw/jbe@1309
 | 
   252         composer.selection.setAfter(textNode);
 | 
| 
bsw/jbe@1309
 | 
   253       } else {
 | 
| 
bsw/jbe@1309
 | 
   254         composer.selection.setAfter(image);
 | 
| 
bsw/jbe@1309
 | 
   255       }
 | 
| 
bsw/jbe@1309
 | 
   256     },
 | 
| 
bsw/jbe@1309
 | 
   257 
 | 
| 
bsw/jbe@1309
 | 
   258     state: function(composer) {
 | 
| 
bsw/jbe@1309
 | 
   259       var doc = composer.doc,
 | 
| 
bsw/jbe@1309
 | 
   260           selectedNode,
 | 
| 
bsw/jbe@1309
 | 
   261           text,
 | 
| 
bsw/jbe@1309
 | 
   262           imagesInSelection;
 | 
| 
bsw/jbe@1309
 | 
   263 
 | 
| 
bsw/jbe@1309
 | 
   264       if (!wysihtml.dom.hasElementWithTagName(doc, NODE_NAME)) {
 | 
| 
bsw/jbe@1309
 | 
   265         return false;
 | 
| 
bsw/jbe@1309
 | 
   266       }
 | 
| 
bsw/jbe@1309
 | 
   267 
 | 
| 
bsw/jbe@1309
 | 
   268       selectedNode = composer.selection.getSelectedNode();
 | 
| 
bsw/jbe@1309
 | 
   269       if (!selectedNode) {
 | 
| 
bsw/jbe@1309
 | 
   270         return false;
 | 
| 
bsw/jbe@1309
 | 
   271       }
 | 
| 
bsw/jbe@1309
 | 
   272 
 | 
| 
bsw/jbe@1309
 | 
   273       if (selectedNode.nodeName === NODE_NAME) {
 | 
| 
bsw/jbe@1309
 | 
   274         // This works perfectly in IE
 | 
| 
bsw/jbe@1309
 | 
   275         return selectedNode;
 | 
| 
bsw/jbe@1309
 | 
   276       }
 | 
| 
bsw/jbe@1309
 | 
   277 
 | 
| 
bsw/jbe@1309
 | 
   278       if (selectedNode.nodeType !== wysihtml.ELEMENT_NODE) {
 | 
| 
bsw/jbe@1309
 | 
   279         return false;
 | 
| 
bsw/jbe@1309
 | 
   280       }
 | 
| 
bsw/jbe@1309
 | 
   281 
 | 
| 
bsw/jbe@1309
 | 
   282       text = composer.selection.getText();
 | 
| 
bsw/jbe@1309
 | 
   283       text = wysihtml.lang.string(text).trim();
 | 
| 
bsw/jbe@1309
 | 
   284       if (text) {
 | 
| 
bsw/jbe@1309
 | 
   285         return false;
 | 
| 
bsw/jbe@1309
 | 
   286       }
 | 
| 
bsw/jbe@1309
 | 
   287 
 | 
| 
bsw/jbe@1309
 | 
   288       imagesInSelection = composer.selection.getNodes(wysihtml.ELEMENT_NODE, function(node) {
 | 
| 
bsw/jbe@1309
 | 
   289         return node.nodeName === "IMG";
 | 
| 
bsw/jbe@1309
 | 
   290       });
 | 
| 
bsw/jbe@1309
 | 
   291 
 | 
| 
bsw/jbe@1309
 | 
   292       if (imagesInSelection.length !== 1) {
 | 
| 
bsw/jbe@1309
 | 
   293         return false;
 | 
| 
bsw/jbe@1309
 | 
   294       }
 | 
| 
bsw/jbe@1309
 | 
   295 
 | 
| 
bsw/jbe@1309
 | 
   296       return imagesInSelection[0];
 | 
| 
bsw/jbe@1309
 | 
   297     }
 | 
| 
bsw/jbe@1309
 | 
   298   };
 | 
| 
bsw/jbe@1309
 | 
   299 })();
 | 
| 
bsw/jbe@1309
 | 
   300 
 | 
| 
bsw/jbe@1309
 | 
   301 wysihtml.commands.fontSize = (function() {
 | 
| 
bsw/jbe@1309
 | 
   302   var REG_EXP = /wysiwyg-font-size-[0-9a-z\-]+/g;
 | 
| 
bsw/jbe@1309
 | 
   303 
 | 
| 
bsw/jbe@1309
 | 
   304   return {
 | 
| 
bsw/jbe@1309
 | 
   305     exec: function(composer, command, size) {
 | 
| 
bsw/jbe@1309
 | 
   306       wysihtml.commands.formatInline.exec(composer, command, {className: "wysiwyg-font-size-" + size, classRegExp: REG_EXP, toggle: true});
 | 
| 
bsw/jbe@1309
 | 
   307     },
 | 
| 
bsw/jbe@1309
 | 
   308 
 | 
| 
bsw/jbe@1309
 | 
   309     state: function(composer, command, size) {
 | 
| 
bsw/jbe@1309
 | 
   310       return wysihtml.commands.formatInline.state(composer, command, {className: "wysiwyg-font-size-" + size});
 | 
| 
bsw/jbe@1309
 | 
   311     }
 | 
| 
bsw/jbe@1309
 | 
   312   };
 | 
| 
bsw/jbe@1309
 | 
   313 })();
 | 
| 
bsw/jbe@1309
 | 
   314 
 | 
| 
bsw/jbe@1309
 | 
   315 /* Set font size by inline style */
 | 
| 
bsw/jbe@1309
 | 
   316 wysihtml.commands.fontSizeStyle = (function() {
 | 
| 
bsw/jbe@1309
 | 
   317   return {
 | 
| 
bsw/jbe@1309
 | 
   318     exec: function(composer, command, size) {
 | 
| 
bsw/jbe@1309
 | 
   319       size = size.size || size;
 | 
| 
bsw/jbe@1309
 | 
   320       if (!(/^\s*$/).test(size)) {
 | 
| 
bsw/jbe@1309
 | 
   321         wysihtml.commands.formatInline.exec(composer, command, {styleProperty: "fontSize", styleValue: size, toggle: false});
 | 
| 
bsw/jbe@1309
 | 
   322       }
 | 
| 
bsw/jbe@1309
 | 
   323     },
 | 
| 
bsw/jbe@1309
 | 
   324 
 | 
| 
bsw/jbe@1309
 | 
   325     state: function(composer, command, size) {
 | 
| 
bsw/jbe@1309
 | 
   326       return wysihtml.commands.formatInline.state(composer, command, {styleProperty: "fontSize", styleValue: size || undefined});
 | 
| 
bsw/jbe@1309
 | 
   327     },
 | 
| 
bsw/jbe@1309
 | 
   328 
 | 
| 
bsw/jbe@1309
 | 
   329     remove: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   330       return wysihtml.commands.formatInline.remove(composer, command, {styleProperty: "fontSize"});
 | 
| 
bsw/jbe@1309
 | 
   331     },
 | 
| 
bsw/jbe@1309
 | 
   332 
 | 
| 
bsw/jbe@1309
 | 
   333     stateValue: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   334       var styleStr,
 | 
| 
bsw/jbe@1309
 | 
   335           st = this.state(composer, command);
 | 
| 
bsw/jbe@1309
 | 
   336 
 | 
| 
bsw/jbe@1309
 | 
   337       if (st && wysihtml.lang.object(st).isArray()) {
 | 
| 
bsw/jbe@1309
 | 
   338           st = st[0];
 | 
| 
bsw/jbe@1309
 | 
   339       }
 | 
| 
bsw/jbe@1309
 | 
   340       if (st) {
 | 
| 
bsw/jbe@1309
 | 
   341         styleStr = st.getAttribute("style");
 | 
| 
bsw/jbe@1309
 | 
   342         if (styleStr) {
 | 
| 
bsw/jbe@1309
 | 
   343           return wysihtml.quirks.styleParser.parseFontSize(styleStr);
 | 
| 
bsw/jbe@1309
 | 
   344         }
 | 
| 
bsw/jbe@1309
 | 
   345       }
 | 
| 
bsw/jbe@1309
 | 
   346       return false;
 | 
| 
bsw/jbe@1309
 | 
   347     }
 | 
| 
bsw/jbe@1309
 | 
   348   };
 | 
| 
bsw/jbe@1309
 | 
   349 })();
 | 
| 
bsw/jbe@1309
 | 
   350 
 | 
| 
bsw/jbe@1309
 | 
   351 wysihtml.commands.foreColor = (function() {
 | 
| 
bsw/jbe@1309
 | 
   352   var REG_EXP = /wysiwyg-color-[0-9a-z]+/g;
 | 
| 
bsw/jbe@1309
 | 
   353 
 | 
| 
bsw/jbe@1309
 | 
   354   return {
 | 
| 
bsw/jbe@1309
 | 
   355     exec: function(composer, command, color) {
 | 
| 
bsw/jbe@1309
 | 
   356       wysihtml.commands.formatInline.exec(composer, command, {className: "wysiwyg-color-" + color, classRegExp: REG_EXP, toggle: true});
 | 
| 
bsw/jbe@1309
 | 
   357     },
 | 
| 
bsw/jbe@1309
 | 
   358 
 | 
| 
bsw/jbe@1309
 | 
   359     state: function(composer, command, color) {
 | 
| 
bsw/jbe@1309
 | 
   360       return wysihtml.commands.formatInline.state(composer, command, {className: "wysiwyg-color-" + color});
 | 
| 
bsw/jbe@1309
 | 
   361     }
 | 
| 
bsw/jbe@1309
 | 
   362   };
 | 
| 
bsw/jbe@1309
 | 
   363 })();
 | 
| 
bsw/jbe@1309
 | 
   364 
 | 
| 
bsw/jbe@1309
 | 
   365 /* Sets text color by inline styles */
 | 
| 
bsw/jbe@1309
 | 
   366 wysihtml.commands.foreColorStyle = (function() {
 | 
| 
bsw/jbe@1309
 | 
   367   return {
 | 
| 
bsw/jbe@1309
 | 
   368     exec: function(composer, command, color) {
 | 
| 
bsw/jbe@1309
 | 
   369       var colorVals, colString;
 | 
| 
bsw/jbe@1309
 | 
   370 
 | 
| 
bsw/jbe@1309
 | 
   371       if (!color) { return; }
 | 
| 
bsw/jbe@1309
 | 
   372 
 | 
| 
bsw/jbe@1309
 | 
   373       colorVals = wysihtml.quirks.styleParser.parseColor("color:" + (color.color || color), "color");
 | 
| 
bsw/jbe@1309
 | 
   374 
 | 
| 
bsw/jbe@1309
 | 
   375       if (colorVals) {
 | 
| 
bsw/jbe@1309
 | 
   376         colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(", ") : "rgba(" + colorVals.join(', ')) + ')';
 | 
| 
bsw/jbe@1309
 | 
   377         wysihtml.commands.formatInline.exec(composer, command, {styleProperty: "color", styleValue: colString});
 | 
| 
bsw/jbe@1309
 | 
   378       }
 | 
| 
bsw/jbe@1309
 | 
   379     },
 | 
| 
bsw/jbe@1309
 | 
   380 
 | 
| 
bsw/jbe@1309
 | 
   381     state: function(composer, command, color) {
 | 
| 
bsw/jbe@1309
 | 
   382       var colorVals  = color ? wysihtml.quirks.styleParser.parseColor("color:" + (color.color || color), "color") : null,
 | 
| 
bsw/jbe@1309
 | 
   383           colString;
 | 
| 
bsw/jbe@1309
 | 
   384 
 | 
| 
bsw/jbe@1309
 | 
   385 
 | 
| 
bsw/jbe@1309
 | 
   386       if (colorVals) {
 | 
| 
bsw/jbe@1309
 | 
   387         colString = (colorVals[3] === 1 ? "rgb(" + [colorVals[0], colorVals[1], colorVals[2]].join(", ") : "rgba(" + colorVals.join(', ')) + ')';
 | 
| 
bsw/jbe@1309
 | 
   388       }
 | 
| 
bsw/jbe@1309
 | 
   389 
 | 
| 
bsw/jbe@1309
 | 
   390       return wysihtml.commands.formatInline.state(composer, command, {styleProperty: "color", styleValue: colString});
 | 
| 
bsw/jbe@1309
 | 
   391     },
 | 
| 
bsw/jbe@1309
 | 
   392 
 | 
| 
bsw/jbe@1309
 | 
   393     remove: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   394       return wysihtml.commands.formatInline.remove(composer, command, {styleProperty: "color"});
 | 
| 
bsw/jbe@1309
 | 
   395     },
 | 
| 
bsw/jbe@1309
 | 
   396 
 | 
| 
bsw/jbe@1309
 | 
   397     stateValue: function(composer, command, props) {
 | 
| 
bsw/jbe@1309
 | 
   398       var st = this.state(composer, command),
 | 
| 
bsw/jbe@1309
 | 
   399           colorStr,
 | 
| 
bsw/jbe@1309
 | 
   400           val = false;
 | 
| 
bsw/jbe@1309
 | 
   401 
 | 
| 
bsw/jbe@1309
 | 
   402       if (st && wysihtml.lang.object(st).isArray()) {
 | 
| 
bsw/jbe@1309
 | 
   403         st = st[0];
 | 
| 
bsw/jbe@1309
 | 
   404       }
 | 
| 
bsw/jbe@1309
 | 
   405 
 | 
| 
bsw/jbe@1309
 | 
   406       if (st) {
 | 
| 
bsw/jbe@1309
 | 
   407         colorStr = st.getAttribute("style");
 | 
| 
bsw/jbe@1309
 | 
   408         if (colorStr) {
 | 
| 
bsw/jbe@1309
 | 
   409           val = wysihtml.quirks.styleParser.parseColor(colorStr, "color");
 | 
| 
bsw/jbe@1309
 | 
   410           return wysihtml.quirks.styleParser.unparseColor(val, props);
 | 
| 
bsw/jbe@1309
 | 
   411         }
 | 
| 
bsw/jbe@1309
 | 
   412       }
 | 
| 
bsw/jbe@1309
 | 
   413       return false;
 | 
| 
bsw/jbe@1309
 | 
   414     }
 | 
| 
bsw/jbe@1309
 | 
   415   };
 | 
| 
bsw/jbe@1309
 | 
   416 })();
 | 
| 
bsw/jbe@1309
 | 
   417 
 | 
| 
bsw/jbe@1309
 | 
   418 wysihtml.commands.insertBlockQuote = (function() {
 | 
| 
bsw/jbe@1309
 | 
   419   var nodeOptions = {
 | 
| 
bsw/jbe@1309
 | 
   420     nodeName: "BLOCKQUOTE",
 | 
| 
bsw/jbe@1309
 | 
   421     toggle: true
 | 
| 
bsw/jbe@1309
 | 
   422   };
 | 
| 
bsw/jbe@1309
 | 
   423   
 | 
| 
bsw/jbe@1309
 | 
   424   return {
 | 
| 
bsw/jbe@1309
 | 
   425     exec: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   426       return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
   427     },
 | 
| 
bsw/jbe@1309
 | 
   428 
 | 
| 
bsw/jbe@1309
 | 
   429     state: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   430       return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
   431     }
 | 
| 
bsw/jbe@1309
 | 
   432   };
 | 
| 
bsw/jbe@1309
 | 
   433 })();
 | 
| 
bsw/jbe@1309
 | 
   434 
 | 
| 
bsw/jbe@1309
 | 
   435 wysihtml.commands.insertHorizontalRule = (function() {
 | 
| 
bsw/jbe@1309
 | 
   436   return {
 | 
| 
bsw/jbe@1309
 | 
   437     exec: function(composer) {
 | 
| 
bsw/jbe@1309
 | 
   438       var node = composer.selection.getSelectedNode(),
 | 
| 
bsw/jbe@1309
 | 
   439           phrasingOnlyParent = wysihtml.dom.getParentElement(node, { query: wysihtml.PERMITTED_PHRASING_CONTENT_ONLY }, null, composer.editableArea),
 | 
| 
bsw/jbe@1309
 | 
   440           elem = document.createElement('hr'),
 | 
| 
bsw/jbe@1309
 | 
   441           range, idx;
 | 
| 
bsw/jbe@1309
 | 
   442 
 | 
| 
bsw/jbe@1309
 | 
   443       // HR is not allowed into some elements (where only phrasing content is allowed)
 | 
| 
bsw/jbe@1309
 | 
   444       // thus the HR insertion must break out of those https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories
 | 
| 
bsw/jbe@1309
 | 
   445       if (phrasingOnlyParent) {
 | 
| 
bsw/jbe@1309
 | 
   446         composer.selection.splitElementAtCaret(phrasingOnlyParent, elem);
 | 
| 
bsw/jbe@1309
 | 
   447       } else {
 | 
| 
bsw/jbe@1309
 | 
   448         composer.selection.insertNode(elem);
 | 
| 
bsw/jbe@1309
 | 
   449       }
 | 
| 
bsw/jbe@1309
 | 
   450 
 | 
| 
bsw/jbe@1309
 | 
   451       if (elem.nextSibling) {
 | 
| 
bsw/jbe@1309
 | 
   452         composer.selection.setBefore(elem.nextSibling);
 | 
| 
bsw/jbe@1309
 | 
   453       } else {
 | 
| 
bsw/jbe@1309
 | 
   454         composer.selection.setAfter(elem);
 | 
| 
bsw/jbe@1309
 | 
   455       }
 | 
| 
bsw/jbe@1309
 | 
   456     },
 | 
| 
bsw/jbe@1309
 | 
   457     state: function() {
 | 
| 
bsw/jbe@1309
 | 
   458       return false; // :(
 | 
| 
bsw/jbe@1309
 | 
   459     }
 | 
| 
bsw/jbe@1309
 | 
   460   };
 | 
| 
bsw/jbe@1309
 | 
   461 })();
 | 
| 
bsw/jbe@1309
 | 
   462 
 | 
| 
bsw/jbe@1309
 | 
   463 wysihtml.commands.insertOrderedList = (function() {
 | 
| 
bsw/jbe@1309
 | 
   464   return {
 | 
| 
bsw/jbe@1309
 | 
   465     exec: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   466       wysihtml.commands.insertList.exec(composer, command, "OL");
 | 
| 
bsw/jbe@1309
 | 
   467     },
 | 
| 
bsw/jbe@1309
 | 
   468 
 | 
| 
bsw/jbe@1309
 | 
   469     state: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   470       return wysihtml.commands.insertList.state(composer, command, "OL");
 | 
| 
bsw/jbe@1309
 | 
   471     }
 | 
| 
bsw/jbe@1309
 | 
   472   };
 | 
| 
bsw/jbe@1309
 | 
   473 })();
 | 
| 
bsw/jbe@1309
 | 
   474 
 | 
| 
bsw/jbe@1309
 | 
   475 wysihtml.commands.insertUnorderedList = (function() {
 | 
| 
bsw/jbe@1309
 | 
   476   return {
 | 
| 
bsw/jbe@1309
 | 
   477     exec: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   478       wysihtml.commands.insertList.exec(composer, command, "UL");
 | 
| 
bsw/jbe@1309
 | 
   479     },
 | 
| 
bsw/jbe@1309
 | 
   480 
 | 
| 
bsw/jbe@1309
 | 
   481     state: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   482       return wysihtml.commands.insertList.state(composer, command, "UL");
 | 
| 
bsw/jbe@1309
 | 
   483     }
 | 
| 
bsw/jbe@1309
 | 
   484   };
 | 
| 
bsw/jbe@1309
 | 
   485 })();
 | 
| 
bsw/jbe@1309
 | 
   486 
 | 
| 
bsw/jbe@1309
 | 
   487 wysihtml.commands.italic = (function() { 
 | 
| 
bsw/jbe@1309
 | 
   488   var nodeOptions = {
 | 
| 
bsw/jbe@1309
 | 
   489     nodeName: "I",
 | 
| 
bsw/jbe@1309
 | 
   490     toggle: true
 | 
| 
bsw/jbe@1309
 | 
   491   };
 | 
| 
bsw/jbe@1309
 | 
   492 
 | 
| 
bsw/jbe@1309
 | 
   493   return {
 | 
| 
bsw/jbe@1309
 | 
   494     exec: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   495       wysihtml.commands.formatInline.exec(composer, command, nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
   496     },
 | 
| 
bsw/jbe@1309
 | 
   497 
 | 
| 
bsw/jbe@1309
 | 
   498     state: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   499       return wysihtml.commands.formatInline.state(composer, command, nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
   500     }
 | 
| 
bsw/jbe@1309
 | 
   501   };
 | 
| 
bsw/jbe@1309
 | 
   502 
 | 
| 
bsw/jbe@1309
 | 
   503 })();
 | 
| 
bsw/jbe@1309
 | 
   504 
 | 
| 
bsw/jbe@1309
 | 
   505 wysihtml.commands.justifyCenter = (function() {
 | 
| 
bsw/jbe@1309
 | 
   506   var nodeOptions = {
 | 
| 
bsw/jbe@1309
 | 
   507     className: "wysiwyg-text-align-center",
 | 
| 
bsw/jbe@1309
 | 
   508     classRegExp: /wysiwyg-text-align-[0-9a-z]+/g,
 | 
| 
bsw/jbe@1309
 | 
   509     toggle: true
 | 
| 
bsw/jbe@1309
 | 
   510   };
 | 
| 
bsw/jbe@1309
 | 
   511 
 | 
| 
bsw/jbe@1309
 | 
   512   return {
 | 
| 
bsw/jbe@1309
 | 
   513     exec: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   514       return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
   515     },
 | 
| 
bsw/jbe@1309
 | 
   516 
 | 
| 
bsw/jbe@1309
 | 
   517     state: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   518       return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
   519     }
 | 
| 
bsw/jbe@1309
 | 
   520   };
 | 
| 
bsw/jbe@1309
 | 
   521   
 | 
| 
bsw/jbe@1309
 | 
   522 })();
 | 
| 
bsw/jbe@1309
 | 
   523 
 | 
| 
bsw/jbe@1309
 | 
   524 wysihtml.commands.justifyFull = (function() {
 | 
| 
bsw/jbe@1309
 | 
   525   var nodeOptions = {
 | 
| 
bsw/jbe@1309
 | 
   526     className: "wysiwyg-text-align-justify",
 | 
| 
bsw/jbe@1309
 | 
   527     classRegExp: /wysiwyg-text-align-[0-9a-z]+/g,
 | 
| 
bsw/jbe@1309
 | 
   528     toggle: true
 | 
| 
bsw/jbe@1309
 | 
   529   };
 | 
| 
bsw/jbe@1309
 | 
   530 
 | 
| 
bsw/jbe@1309
 | 
   531   return {
 | 
| 
bsw/jbe@1309
 | 
   532     exec: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   533       return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
   534     },
 | 
| 
bsw/jbe@1309
 | 
   535 
 | 
| 
bsw/jbe@1309
 | 
   536     state: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   537       return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
   538     }
 | 
| 
bsw/jbe@1309
 | 
   539   };
 | 
| 
bsw/jbe@1309
 | 
   540 })();
 | 
| 
bsw/jbe@1309
 | 
   541 
 | 
| 
bsw/jbe@1309
 | 
   542 wysihtml.commands.justifyLeft = (function() {
 | 
| 
bsw/jbe@1309
 | 
   543   var nodeOptions = {
 | 
| 
bsw/jbe@1309
 | 
   544     className: "wysiwyg-text-align-left",
 | 
| 
bsw/jbe@1309
 | 
   545     classRegExp: /wysiwyg-text-align-[0-9a-z]+/g,
 | 
| 
bsw/jbe@1309
 | 
   546     toggle: true
 | 
| 
bsw/jbe@1309
 | 
   547   };
 | 
| 
bsw/jbe@1309
 | 
   548 
 | 
| 
bsw/jbe@1309
 | 
   549   return {
 | 
| 
bsw/jbe@1309
 | 
   550     exec: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   551       return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
   552     },
 | 
| 
bsw/jbe@1309
 | 
   553 
 | 
| 
bsw/jbe@1309
 | 
   554     state: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   555       return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
   556     }
 | 
| 
bsw/jbe@1309
 | 
   557   };
 | 
| 
bsw/jbe@1309
 | 
   558 })();
 | 
| 
bsw/jbe@1309
 | 
   559 
 | 
| 
bsw/jbe@1309
 | 
   560 wysihtml.commands.justifyRight = (function() {
 | 
| 
bsw/jbe@1309
 | 
   561   var nodeOptions = {
 | 
| 
bsw/jbe@1309
 | 
   562     className: "wysiwyg-text-align-right",
 | 
| 
bsw/jbe@1309
 | 
   563     classRegExp: /wysiwyg-text-align-[0-9a-z]+/g,
 | 
| 
bsw/jbe@1309
 | 
   564     toggle: true
 | 
| 
bsw/jbe@1309
 | 
   565   };
 | 
| 
bsw/jbe@1309
 | 
   566 
 | 
| 
bsw/jbe@1309
 | 
   567   return {
 | 
| 
bsw/jbe@1309
 | 
   568     exec: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   569       return wysihtml.commands.formatBlock.exec(composer, "formatBlock", nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
   570     },
 | 
| 
bsw/jbe@1309
 | 
   571 
 | 
| 
bsw/jbe@1309
 | 
   572     state: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   573       return wysihtml.commands.formatBlock.state(composer, "formatBlock", nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
   574     }
 | 
| 
bsw/jbe@1309
 | 
   575   };
 | 
| 
bsw/jbe@1309
 | 
   576 })();
 | 
| 
bsw/jbe@1309
 | 
   577 
 | 
| 
bsw/jbe@1309
 | 
   578 wysihtml.commands.subscript = (function() {
 | 
| 
bsw/jbe@1309
 | 
   579   var nodeOptions = {
 | 
| 
bsw/jbe@1309
 | 
   580     nodeName: "SUB",
 | 
| 
bsw/jbe@1309
 | 
   581     toggle: true
 | 
| 
bsw/jbe@1309
 | 
   582   };
 | 
| 
bsw/jbe@1309
 | 
   583 
 | 
| 
bsw/jbe@1309
 | 
   584   return {
 | 
| 
bsw/jbe@1309
 | 
   585     exec: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   586       wysihtml.commands.formatInline.exec(composer, command, nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
   587     },
 | 
| 
bsw/jbe@1309
 | 
   588 
 | 
| 
bsw/jbe@1309
 | 
   589     state: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   590       return wysihtml.commands.formatInline.state(composer, command, nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
   591     }
 | 
| 
bsw/jbe@1309
 | 
   592   };
 | 
| 
bsw/jbe@1309
 | 
   593 
 | 
| 
bsw/jbe@1309
 | 
   594 })();
 | 
| 
bsw/jbe@1309
 | 
   595 
 | 
| 
bsw/jbe@1309
 | 
   596 wysihtml.commands.superscript = (function() {
 | 
| 
bsw/jbe@1309
 | 
   597   var nodeOptions = {
 | 
| 
bsw/jbe@1309
 | 
   598     nodeName: "SUP",
 | 
| 
bsw/jbe@1309
 | 
   599     toggle: true
 | 
| 
bsw/jbe@1309
 | 
   600   };
 | 
| 
bsw/jbe@1309
 | 
   601 
 | 
| 
bsw/jbe@1309
 | 
   602   return {
 | 
| 
bsw/jbe@1309
 | 
   603     exec: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   604       wysihtml.commands.formatInline.exec(composer, command, nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
   605     },
 | 
| 
bsw/jbe@1309
 | 
   606 
 | 
| 
bsw/jbe@1309
 | 
   607     state: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   608       return wysihtml.commands.formatInline.state(composer, command, nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
   609     }
 | 
| 
bsw/jbe@1309
 | 
   610   };
 | 
| 
bsw/jbe@1309
 | 
   611 
 | 
| 
bsw/jbe@1309
 | 
   612 })();
 | 
| 
bsw/jbe@1309
 | 
   613 
 | 
| 
bsw/jbe@1309
 | 
   614 wysihtml.commands.underline = (function() {
 | 
| 
bsw/jbe@1309
 | 
   615   var nodeOptions = {
 | 
| 
bsw/jbe@1309
 | 
   616     nodeName: "U",
 | 
| 
bsw/jbe@1309
 | 
   617     toggle: true
 | 
| 
bsw/jbe@1309
 | 
   618   };
 | 
| 
bsw/jbe@1309
 | 
   619 
 | 
| 
bsw/jbe@1309
 | 
   620   return {
 | 
| 
bsw/jbe@1309
 | 
   621     exec: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   622       wysihtml.commands.formatInline.exec(composer, command, nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
   623     },
 | 
| 
bsw/jbe@1309
 | 
   624 
 | 
| 
bsw/jbe@1309
 | 
   625     state: function(composer, command) {
 | 
| 
bsw/jbe@1309
 | 
   626       return wysihtml.commands.formatInline.state(composer, command, nodeOptions);
 | 
| 
bsw/jbe@1309
 | 
   627     }
 | 
| 
bsw/jbe@1309
 | 
   628   };
 | 
| 
bsw/jbe@1309
 | 
   629 
 | 
| 
bsw/jbe@1309
 | 
   630 })();
 |