feat: add const.ts

This commit is contained in:
frostime 2024-06-08 20:51:13 +08:00
parent 6d75a46a56
commit ba57ba3f23
2 changed files with 129 additions and 6 deletions

99
src/libs/const.ts Normal file
View file

@ -0,0 +1,99 @@
/*
* Copyright (c) 2024 by frostime. All Rights Reserved.
* @Author : frostime
* @Date : 2024-06-08 20:36:30
* @FilePath : /src/libs/const.ts
* @LastEditTime : 2024-06-08 20:48:06
* @Description :
*/
export const BlockType2NodeType: {[key in BlockType]: string} = {
d: 'NodeDocument',
p: 'NodeParagraph',
query_embed: 'NodeBlockQueryEmbed',
l: 'NodeList',
i: 'NodeListItem',
h: 'NodeHeading',
iframe: 'NodeIFrame',
tb: 'NodeThematicBreak',
b: 'NodeBlockquote',
s: 'NodeSuperBlock',
c: 'NodeCodeBlock',
widget: 'NodeWidget',
t: 'NodeTable',
html: 'NodeHTMLBlock',
m: 'NodeMathBlock',
av: 'NodeAttributeView',
audio: 'NodeAudio'
}
export const NodeIcons = {
NodeAttributeView: {
icon: "iconDatabase"
},
NodeAudio: {
icon: "iconRecord"
},
NodeBlockQueryEmbed: {
icon: "iconSQL"
},
NodeBlockquote: {
icon: "iconQuote"
},
NodeCodeBlock: {
icon: "iconCode"
},
NodeDocument: {
icon: "iconFile"
},
NodeHTMLBlock: {
icon: "iconHTML5"
},
NodeHeading: {
icon: "iconHeadings",
subtypes: {
h1: { icon: "iconH1" },
h2: { icon: "iconH2" },
h3: { icon: "iconH3" },
h4: { icon: "iconH4" },
h5: { icon: "iconH5" },
h6: { icon: "iconH6" }
}
},
NodeIFrame: {
icon: "iconLanguage"
},
NodeList: {
subtypes: {
o: { icon: "iconOrderedList" },
t: { icon: "iconCheck" },
u: { icon: "iconList" }
}
},
NodeListItem: {
icon: "iconListItem"
},
NodeMathBlock: {
icon: "iconMath"
},
NodeParagraph: {
icon: "iconParagraph"
},
NodeSuperBlock: {
icon: "iconSuper"
},
NodeTable: {
icon: "iconTable"
},
NodeThematicBreak: {
icon: "iconLine"
},
NodeVideo: {
icon: "iconVideo"
},
NodeWidget: {
icon: "iconBoth"
}
};

36
src/types/index.d.ts vendored
View file

@ -1,10 +1,13 @@
/**
* Copyright (c) 2023 frostime. All rights reserved.
/*
* Copyright (c) 2024 by frostime. All Rights Reserved.
* @Author : frostime
* @Date : 2023-08-15 10:28:10
* @FilePath : /src/types/index.d.ts
* @LastEditTime : 2024-06-08 20:50:53
* @Description : Frequently used data structures in SiYuan
*/
/**
* Frequently used data structures in SiYuan
*/
type DocumentId = string;
type BlockId = string;
type NotebookId = string;
@ -28,7 +31,25 @@ type NotebookConf = {
dailyNoteTemplatePath: string;
}
type BlockType = "d" | "s" | "h" | "t" | "i" | "p" | "f" | "audio" | "video" | "other";
type BlockType =
| 'd'
| 'p'
| 'query_embed'
| 'l'
| 'i'
| 'h'
| 'iframe'
| 'tb'
| 'b'
| 's'
| 'c'
| 'widget'
| 't'
| 'html'
| 'm'
| 'av'
| 'audio';
type BlockSubType = "d1" | "d2" | "s1" | "s2" | "s3" | "t1" | "t2" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "table" | "task" | "toggle" | "latex" | "quote" | "html" | "code" | "footnote" | "cite" | "collection" | "bookmark" | "attachment" | "comment" | "mindmap" | "spreadsheet" | "calendar" | "image" | "audio" | "video" | "other";
@ -70,6 +91,7 @@ type doOperation = {
interface Window {
siyuan: {
config: any;
notebooks: any;
menus: any;
dialogs: any;
@ -78,5 +100,7 @@ interface Window {
user: any;
ws: any;
languages: any;
emojis: any;
};
Lute: any;
}