Skip to content

Instantly share code, notes, and snippets.

@micrypt
Created February 20, 2012 23:37
Show Gist options
  • Save micrypt/1872313 to your computer and use it in GitHub Desktop.
Save micrypt/1872313 to your computer and use it in GitHub Desktop.
//This wee bit o' CoffeeScript
editor = CodeMirror.fromTextArea(document.getElementById('id_body'),
mode: "markdown"
lineNumbers: false
lineWrapping: true
onCursorActivity: () ->
setLineClass(hlLine, null)
hlLine = editor.setLineClass(editor.getCursor().line, "activeline"))
hlLine = window.editor.setLineClass(0, "activeline")
$(() -> $('.create #id_title').focus())
//Compiles to this and proceeds to vex me…
(function() {
var editor, hlLine;
editor = CodeMirror.fromTextArea(document.getElementById('id_body'), {
mode: "markdown",
lineNumbers: false,
lineWrapping: true,
onCursorActivity: function() {
var hlLine;
setLineClass(hlLine, null);
return hlLine = editor.setLineClass(editor.getCursor().line, "activeline");
}
});
hlLine = window.editor.setLineClass(0, "activeline");
$(function() {
return $('.create #id_title').focus();
});
}).call(this);
editor = CodeMirror.fromTextArea(document.getElementById('id_body'),
mode: "markdown"
lineNumbers: false
lineWrapping: true
onCursorActivity: () ->
setLineClass(hlLine, null)
hlLine = editor.setLineClass(editor.getCursor().line, "activeline"))
hlLine = window.editor.setLineClass(0, "activeline")
$(() -> $('.create #id_title').focus())
Compiles to this and proceeds to vex me…
(function() {
var editor, hlLine;
editor = CodeMirror.fromTextArea(document.getElementById('id_body'), {
mode: "markdown",
lineNumbers: false,
lineWrapping: true,
onCursorActivity: function() {
var hlLine;
setLineClass(hlLine, null);
return hlLine = editor.setLineClass(editor.getCursor().line, "activeline");
}
});
hlLine = window.editor.setLineClass(0, "activeline");
$(function() {
return $('.create #id_title').focus();
});
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment