Skip to content

Commit 93caabf

Browse files
committed
Initialize more content
1 parent 3cd4e32 commit 93caabf

File tree

4 files changed

+28
-22
lines changed

4 files changed

+28
-22
lines changed

assets/js/entry/html.js

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,23 @@ import SwupProgressPlugin from '@swup/progress-plugin'
2727

2828
onDocumentReady(() => {
2929
const params = new URLSearchParams(window.location.search)
30+
const isEmbedded = window.self !== window.parent
3031
const isPreview = params.has('preview')
32+
const isHint = params.has('hint')
3133

32-
initTabsets() // alters content HTML, so is run early
3334
initTheme(params.get('theme'))
35+
initStyling()
36+
37+
initTabsets()
3438
initContent(isPreview)
3539
initMakeup()
3640
initTooltips()
37-
initHintsPage()
3841
initCopyButton()
39-
initStyling()
4042

41-
if (isPreview) {
43+
if (isPreview && isEmbedded) {
4244
initPreview()
45+
} if (isHint && isEmbedded) {
46+
initHintsPage()
4347
} else {
4448
if (window.location.protocol !== 'file:') {
4549
new Swup({
@@ -52,9 +56,17 @@ onDocumentReady(() => {
5256
},
5357
hooks: {
5458
'page:view': () => {
59+
initTabsets()
60+
initContent(false)
61+
initMakeup()
62+
initTooltips()
63+
initCopyButton()
64+
5565
updateSidebarDrawer()
5666
updateSidebarContent()
67+
initSearch()
5768
initSearchPage()
69+
initSettings()
5870
}
5971
},
6072
linkSelector: 'a[href]:not([href^="/"]):not([href^="http"])',
@@ -63,13 +75,14 @@ onDocumentReady(() => {
6375
}
6476

6577
initVersions()
66-
initSidebarDrawer()
67-
initSidebarContent()
68-
initSearch()
6978
initModal()
7079
initKeyboardShortcuts()
7180
initQuickSwitch()
7281
initToast()
82+
83+
initSidebarDrawer()
84+
initSidebarContent()
85+
initSearch()
7386
initSearchPage()
7487
initSettings()
7588
}

assets/js/tooltips/hint-page.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,12 @@ const CONTENT_INNER_SELECTOR = '.content-inner'
99
* and sends to the parent window as an event.
1010
*/
1111
export function initialize () {
12-
if (shouldSendHint()) {
13-
const hint = buildHint()
14-
if (hint) {
15-
sendHintToParentWindow(hint)
16-
}
12+
const hint = buildHint()
13+
if (hint) {
14+
sendHintToParentWindow(hint)
1715
}
1816
}
1917

20-
function shouldSendHint () {
21-
const params = new URLSearchParams(window.location.search)
22-
return params.has('hint') && window.self !== window.parent
23-
}
24-
2518
function sendHintToParentWindow (hint) {
2619
const href = window.location.href
2720
const message = { hint, href }

formatters/html/dist/html-FU3IVMGH.js renamed to formatters/html/dist/html-HJ5ACJPS.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ex_doc/formatter/html/templates/sidebar_template.eex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@
6464
<% end %>
6565
</nav>
6666

67-
<main class="content page-<%= type %>" id="main" data-type="<%= sidebar_type(type) %>">
68-
<output role="status" id="toast"></output>
67+
<output role="status" id="toast"></output>
6968

69+
<main class="content page-<%= type %>" id="main" data-type="<%= sidebar_type(type) %>">
7070
<div id="content" class="content-inner">
7171
<div class="top-search">
7272
<div class="search-settings">

0 commit comments

Comments
 (0)