-
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
Passing ?readthedocs-diff=true
breaks Links Preview
#460
Comments
Noting that passing around the URL param is not necessary either. The diff links could instead:
This would avoid passing around the url param. Maybe something to explore here instead. |
This doesn't look like an issue with the GET arg, it's just docdiff in general? It's replacing the page content, so it's likely the new I don't know if we can really expect previews to work while doing a docdiff. If we want them to continue working, we probably need some way to retrigger the link selector logic after doing the replacement of the page content. Looking at MDN, it seems we need a live nodelist, instead of a static one: https://developer.mozilla.org/en-US/docs/Web/API/NodeList#live_vs._static_nodelists |
Good point. However, the The problem seems to be the JavaScript event attached to each of these nodes being deleted somehow. |
Probably, a first step here would be to disable links preview when the docdiff is enabled? At least, that will remove the confusion of having these elements with dot underline where I'm expecting to trigger links preview. I'm not sure if that will add the confusion of "Why links preview is not enabled in this project now?" 🥲 |
I'm not sure to follow how this would help us here 🤔 |
I suppose we will want DocDiff to trigger This will be similar to what we are implementing for SPA in #157. I think these issues are related, so we may want to wait for that other issue to set the pattern here and we can use it here. |
I found another issue when passing the URL param: #461. I opened #462 to fix it for now and to start thinking about the idea anything external that enables/disables an add should be done via an event, so all the other addons that needs to update an internal state can do it. |
A new event `READTHEDOCS_ROOT_DOM_CHANGED` is triggered when the "Visual diff" is enabled/disabled after the DOM was modified. This allows other addons to subscribe to this event to re-initialize if required. I used this event from links preview to call `setupTooltips` again to re-install tooltips on these links. I migrated links preview to a `LitElement` to be able to make usage of this pattern and follow what we already had. We will be able to do something similar on #157 Closes #460
Steps to reproduce:
If you go to https://docs--11751.org.readthedocs.build/en/11751/user-defined-redirects.html (without
readthedocs-diff
), links preview works properly.The text was updated successfully, but these errors were encountered: