Better way of saving through CodeMirror

This should support whatever keyboard shortcuts are configured for the
'save' command.
This commit is contained in:
Thomas Kluyver 2014-11-18 15:08:06 -08:00
parent 8dced9ab73
commit d567331d4d

View File

@ -21,6 +21,11 @@ function($,
this.codemirror = CodeMirror($(this.selector)[0]);
// It appears we have to set commands on the CodeMirror class, not the
// instance. I'd like to be wrong, but since there should only be one CM
// instance on the page, this is good enough for now.
CodeMirror.commands.save = $.proxy(this.save, this);
this.save_enabled = false;
};
@ -46,9 +51,6 @@ function($,
that.save_enabled = false;
}
);
cm.setOption("extraKeys", {
"Ctrl-S": $.proxy(this.save, this),
});
};
Editor.prototype.save = function() {