aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMatt Mayer <[email protected]>2023-09-28 19:38:59 +0700
committerGitHub <[email protected]>2023-09-28 14:38:59 +0200
commitc498c091f488db287684690ab4ff109b1589523f (patch)
tree3e237990455f8eea6c812930636b05a390396cd6 /docs
parent9b58fe305067860e07eabb77f87f6e9f20eb5acd (diff)
downloadfaker-c498c091f488db287684690ab4ff109b1589523f.tar.xz
faker-c498c091f488db287684690ab4ff109b1589523f.zip
fix(docs): revert filter code that breaks search in docs (#2425)
Diffstat (limited to 'docs')
-rw-r--r--docs/api/ApiIndex.vue34
1 files changed, 1 insertions, 33 deletions
diff --git a/docs/api/ApiIndex.vue b/docs/api/ApiIndex.vue
index 608385b4..7ef64a80 100644
--- a/docs/api/ApiIndex.vue
+++ b/docs/api/ApiIndex.vue
@@ -1,7 +1,7 @@
<!-- This content is mostly copied over from https://github.com/vuejs/docs/blob/main/src/api/ApiIndex.vue -->
<script setup lang="ts">
-import { computed, onMounted, onUnmounted, ref } from 'vue';
+import { computed, ref } from 'vue';
import { slugify } from '../.vitepress/shared/utils/slugify';
import apiSearchIndex from './api-search-index.json';
import { APIGroup } from './api-types';
@@ -43,37 +43,6 @@ const filtered = computed(() => {
})
.filter((i) => i) as APIGroup[];
});
-
-const apiFilter = ref<HTMLInputElement>();
-
-function apiSearchFocusHandler(event: KeyboardEvent): void {
- if (event.key === 'Escape') {
- if (apiFilter.value !== document.activeElement) {
- query.value = '';
- } else {
- apiFilter.value!.blur();
- }
- } else if (event.key === 'Enter') {
- if (apiFilter.value !== document.activeElement) return;
- if (query.value === '') return;
- const item = filtered.value[0].items[0];
- if (!item) return;
- const header = item.headers[0];
- if (!header) return;
- window.location.href = item.link + '#' + slugify(header.anchor);
- } else if (
- /^[a-z]$/.test(event.key) &&
- !event.altKey &&
- !event.ctrlKey &&
- !event.shiftKey &&
- !event.metaKey
- ) {
- apiFilter.value!.focus();
- }
-}
-
-onMounted(() => window.addEventListener('keydown', apiSearchFocusHandler));
-onUnmounted(() => window.removeEventListener('keydown', apiSearchFocusHandler));
</script>
<template>
@@ -85,7 +54,6 @@ onUnmounted(() => window.removeEventListener('keydown', apiSearchFocusHandler));
<input
type="search"
placeholder="Enter keyword"
- ref="apiFilter"
id="api-filter"
v-model="query"
/>