text & html entrelineas
This commit is contained in:
parent
d71334089f
commit
46205886ca
|
|
@ -21,6 +21,7 @@ interface EntrelineaDoc {
|
||||||
filter?: string
|
filter?: string
|
||||||
page?: number | string
|
page?: number | string
|
||||||
text?: string
|
text?: string
|
||||||
|
html?: string
|
||||||
studies?: Study[]
|
studies?: Study[]
|
||||||
[key: string]: unknown
|
[key: string]: unknown
|
||||||
}
|
}
|
||||||
|
|
@ -80,7 +81,7 @@ function formatEntrelineaText(html: string): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
const bodyHtml = computed<string>(() =>
|
const bodyHtml = computed<string>(() =>
|
||||||
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 {
|
function toSearchHit(doc: EntrelineaDoc): SearchHit {
|
||||||
const id = doc.id || ''
|
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(
|
watch(
|
||||||
|
|
@ -114,9 +115,10 @@ function onToggleFavorite() {
|
||||||
if (!props.collection || !props.document?.id) return
|
if (!props.collection || !props.document?.id) return
|
||||||
const wasFav = isFav.value
|
const wasFav = isFav.value
|
||||||
favorites.toggle(props.collection, toSearchHit(props.document))
|
favorites.toggle(props.collection, toSearchHit(props.document))
|
||||||
|
console.log("text slice", props.document.text?.slice(0, 100))
|
||||||
toast.add({
|
toast.add({
|
||||||
title: wasFav ? 'Eliminado de tu lista' : 'Guardado en tu lista',
|
title: 'Entrelínea',
|
||||||
description: props.document.id,
|
description: props.document.text?.slice(0, 100) || props.document.id,
|
||||||
icon: wasFav ? 'i-lucide-bookmark-x' : 'i-lucide-bookmark-check',
|
icon: wasFav ? 'i-lucide-bookmark-x' : 'i-lucide-bookmark-check',
|
||||||
color: wasFav ? 'neutral' : 'primary',
|
color: wasFav ? 'neutral' : 'primary',
|
||||||
duration: 1800
|
duration: 1800
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ interface EntrelineaDoc {
|
||||||
description?: string
|
description?: string
|
||||||
page?: number | string
|
page?: number | string
|
||||||
text?: string
|
text?: string
|
||||||
|
html?: string
|
||||||
studies?: Study[]
|
studies?: Study[]
|
||||||
[key: string]: unknown
|
[key: string]: unknown
|
||||||
}
|
}
|
||||||
|
|
@ -255,7 +256,7 @@ function toSearchHit(doc: EntrelineaDoc): SearchHit {
|
||||||
return {
|
return {
|
||||||
_id: id,
|
_id: id,
|
||||||
id,
|
id,
|
||||||
title: id || 'Entrelínea',
|
title: doc.text?.slice(0, 100) || 'Entrelínea',
|
||||||
body: doc.text,
|
body: doc.text,
|
||||||
...doc
|
...doc
|
||||||
}
|
}
|
||||||
|
|
@ -273,7 +274,7 @@ function toggleFavorite(doc: EntrelineaDoc, ev?: Event) {
|
||||||
favorites.toggle(FAVORITES_COLLECTION, toSearchHit(doc))
|
favorites.toggle(FAVORITES_COLLECTION, toSearchHit(doc))
|
||||||
toast.add({
|
toast.add({
|
||||||
title: wasFav ? 'Eliminado de tu lista' : 'Guardado en tu lista',
|
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',
|
icon: wasFav ? 'i-lucide-bookmark-x' : 'i-lucide-bookmark-check',
|
||||||
color: wasFav ? 'neutral' : 'primary',
|
color: wasFav ? 'neutral' : 'primary',
|
||||||
duration: 1800
|
duration: 1800
|
||||||
|
|
|
||||||
|
|
@ -527,7 +527,9 @@ const nearLimit = computed(() => histTotal.value >= Math.floor(HISTORY_LIMIT * 0
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-sm font-semibold line-clamp-2">
|
<div class="text-sm font-semibold line-clamp-2">
|
||||||
{{ 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') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<UButton
|
<UButton
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue