-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
38 lines (30 loc) · 963 Bytes
/
index.html
File metadata and controls
38 lines (30 loc) · 963 Bytes
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
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- when using the mode "code", it's important to specify charset utf-8 -->
<meta charset="utf-8">
<link href="jsoneditor.min.css" rel="stylesheet" type="text/css">
<script src="jsoneditor.min.js"></script>
</head>
<body>
<div id="jsoneditor" style="width: 100%; height: 100%;"></div>
<script>
// create the editor
const container = document.getElementById("jsoneditor")
const options = {}
const editor = new JSONEditor(container, options)
// set json
const initialJson = {}
editor.set(initialJson)
function setJSON(jsonString) {
editor.set(JSON.parse(jsonString));
}
function sendJSON() {
window.chrome.webview.postMessage(JSON.stringify(editor.get()));
}
document.addEventListener("input", function() {
sendJSON();
});
</script>
</body>
</html>