public/javascript/libs/wysihtml5-0.3.0.js
function(html) {
      var range     = rangy.createRange(this.doc),
          node      = range.createContextualFragment(html),
          lastChild = node.lastChild;
      this.insertNode(node);
      if (lastChild) {
        this.setAfter(lastChild);
      }
    }
function(html) {
      var range     = rangy.createRange(this.doc),
          node      = range.createContextualFragment(html),
          lastChild = node.lastChild;
      this.insertNode(node);
      if (lastChild) {
        this.setAfter(lastChild);
      }
    }
Insert html at the caret position and move the cursor after the inserted html

@param {String} html HTML string to insert
@example
selection.insertHTML("<p>foobar</p>");