Created
January 22, 2013 05:02
-
-
Save CrowderSoup/4592209 to your computer and use it in GitHub Desktop.
Simple example on how to use the ACE Editor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dom = require("ace/lib/dom"); | |
require("ace/commands/default_commands").commands.push({ | |
name: "Toggle Fullscreen", | |
bindKey: "F11", | |
exec: function(editor) { | |
dom.toggleCssClass(document.body, "fullScreen"); | |
dom.toggleCssClass(editor.container, "fullScreen"); | |
editor.resize(); | |
} | |
}); | |
var editor = ace.edit("editor"); | |
editor.setTheme("ace/theme/github"); | |
editor.getSession().setMode("ace/mode/markdown"); | |
var converter = Markdown.getSanitizingConverter(); | |
editor.on("change", function(e){ | |
var strHTML = converter.makeHtml(editor.getValue()); | |
$('#editor_preview').html(strHTML); | |
}); | |
function undo() { | |
editor.undo(); | |
} | |
function redo() { | |
editor.redo(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment