generated from caperaven/crs-starter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index-extension.html
62 lines (53 loc) · 1.75 KB
/
index-extension.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
html, body, main {
padding: 0;
margin: 0;
width: 100vw;
height: 100vh;
}
main {
display: grid;
grid-template-columns: 1fr;
grid-template-rows: 32px 1fr;
}
.toolbar {
background: #dadada;
display: flex;
align-items: center;
justify-items: flex-end;
}
button {
height: 2rem;
}
</style>
</head>
<body>
<main>
<div class="toolbar">
<button id="btnSetValue">Set Value</button>
<button id="btnGetValue">Get Value</button>
</div>
<crs-monaco-editor id="editor" show-minimap="false" html="dev/crs-monaco-editor-inner.html"></crs-monaco-editor>
<schema-editor for="editor"></schema-editor>
</main>
<script type="module" src="./src/crs-monaco-editor.js"></script>
<script type="module" src="./extensions/schema-editor.js"></script>
<script>
const editor = document.querySelector("crs-monaco-editor");
document.querySelector("#btnSetValue").addEventListener("click", () => {
editor.value = "const fx = () => console.log('hello world');";
});
document.querySelector("#btnGetValue").addEventListener("click", () => {
console.log(editor.value);
});
</script>
</body>
</html>