File tree Expand file tree Collapse file tree 4 files changed +28
-22
lines changed
lib/ex_doc/formatter/html/templates Expand file tree Collapse file tree 4 files changed +28
-22
lines changed Original file line number Diff line number Diff line change @@ -27,19 +27,23 @@ import SwupProgressPlugin from '@swup/progress-plugin'
27
27
28
28
onDocumentReady ( ( ) => {
29
29
const params = new URLSearchParams ( window . location . search )
30
+ const isEmbedded = window . self !== window . parent
30
31
const isPreview = params . has ( 'preview' )
32
+ const isHint = params . has ( 'hint' )
31
33
32
- initTabsets ( ) // alters content HTML, so is run early
33
34
initTheme ( params . get ( 'theme' ) )
35
+ initStyling ( )
36
+
37
+ initTabsets ( )
34
38
initContent ( isPreview )
35
39
initMakeup ( )
36
40
initTooltips ( )
37
- initHintsPage ( )
38
41
initCopyButton ( )
39
- initStyling ( )
40
42
41
- if ( isPreview ) {
43
+ if ( isPreview && isEmbedded ) {
42
44
initPreview ( )
45
+ } if ( isHint && isEmbedded ) {
46
+ initHintsPage ( )
43
47
} else {
44
48
if ( window . location . protocol !== 'file:' ) {
45
49
new Swup ( {
@@ -52,9 +56,17 @@ onDocumentReady(() => {
52
56
} ,
53
57
hooks : {
54
58
'page:view' : ( ) => {
59
+ initTabsets ( )
60
+ initContent ( false )
61
+ initMakeup ( )
62
+ initTooltips ( )
63
+ initCopyButton ( )
64
+
55
65
updateSidebarDrawer ( )
56
66
updateSidebarContent ( )
67
+ initSearch ( )
57
68
initSearchPage ( )
69
+ initSettings ( )
58
70
}
59
71
} ,
60
72
linkSelector : 'a[href]:not([href^="/"]):not([href^="http"])' ,
@@ -63,13 +75,14 @@ onDocumentReady(() => {
63
75
}
64
76
65
77
initVersions ( )
66
- initSidebarDrawer ( )
67
- initSidebarContent ( )
68
- initSearch ( )
69
78
initModal ( )
70
79
initKeyboardShortcuts ( )
71
80
initQuickSwitch ( )
72
81
initToast ( )
82
+
83
+ initSidebarDrawer ( )
84
+ initSidebarContent ( )
85
+ initSearch ( )
73
86
initSearchPage ( )
74
87
initSettings ( )
75
88
}
Original file line number Diff line number Diff line change @@ -9,19 +9,12 @@ const CONTENT_INNER_SELECTOR = '.content-inner'
9
9
* and sends to the parent window as an event.
10
10
*/
11
11
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 )
17
15
}
18
16
}
19
17
20
- function shouldSendHint ( ) {
21
- const params = new URLSearchParams ( window . location . search )
22
- return params . has ( 'hint' ) && window . self !== window . parent
23
- }
24
-
25
18
function sendHintToParentWindow ( hint ) {
26
19
const href = window . location . href
27
20
const message = { hint, href }
Original file line number Diff line number Diff line change 64
64
<% end %>
65
65
</nav>
66
66
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>
69
68
69
+ <main class="content page-<%= type %>" id="main" data-type="<%= sidebar_type(type) %>">
70
70
<div id="content" class="content-inner">
71
71
<div class="top-search">
72
72
<div class="search-settings">
You can’t perform that action at this time.
0 commit comments