WIP: toolbar

This commit is contained in:
2019-09-03 23:02:29 +03:00
parent 0548087b39
commit 6e8c68966e

View File

@@ -1,38 +1,32 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" /> <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
<meta name="HandheldFriendly" content="True" /> <meta name="HandheldFriendly" content="True" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Editor</title> <title>Editor</title>
<style type="text/css" media="screen"> <style type="text/css" media="screen">
.ace_editor, body {
.toolbar { overflow: hidden;
border: 1px solid lightgray;
margin: auto;
width: 80%;
} }
.ace_editor { #editor {
height: 200px; margin: 0;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
} }
</style> </style>
</head> </head>
<body> <body>
<script src="require.js"></script> <pre id="editor"></pre>
<script>
// setup paths <script src="src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
require.config({ <script>
paths: {
"ace": "src-min-noconflict"
}
});
// load ace and extensions
require(["ace/ace", "ace/ext-language_tools"], function(ace) {
var buildDom = ace.require("ace/lib/dom").buildDom; var buildDom = ace.require("ace/lib/dom").buildDom;
var editor = ace.edit(); var editor = ace.edit();
editor.setOptions({ editor.setOptions({
@@ -66,6 +60,7 @@
function save() { function save() {
alert("not yet implemented"); alert("not yet implemented");
} }
editor.commands.addCommand({ editor.commands.addCommand({
name: "save", name: "save",
exec: save, exec: save,
@@ -112,9 +107,7 @@
document.body.appendChild(editor.container) document.body.appendChild(editor.container)
window.editor = editor; window.editor = editor;
}); </script>
</script>
</body> </body>
</html> </html>