Commit 7cc30e4b authored by John Crepezzi's avatar John Crepezzi
Browse files

ctrl-n for new documents

parent c5a551f7
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ heist_document.prototype.save = function(data, callback) {
var heist = function(appName) {

  this.appName = appName;
  this.setTitle();
  this.$textarea = $('textarea');
  this.$box = $('#box');
  this.$code = $('#box code');
@@ -43,6 +42,7 @@ heist.prototype.setTitle = function(ext) {
heist.prototype.newDocument = function(ext) {
  this.doc = new heist_document();
  this.$box.hide();
  this.setTitle();
  this.$textarea.val('').show().focus();
}

@@ -64,9 +64,12 @@ heist.prototype.configureShortcuts = function() {
  var _this = this;
  this.$textarea.keyup(function(evt) {
    // ^L for lock
    if (evt.ctrlKey && evt.which === 76) {
    if (evt.ctrlKey && evt.keyCode === 76) {
      _this.lockDocument();
    }
    else if (evt.ctrlKey && evt.keyCode === 78) {
      _this.newDocument();
    }
  });
};

@@ -74,7 +77,6 @@ heist.prototype.configureShortcuts = function() {
// TODO refuse to lock empty documents
// TODO support for browsers without pushstate
// TODO support for push state navigation
// TODO ctrl-n for new
// TODO ctrl-d for duplicate

$(function() {