File tree Expand file tree Collapse file tree 2 files changed +36
-4
lines changed Expand file tree Collapse file tree 2 files changed +36
-4
lines changed Original file line number Diff line number Diff line change 175
175
var rightInputView = new JsonInputView ( document . getElementById ( 'json-diff-right' ) ) ;
176
176
leftInputView . on ( 'change' , compareJson ) ;
177
177
rightInputView . on ( 'change' , compareJson ) ;
178
- leftInputView . on ( 'scroll' , function ( ) {
179
-
178
+ leftInputView . codemirror . on ( 'scroll' , function ( ) {
179
+ var scrollInfo = leftInputView . codemirror . getScrollInfo ( ) ;
180
+ rightInputView . codemirror . scrollTo ( scrollInfo . left , scrollInfo . top ) ;
180
181
} ) ;
181
- rightInputView . on ( 'scroll' , function ( ) {
182
-
182
+ rightInputView . codemirror . on ( 'scroll' , function ( ) {
183
+ var scrollInfo = rightInputView . codemirror . getScrollInfo ( ) ;
184
+ leftInputView . codemirror . scrollTo ( scrollInfo . left , scrollInfo . top ) ;
183
185
} ) ;
184
186
185
187
function compareJson ( ) {
Original file line number Diff line number Diff line change
1
+ {
2
+ "data" : [ {
3
+ "type" : "articles" ,
4
+ "id" : "1" ,
5
+ "attributes" : {
6
+ "title" : "JSON API paints my bikeshed!" ,
7
+ "body" : "The shortest article. Ever." ,
8
+ "created" : "2015-05-22T14:56:29.000Z" ,
9
+ "updated" : "2015-05-22T14:56:28.000Z"
10
+ } ,
11
+ "relationships" : {
12
+ "author" : {
13
+ "data" : { "id" : "42" , "type" : "people" }
14
+ }
15
+ }
16
+ } ] ,
17
+ "included" : [
18
+ {
19
+ "type" : "people" ,
20
+ "id" : "42" ,
21
+ "attributes" : {
22
+ "name" : "John" ,
23
+ "age" : 80 ,
24
+ "gender" : "male"
25
+ }
26
+ }
27
+ ]
28
+ }
29
+
30
+
1
31
{
2
32
"glossary" : {
3
33
"title" : "example glossary" ,
You can’t perform that action at this time.
0 commit comments