61 lines
1.5 KiB
HTML
61 lines
1.5 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<title>Test Ace</title>
|
||
|
|
||
|
<script src="../app/web/lib/ace/ace.js" type="text/javascript" charset="utf-8"></script>
|
||
|
<script src="../app/web/lib/ace/mode-json.js" type="text/javascript" charset="utf-8"></script>
|
||
|
<script src="../app/web/lib/ace/theme-textmate.js" type="text/javascript" charset="utf-8"></script>
|
||
|
<script src="../app/web/lib/ace/theme-jso.js" type="text/javascript" charset="utf-8"></script>
|
||
|
|
||
|
<style type="text/css" media="screen">
|
||
|
html, body {
|
||
|
width: 100%;
|
||
|
height: 100%;
|
||
|
margin: 0;
|
||
|
padding: 0;
|
||
|
}
|
||
|
|
||
|
#editor {
|
||
|
border: 1px solid gray;
|
||
|
width: 50%;
|
||
|
height: 75%;
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<h1>Test Ace</h1>
|
||
|
|
||
|
<div id="editor"></div>
|
||
|
|
||
|
<script>
|
||
|
var editor = ace.edit('editor');
|
||
|
editor.setTheme("ace/theme/jso");
|
||
|
editor.setShowPrintMargin(false);
|
||
|
editor.setFontSize(13);
|
||
|
editor.getSession().setMode('ace/mode/json');
|
||
|
editor.getSession().setUseSoftTabs(true);
|
||
|
editor.getSession().setUseWrapMode(true);
|
||
|
|
||
|
var json = {
|
||
|
"array": [
|
||
|
1,
|
||
|
2,
|
||
|
3
|
||
|
],
|
||
|
"boolean": true,
|
||
|
"null": null,
|
||
|
"number": 123,
|
||
|
"object": {
|
||
|
"a": "b",
|
||
|
"c": "d",
|
||
|
"e": "f"
|
||
|
},
|
||
|
"string": "Hello World"
|
||
|
};
|
||
|
editor.setValue(JSON.stringify(json, null, 4), -1);
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|