From 9f0d7d128fd23c22944a1e054b72bac1a6f8cfad Mon Sep 17 00:00:00 2001 From: WithoutAName25 Date: Wed, 2 Oct 2024 22:27:11 +0200 Subject: [PATCH] GH-2234 Fix snippet inconsistencies The snippet is now extracted from the HTML via textContent and not generated separately to avoid inconsistencies --- .../src/components/card/ArtifactSnippet.vue | 16 ++++++--- .../src/components/card/RepositorySnippet.vue | 14 +++++--- .../src/components/card/SnippetsCard.vue | 15 ++++---- .../src/store/maven/artifact.js | 36 ------------------- .../src/store/maven/repository.js | 19 +--------- 5 files changed, 27 insertions(+), 73 deletions(-) delete mode 100644 reposilite-frontend/src/store/maven/artifact.js diff --git a/reposilite-frontend/src/components/card/ArtifactSnippet.vue b/reposilite-frontend/src/components/card/ArtifactSnippet.vue index e03b02a91..1c2b0bcf0 100644 --- a/reposilite-frontend/src/components/card/ArtifactSnippet.vue +++ b/reposilite-frontend/src/components/card/ArtifactSnippet.vue @@ -18,6 +18,7 @@ import XmlTag from './XmlTag.vue' import CodeString from './CodeString.vue' import CodeBrackets from "./CodeBrackets.vue" +import { computed, ref } from "vue"; defineProps({ configuration: { @@ -29,23 +30,28 @@ defineProps({ required: true } }) + +const preElement = ref() +const content = computed(() => preElement?.value?.textContent) + +defineExpose({ content }) \ No newline at end of file + diff --git a/reposilite-frontend/src/components/card/RepositorySnippet.vue b/reposilite-frontend/src/components/card/RepositorySnippet.vue index b5b9f1965..cd7a165bd 100644 --- a/reposilite-frontend/src/components/card/RepositorySnippet.vue +++ b/reposilite-frontend/src/components/card/RepositorySnippet.vue @@ -18,7 +18,7 @@ import XmlTag from './XmlTag.vue' import CodeString from './CodeString.vue' import CodeBrackets from "./CodeBrackets.vue" -import {computed} from 'vue' +import { computed, ref } from 'vue' const props = defineProps({ configuration: { @@ -40,29 +40,33 @@ const gradleId = computed(() => { return gradleIdUppercase.charAt(0).toLowerCase() + gradleIdUppercase.slice(1) }) +const preElement = ref(null) +const content = computed(() => preElement?.value?.textContent) + +defineExpose({ content })