notes.kaplon.us/views/index.hbs

44 lines
952 B
Handlebars

<!DOCTYPE html>
<html lang="en">
<head>
<title>Jody's CodeMirror</title>
<link rel="stylesheet" href="lib/codemirror.css">
<script src="lib/codemirror.js"></script>
<script src="mode/markdown/markdown.js"></script>
<script src="keymap/vim.js"></script>
<style type="text/css">
.CodeMirror {
border: 1px solid #eee;
height: auto;
}
</style>
</head>
<body>
<form><textarea id="editor" name="editor">
{{notetxt}}
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("editor"), {
mode: "markdown",
lineNumbers: "true",
keyMap: "vim",
viewportMargin: Infinity
});
var typingTimer;
editor.on("changes", function() {
//console.log("changes fired");
clearTimeout(typingTimer);
typingTimer = setTimeout(
function() {
alert("saved now!");
},
2000
);
});
</script>
</body>
</html>