mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-11-21 01:21:54 +08:00
fix(frontend): fix prism.js not being triggered at the right moment
This commit is contained in:
parent
5f3c45f736
commit
4234d10bb4
@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, nextTick, ref, watch } from "vue";
|
||||
import { computed, ref, watch, watchPostEffect } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { debounce } from "lodash-es";
|
||||
import { useInternalApi } from "~/composables/useApi";
|
||||
@ -30,15 +30,17 @@ async function fetch() {
|
||||
content: props.raw,
|
||||
}).catch<any>((e) => handleRequestError(e));
|
||||
loading.value = false;
|
||||
}
|
||||
await fetch();
|
||||
|
||||
watchPostEffect(async () => {
|
||||
if (!import.meta.env.SSR) {
|
||||
await nextTick();
|
||||
setupAdmonition();
|
||||
if (typeof renderedMarkdown.value?.includes === "function" && renderedMarkdown.value?.includes("<code")) {
|
||||
await usePrismStore().handlePrism();
|
||||
}
|
||||
}
|
||||
}
|
||||
await fetch();
|
||||
});
|
||||
|
||||
function setupAdmonition() {
|
||||
/** @licence
|
||||
|
@ -78,7 +78,7 @@ function createPinnedVersionUrl(version: PinnedVersion): string {
|
||||
:deletable="false"
|
||||
:saveable="true"
|
||||
:cancellable="true"
|
||||
:maxlength="useBackendData.validations.project.sponsorsContent.max"
|
||||
:maxlength="useBackendData.validations.project.sponsorsContent?.max"
|
||||
:title="i18n.t('project.sponsors')"
|
||||
class="pt-0 mr-4"
|
||||
@save="saveSponsors"
|
||||
|
Loading…
Reference in New Issue
Block a user