Last active
May 23, 2016 17:42
-
-
Save darcyliu/45d261edc05c72d2b59b15cef3a044c4 to your computer and use it in GitHub Desktop.
Ace code editor
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>ACE in Action</title> | |
<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.0/css/bootstrap.min.css"> | |
<style type="text/css" media="screen"> | |
#editor { | |
margin: 10px 0; | |
height: 300px; | |
border-radius: 3px; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="panel panel-default"> | |
<div class="panel-heading"> | |
<h3 class="panel-title">Editor</h3> | |
</div> | |
<div class="panel-body"> | |
<form> | |
<div id="editor">#include<stdio.h> | |
int main(){ | |
printf("Hello world!\n"); | |
return 0; | |
}</div> | |
<button type="button" class="btn btn-primary">Primary</button> | |
<button type="button" class="btn btn-success">Success</button> | |
</form> | |
</div> | |
</div> | |
<div class="text-center">---End of editor---</div> | |
</div> | |
<script src="https://ace.c9.io/build/src/ace.js" type="text/javascript" charset="utf-8"></script> | |
<script> | |
var editor = ace.edit("editor"); | |
editor.setTheme("ace/theme/solarized_dark"); | |
editor.getSession().setMode("ace/mode/c_cpp"); | |
editor.commands.addCommands([{ | |
name: "showSettingsMenu", | |
bindKey: {win: "Ctrl-q", mac: "Command-q"}, | |
exec: function(editor) { | |
editor.showSettingsMenu(); | |
}, | |
readOnly: true | |
}]); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment