Skip to content

Commit a7cc852

Browse files
committed
Updated history, some minor tweaks in example 20 (see #604)
1 parent 1c5d7d7 commit a7cc852

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

HISTORY.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ https://github.com/josdejong/jsoneditor
77

88
- Implemented new option `maxVisibleChilds` to customize the maximum number
99
childs that is rendered by default. Thanks @20goto10.
10+
- Implemented new option `onClassName`, allowing customized and dynamic
11+
styling of nodes. See 20_custom_css_style_for_nodes.html for a demo.
12+
Thanks @maestr0.
1013

1114

1215
## 2019-01-16, version 5.27.1

examples/20_custom_css_style_for_nodes.html

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,25 @@
1111
font: 10.5pt arial;
1212
color: #4d4d4d;
1313
line-height: 150%;
14-
width: 500px;
15-
padding-left: 40px;
14+
width: 100%;
15+
padding-left: 10px;
1616
}
1717

1818
code {
1919
background-color: #f5f5f5;
2020
}
2121

2222
#containerLeft {
23+
display: inline-block;
2324
width: 500px;
24-
height: 500px;
25-
float: left;
25+
height: 500px;
26+
margin-right: 10px;
2627
}
28+
2729
#containerRight {
30+
display: inline-block;
2831
width: 500px;
2932
height: 500px;
30-
float: right;
31-
}
32-
#wrapper {
33-
width: 1000px;
3433
}
3534
#containerRight .different_element {
3635
background-color: greenyellow !important;
@@ -42,19 +41,19 @@
4241
</head>
4342
<body>
4443

44+
<h3>JSON Diff</h3>
4545
<p>
46-
JSON Diff
46+
This example highlights the differences between two JSON objects using the option <code>onClassName</code>.
47+
Make a change in the left or right editor to see the changes update accordingly.
4748
</p>
4849
<div id="wrapper">
4950
<div id="containerLeft"></div>
5051
<div id="containerRight"></div>
5152
</div>
5253

5354
<script>
54-
var containerLeft, containerRight, options, json;
55-
56-
containerLeft = document.getElementById('containerLeft');
57-
containerRight = document.getElementById('containerRight');
55+
var containerLeft = document.getElementById('containerLeft');
56+
var containerRight = document.getElementById('containerRight');
5857

5958
function findNodeInJson(json, path){
6059
if(!json || path.length ===0) {
@@ -71,9 +70,8 @@
7170

7271
}
7372

74-
optionsLeft = {
73+
var optionsLeft = {
7574
mode: 'tree',
76-
modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes
7775
onError: function (err) {
7876
alert(err.toString());
7977
},
@@ -102,10 +100,8 @@
102100
}
103101
};
104102

105-
optionsRight = {
103+
var optionsRight = {
106104
mode: 'tree',
107-
modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes
108-
// name: "jsonContent",
109105
onError: function (err) {
110106
alert(err.toString());
111107
},
@@ -135,7 +131,7 @@
135131
}
136132
};
137133

138-
jsonLeft = {
134+
var jsonLeft = {
139135
"arrayOfArrays": [1, 2, 999, [3,4,5]],
140136
"someField": true,
141137
"boolean": true,
@@ -152,7 +148,7 @@
152148
"[0]": "zero"
153149
};
154150

155-
jsonRight = {
151+
var jsonRight = {
156152
"arrayOfArrays": [1, 2, [3,4,5]],
157153
"boolean": true,
158154
"htmlcode": '&quot;',

0 commit comments

Comments
 (0)