1
0
Fork 0
mirror of https://github.com/SunRed/haste-server.git synced 2024-11-23 17:50:19 +01: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) {
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() {