Skip to content

Commit

Permalink
Merge commit 'ad31d962' into ghc-9.8
Browse files Browse the repository at this point in the history
  • Loading branch information
bgamari committed Sep 27, 2023
2 parents 44c9290 + ad31d96 commit 5b1a520
Show file tree
Hide file tree
Showing 8 changed files with 3,282 additions and 2,290 deletions.
2 changes: 1 addition & 1 deletion haddock-api/resources/html/haddock-bundle.min.js

Large diffs are not rendered by default.

23 changes: 9 additions & 14 deletions haddock-api/resources/html/js-src/quick-jump.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@ class PageMenuButton extends Component<any, any> {

}

function addSearchPageMenuButton(quickJumpButton: HTMLLIElement) {
const showHide = function(action: () => void) {
const pageMenu = document.querySelector('#page-menu') as HTMLUListElement;
preact.render(<PageMenuButton onClick={action} title="Quick Jump" />, pageMenu, quickJumpButton);
};
return showHide;
function addSearchPageMenuButton(action: () => void) {
const pageMenu = document.querySelector('#page-menu') as HTMLUListElement;
const dummy = document.createElement('li');
pageMenu.insertBefore(dummy, pageMenu.firstChild);
preact.render(<PageMenuButton onClick={action} title="Quick Jump" />, pageMenu, dummy);
}

// -------------------------------------------------------------------------- //
Expand Down Expand Up @@ -411,14 +410,10 @@ function NoResultsMsg(props: { searchString: string }) {
}

export function init(docBaseUrl?: string, showHide?: (action: () => void) => void) {
// A <li> element with this id should exist if --quickjump was set
const quickJumpButton = document.getElementById('quick-jump-button');
if (quickJumpButton)
preact.render(
<QuickJump baseUrl={docBaseUrl || "."} showHideTrigger={showHide ||
addSearchPageMenuButton(quickJumpButton as HTMLLIElement)} />,
document.body
);
preact.render(
<QuickJump baseUrl={docBaseUrl || "."} showHideTrigger={showHide || addSearchPageMenuButton} />,
document.body
);
}

// export to global object
Expand Down
Loading

0 comments on commit 5b1a520

Please sign in to comment.