Skip to content

Commit 0424784

Browse files
Merge pull request #3 from ananttripathi/feature/difftool-app
Fix diff2html import: use named export html instead of Diff2Html
2 parents e809b12 + 419a4e4 commit 0424784

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/components/DiffViewer.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useEffect, useRef } from 'react'
22
import { createPatch } from 'diff'
3-
import { Diff2Html } from 'diff2html'
3+
import { html as diff2htmlHtml } from 'diff2html'
44
import 'diff2html/bundles/css/diff2html.min.css'
55

66
export default function DiffViewer({ left, right, viewType, fileName }) {
@@ -10,12 +10,12 @@ export default function DiffViewer({ left, right, viewType, fileName }) {
1010
if (!containerRef.current) return
1111

1212
const patch = createPatch(fileName || 'file', left, right, '', '')
13-
const html = Diff2Html.html(patch, {
13+
const rendered = diff2htmlHtml(patch, {
1414
drawFileList: false,
1515
matching: 'lines',
1616
outputFormat: viewType === 'side-by-side' ? 'side-by-side' : 'line-by-line',
1717
})
18-
containerRef.current.innerHTML = html
18+
containerRef.current.innerHTML = rendered
1919
}, [left, right, viewType, fileName])
2020

2121
return <div className="diff-output" ref={containerRef} />

0 commit comments

Comments
 (0)