Skip to content

Commit

Permalink
add new params to renderContent
Browse files Browse the repository at this point in the history
Signed-off-by: Hermione Dadheech <[email protected]>
  • Loading branch information
Hermione2408 committed May 30, 2024
1 parent 2e2d4e9 commit 91f9d32
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export interface ReactDiffViewerProps {
// Show only diff between the two values.
showDiffOnly?: boolean;
// Render prop to format final string before displaying them in the UI.
renderContent?: (source: string) => JSX.Element;
renderContent?: (source: string,prefix?:string,lineId?:string) => JSX.Element;
// Render prop to format code fold message.
codeFoldMessageRenderer?: (
totalFoldedLines: number,
Expand Down Expand Up @@ -239,9 +239,9 @@ class DiffViewer extends React.Component<
const removed = type === DiffType.REMOVED;
let content;
if (Array.isArray(value)) {
content = this.renderWordDiff(value, this.props.renderContent);
content = this.renderWordDiff(value, (chunk:string,prefix:string,lineId:string)=>this.props.renderContent(chunk,prefix,lineNumberTemplate));
} else if (this.props.renderContent) {
content = this.props.renderContent(value);
content = this.props.renderContent(value,prefix,lineNumberTemplate);
} else {
content = value;
}
Expand Down

0 comments on commit 91f9d32

Please sign in to comment.