Update DocSearch.js to latest version#27710
Merged
XhmikosR merged 1 commit intotwbs:v4-devfrom Nov 22, 2018
Merged
Conversation
The latest (2.6.2) docsearch.js version now displays results as standard `<a href>` links, allowing users to `ctrl`-click on them to trigger default browser behavior of opening in a new tab. To maintain backward compatibility, this behavior has only been enabled to users that didn't define their own `handleSelected` method. This PR updates your `docsearch()` code to take advantage of the new `<a href>` template, by removing your custom `handleSelected` and moving its behavior to the `transformData` call. Namely, what you wanted to avoid was jumping to the first `<h1>` of the pages, which would prevent users from seeing the header. This PR checks if the suggestion targets the `#content` anchor (meaning it goes to this first `<h1>`) and remove it. Behavior should be the same, but at least now you can enjoy the `ctrl`-click :)
Closed
Member
|
Thanks @pixelastic. Note to self, backport this to master-xmr-v3-fixes branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The latest (2.6.2) docsearch.js version now displays results as standard
<a href>links, allowing users toctrl-click on them to trigger default browser behavior of opening in a new tab. This has been a been a long awaited feature and is now live.To maintain backward compatibility, this behavior has only been enabled to users that didn't define their own
handleSelectedmethod. Because the Bootstrap documentation uses its ownhandleSelected, you won't be able toctrl-clicks results as of today :/This PR updates your
docsearch()code to take advantage of the new<a href>template, by removing your customhandleSelectedand moving its behavior to thetransformDatacall. Namely, what you wanted to avoid was jumping to the first<h1>of the pages (source), which would prevent users from seeing the header. This PR checks if the suggestion targets the#contentanchor (meaning it goes to this first<h1>) and if so, removes it.Behavior should be the same, but at least now you can enjoy the
ctrl-click :)