-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
148 lines (128 loc) · 3.29 KB
/
index.html
File metadata and controls
148 lines (128 loc) · 3.29 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!doctype html>
<meta charset=utf8>
<title>JSON Tree Viewer</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #f5f5f5;
}
.container {
max-width: 1200px;
margin: 0 auto;
background: white;
overflow: hidden;
}
.header {
background: #2c3e50;
color: white;
padding: 20px;
text-align: center;
}
.header h1 {
margin: 0;
font-size: 24px;
}
.jsontree-container {
border: 1px solid #ddd;
border-radius: 4px;
min-height: 200px;
background: #fafafa;
}
</style>
<link rel="stylesheet" href="dist/jsontree.js.css?t=20250117153500">
<script src="dist/editor.codemirror.js?t=20250117153500"></script>
<script src="dist/jsontree.js?t=20250117153500"></script>
<div class="container">
<div class="header">
<h1>JSON Editor Demo</h1>
</div>
<div class="content">
<!-- Demo 1: Simple JSON Object -->
<div class="demo-section" style="padding: 30px;">
<div id="json-tree-1"></div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Test data
const testData =
{
"chartName": "c3",
"chartType": "Gauge",
"title": [
{
"padding": 15,
"text": "Gauge Example",
"textStyle": {
"color": "#999"
}
}
],
"toolbox": {
"feature": {
"saveAsImage": {
"show": true
}
},
"show": true
},
"tooltip": {
"formatter": "{a} <br/>{c} {b}"
},
"xAxis": [
{
"show": false
}
],
"yAxis": [
{
"show": false
}
],
"chartTemplate": "Speedometer",
"chartSize": "1x1"
};
// Initialize the JSON tree using the public API
if (typeof $jsontree !== 'undefined') {
console.log('JsonTree library loaded successfully');
const element = document.getElementById('json-tree-1');
if (element) {
console.log('Element found, rendering tree...');
$jsontree.render(element, {
title: {
show: false
},
sideMenu: {
enabled: false
},
controlPanel: {
enabled: true,
showOpenCloseButton: false,
showEditButton: true
},
allowEditing: {
bulk: true
},
paging: {
enabled: false
},
events: {
onRenderComplete: function(element) {
console.log('JSON Tree rendered successfully!');
console.log('Edit button should be visible in the control panel');
}
},
data: testData
});
} else {
console.error('Element json-tree-1 not found!');
}
} else {
console.error('JsonTree library not loaded!');
}
});
</script>
</body>
</html>