Move visualiser to explorer folder and start working on account

This commit is contained in:
2024-07-25 13:24:44 +02:00
parent a4729b8d84
commit 39299a268c
23 changed files with 242 additions and 12574 deletions

View File

@@ -2,6 +2,8 @@
import type { MarkdownRoot, ParsedContent, TocLink } from '@nuxt/content/dist/runtime/types';
import type { Canvas, CanvasContent } from '~/types/canvas';
import { stringifyParsedURL, type ParsedURL } from 'ufo';
interface ParsedContentExtended extends Omit<ParsedContent, 'body'> {
body: MarkdownRoot | CanvasContent | null;
}
@@ -31,6 +33,7 @@ function flatten(val: TocLink[]): TocLink[] {
return val.flatMap ? val?.flatMap((e: TocLink) => e.children ? [e, ...flatten(e.children)] : e) : val;
}
function handleResult(result: ParsedContentExtended, tag: boolean = false) {
console.log();
loading.value = false;
let body: MarkdownRoot | CanvasContent | null = JSON.parse(JSON.stringify(result.body));
@@ -120,9 +123,9 @@ function hidePreview(e: Event) {
<template >
<template v-if="href !== ''">
<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>
<a @mouseenter="(e) => showPreview(e, true)" @mouseleave="hidePreview" v-bind="$attrs" :href="stringifyParsedURL({ host: '/explorer', pathname: content?._path ?? href, hash: anchor, search: '' })" :target="target">
<slot></slot>
</a>
<Teleport to="body" v-if="hovered && (loading || !!content)">
<div class="popover hover-popover is-loaded" :style="pos" @mouseenter="(e) => showPreview(e, false)" @mouseleave="hidePreview">
<template v-if="!!content">