Repository navigation
Add default-to-rich-diff feature - #1932
Conversation
|
Can you rebase from master (we enabled TS strict mode) and fix any issues? |
* This functionality can be extended to other files: just add the intended extension in default-to-rich-diff.tsx
* Use selector to find SVG files for accessing the rich-diff button
b708304 to
446b8d5
Compare
|
I simplified the loading mechanism (I'd still like this moved to its own file), however I noticed a pretty big problem:
I added a |
|
@bfred-it Or use |
|
That restores the button and at least the user can click it, even though I'd rather have a solution that keeps trying to load it. From my tests it looks like no further requests are triggered if we keep clicking it and re-enabling it until it's This would let us drop the 1000ms timeout. You can use something like this where we have button.click();
const interval = setInterval(() => {
if (button.classList.contains('selected')) {
clearInterval(interval);
} else {
button.disabled = false;
button.click();
}
}, 300); |
There was a problem hiding this comment.
This seems to work for me!
Left before merging:
- Description in readme and file header
- @sindresorhus is the feature name ok?
It appeared in reviews like #1932 (review)
👍 |
|
@idasbiste Can you commit to maintain this feature going forward? For example, in case GitHub changes something that breaks it. We already have way too many features to maintain, so we need to find a way to make this sustainable. If so, can you add a line to the CODEOWNERS file? |
* Update CODEOWNERS to commit to maintain this feature in the future
Co-Authored-By: idasbiste <[email protected]>
default-to-rich-diff feature
🌈 |
I've used a similar approach as the one in #1924. With
MutationObserverwe can watch changes in the DOM for files that are loaded asynchronously and added to the page a posteriori.This functionality can be extended to other files (markdown ones, for example): just add the intended extension to the array defined in
default-to-rich-diff.tsx::7.Example of a PR with SVG files: elementary/icons#792 (as the issue's OP said "pretty much any PR at icon repos, such as https://github.com/elementary/icons/pulls")
Closes #1599