We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently, I find that the split line between origin code and current is not stable. I have adjusted the style for "line", but it still misaligned.
Here is my code:
import React from "react" import ReactDiffViewer, { DiffMethod, ReactDiffViewerStylesOverride } from "react-diff-viewer" interface IProps { filePath?: string oldValue?: string newValue?: string leftTitle?: string rightTitle?: string splitView?: boolean loading?: boolean } const styles = { line: { wordBreak: 'break-word', whiteSpace: "normal" }, diffContainer: { borderRadius: '8px', border: '1px solid #e8e8e8', }, gutter: { width: '2.5%' } } const DiffViewer: React.FC<IProps> = ({ filePath, oldValue, newValue, rightTitle, loading, splitView = true }) => { // const highlightSyntax = (str) => ( // <pre // style={{ display: "inline" }} // class="foo" // dangerouslySetInnerHTML={{ // // __html: Prism.highlight(str, Prism.languages.javascript) // __html: Prism.highlight(str, Prism.languages.json, "json") // // __html: str // }} // /> // ); return ( <div > {loading && ( <CubeSpin /> ) || <ReactDiffViewer oldValue={oldValue?.toString()} newValue={newValue?.toString()} splitView={splitView} compareMethod={DiffMethod.WORDS} leftTitle={filePath} rightTitle={rightTitle} styles={styles as ReactDiffViewerStylesOverride} // renderContent={highlightSyntax} />} </div> ); } export default DiffViewer;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Currently, I find that the split line between origin code and current is not stable. I have adjusted the style for "line", but it still misaligned.
Here is my code:
The text was updated successfully, but these errors were encountered: