Skip to content

Commit 17f4903

Browse files
committed
Bump.
1 parent 5962f42 commit 17f4903

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/jsondiff-for-react.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,23 @@ class JsonDiffReact extends Component {
2828
tips,
2929
objectHash,
3030
} = this.props;
31-
const delta = Jsondiffpatch.create({ objectHash }).diff(left, right);
31+
const delta = Jsondiffpatch.create({
32+
objectHash,
33+
34+
arrays: {
35+
// default true, detect items moved inside the array (otherwise they will be registered as remove+add)
36+
detectMove: true,
37+
// default false, the value of items moved is not included in deltas
38+
includeValueOnMove: true,
39+
},
40+
}).diff(left, right);
3241
const html = annotated
3342
? formatters.annotated.format(delta)
3443
: formatters.html.format(delta, left);
3544
show ? formatters.html.showUnchanged() : formatters.html.hideUnchanged();
3645
console.log("test");
3746
return html ? (
38-
<span>
39-
<h1>hi there</h1>
40-
<div dangerouslySetInnerHTML={{ __html: html }} />
41-
</span>
47+
<div dangerouslySetInnerHTML={{ __html: html }} />
4248
) : (
4349
<p style={{ fontSize: 12, color: "#999" }}>
4450
{tips || "Both objects are identical."}

0 commit comments

Comments
 (0)