From 429fb2e1004495fc44c4564dac341169b58a2d4a Mon Sep 17 00:00:00 2001 From: Dan Pastori Date: Tue, 10 Dec 2024 14:26:31 -0600 Subject: [PATCH 1/2] Keeps the active page in view on the navigation --- docs/components/Docs/Navigation.vue | 17 ++++++++++------- docs/components/Docs/NavigationGroup.vue | 4 +++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/docs/components/Docs/Navigation.vue b/docs/components/Docs/Navigation.vue index 2621838b..b340afaf 100644 --- a/docs/components/Docs/Navigation.vue +++ b/docs/components/Docs/Navigation.vue @@ -1,5 +1,5 @@ @@ -53,4 +47,13 @@ const route = useRoute(); const { navigation, toc } = useContent(); + +onMounted(() => { + console.log(route.path); + const element = document.querySelector(`[data-attr-link-id="${route.path}"]`); + if (element) { + // Can we scroll to this element without using smooth? + element.scrollIntoView(); + } +}) \ No newline at end of file diff --git a/docs/components/Docs/NavigationGroup.vue b/docs/components/Docs/NavigationGroup.vue index 9fb56ed9..27d33b9a 100644 --- a/docs/components/Docs/NavigationGroup.vue +++ b/docs/components/Docs/NavigationGroup.vue @@ -15,6 +15,7 @@ }"> + + \ No newline at end of file From 5c77e60354e3cdd8a1c841e10e23bc909e27d962 Mon Sep 17 00:00:00 2001 From: Dan Pastori Date: Tue, 10 Dec 2024 14:32:54 -0600 Subject: [PATCH 2/2] Installed hotkeys for FF support fixes #107 --- docs/components/content/Search.vue | 12 +++++++----- docs/package.json | 3 ++- docs/yarn.lock | 5 +++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/components/content/Search.vue b/docs/components/content/Search.vue index e46cb6f4..c6898e0b 100644 --- a/docs/components/content/Search.vue +++ b/docs/components/content/Search.vue @@ -106,17 +106,19 @@ import DocsIcon from './DocsIcon.vue'; import HeartIcon from './HeartIcon.vue'; import GitHubIcon from './GitHubIcon.vue'; +import hotkeys from 'hotkeys-js'; + /** * CMD + K shortcut for activating the modal */ const show = ref(false); -const { meta, k } = useMagicKeys(); -watchEffect(() => { - if (meta.value && k.value) { +if( import.meta.client ){ + hotkeys('ctrl+k,command+k', (event, handler) => { show.value = true; - } -}); + event.preventDefault(); + }); +} /** * Event handler for opening the modal diff --git a/docs/package.json b/docs/package.json index d6b037b6..1c5dc576 100644 --- a/docs/package.json +++ b/docs/package.json @@ -24,6 +24,7 @@ "surge": "^0.23.1" }, "dependencies": { - "@heroicons/vue": "^2.1.1" + "@heroicons/vue": "^2.1.1", + "hotkeys-js": "^3.13.7" } } diff --git a/docs/yarn.lock b/docs/yarn.lock index 17320059..31bb345f 100644 --- a/docs/yarn.lock +++ b/docs/yarn.lock @@ -4284,6 +4284,11 @@ hosted-git-info@^7.0.0: dependencies: lru-cache "^10.0.1" +hotkeys-js@^3.13.7: + version "3.13.7" + resolved "https://registry.yarnpkg.com/hotkeys-js/-/hotkeys-js-3.13.7.tgz#0188d8e2fca16a3f1d66541b48de0bb9df613726" + integrity sha512-ygFIdTqqwG4fFP7kkiYlvayZppeIQX2aPpirsngkv1xM1lP0piDY5QEh68nQnIKvz64hfocxhBaD/uK3sSK1yQ== + html-tags@^3.3.1: version "3.3.1" resolved "https://registry.yarnpkg.com/html-tags/-/html-tags-3.3.1.tgz#a04026a18c882e4bba8a01a3d39cfe465d40b5ce"