Skip to content
tiff edited this page Apr 1, 2012 · 28 revisions

Supported Commands

Below is a full list of formatting commands supported by wysihtml5.

  • bold
  • createLink
  • fontSize
  • foreColor
  • formatBlock
  • formatInline
  • insertHTML
  • insertImage
  • insertLineBreak
  • insertOrderedList
  • insertUnorderedList
  • italic
  • justifyCenter
  • justifyLeft
  • justifyRight
  • underline

bold

  • Generated markup
    <b>text</b>
  • Toolbar element
    <a data-wysihtml5-command="bold">bold</a>
  • Required parser rules
    var wysihtml5ParserRules = {
      tagNames: {
        "b": 1
        // if you want to turn all <strong> elements into <b> (optional)
       "strong": { "rename_tag": "b" }
      }
    };
    

createLink

  • Generated markup
    <!-- target="_blank" and rel="nofollow" are only set when defined in parser rules -->
    <a href="http://url" target="_blank" rel="nofollow">link</a>
    
  • Toolbar element
    <!-- User can define the link's href: -->
    <a data-wysihtml5-command="createLink">insert link</a>
    <div data-wysihtml5-dialog="createLink">
      <label>
        Link:
        <input data-wysihtml5-dialog-field="href" value="http://" class="text">
      </label>
      <a data-wysihtml5-dialog-action="save">OK</a>
      <a data-wysihtml5-dialog-action="cancel">Cancel</a>
    </div>
    <!-- Pre-defined href -->
    <a data-wysihtml5-command="createLink" data-wysihtml5-command-value="http://www.google.com">insert google link</a>
    
  • Required parser rules
    var wysihtml5ParserRules = {
      tagNames: {
        "a": {
          "check_attributes": {
            "href": "url" // make sure the entered url is really an url
          },
          "set_attributes": {
            "rel": "nofollow",   // optional
            "target": "_blank"   // optional
          }
        }
      }
    };
    
Clone this wiki locally