old_contents: WysiHat.Editor = {
    /**
     *  WysiHat.Editor.attach(textarea)
     *  - textarea (String | Element): an id or DOM node of the textarea that
     *  you want to convert to rich text.
     *
     *  Creates a new editor for the textarea.
     **/
    attach: function(textarea) {
      textarea = $(textarea);
      textarea.hide();
  
      return WysiHat.Editable.create(textarea, function(editArea) {
        var document = editArea.getDocument();
        var window = editArea.getWindow();
  
        editArea.load();
  
        Event.observe(window, 'focus', function(event) { editArea.focus(); });
        Event.observe(window, 'blur', function(event) { editArea.blur(); });
  
  
        Event.observe(document, 'mouseup', function(event) {
          editArea.fire("wysihat:mouseup");
        });
  
        Event.observe(document, 'mousemove', function(event) {
          editArea.fire("wysihat:mousemove");
        });
  
        Event.observe(document, 'keypress', function(event) {
          editArea.fire("wysihat:change");
          editArea.fire("wysihat:keypress");
        });
  
        Event.observe(document, 'keyup', function(event) {
          editArea.fire("wysihat:change");
          editArea.fire("wysihat:keyup");
        });
  
        Event.observe(document, 'keydown', function(event) {
          if (event.keyCode == 86)
            editArea.fire("wysihat:paste");
        });
  
        Event.observe(window, 'paste', function(event) {
          editArea.fire("wysihat:paste");
        });
  
  
        editArea.observe("wysihat:change", function(event) {
          event.target.save();
        });
        
        editArea.focus();
      });
    }
  };
  
new_contents: WysiHat.Editor = {
    /**
     *  WysiHat.Editor.attach(textarea)
     *  - textarea (String | Element): an id or DOM node of the textarea that
     *  you want to convert to rich text.
     *
     *  Creates a new editor for the textarea.
     **/
    attach: function(textarea, options) {
      options = $H(options);
      textarea = $(textarea);
      textarea.hide();
  
      var model = options.get('model') || WysiHat.iFrame;
  
      return model.create(textarea, function(editArea) {
        var document = editArea.getDocument();
        var window = editArea.getWindow();
  
        editArea.load();
  
        Event.observe(window, 'focus', function(event) { editArea.focus(); });
        Event.observe(window, 'blur', function(event) { editArea.blur(); });
  
  
        Event.observe(document, 'mouseup', function(event) {
          editArea.fire("wysihat:mouseup");
        });
  
        Event.observe(document, 'mousemove', function(event) {
          editArea.fire("wysihat:mousemove");
        });
  
        Event.observe(document, 'keypress', function(event) {
          editArea.fire("wysihat:change");
          editArea.fire("wysihat:keypress");
        });
  
        Event.observe(document, 'keyup', function(event) {
          editArea.fire("wysihat:change");
          editArea.fire("wysihat:keyup");
        });
  
        Event.observe(document, 'keydown', function(event) {
          if (event.keyCode == 86)
            editArea.fire("wysihat:paste");
        });
  
        Event.observe(window, 'paste', function(event) {
          editArea.fire("wysihat:paste");
        });
  
  
        editArea.observe("wysihat:change", function(event) {
          event.target.save();
        });
        
        editArea.focus();
      });
    }
  };
  
subject: allow editable class to be swapped in