feat/enh: embed citation
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { getContext } from 'svelte';
|
||||
import CitationModal from './Citations/CitationModal.svelte';
|
||||
import { embed, showControls, showEmbeds } from '$lib/stores';
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
@@ -21,8 +22,24 @@
|
||||
export const showSourceModal = (sourceIdx) => {
|
||||
if (citations[sourceIdx]) {
|
||||
console.log('Showing citation modal for:', citations[sourceIdx]);
|
||||
selectedCitation = citations[sourceIdx];
|
||||
showCitationModal = true;
|
||||
|
||||
if (citations[sourceIdx]?.source?.embed_url) {
|
||||
const embedUrl = citations[sourceIdx].source.embed_url;
|
||||
if (embedUrl) {
|
||||
showControls.set(true);
|
||||
showEmbeds.set(true);
|
||||
embed.set({
|
||||
title: citations[sourceIdx]?.source?.name || 'Embedded Content',
|
||||
url: embedUrl
|
||||
});
|
||||
} else {
|
||||
selectedCitation = citations[sourceIdx];
|
||||
showCitationModal = true;
|
||||
}
|
||||
} else {
|
||||
selectedCitation = citations[sourceIdx];
|
||||
showCitationModal = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user