Skip to content

Commit 7a79d27

Browse files
committed
Fix synchronised scroll
1 parent b9386de commit 7a79d27

File tree

4 files changed

+44
-95
lines changed

4 files changed

+44
-95
lines changed

dist/template.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,22 @@
99
Author: rtfpessoa
1010
-->
1111

12-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/styles/github.min.css">
12+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/styles/github.min.css">
1313

1414
<!--diff2html-css-->
1515

1616
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.js"></script>
1717

18-
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/highlight.min.js"></script>
19-
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/languages/scala.min.js"></script>
18+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/highlight.min.js"></script>
19+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/languages/scala.min.js"></script>
2020

2121
<!--diff2html-js-ui-->
2222

2323
<script>
2424
$(document).ready(function() {
2525
var diff2htmlUi = new Diff2HtmlUI();
2626
//diff2html-fileListCloseable
27+
//diff2html-synchronisedScroll
2728
diff2htmlUi.highlightCode('#diff');
2829
});
2930
</script>

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@
5050
"main": "./src/main.js",
5151
"dependencies": {
5252
"copy-paste": "^1.3.0",
53-
"diff2html": "^2.0.11",
53+
"diff2html": "^2.0.12",
5454
"extend": "^3.0.0",
5555
"open": "^0.0.5",
5656
"request": "^2.79.0",
57-
"yargs": "^6.5.0"
57+
"yargs": "^6.6.0"
5858
},
5959
"devDependencies": {
6060
"codacy-coverage": "^2.0.0",
61-
"eslint": "^3.12.2",
61+
"eslint": "^3.13.1",
6262
"eslint-plugin-promise": "^3.4.0",
6363
"eslint-plugin-standard": "^2.0.1",
6464
"istanbul": "^0.4.5",

src/cli.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@
8686
config.synchronisedScroll = (baseConfig.synchronisedScroll === 'enabled');
8787

8888
var htmlContent = diff2Html.getPrettyHtml(jsonContent, config);
89-
return callback(null, that._prepareHTML(htmlContent, config.showFilesOpen));
89+
return callback(null, that._prepareHTML(htmlContent, config));
9090
} else if (baseConfig.format === 'json') {
9191
return callback(null, JSON.stringify(jsonContent));
9292
}
9393

9494
return callback(new Error('Wrong output format `' + baseConfig.format + '`!'));
9595
};
9696

97-
Diff2HtmlInterface.prototype._prepareHTML = function(content, showFilesOpen) {
97+
Diff2HtmlInterface.prototype._prepareHTML = function(content, config) {
9898
var templatePath = path.resolve(__dirname, '..', 'dist', 'template.html');
9999
var template = utils.readFileSync(templatePath);
100100

@@ -109,7 +109,8 @@
109109
return template
110110
.replace('<!--diff2html-css-->', '<style>\n' + cssContent + '\n</style>')
111111
.replace('<!--diff2html-js-ui-->', '<script>\n' + jsUiContent + '\n</script>')
112-
.replace('//diff2html-fileListCloseable', 'diff2htmlUi.fileListCloseable("#diff", ' + showFilesOpen + ');')
112+
.replace('//diff2html-fileListCloseable', 'diff2htmlUi.fileListCloseable("#diff", ' + config.showFilesOpen + ');')
113+
.replace('//diff2html-synchronisedScroll', 'diff2htmlUi.synchronisedScroll("#diff", ' + config.synchronisedScroll + ');')
113114
.replace('<!--diff2html-diff-->', content);
114115
};
115116

yarn.lock

Lines changed: 33 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,6 @@ bcrypt-pbkdf@^1.0.0:
125125
dependencies:
126126
tweetnacl "^0.14.3"
127127

128-
bl@~1.1.2:
129-
version "1.1.2"
130-
resolved "https://registry.yarnpkg.com/bl/-/bl-1.1.2.tgz#fdca871a99713aa00d19e3bbba41c44787a65398"
131-
dependencies:
132-
readable-stream "~2.0.5"
133-
134128
bluebird@^2.3, bluebird@^2.9.x:
135129
version "2.11.0"
136130
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-2.11.0.tgz#534b9033c022c9579c56ba3b3e5a5caafbb650e1"
@@ -231,7 +225,7 @@ co@^4.6.0:
231225

232226
codacy-coverage@^2.0.0:
233227
version "2.0.0"
234-
resolved "https://registry.yarnpkg.com/codacy-coverage/-/codacy-coverage-2.0.0.tgz#58c5b5df4bcaaa7b52142417f2f8774ed3fb4fe7"
228+
resolved "https://registry.npmjs.org/codacy-coverage/-/codacy-coverage-2.0.0.tgz#58c5b5df4bcaaa7b52142417f2f8774ed3fb4fe7"
235229
dependencies:
236230
bluebird "^2.9.x"
237231
commander "^2.x"
@@ -272,7 +266,7 @@ concat-stream@^1.4.6:
272266

273267
copy-paste@^1.3.0:
274268
version "1.3.0"
275-
resolved "https://registry.yarnpkg.com/copy-paste/-/copy-paste-1.3.0.tgz#a7e6c4a1c28fdedf2b081e72b97df2ef95f471ed"
269+
resolved "https://registry.npmjs.org/copy-paste/-/copy-paste-1.3.0.tgz#a7e6c4a1c28fdedf2b081e72b97df2ef95f471ed"
276270
dependencies:
277271
iconv-lite "^0.4.8"
278272
optionalDependencies:
@@ -330,21 +324,21 @@ delayed-stream@~1.0.0:
330324
version "1.0.0"
331325
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
332326

333-
diff2html@^2.0.11:
334-
version "2.0.11"
335-
resolved "https://registry.yarnpkg.com/diff2html/-/diff2html-2.0.11.tgz#b0ccb1d8da49702fdc191737c4b1f5e6fa8affc6"
327+
diff2html@^2.0.12:
328+
version "2.0.12"
329+
resolved "https://registry.npmjs.org/diff2html/-/diff2html-2.0.12.tgz#20eda2f1ffd14027716485c938e3fe21dc379455"
336330
dependencies:
337-
diff "^3.1.0"
331+
diff "^3.2.0"
338332
hogan.js "^3.0.2"
339-
whatwg-fetch "^1.0.0"
333+
whatwg-fetch "^2.0.1"
340334

341335
diff@1.4.0:
342336
version "1.4.0"
343337
resolved "https://registry.yarnpkg.com/diff/-/diff-1.4.0.tgz#7f28d2eb9ee7b15a97efd89ce63dcfdaa3ccbabf"
344338

345-
diff@^3.1.0:
346-
version "3.1.0"
347-
resolved "https://registry.yarnpkg.com/diff/-/diff-3.1.0.tgz#9406c73a401e6c2b3ba901c5e2c44eb6a60c5385"
339+
diff@^3.2.0:
340+
version "3.2.0"
341+
resolved "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9"
348342

349343
doctrine@^1.2.2:
350344
version "1.5.0"
@@ -443,15 +437,15 @@ escope@^3.6.0:
443437

444438
eslint-plugin-promise@^3.4.0:
445439
version "3.4.0"
446-
resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-3.4.0.tgz#6ba9048c2df57be77d036e0c68918bc9b4fc4195"
440+
resolved "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-3.4.0.tgz#6ba9048c2df57be77d036e0c68918bc9b4fc4195"
447441

448442
eslint-plugin-standard@^2.0.1:
449443
version "2.0.1"
450-
resolved "https://registry.yarnpkg.com/eslint-plugin-standard/-/eslint-plugin-standard-2.0.1.tgz#3589699ff9c917f2c25f76a916687f641c369ff3"
444+
resolved "https://registry.npmjs.org/eslint-plugin-standard/-/eslint-plugin-standard-2.0.1.tgz#3589699ff9c917f2c25f76a916687f641c369ff3"
451445

452-
eslint@^3.12.2:
453-
version "3.12.2"
454-
resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.12.2.tgz#6be5a9aa29658252abd7f91e9132bab1f26f3c34"
446+
eslint@^3.13.1:
447+
version "3.13.1"
448+
resolved "https://registry.npmjs.org/eslint/-/eslint-3.13.1.tgz#564d2646b5efded85df96985332edd91a23bff25"
455449
dependencies:
456450
babel-code-frame "^6.16.0"
457451
chalk "^1.1.3"
@@ -483,7 +477,7 @@ eslint@^3.12.2:
483477
require-uncached "^1.0.2"
484478
shelljs "^0.7.5"
485479
strip-bom "^3.0.0"
486-
strip-json-comments "~1.0.1"
480+
strip-json-comments "~2.0.1"
487481
table "^3.7.8"
488482
text-table "~0.2.0"
489483
user-home "^2.0.0"
@@ -535,7 +529,7 @@ exit-hook@^1.0.0:
535529

536530
extend@^3.0.0, extend@~3.0.0:
537531
version "3.0.0"
538-
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.0.tgz#5a474353b9f3353ddd8176dfd37b91c83a46f1d4"
532+
resolved "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz#5a474353b9f3353ddd8176dfd37b91c83a46f1d4"
539533

540534
extsprintf@1.0.2:
541535
version "1.0.2"
@@ -579,14 +573,6 @@ forever-agent@~0.6.1:
579573
version "0.6.1"
580574
resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
581575

582-
form-data@~2.0.0:
583-
version "2.0.0"
584-
resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.0.0.tgz#6f0aebadcc5da16c13e1ecc11137d85f9b883b25"
585-
dependencies:
586-
asynckit "^0.4.0"
587-
combined-stream "^1.0.5"
588-
mime-types "^2.1.11"
589-
590576
form-data@~2.1.1:
591577
version "2.1.2"
592578
resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.2.tgz#89c3534008b97eada4cbb157d58f6f5df025eae4"
@@ -869,7 +855,7 @@ isstream@~0.1.2:
869855

870856
istanbul@^0.4.5:
871857
version "0.4.5"
872-
resolved "https://registry.yarnpkg.com/istanbul/-/istanbul-0.4.5.tgz#65c7d73d4c4da84d4f3ac310b918fb0b8033733b"
858+
resolved "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz#65c7d73d4c4da84d4f3ac310b918fb0b8033733b"
873859
dependencies:
874860
abbrev "1.0.x"
875861
async "1.x"
@@ -1054,7 +1040,7 @@ mime-db@~1.24.0:
10541040
version "1.24.0"
10551041
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.24.0.tgz#e2d13f939f0016c6e4e9ad25a8652f126c467f0c"
10561042

1057-
mime-types@^2.1.11, mime-types@^2.1.12, mime-types@~2.1.7:
1043+
mime-types@^2.1.12, mime-types@~2.1.7:
10581044
version "2.1.12"
10591045
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.12.tgz#152ba256777020dd4663f54c2e7bc26381e71729"
10601046
dependencies:
@@ -1082,7 +1068,7 @@ mkdirp@0.5.1, mkdirp@0.5.x, mkdirp@^0.5.0, mkdirp@^0.5.1:
10821068

10831069
mocha@^3.2.0:
10841070
version "3.2.0"
1085-
resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.2.0.tgz#7dc4f45e5088075171a68896814e6ae9eb7a85e3"
1071+
resolved "https://registry.npmjs.org/mocha/-/mocha-3.2.0.tgz#7dc4f45e5088075171a68896814e6ae9eb7a85e3"
10861072
dependencies:
10871073
browser-stdout "1.3.0"
10881074
commander "2.9.0"
@@ -1112,10 +1098,6 @@ natural-compare@^1.4.0:
11121098
version "1.4.0"
11131099
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
11141100

1115-
node-uuid@~1.4.7:
1116-
version "1.4.7"
1117-
resolved "https://registry.yarnpkg.com/node-uuid/-/node-uuid-1.4.7.tgz#6da5a17668c4b3dd59623bda11cf7fa4c1f60a6f"
1118-
11191101
nopt@1.0.10:
11201102
version "1.0.10"
11211103
resolved "https://registry.yarnpkg.com/nopt/-/nopt-1.0.10.tgz#6ddd21bd2a31417b92727dd585f8a6f37608ebee"
@@ -1161,7 +1143,7 @@ onetime@^1.0.0:
11611143

11621144
open@^0.0.5:
11631145
version "0.0.5"
1164-
resolved "https://registry.yarnpkg.com/open/-/open-0.0.5.tgz#42c3e18ec95466b6bf0dc42f3a2945c3f0cad8fc"
1146+
resolved "https://registry.npmjs.org/open/-/open-0.0.5.tgz#42c3e18ec95466b6bf0dc42f3a2945c3f0cad8fc"
11651147

11661148
optimist@^0.6.1:
11671149
version "0.6.1"
@@ -1249,10 +1231,6 @@ progress@^1.1.8:
12491231
version "1.1.8"
12501232
resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be"
12511233

1252-
qs@~6.2.0:
1253-
version "6.2.1"
1254-
resolved "https://registry.yarnpkg.com/qs/-/qs-6.2.1.tgz#ce03c5ff0935bc1d9d69a9f14cbd18e568d67625"
1255-
12561234
qs@~6.3.0:
12571235
version "6.3.0"
12581236
resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.0.tgz#f403b264f23bc01228c74131b407f18d5ea5d442"
@@ -1272,7 +1250,7 @@ read-pkg@^1.0.0:
12721250
normalize-package-data "^2.3.2"
12731251
path-type "^1.0.0"
12741252

1275-
readable-stream@~2.0.0, readable-stream@~2.0.5:
1253+
readable-stream@~2.0.0:
12761254
version "2.0.6"
12771255
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e"
12781256
dependencies:
@@ -1310,35 +1288,9 @@ request-promise@^0.x:
13101288
lodash "^3.10.0"
13111289
request "^2.34"
13121290

1313-
request@^2.34:
1314-
version "2.75.0"
1315-
resolved "https://registry.yarnpkg.com/request/-/request-2.75.0.tgz#d2b8268a286da13eaa5d01adf5d18cc90f657d93"
1316-
dependencies:
1317-
aws-sign2 "~0.6.0"
1318-
aws4 "^1.2.1"
1319-
bl "~1.1.2"
1320-
caseless "~0.11.0"
1321-
combined-stream "~1.0.5"
1322-
extend "~3.0.0"
1323-
forever-agent "~0.6.1"
1324-
form-data "~2.0.0"
1325-
har-validator "~2.0.6"
1326-
hawk "~3.1.3"
1327-
http-signature "~1.1.0"
1328-
is-typedarray "~1.0.0"
1329-
isstream "~0.1.2"
1330-
json-stringify-safe "~5.0.1"
1331-
mime-types "~2.1.7"
1332-
node-uuid "~1.4.7"
1333-
oauth-sign "~0.8.1"
1334-
qs "~6.2.0"
1335-
stringstream "~0.0.4"
1336-
tough-cookie "~2.3.0"
1337-
tunnel-agent "~0.4.1"
1338-
1339-
request@^2.79.0:
1291+
request@^2.34, request@^2.79.0:
13401292
version "2.79.0"
1341-
resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de"
1293+
resolved "https://registry.npmjs.org/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de"
13421294
dependencies:
13431295
aws-sign2 "~0.6.0"
13441296
aws4 "^1.2.1"
@@ -1520,9 +1472,9 @@ strip-bom@^3.0.0:
15201472
version "3.0.0"
15211473
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3"
15221474

1523-
strip-json-comments@~1.0.1:
1524-
version "1.0.4"
1525-
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-1.0.4.tgz#1e15fbcac97d3ee99bf2d73b4c656b082bbafb91"
1475+
strip-json-comments@~2.0.1:
1476+
version "2.0.1"
1477+
resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
15261478

15271479
supports-color@3.1.2, supports-color@^3.1.0:
15281480
version "3.1.2"
@@ -1629,9 +1581,9 @@ verror@1.3.6:
16291581
dependencies:
16301582
extsprintf "1.0.2"
16311583

1632-
whatwg-fetch@^1.0.0:
1633-
version "1.1.1"
1634-
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-1.1.1.tgz#ac3c9d39f320c6dce5339969d054ef43dd333319"
1584+
whatwg-fetch@^2.0.1:
1585+
version "2.0.1"
1586+
resolved "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.1.tgz#078b9461bbe91cea73cbce8bb122a05f9e92b772"
16351587

16361588
which-module@^1.0.0:
16371589
version "1.0.0"
@@ -1647,10 +1599,6 @@ window-size@0.1.0:
16471599
version "0.1.0"
16481600
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d"
16491601

1650-
window-size@^0.2.0:
1651-
version "0.2.0"
1652-
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.2.0.tgz#b4315bb4214a3d7058ebeee892e13fa24d98b075"
1653-
16541602
wordwrap@0.0.2:
16551603
version "0.0.2"
16561604
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f"
@@ -1693,9 +1641,9 @@ yargs-parser@^4.2.0:
16931641
dependencies:
16941642
camelcase "^3.0.0"
16951643

1696-
yargs@^6.5.0:
1697-
version "6.5.0"
1698-
resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.5.0.tgz#a902e23a1f0fe912b2a03f6131b7ed740c9718ff"
1644+
yargs@^6.6.0:
1645+
version "6.6.0"
1646+
resolved "https://registry.npmjs.org/yargs/-/yargs-6.6.0.tgz#782ec21ef403345f830a808ca3d513af56065208"
16991647
dependencies:
17001648
camelcase "^3.0.0"
17011649
cliui "^3.2.0"
@@ -1708,7 +1656,6 @@ yargs@^6.5.0:
17081656
set-blocking "^2.0.0"
17091657
string-width "^1.0.2"
17101658
which-module "^1.0.0"
1711-
window-size "^0.2.0"
17121659
y18n "^3.2.1"
17131660
yargs-parser "^4.2.0"
17141661

0 commit comments

Comments
 (0)