From e882a41510ac76bb6b575181ed665099c7689ee3 Mon Sep 17 00:00:00 2001 From: David Ascanio Date: Sun, 24 May 2026 06:07:30 -0300 Subject: [PATCH] =?UTF-8?q?apikey=20estudios=20b=C3=ADblicos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../estudiosTypensense/EstudiosTypensenseDetail.vue | 12 ++++++++---- nuxt.config.ts | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/components/estudiosTypensense/EstudiosTypensenseDetail.vue b/app/components/estudiosTypensense/EstudiosTypensenseDetail.vue index 98f52bc..36e2a12 100644 --- a/app/components/estudiosTypensense/EstudiosTypensenseDetail.vue +++ b/app/components/estudiosTypensense/EstudiosTypensenseDetail.vue @@ -17,6 +17,7 @@ interface ParagraphDoc { id?: string document_id: string text: string + raw?: string number: number locale: string type: string @@ -327,6 +328,7 @@ function normalize(s: string): string { // ---- Refs de estado --------------------------------------------------------- const paragraphsContainer = ref(null) +const scrollContainer = ref(null) // 'typesense' = Estado 1 (server-driven), 'local' = Estado 2 (client-driven) type SearchMode = 'typesense' | 'local' @@ -481,9 +483,11 @@ async function applyTypesenseHighlights() { matchElements.value = domMarks currentMatchIdx.value = 0 - // Paso 4: scroll — solo cuando hay hits de Typesense que ubican el párrafo correcto. - // Sin hits, los marks se muestran para que el usuario navegue, pero no se hace scroll. - if (!hasMatchingHits) return + // Paso 4: scroll — sin hits (browse mode) volver al inicio; con hits, ir al párrafo correcto. + if (!hasMatchingHits) { + if (scrollContainer.value) scrollContainer.value.scrollTop = 0 + return + } let targetMark: HTMLElement | null = snippetMarks[0] ?? null @@ -856,7 +860,7 @@ function highlightTextNodes(root: HTMLElement, terms: string[]): number {
diff --git a/nuxt.config.ts b/nuxt.config.ts index 8526546..e3ff018 100755 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -76,7 +76,7 @@ export default defineNuxtConfig({ typesense: { url: 'https://searchts.carpa.com', // Your Typesense server URL - apiKey: 'a2lbIMTxh48KVteLLndpBfo4tuOIGiwD', // Your Typesense API key + apiKey: 'ULcypm8VYP2vgQkN57CuUqSFypWaR6ox', // Your Typesense API key // Habilita los composables auto-importados en cliente // (useTypesenseDocuments, useTypesenseApi, etc.). // ⚠️ Solo usa una clave de búsqueda (search-only) aquí: queda expuesta al navegador.