So far I have an editor made out of a <textarea>
with CodeMirror.fromTextArea
.
I can write code and it works awesomely, but when I press CTRL+S it shows a dialog to save the HTML page. I'd expect it to instead let me save (download) the code I typed.
I have successfully bound to the save command as follows:
CodeMirror.commands.save = function(editor) {
console.log("Yay!");
};
and indeed when I hit CTRL+S, I have "Yay!" printed to the console and no dialog is shown.
Now, how do I make a save dialog that saves just the code in the editor instance?