Add tag page and fix mobile header

This commit is contained in:
2024-01-15 17:45:26 +01:00
parent a228b7d222
commit b43bafdd57
6 changed files with 108 additions and 6 deletions

View File

@@ -68,6 +68,7 @@ const onPointerUp = (event: PointerEvent) => {
dragging = false;
document.removeEventListener('pointermove', onPointerMove);
document.removeEventListener('pointerup', onPointerUp);
document.removeEventListener('pointercancel', onPointerUp);
}
const onWheel = (event: WheelEvent) => {
@@ -79,7 +80,7 @@ const onWheel = (event: WheelEvent) => {
zoom.value = minZoom.value;
}
const reset = (event: PointerEvent) => {
const reset = (_: MouseEvent) => {
zoom.value = minZoom.value;
dispX.value = -(maxX.value + minX.value) / 2;
dispY.value = -(maxY.value + minY.value) / 2;

View File

@@ -6,7 +6,7 @@ interface ParsedContentExtended extends Omit<ParsedContent, 'body'> {
body: MarkdownRoot | CanvasContent | null;
}
const tags = inject('tags') as ParsedContent;
const tags = inject('tags/descriptions') as ParsedContent;
const props = defineProps({
href: {
type: String,
@@ -109,6 +109,10 @@ function showPreview(e: Event, bbox: boolean) {
if(content.value === null)
loadContent();
}
function showTag(e: Event)
{
//e.preventDefault();
}
function hidePreview(e: Event) {
timeout = setTimeout(() => hovered.value = false, 300);
}
@@ -116,8 +120,8 @@ function hidePreview(e: Event) {
<template >
<template v-if="href !== ''">
<NuxtLink custom no-prefetch v-slot="{ href: hrefSlot, navigate }" :href="isTag ? undefined : { path: content?._path ?? link, hash: anchor }" :target="target">
<a :href="hrefSlot" @click="(isTag ? (e: Event) => e.preventDefault() : navigate)" @mouseenter="(e) => showPreview(e, true)" @mouseleave="hidePreview" v-bind="$attrs"><slot ></slot></a>
<NuxtLink custom no-prefetch v-slot="{ href: hrefSlot, navigate }" :href="isTag ? { path: '/tags/' + anchor.substring(1) } : { path: content?._path ?? link, hash: anchor }" :target="target">
<a :href="hrefSlot" @click="navigate" @mouseenter="(e) => showPreview(e, true)" @mouseleave="hidePreview" v-bind="$attrs"><slot></slot></a>
</NuxtLink>
<Teleport to="body" v-if="hovered && (loading || !!content)">
<div class="popover hover-popover is-loaded" :style="pos" @mouseenter="(e) => showPreview(e, false)" @mouseleave="hidePreview">