From a3281554202eed87f517c1307fd5cd9497fd2f73 Mon Sep 17 00:00:00 2001 From: Jeff Nawroth Date: Sun, 5 Jan 2025 19:16:01 +0100 Subject: [PATCH] refactor: rename bibliography to text in DOI store and related components --- src/components/Input/FileInput.vue | 12 ++++++------ src/components/Input/TextInput.vue | 10 +++++----- src/components/Report/States/NoDoisFoundState.vue | 4 ++-- src/components/Report/States/NoInputState.vue | 4 ++-- src/stores/doi.ts | 14 +++++++------- src/utils/doiExtractor.ts | 6 +++--- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/components/Input/FileInput.vue b/src/components/Input/FileInput.vue index fa265e3..a45b1e1 100644 --- a/src/components/Input/FileInput.vue +++ b/src/components/Input/FileInput.vue @@ -5,7 +5,7 @@ import { useDoiStore } from '~/stores/doi' // Doi Store const doiStore = useDoiStore() -const { bibliography, file, dois } = storeToRefs(doiStore) +const { text, file, dois } = storeToRefs(doiStore) // Data @@ -17,18 +17,18 @@ async function extractPDFText() { const pdf = await getDocumentProxy(new Uint8Array(buffer)) - const { text } = await extractText(pdf, { mergePages: true }) + const { text: pdfText } = await extractText(pdf, { mergePages: true }) - bibliography.value = text + text.value = pdfText - bibliography.value = dois.value.length > 0 ? dois.value.join('\n') : '' + text.value = dois.value.length > 0 ? dois.value.join('\n') : '' } catch (error) { console.error('Error extracting text:', error) } } else { - bibliography.value = '' + text.value = '' console.warn('Please upload a valid PDF file.') } } @@ -38,7 +38,7 @@ watch(file, (newValue) => { extractPDFText() } else { - bibliography.value = '' + text.value = '' } }) diff --git a/src/components/Input/TextInput.vue b/src/components/Input/TextInput.vue index 46b3e4a..666eb19 100644 --- a/src/components/Input/TextInput.vue +++ b/src/components/Input/TextInput.vue @@ -5,11 +5,11 @@ import { autoImportOption } from '~/logic' import { useDoiStore } from '~/stores/doi' // App Store -const { bibliography, dois, url } = storeToRefs(useDoiStore()) +const { text, dois, url } = storeToRefs(useDoiStore()) // Listen for messages onMessage('bibliography', ({ data }) => { - bibliography.value = data.selectedText + text.value = data.selectedText }) onMessage('autoImportBibliography', ({ data }) => { @@ -18,9 +18,9 @@ onMessage('autoImportBibliography', ({ data }) => { url.value = data.url - bibliography.value = data.selectedText + text.value = data.selectedText - bibliography.value = dois.value.length > 0 ? dois.value.join('\n') : '' + text.value = dois.value.length > 0 ? dois.value.join('\n') : '' }) // I18n @@ -34,7 +34,7 @@ const placeholder = computed(() => autoImportOption.value ? t('reload-page-auto-