forked from josdejong/jsoneditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_bootstrap.html
56 lines (48 loc) · 1.28 KB
/
test_bootstrap.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
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<!--<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/css/bootstrap.min.css" rel="stylesheet" type="text/css">-->
<link href="../dist/jsoneditor.css" rel="stylesheet" type="text/css">
<script src="../dist/jsoneditor.js"></script>
<style type="text/css">
#jsoneditor {
width: 500px;
height: 500px;
}
</style>
</head>
<body>
<p>
Test with bootstrap
</p>
<div id="jsoneditor"></div>
<script>
var container = document.getElementById('jsoneditor');
var options = {
"mode": "tree",
"modes": [
"tree",
"form",
"code",
"text",
"view"
],
"history": false,
onChange: function () {
if (editor) {
// if you comment out the next line of code, the problem is solved
// editor.get() throws an exception when the editor does not
// contain valid JSON.
console.log('change', editor.get())
}
}
};
var editor = new JSONEditor(container, options);
var text = "[{\"test\":\"test\"}]";
var json = JSON.parse(text);
editor.set(json);
</script>
</body>
</html>