Separated copy to clipboard function into a new utilities class
Added corrected colors for old content Added paragraph click to copy function Fixed visual styling for paragraph display
This commit is contained in:
parent
97cf386f96
commit
d632846e24
|
|
@ -15,6 +15,21 @@
|
|||
--color-green-800: #016538;
|
||||
--color-green-900: #0A5331;
|
||||
--color-green-950: #052E16;
|
||||
|
||||
--color-carpablue: #2C4EA2;
|
||||
--color-carpagreen: #6B8E23;
|
||||
--color-carpared: #ff0000;
|
||||
}
|
||||
|
||||
/* Colors for Typesense rich text */
|
||||
.red {
|
||||
color: #C00000 !important;
|
||||
}
|
||||
.purple {
|
||||
color: #7030A0 !important;
|
||||
}
|
||||
.blue {
|
||||
color: #0070C0 !important;
|
||||
}
|
||||
|
||||
/* Search match highlighting --------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -830,12 +830,19 @@ function highlightTextNodes(root: HTMLElement, terms: string[]): number {
|
|||
|
||||
<!-- Todos los párrafos -->
|
||||
<div v-else-if="paragraphs.length" ref="paragraphsContainer" class="p-1 sm:p-4 max-w-4xl m-4 sm:mx-auto sm:my-6">
|
||||
<div class="bg-white rounded-lg shadow-md p-4 mb-4 last:mb-0">
|
||||
<div class="bg-white rounded-lg shadow-md p-4 sm:p-8 mb-4 last:mb-0">
|
||||
<div v-for="(hit, idx) in paragraphs" :key="idx" :data-paragraph-number="hit.document.number">
|
||||
<div class="flex items-start gap-2 mb-2">
|
||||
<div v-if="showParagraphNumbers" class="w-4 mr-2">
|
||||
<UBadge v-if="hit.document.number" :label="`#${hit.document.number}`" size="xs" variant="outline"
|
||||
color="info" />
|
||||
<div class="grid grid-cols-[32px_1fr] items-start gap-4 mb-2">
|
||||
<div v-if="showParagraphNumbers" class="w-10 select-none cursor-pointer flex justify-end">
|
||||
<UBadge
|
||||
v-if="hit.document.number"
|
||||
:label="`${hit.document.number}`"
|
||||
size="md"
|
||||
variant="ghost"
|
||||
@click="copyToClipboard(hit.document.text, hit.document.type)"
|
||||
class="text-gray-400 hover:text-white"
|
||||
:class="(hit.document.type=='activities'?'hover:bg-carpagreen':'hover:bg-carpablue')"
|
||||
/>
|
||||
</div>
|
||||
<div class="">
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -305,7 +305,15 @@ async function renderBody() {
|
|||
const el = bodyContainer.value
|
||||
if (!el) return
|
||||
|
||||
const raw = props.activity?.body
|
||||
// const raw = props.activity?.body
|
||||
let raw = props.activity?.body || ''
|
||||
if (raw) {
|
||||
raw = raw
|
||||
.replaceAll('#00ccff', '#0070C0')
|
||||
.replaceAll('#FF0000', '#C00000')
|
||||
.replaceAll('#333399', '#7030A0')
|
||||
}
|
||||
|
||||
el.innerHTML = raw ? ((fixLink(raw) as string) || '') : ''
|
||||
|
||||
if (scrollContainer.value) scrollContainer.value.scrollTop = 0
|
||||
|
|
|
|||
|
|
@ -36,13 +36,13 @@ const links = computed(() => {
|
|||
},
|
||||
{
|
||||
label: t("nav.bible_studies_ts"),
|
||||
icon: 'i-lucide-database',
|
||||
icon: 'ph:books',
|
||||
to: '/estudios-typensense',
|
||||
onSelect: () => { open.value = false }
|
||||
},
|
||||
{
|
||||
label: t("nav.conferences_ts"),
|
||||
icon: 'i-lucide-database',
|
||||
icon: 'ph:books',
|
||||
to: '/conferencias-typensense',
|
||||
onSelect: () => { open.value = false }
|
||||
},
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ async function runSearch(q: string, page = 1, append = false) {
|
|||
const name = (err as { name?: string })?.name
|
||||
if (name === 'AbortError') return
|
||||
if (seq !== searchSeq) return
|
||||
console.error('Meilisearch error', err)
|
||||
errorMsg.value = (err as Error)?.message || 'Error al buscar.'
|
||||
if (!append) {
|
||||
hits.value = []
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
const toast = useToast()
|
||||
|
||||
/* Copy to Clipboard */
|
||||
export async function copyToClipboard(textToCopy: string, type: string) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(textToCopy)
|
||||
toast.add({
|
||||
title: 'Texto copiado!',
|
||||
description: `${textToCopy}`,
|
||||
icon: 'ph-clipboard-text',
|
||||
color: type == 'activities' ? 'success' : 'info'
|
||||
})
|
||||
} catch (err) {
|
||||
console.error('Failed to copy: ', err)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue