From 46205886cabfefd75e78b067e3092bde59d7648a Mon Sep 17 00:00:00 2001 From: David Ascanio Date: Sat, 30 May 2026 08:30:53 -0300 Subject: [PATCH] text & html entrelineas --- app/components/entrelineas/EntrelineaDetail.vue | 10 ++++++---- app/pages/entrelineas.vue | 5 +++-- app/pages/historial.vue | 4 +++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/components/entrelineas/EntrelineaDetail.vue b/app/components/entrelineas/EntrelineaDetail.vue index 2e5a55c..3f308c1 100644 --- a/app/components/entrelineas/EntrelineaDetail.vue +++ b/app/components/entrelineas/EntrelineaDetail.vue @@ -21,6 +21,7 @@ interface EntrelineaDoc { filter?: string page?: number | string text?: string + html?: string studies?: Study[] [key: string]: unknown } @@ -80,7 +81,7 @@ function formatEntrelineaText(html: string): string { } const bodyHtml = computed(() => - formatEntrelineaText(props.highlightedText || props.document?.text || '') + formatEntrelineaText(props.document?.html || props.document?.text || '') ) /* -------------------------------------------------------------------------- */ @@ -93,7 +94,7 @@ const toast = useToast() function toSearchHit(doc: EntrelineaDoc): SearchHit { const id = doc.id || '' - return { _id: id, id, title: id || 'Entrelínea', body: doc.text, ...doc } + return { _id: id, id, title: doc.text?.slice(0, 100) || 'Entrelínea', body: doc.text, ...doc } } watch( @@ -114,9 +115,10 @@ function onToggleFavorite() { if (!props.collection || !props.document?.id) return const wasFav = isFav.value favorites.toggle(props.collection, toSearchHit(props.document)) + console.log("text slice", props.document.text?.slice(0, 100)) toast.add({ - title: wasFav ? 'Eliminado de tu lista' : 'Guardado en tu lista', - description: props.document.id, + title: 'Entrelínea', + description: props.document.text?.slice(0, 100) || props.document.id, icon: wasFav ? 'i-lucide-bookmark-x' : 'i-lucide-bookmark-check', color: wasFav ? 'neutral' : 'primary', duration: 1800 diff --git a/app/pages/entrelineas.vue b/app/pages/entrelineas.vue index 3ad82f1..877e9eb 100644 --- a/app/pages/entrelineas.vue +++ b/app/pages/entrelineas.vue @@ -59,6 +59,7 @@ interface EntrelineaDoc { description?: string page?: number | string text?: string + html?: string studies?: Study[] [key: string]: unknown } @@ -255,7 +256,7 @@ function toSearchHit(doc: EntrelineaDoc): SearchHit { return { _id: id, id, - title: id || 'Entrelínea', + title: doc.text?.slice(0, 100) || 'Entrelínea', body: doc.text, ...doc } @@ -273,7 +274,7 @@ function toggleFavorite(doc: EntrelineaDoc, ev?: Event) { favorites.toggle(FAVORITES_COLLECTION, toSearchHit(doc)) toast.add({ title: wasFav ? 'Eliminado de tu lista' : 'Guardado en tu lista', - description: doc.id, + description: doc.text?.slice(0, 100), icon: wasFav ? 'i-lucide-bookmark-x' : 'i-lucide-bookmark-check', color: wasFav ? 'neutral' : 'primary', duration: 1800 diff --git a/app/pages/historial.vue b/app/pages/historial.vue index 8156396..a55284d 100644 --- a/app/pages/historial.vue +++ b/app/pages/historial.vue @@ -527,7 +527,9 @@ const nearLimit = computed(() => histTotal.value >= Math.floor(HISTORY_LIMIT * 0 />
- {{ it.hit?.origin || it.hit?.title || 'Sin título' }} + {{ it.collection === ENTRELINEAS_COLLECTION + ? (it.hit?.title || 'Sin título') + : (it.hit?.origin || it.hit?.title || 'Sin título') }}