Skip to content

Commit 564f184

Browse files
authored
Merge pull request #98 from cloudlinux/revert-97-bogdan-TCR-566-stage2
Revert "Update client.ts"
2 parents 196b519 + 1905a52 commit 564f184

File tree

1 file changed

+14
-66
lines changed

1 file changed

+14
-66
lines changed

docs/.vuepress/client.ts

Lines changed: 14 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,24 @@
1-
import { provide, onMounted, onBeforeUnmount, nextTick } from "vue";
2-
import { defineClientConfig } from "@vuepress/client";
1+
import {provide} from "vue";
2+
import {defineClientConfig} from "@vuepress/client";
33
import mitt from 'mitt';
4+
45
import Layout from "./theme/layouts/Layout.vue";
56
import HomeLayout from "./theme/layouts/HomeLayout.vue";
67
import NotFound from "./theme/layouts/NotFound.vue";
8+
79
import bottomLinks from "./config-client/bottomLinks";
810
import navbarLinks from "./config-client/navbarLinks";
911
import documents from "./config-client/documents";
1012
import sidebar from "./config-client/sidebar";
1113
import social from "./config-client/social";
1214
import Chat from "./components/Chat.vue";
1315

14-
declare const __VUEPRESS_DEV__: boolean;
15-
1616
export default defineClientConfig({
17-
rootComponents: [
17+
rootComponents: [
1818
Chat,
1919
],
20-
async enhance({ app, router }) {
21-
// Existing event bus setup
20+
async enhance({ app }) {
2221
app.config.globalProperties.$eventBus = mitt();
23-
24-
// Add anchor navigation handling
25-
if (!__VUEPRESS_DEV__) {
26-
const handleAnchorClick = (event: MouseEvent) => {
27-
const target = event.target as HTMLElement;
28-
const anchor = target.closest('a');
29-
30-
if (anchor?.hash && anchor.origin === window.location.origin) {
31-
event.preventDefault();
32-
33-
const hash = anchor.hash;
34-
nextTick(() => {
35-
const element = document.querySelector(hash);
36-
if (element) {
37-
// Add offset for fixed header if needed
38-
const headerOffset = 80; // Adjust based on your header height
39-
const elementPosition = element.getBoundingClientRect().top;
40-
const offsetPosition = elementPosition + window.pageYOffset - headerOffset;
41-
42-
window.scrollTo({
43-
top: offsetPosition,
44-
behavior: 'smooth'
45-
});
46-
47-
// Update URL without full page reload
48-
window.history.pushState(null, '', hash);
49-
}
50-
});
51-
}
52-
};
53-
54-
// Handle initial hash on page load
55-
router.afterEach(() => {
56-
if (window.location.hash) {
57-
nextTick(() => {
58-
const element = document.querySelector(window.location.hash);
59-
if (element) {
60-
const headerOffset = 80; // Adjust based on your header height
61-
const elementPosition = element.getBoundingClientRect().top;
62-
const offsetPosition = elementPosition + window.pageYOffset - headerOffset;
63-
64-
window.scrollTo({
65-
top: offsetPosition,
66-
behavior: 'smooth'
67-
});
68-
}
69-
});
70-
}
71-
});
72-
73-
// Add event listeners
74-
onMounted(() => {
75-
document.addEventListener('click', handleAnchorClick);
76-
});
77-
78-
onBeforeUnmount(() => {
79-
document.removeEventListener('click', handleAnchorClick);
80-
});
81-
}
8222
},
8323
layouts: {
8424
Layout,
@@ -95,8 +35,10 @@ export default defineClientConfig({
9535
githubMainDir: "docs",
9636
githubRepository: "cloudlinux/imunify360-documentation",
9737
MOBILE_BREAKPOINT: 767,
38+
9839
//docs cards
9940
documents,
41+
10042
// icons
10143
arrowDownIcon: "arrows/arrow-down.svg",
10244
githubEditIcon: 'global/pen.svg',
@@ -105,9 +47,11 @@ export default defineClientConfig({
10547
siteLogo: "global/logo.svg",
10648
searchSelectIcon: 'arrows/select-down.svg',
10749
headerSearchIcon: 'global/header-search.svg',
50+
10851
// Header
10952
headerSearch: "Imunify360 Product Documentation",
11053
headerSearchPlaceholder: "Search across all Imunify360 product documentation",
54+
11155
//locales
11256
locales: {
11357
bottomLinks,
@@ -117,18 +61,22 @@ export default defineClientConfig({
11761
stayInTouch: "Stay in touch",
11862
navbarLinks: navbarLinks,
11963
},
64+
12065
// Products
12166
productsList: ['Cloudlinux', 'Imunify', 'TuxCare'],
12267
productsTitle: 'Products',
12368
productsURLs: ['https://docs.cloudlinux.com', 'https://docs.imunify360.com', 'https://docs.tuxcare.com'],
69+
12470
//social links for footer
12571
social,
72+
12673
// Algolia
12774
algoliaOptions: {
12875
apiKey: "e6b9d79daf71aa98e2e2a51d4556f9d4",
12976
indexName: "imunify360-unified",
13077
appId: "0TCNL6CGX8",
13178
},
79+
13280
MAX_VISIBLE_RESULT: 12,
13381
MAX_VISIBLE_ROWS: 12,
13482
MAX_HITS_PER_PAGE: 12,

0 commit comments

Comments
 (0)