You've already forked obsidian-visualiser
New logo, starting account handling
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import type { MarkdownRoot, ParsedContent, TocLink } from '@nuxt/content/dist/runtime/types';
|
||||
import type { Canvas, CanvasContent } from '~/types/canvas';
|
||||
|
||||
import { stringifyParsedURL, type ParsedURL } from 'ufo';
|
||||
import { stringifyParsedURL } from 'ufo';
|
||||
|
||||
interface ParsedContentExtended extends Omit<ParsedContent, 'body'> {
|
||||
body: MarkdownRoot | CanvasContent | null;
|
||||
@@ -33,7 +33,6 @@ 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));
|
||||
|
||||
@@ -119,18 +118,23 @@ function hidePreview(e: Event) {
|
||||
|
||||
<template >
|
||||
<template v-if="href !== ''">
|
||||
<a @mouseenter="(e) => showPreview(e, true)" @mouseleave="hidePreview" v-bind="$attrs" :href="stringifyParsedURL({ host: '/explorer', pathname: (content?._path ?? href) + (anchor ? '/' + anchor.substring(1) : ''), hash: '', search: '' })" :target="target">
|
||||
<a @mouseenter="(e) => showPreview(e, true)" @mouseleave="hidePreview" v-bind="$attrs"
|
||||
:href="stringifyParsedURL({ host: '/explorer', pathname: (content?._path ?? href) + (isTag && anchor ? '/' + anchor.substring(1) : ''), hash: !isTag ? 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">
|
||||
<div class="popover hover-popover is-loaded" :style="pos" @mouseenter="(e) => showPreview(e, false)"
|
||||
@mouseleave="hidePreview">
|
||||
<template v-if="!!content">
|
||||
<div class="markdown-embed" :class="{'tag-embed': isTag}" v-if="content._type == 'markdown' && ((content as ParsedContent)?.body?.children?.length ?? 0) > 0">
|
||||
<div class="markdown-embed" :class="{'tag-embed': isTag}"
|
||||
v-if="content._type == 'markdown' && ((content as ParsedContent)?.body?.children?.length ?? 0) > 0">
|
||||
<div class="markdown-embed-content">
|
||||
<div class="markdown-preview-view markdown-rendered node-insert-event hide-title">
|
||||
<div class="markdown-preview-sizer markdown-preview-section" style="padding-bottom: 0px;">
|
||||
<div class="markdown-preview-sizer markdown-preview-section"
|
||||
style="padding-bottom: 0px;">
|
||||
<h1 v-if="content?.title && !isTag">{{ content?.title }}</h1>
|
||||
<ContentRenderer :key="content._id" :value="content"/>
|
||||
<ContentRenderer :key="content._id" :value="content" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -142,17 +146,21 @@ function hidePreview(e: Event) {
|
||||
<div class="not-found-container">
|
||||
<div class="not-found-image"></div>
|
||||
<div class="not-found-title">Impossible de prévisualiser</div>
|
||||
<div v-if="!isTag" class="not-found-description">Cliquez sur le lien pour accéder au contenu</div>
|
||||
<div v-if="!isTag" class="not-found-description">Cliquez sur le lien pour accéder au contenu
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div v-else class="preload" style="text-align:center">
|
||||
<svg style="width:50px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
|
||||
<path style="transform-origin:50px 50px;animation:1s linear infinite rotate" fill="currentColor" d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"/>
|
||||
<path style="transform-origin:50px 50px;animation:1s linear infinite rotate" fill="currentColor"
|
||||
d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50" />
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
<a v-bind="$attrs" v-else><slot></slot></a>
|
||||
<a v-bind="$attrs" v-else>
|
||||
<slot></slot>
|
||||
</a>
|
||||
</template>
|
||||
Reference in New Issue
Block a user