Skip to content

Commit

Permalink
Fix the flutter SDK search box loading on non-root pages with --use-b…
Browse files Browse the repository at this point in the history
…ase-href (#2158)

* Fix flutter search box

* Refine comment
  • Loading branch information
jcollins-g authored Mar 4, 2020
1 parent c535249 commit 6aa2a97
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/resources/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ function initSearch(name) {
'constructor' : 4
};

var baseHref = $('body').data('base-href');
var baseHref = '';
if (!$('body').data('using-base-href')) {
// If dartdoc did not add a base-href tag, we will need to add the relative
// path ourselves.
baseHref = $('body').data('base-href');
}

function findMatches(q) {
var allMatches = []; // list of matches
Expand Down
3 changes: 2 additions & 1 deletion lib/templates/html/_head.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
</head>

{{! We don't use <base href>, but we do lookup the htmlBase from javascript. }}
<body data-base-href="{{{htmlBase}}}">
<body data-base-href="{{{htmlBase}}}"
data-using-base-href="{{{useBaseHref}}}">

<div id="overlay-under-drawer"></div>

Expand Down

0 comments on commit 6aa2a97

Please sign in to comment.