wip
This commit is contained in:
parent
29d2033541
commit
57a64b3fe2
|
@ -24,34 +24,13 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, provide, ref, shallowRef, onMounted, onUnmounted, inject } from 'vue';
|
||||
import { ref, shallowRef, onMounted, onUnmounted, inject } from 'vue';
|
||||
import type { ParsedEmbedParams } from '@/scripts/embed-page.js';
|
||||
import { PageMetadata, provideMetadataReceiver, provideReactiveMetadata } from '@/scripts/page-metadata.js';
|
||||
import { instanceName } from '@/config.js';
|
||||
import { mainRouter } from '@/router/main.js';
|
||||
import { postMessageToParentWindow } from '@/scripts/post-message.js';
|
||||
import { defaultEmbedParams } from '@/scripts/embed-page.js';
|
||||
|
||||
const embedParams = inject<ParsedEmbedParams>('embedParams', defaultEmbedParams);
|
||||
|
||||
const isRoot = computed(() => mainRouter.currentRoute.value.name === 'index');
|
||||
|
||||
const pageMetadata = ref<null | PageMetadata>(null);
|
||||
|
||||
provide('router', mainRouter);
|
||||
provideMetadataReceiver((metadataGetter) => {
|
||||
const info = metadataGetter();
|
||||
pageMetadata.value = info;
|
||||
if (pageMetadata.value) {
|
||||
if (isRoot.value && pageMetadata.value.title === instanceName) {
|
||||
document.title = pageMetadata.value.title;
|
||||
} else {
|
||||
document.title = `${pageMetadata.value.title} | ${instanceName}`;
|
||||
}
|
||||
}
|
||||
});
|
||||
provideReactiveMetadata(pageMetadata);
|
||||
|
||||
//#region Embed Style
|
||||
const embedRounded = ref(embedParams.rounded);
|
||||
const embedNoBorder = ref(!embedParams.border);
|
||||
|
|
Loading…
Reference in a new issue