-
Notifications
You must be signed in to change notification settings - Fork 114
/
Copy pathtoggle_options.html
76 lines (66 loc) · 1.75 KB
/
toggle_options.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>JSONEditor | Toggle options</title>
<style>
body,
input,
label {
font-family: verdana, serif;
font-size: 12pt;
}
#jsoneditor {
width: 600px;
height: 500px;
}
</style>
</head>
<body>
<p>
<label> <input type="checkbox" id="mainMenuBar" checked /> Show main menu bar </label>
<label> <input type="checkbox" id="navigationBar" checked /> Show navigation bar </label>
<label> <input type="checkbox" id="readOnly" /> Read only </label>
</p>
<div id="jsoneditor"></div>
<script type="module">
import { createJSONEditor } from '../../package-vanilla/standalone.js'
const content = {
text: undefined,
json: {
array: [1, 2, 3],
boolean: true,
color: '#82b92c',
null: null,
number: 123,
object: { a: 'b', c: 'd' },
time: 1575599819000,
string: 'Hello World'
}
}
// create the editor
const editor = createJSONEditor({
target: document.getElementById('jsoneditor'),
props: {
content
}
})
document.getElementById('mainMenuBar').onchange = (event) => {
editor.updateProps({
mainMenuBar: event.target.checked
})
}
document.getElementById('navigationBar').onchange = (event) => {
editor.updateProps({
navigationBar: event.target.checked
})
}
document.getElementById('readOnly').onchange = (event) => {
editor.updateProps({
readOnly: event.target.checked
})
}
window.editor = editor
</script>
</body>
</html>