-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
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
Feature Request: Add event callback when click line #44
Comments
PR is always welcome! Just be curious: I don't know how you map the diff results to the original key or value; if I implement this feature, I can only provide the Update: adding the key prefix (e.g. |
Yes, this is indeed a problem that I need to find a way to solve. My intuitive thought is that the callback will carry information such as the content of the current line and the line number, and then compare it with the original information to determine the specific part of the diff. Since my current requirement is to replace keywords, the diff will only occur within a single line and not span multiple lines. Moreover, the possibility of the diff content being repetitive is quite low, and I can specifically handle this part of the bad case. The line numbers might not align due to different formatters, but in most scenarios, it should be feasible through content. I want to give it a try. |
I see, you just want a feature like this: interface RowClickInfo {
// must have
diff: [DiffResult, DiffResult];
// nice to have
side: 'left' | 'right';
isLineNumberColumn: boolean;
}
const viewerProps: ViewerProps = {
onRowClick: (info: RowClickInfo) => {
const [left, right] = info.diff;
console.log(left.lineNumber, left.text, left.comma);
},
}; Feel free to submit a PR :) |
Yes, this is good enough. I will submit this PR I think. |
Hello, this library is really convenient, and I am very grateful to the author!
I am currently using this library at work for some batch update checks. In this process, I found that if I could directly click on the code diff to remove unnecessary diffs, it would be very convenient (I also use the just-diff package to patch the diffs). Currently, there is no way to achieve this requirement, so it's a pity. If possible, I hope to add event callbacks, which would really be helpful! If possible, I am willing to contribute code.
Once again, thank you very much to the author.
The text was updated successfully, but these errors were encountered: