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'
2727
2828onDocumentReady ( ( ) => {
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 }
Original file line number Diff line number Diff line change @@ -9,19 +9,12 @@ const CONTENT_INNER_SELECTOR = '.content-inner'
99 * and sends to the parent window as an event.
1010 */
1111export 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-
2518function sendHintToParentWindow ( hint ) {
2619 const href = window . location . href
2720 const message = { hint, href }
Original file line number Diff line number Diff line change 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">
You can’t perform that action at this time.
0 commit comments