@@ -28,6 +28,8 @@ export interface ReactDiffViewerProps {
2828 newValue : string ;
2929 // Enable/Disable split view.
3030 splitView ?: boolean ;
31+ // Set line Offset
32+ linesOffset ?: number ;
3133 // Enable/Disable word diff.
3234 disableWordDiff ?: boolean ;
3335 // JsDiff text diff method from https://github.com/kpdecker/jsdiff/tree/v4.0.1#api
@@ -83,6 +85,7 @@ class DiffViewer extends React.Component<ReactDiffViewerProps, ReactDiffViewerSt
8385 extraLinesSurroundingDiff : 3 ,
8486 showDiffOnly : true ,
8587 useDarkTheme : false ,
88+ linesOffset : 0
8689 } ;
8790
8891 public static propTypes = {
@@ -106,6 +109,7 @@ class DiffViewer extends React.Component<ReactDiffViewerProps, ReactDiffViewerSt
106109 PropTypes . string ,
107110 PropTypes . element ,
108111 ] ) ,
112+ linesOffset : PropTypes . number
109113 } ;
110114
111115 public constructor ( props : ReactDiffViewerProps ) {
@@ -441,12 +445,13 @@ class DiffViewer extends React.Component<ReactDiffViewerProps, ReactDiffViewerSt
441445 * Generates the entire diff view.
442446 */
443447 private renderDiff = ( ) : JSX . Element [ ] => {
444- const { oldValue, newValue, splitView, disableWordDiff, compareMethod } = this . props ;
448+ const { oldValue, newValue, splitView, disableWordDiff, compareMethod, linesOffset } = this . props ;
445449 const { lineInformation, diffLines } = computeLineInformation (
446450 oldValue ,
447451 newValue ,
448452 disableWordDiff ,
449453 compareMethod ,
454+ linesOffset
450455 ) ;
451456 const extraLines = this . props . extraLinesSurroundingDiff < 0
452457 ? 0
0 commit comments