Aeolun / react-diff-viewer-continued

A simple and beautiful text diff viewer component made with Diff and React.
https://aeolun.github.io/react-diff-viewer-continued/
MIT License
113 stars 34 forks source link

feat: Allow Custom Compare Functions #47

Closed davidfan168 closed 3 months ago

davidfan168 commented 3 months ago

Most changes are copied from this pull request: https://github.com/praneshr/react-diff-viewer/pull/137/files

If a function is passed as lineCompareMethod, this function will be treated as the diff function. Users can pass other functions in the diff library, or pass their own functions.

Aeolun commented 3 months ago

Sorry for the delay, I don't always get the important Github notifications.

Aeolun commented 3 months ago

:tada: This PR is included in version 4.0.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

kevinlu1248 commented 1 week ago

@davidfan168 @Aeolun

This change is actually wrong and causes a bug where the diff lines are sometimes hidden for some reason. I found that turning on dissabledWordDiff unhides them.

Instead, these are the lines you're supposed to change to change how the diff lines are handled:

https://github.com/Aeolun/react-diff-viewer-continued/blob/71d1374c3915b026739c52e780be06f40c48e7e3/src/compute-lines.ts#L137-L145