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
Multiline import in diff view #510
Comments
Good spot 👍@leomoty do you want to look into this one? A good starting point is to verify that the RegExp search made by findAndReplaceDOMText is working. The replace callback should be called with this * Warning in advance: The advanced replace handler is the most complicated part in OctoLinker 😉 |
Sure, will take a look this weekend. Any ideas why it works on firefox but not chrome? |
Not at all, sorry. That's really strange. |
So, I was able to narrow down the issue, it only fails on split view: It happens in both chrome and firefox. |
@stefanbuck I had a hunch. When in split view, the HTML structure is as follow:
The regex is not really effective, because the import is across lines, which means it is splitten across multiple So I wrote a little hack to test if i I was right:
This (
I was able to get a match: Obviously this won't convert anything into octolinks. |
Tried running this by hand: https://github.com/padolsey/findAndReplaceDOMText/blob/master/src/findAndReplaceDOMText.js#L262 Unless I am mistaken, the result is what I expected:
|
Thanks @leomoty, that's a really well researched report! Off the top of my head, I have no idea how to solve this best. Let me think about it. @josephfrazier do you have any smart idea? |
Ya me neither, unless we somehow start treating each side in split diff view as a different blob. Right now, that approach would break and it requires more than just text replacing. |
It seems that the multiline import does no longer exist in that PR. I'll try to find another one. Edit: cockpit-project/cockpit@24ccf2e?diff=split#diff-fcaf1080ed0a2139de7cef9b184476a6L71 |
Intended outcome:
dialogx.jsx
is clickableActual outcome:
dialogx.jsx
is not clickable in diff viewHow to reproduce the issue:
https://github.com/cockpit-project/cockpit/pull/9943/files#diff-a2edaced83836966f97b3d8df14beabcR24
Doesn't work on chrome (master) for me, works fine in Firefox.
It works correctly in blob (both browsers):
https://github.com/cockpit-project/cockpit/blob/7f47354e306dc5be08d235be9e3ae52c1f85d445/pkg/storaged/content-views.jsx#L25
Edit:
Old link doesn't work, see this one instead (split view is already pinned):
cockpit-project/cockpit@24ccf2e?diff=split#diff-fcaf1080ed0a2139de7cef9b184476a6L71
The text was updated successfully, but these errors were encountered: