5555 <closed-sources-banner v-if =" isClosedSourcesSection" />
5656 <article class =" md-content__inner md-typeset" >
5757 <Content />
58- <hr class =" solid" >
59- <div class =" edit-link" style =" color : #4e6e8e ;" >
60- <a target =" _blank" rel =" noopener noreferrer" :href =" getGithubLink()" >Edit this page on Github</a >
61- <span class =" sr-only" >(opens new window)</span >
62- </div >
6358 </article >
6459 </div >
6560 </div >
6661 </main >
67-
68- <Footer ref =" footer" />
6962 </div >
7063 </div >
7164</template >
@@ -77,21 +70,18 @@ import Header from './Header.vue';
7770import DeprecatedBanner from ' ../components/DeprecatedBanner.vue' ;
7871import Sidebar from ' ./Sidebar.vue' ;
7972import TOC from ' ./TOC.vue' ;
80- import Footer from ' ./Footer.vue' ;
8173import { getCurrentVersion , DEFAULT_VERSION } from ' ../helpers' ;
8274import MajorVersionDeprecation from ' ../components/MajorVersionDeprecation.vue' ;
8375import ClosedSourcesBanner from ' ../components/ClosedSourcesBanner.vue' ;
84- import repositories from ' ../../../.repos/repositories.json' ;
8576
8677export default {
8778 components: {
8879 Header,
8980 Sidebar,
9081 TOC ,
9182 DeprecatedBanner,
92- Footer,
9383 MajorVersionDeprecation,
94- ClosedSourcesBanner
84+ ClosedSourcesBanner,
9585 },
9686 setup () {
9787 return {
@@ -126,7 +116,7 @@ export default {
126116 },
127117 sdkList () {
128118 return this .page$ .sectionList .filter (
129- s =>
119+ ( s ) =>
130120 s .kuzzleMajor === this .kuzzleMajor &&
131121 (s .section === ' sdk' || s .subsection === ' api' ) &&
132122 s .released
@@ -154,20 +144,6 @@ export default {
154144 },
155145 },
156146 methods: {
157- getGithubLink () {
158- const fullPath = this .page$ .fullPath ;
159- const base = fullPath .replace (this .page$ .regularPath , ' ' );
160- const relativePath = fullPath .replace (base, ' ' );
161- const repository = repositories .find (repo => repo .deploy_path .startsWith (base));
162-
163- if (! repository) {
164- return ;
165- }
166-
167- const link = ` ${ repository .url .replace (' .git' , ' ' )} /blob/${ repository .dev } /doc/${ repository .doc_version } /${ relativePath} index.md` ;
168-
169- return link;
170- },
171147 openSidebar () {
172148 this .sidebarOpen = true ;
173149 },
@@ -180,8 +156,8 @@ export default {
180156 },
181157 setContainerPadding () {
182158 try {
183- const padding = this . $refs . header . $el . querySelector ( ' header ' )
184- .offsetHeight ;
159+ const padding =
160+ this . $refs . header . $el . querySelector ( ' header ' ) .offsetHeight ;
185161
186162 if (padding === null || typeof padding === ' undefined' ) {
187163 return ;
@@ -213,61 +189,59 @@ export default {
213189 return ;
214190 }
215191
216- const topBoundary = this . $refs . header . $el . querySelector ( ' header ' )
217- .offsetHeight ;
192+ const topBoundary =
193+ this . $refs . header . $el . querySelector ( ' header ' ) .offsetHeight ;
218194
219195 if (topBoundary === null || typeof topBoundary === ' undefined' ) {
220196 return ;
221197 }
222198
223199 const visible = window .innerHeight - topBoundary;
224- let sidebarHeight = visible - this . $refs . footer . $el . offsetHeight ;
200+ let sidebarHeight = visible - 0 ;
225201
226202 if (this .$refs .container .offsetHeight > visible) {
227203 sidebarHeight = Math .min (
228204 visible,
229205 this .$refs .container .offsetHeight -
230- this . $refs . footer . $el . offsetHeight -
206+ 0 -
231207 window .pageYOffset -
232208 topBoundary
233209 );
234210 }
235211
236212 this .$refs .sidebar .$el .style = ` height: ${ sidebarHeight} px` ;
237213 this .$refs .toc .style = ` height: ${ sidebarHeight} px` ;
238- }
214+ },
239215 },
240216 mounted () {
241- // fix scroll to anchor on chrome https://github.com/vuejs/vuepress/issues/2558
242- if (location .hash && location .hash !== ' #' ) {
243- const anchorLocation = decodeURIComponent (location .hash );
244- const anchorElement = document .querySelector (anchorLocation);
245- if (anchorElement && anchorElement .offsetTop )
246- window .scrollTo (0 , anchorElement .offsetTop );
247- }
248-
249- window .addEventListener (' resize' , this .computeContentHeight .bind (this ));
250- window .addEventListener (' scroll' , this .computeSidebarHeight .bind (this ));
217+ try {
218+ window .addEventListener (' resize' , this .computeContentHeight .bind (this ));
219+ window .addEventListener (' scroll' , this .computeSidebarHeight .bind (this ));
251220
252- this .headerResizeObserver = new ResizeObserver (
253- this .computeContentHeight .bind (this )
254- );
255- this .headerResizeObserver .observe (this .$refs .header .$el .querySelector (' header' ));
221+ this .headerResizeObserver = new ResizeObserver (
222+ this .computeContentHeight .bind (this )
223+ );
224+ this .headerResizeObserver .observe (
225+ this .$refs .header .$el .querySelector (' header' )
226+ );
256227
257- this .removeRouterListener = this .router$ .afterEach (() => {
258- this .$nextTick (() => {
259- this .computeContentHeight ();
228+ this .removeRouterListener = this .router$ .afterEach (() => {
229+ this .$nextTick (() => {
230+ this .computeContentHeight ();
231+ });
260232 });
261- });
262233
263- this .computeContentHeight ();
234+ this .computeContentHeight ();
235+ } catch (error) {
236+ console .error (' Error setting up layout:' , error);
237+ }
264238 },
265239 beforeUnmount () {
266240 window .removeEventListener (' resize' , this .computeContentHeight .bind (this ));
267241 window .removeEventListener (' scroll' , this .computeSidebarHeight .bind (this ));
268242
269243 this .headerResizeObserver .disconnect ();
270244 this .removeRouterListener ? .();
271- }
245+ },
272246};
273247< / script>
0 commit comments