You've already forked obsidian-visualiser
New useContent composable to store global navigation state. Fixes for Markdown and Canvas
This commit is contained in:
4
types/api.d.ts
vendored
4
types/api.d.ts
vendored
@@ -1,3 +1,5 @@
|
||||
import type { FileType } from '~/types/content';
|
||||
|
||||
export interface SuccessHandler
|
||||
{
|
||||
success: true;
|
||||
@@ -25,9 +27,7 @@ export interface Navigation {
|
||||
children?: Navigation[];
|
||||
}
|
||||
export type FileMetadata = Record<string, boolean | string | number>;
|
||||
export type FileType = 'markdown' | 'canvas' | 'file' | 'folder';
|
||||
export interface File {
|
||||
project: number;
|
||||
path: string;
|
||||
owner: number;
|
||||
title: string;
|
||||
|
||||
4
types/auth.d.ts
vendored
4
types/auth.d.ts
vendored
@@ -30,8 +30,8 @@ export interface UserRawData {
|
||||
}
|
||||
|
||||
export interface UserExtendedData {
|
||||
signin: Date;
|
||||
lastTimestamp: Date;
|
||||
signin: string;
|
||||
lastTimestamp: string;
|
||||
logCount: number;
|
||||
}
|
||||
|
||||
|
||||
33
types/content.d.ts
vendored
Normal file
33
types/content.d.ts
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { explorerContentTable } from "~/db/schema";
|
||||
import type { CanvasContent } from "./canvas";
|
||||
|
||||
export type FileType = typeof explorerContentTable.$inferSelect.type;
|
||||
export type Overview = Omit<typeof explorerContentTable.$inferSelect, 'content'>;
|
||||
export type Content = { content: string };
|
||||
export type ExploreContent= Overview & Partial<Content>;
|
||||
export type TreeItem = ExploreContent & { children?: TreeItem[] };
|
||||
|
||||
export interface ContentComposable {
|
||||
content: Ref<ExploreContent[]>
|
||||
tree: ComputedRef<TreeItem[]>
|
||||
/**
|
||||
* Fetch the overview of every content from the server.
|
||||
*/
|
||||
fetch: (force: boolean) => Promise<void>
|
||||
/**
|
||||
* Get the given content from the server.
|
||||
*/
|
||||
get: (path: string) => Promise<void>
|
||||
}
|
||||
|
||||
export type MarkdownContent = string;
|
||||
export type FileContent = any;
|
||||
export type FolderContent = null;
|
||||
|
||||
export interface ContentTypeMap
|
||||
{
|
||||
markdown: MarkdownContent;
|
||||
canvas: CanvasContent;
|
||||
file: FileContent;
|
||||
folder: FolderContent;
|
||||
}
|
||||
Reference in New Issue
Block a user