Oops, you need to build the package before running this example. It's easy: just run rake in the project's directory.

This example shows you how to create a simple UI for linking and unlinking selections

  WysiHat.Commands.promptLinkSelection = function() {
    if (this.linkSelected()) {
      if (confirm("Remove link?"))
        this.unlinkSelection();
    } else {
      var value = prompt("Enter a URL", "http://www.google.com/");
      if (value)
        this.linkSelection(value);
    }
  }

  document.on("dom:loaded", function() {
    var editor = WysiHat.Editor.attach('content');
    var toolbar = new WysiHat.Toolbar(editor);

    toolbar.addButton({
      label: "Link",
      handler: function(editor) { return editor.promptLinkSelection(); }
    });
  });