1
0
Fork 0
mirror of https://github.com/seejohnrun/haste-server.git synced 2024-11-01 03:21:21 +00:00

ctrl-n for new documents

This commit is contained in:
John Crepezzi 2011-11-18 10:19:44 -05:00
parent c5a551f770
commit 7cc30e4b69

View file

@ -23,7 +23,6 @@ heist_document.prototype.save = function(data, callback) {
var heist = function(appName) { var heist = function(appName) {
this.appName = appName; this.appName = appName;
this.setTitle();
this.$textarea = $('textarea'); this.$textarea = $('textarea');
this.$box = $('#box'); this.$box = $('#box');
this.$code = $('#box code'); this.$code = $('#box code');
@ -43,6 +42,7 @@ heist.prototype.setTitle = function(ext) {
heist.prototype.newDocument = function(ext) { heist.prototype.newDocument = function(ext) {
this.doc = new heist_document(); this.doc = new heist_document();
this.$box.hide(); this.$box.hide();
this.setTitle();
this.$textarea.val('').show().focus(); this.$textarea.val('').show().focus();
} }
@ -64,9 +64,12 @@ heist.prototype.configureShortcuts = function() {
var _this = this; var _this = this;
this.$textarea.keyup(function(evt) { this.$textarea.keyup(function(evt) {
// ^L for lock // ^L for lock
if (evt.ctrlKey && evt.which === 76) { if (evt.ctrlKey && evt.keyCode === 76) {
_this.lockDocument(); _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 refuse to lock empty documents
// TODO support for browsers without pushstate // TODO support for browsers without pushstate
// TODO support for push state navigation // TODO support for push state navigation
// TODO ctrl-n for new
// TODO ctrl-d for duplicate // TODO ctrl-d for duplicate
$(function() { $(function() {