Obsidian_API
2021-11-27 03:09:11 0 举报
AI智能生成
可以搭配 Templater 插件使用,在Templater中可调用API
作者其他创作
大纲/内容
workspace
leftSplit
rightSplit
leftRibbon
rightRibbon
rootSplit
activeLeaf
containerEl
layoutReady
requestSaveLayout: () => void;
requestSaveHistory: () => void;
onLayoutReady
(callback: () => any): void;
(callback: () => any): void;
changeLayout
(workspace: any)
(workspace: any)
Promise<void>;
getLayout()
any;
createLeafInParent
(parent: WorkspaceSplit, index: number)
(parent: WorkspaceSplit, index: number)
splitLeaf
(source: WorkspaceItem, newLeaf: WorkspaceItem, direction?: SplitDirection, before?: boolean)
(source: WorkspaceItem, newLeaf: WorkspaceItem, direction?: SplitDirection, before?: boolean)
void
createLeafBySplit
(leaf: WorkspaceLeaf, direction?: SplitDirection, before?: boolean)
(leaf: WorkspaceLeaf, direction?: SplitDirection, before?: boolean)
splitActiveLeaf
(direction?: SplitDirection)
(direction?: SplitDirection)
splitLeafOrActive
(leaf?: WorkspaceLeaf, direction?: SplitDirection)
(leaf?: WorkspaceLeaf, direction?: SplitDirection)
duplicateLeaf
(leaf: WorkspaceLeaf, direction?: SplitDirection)
(leaf: WorkspaceLeaf, direction?: SplitDirection)
Promise<void>;
getUnpinnedLeaf
(type?: string)
(type?: string)
getLeaf
(newLeaf?: boolean)
(newLeaf?: boolean)
openLinkText
(linktext: string, sourcePath: string, newLeaf?: boolean, openViewState?: OpenViewState)
(linktext: string, sourcePath: string, newLeaf?: boolean, openViewState?: OpenViewState)
Promise<void>;
setActiveLeaf
(leaf: WorkspaceLeaf, pushHistory?: boolean, focus?: boolean)
(leaf: WorkspaceLeaf, pushHistory?: boolean, focus?: boolean)
void
getLeafById
(id: string)
(id: string)
getGroupLeaves
(group: string)
(group: string)
getMostRecentLeaf()
getLeftLeaf
(split: boolean)
(split: boolean)
getRightLeaf
(split: boolean)
(split: boolean)
getActiveViewOfType
<T extends View>(type: Constructor<T>)
<T extends View>(type: Constructor<T>)
getActiveFile()
iterateRootLeaves
(callback: (leaf: WorkspaceLeaf) => any)
(callback: (leaf: WorkspaceLeaf) => any)
void
iterateAllLeaves
(callback: (leaf: WorkspaceLeaf) => any)
(callback: (leaf: WorkspaceLeaf) => any)
void
getLeavesOfType
(viewType: string)
(viewType: string)
detachLeavesOfType
(viewType: string)
(viewType: string)
void
revealLeaf
(leaf: WorkspaceLeaf)
(leaf: WorkspaceLeaf)
void
getLastOpenFiles()
iterateCodeMirrors
(callback: (cm: CodeMirror.Editor) => any)
(callback: (cm: CodeMirror.Editor) => any)
void
on
on(name: 'quick-preview', callback: (file: TFile, data: string) => any, ctx?: any)
on(name: 'resize', callback: () => any, ctx?: any)
on(name: 'click', callback: () => any, ctx?: any)
on(name: 'active-leaf-change', callback: (leaf: WorkspaceLeaf | null) => any, ctx?: any)
on(name: 'file-open', callback: (file: TFile | null) => any, ctx?: any)
on(name: 'layout-change', callback: () => any, ctx?: any)
on(name: 'css-change', callback: () => any, ctx?: any)
on(name: 'file-menu', callback: (menu: Menu, file: TAbstractFile, source: string, leaf?: WorkspaceLeaf) => any, ctx?: any)
on(name: 'editor-menu', callback: (menu: Menu, editor: Editor, view: MarkdownView) => any, ctx?: any)
on(name: 'editor-change', callback: (editor: Editor, markdownView: MarkdownView) => any, ctx?: any)
on(name: 'editor-paste', callback: (evt: ClipboardEvent, editor: Editor, markdownView: MarkdownView) => any, ctx?: any)
on(name: 'editor-drop', callback: (evt: DragEvent, editor: Editor, markdownView: MarkdownView) => any, ctx?: any)
on(name: 'codemirror', callback: (cm: CodeMirror.Editor) => any, ctx?: any)
on(name: 'quit', callback: (tasks: Tasks) => any, ctx?: any)
vault
adapter
configDir
getName()
根目录名称
getAbstractFileByPath
(path: string)
(path: string)
getRoot()
create
(path: string, data: string, options?: DataWriteOptions)
(path: string, data: string, options?: DataWriteOptions)
Promise<TFile>
createBinary
(path: string, data: ArrayBuffer, options?: DataWriteOptions)
(path: string, data: ArrayBuffer, options?: DataWriteOptions)
Promise<TFile>
createFolder
(path: string)
(path: string)
Promise<void>;
read
(file: TFile)
(file: TFile)
Promise<string>
cachedRead
(file: TFile):
(file: TFile):
Promise<string>
readBinary
(file: TFile)
(file: TFile)
Promise<ArrayBuffer>
getResourcePath
(file: TFile)
(file: TFile)
delete
(file: TAbstractFile, force?: boolean)
(file: TAbstractFile, force?: boolean)
Promise<void>
trash
(file: TAbstractFile, system: boolean)
(file: TAbstractFile, system: boolean)
Promise<void>
rename
(file: TAbstractFile, newPath: string)
(file: TAbstractFile, newPath: string)
Promise<void>
modify
(file: TFile, data: string, options?: DataWriteOptions)
(file: TFile, data: string, options?: DataWriteOptions)
Promise<void>
modifyBinary
(file: TFile, data: ArrayBuffer, options?: DataWriteOptions)
(file: TFile, data: ArrayBuffer, options?: DataWriteOptions)
Promise<void>
append
(file: TFile, data: string, options?: DataWriteOptions)
(file: TFile, data: string, options?: DataWriteOptions)
Promise<void>
copy
(file: TFile, newPath: string)
(file: TFile, newPath: string)
Promise<TFile>
getAllLoadedFiles()
static recurseChildren
(root: TFolder, cb: (file: TAbstractFile) => any)
(root: TFolder, cb: (file: TAbstractFile) => any)
void
getMarkdownFiles()
getFiles()
on
on(name: 'create', callback: (file: TAbstractFile) => any, ctx?: any)
on(name: 'modify', callback: (file: TAbstractFile) => any, ctx?: any)
on(name: 'delete', callback: (file: TAbstractFile) => any, ctx?: any)
on(name: 'rename', callback: (file: TAbstractFile, oldPath: string) => any, ctx?: any)
on(name: 'closed', callback: () => any, ctx?: any)
metadataCache
getFirstLinkpathDest
(linkpath: string, sourcePath: string)
(linkpath: string, sourcePath: string)
getFileCache
(file: TFile)
(file: TFile)
getCache
(path: string)
(path: string)
fileToLinktext
(file: TFile, sourcePath: string, omitMdExtension?: boolean)
(file: TFile, sourcePath: string, omitMdExtension?: boolean)
resolvedLinks
Record<string, Record<string, number>>
unresolvedLinks
Record<string, Record<string, number>>
on
on(name: 'changed', callback: (file: TFile) => any, ctx?: any)
on(name: 'resolve', callback: (file: TFile) => any, ctx?: any)
on(name: 'resolved', callback: () => any, ctx?: any)
fileManager
getNewFileParent
(sourcePath: string)
(sourcePath: string)
renameFile
(file: TAbstractFile, newPath: string)
(file: TAbstractFile, newPath: string)
Promise<void>
generateMarkdownLink
(file: TFile, sourcePath: string, subpath?: string, alias?: string)
(file: TFile, sourcePath: string, subpath?: string, alias?: string)
TAbstractFile
vault
path
name
parent
CachedMetadata
links?: LinkCache[];
embeds?: EmbedCache[];
tags?: TagCache[];
headings?: HeadingCache[];
sections?: SectionCache[];
listItems?: ListItemCache[];
frontmatter?: FrontMatterCache;
blocks?: Record<string, BlockCache>;
DataAdapter
getName()
getBasePath()
mkdir
(normalizedPath: string)
(normalizedPath: string)
Promise<void>
trashSystem
(normalizedPath: string)
(normalizedPath: string)
Promise<boolean>
trashLocal
(normalizedPath: string)
(normalizedPath: string)
Promise<void>
rmdir
(normalizedPath: string, recursive: boolean)
(normalizedPath: string, recursive: boolean)
Promise<void>
read
(normalizedPath: string)
(normalizedPath: string)
Promise<string>
readBinary
(normalizedPath: string)
(normalizedPath: string)
Promise<ArrayBuffer>
write
(normalizedPath: string, data: string, options?: DataWriteOptions)
(normalizedPath: string, data: string, options?: DataWriteOptions)
Promise<void>
writeBinary
(normalizedPath: string, data: ArrayBuffer, options?: DataWriteOptions)
(normalizedPath: string, data: ArrayBuffer, options?: DataWriteOptions)
Promise<void>
append
(normalizedPath: string, data: string, options?: DataWriteOptions)
(normalizedPath: string, data: string, options?: DataWriteOptions)
Promise<void>
getResourcePath
(normalizedPath: string)
(normalizedPath: string)
remove
(normalizedPath: string)
(normalizedPath: string)
Promise<void>
rename
(normalizedPath: string, normalizedNewPath: string)
(normalizedPath: string, normalizedNewPath: string)
Promise<void>
copy
(normalizedPath: string, normalizedNewPath: string)
(normalizedPath: string, normalizedNewPath: string)
Promise<void>
exists
(normalizedPath: string, sensitive?: boolean)
(normalizedPath: string, sensitive?: boolean)
Promise<boolean>
stat
(normalizedPath: string)
(normalizedPath: string)
Promise<Stat | null>
list
(normalizedPath: string)
(normalizedPath: string)
Promise<ListedFiles>
getFullPath
(normalizedPath: string)
(normalizedPath: string)
static readLocalFile
(path: string)
(path: string)
Promise<ArrayBuffer>
static mkdir
(path: string)
(path: string)
Promise<void>
ListedFiles
files: string[];
folders: string[];
Stat
type: 'file' | 'folder';
ctime: number;
mtime: number;
size: number;
HTMLElement
show(): void;
显示此文本区
hide(): void;
隐藏此文本区
toggle(show: boolean)
toggleVisibility
(visible: boolean)
(visible: boolean)
void
WorkspaceLeaf
view
app
icon
navigation
leaf
containerEl
constructor
(leaf: WorkspaceLeaf)
(leaf: WorkspaceLeaf)
protected onOpen()
Promise<void>
protected onClose()
Promise<void>
abstract getViewType()
getState()
any
setState
(state: any, result: ViewStateResult)
(state: any, result: ViewStateResult)
Promise<void>
getEphemeralState()
any
setEphemeralState
(state: any)
(state: any)
void
getIcon()
onResize()
void
abstract getDisplayText()
onHeaderMenu
(menu: Menu)
(menu: Menu)
void
openFile
(file: TFile, openState?: OpenViewState)
(file: TFile, openState?: OpenViewState)
Promise<void>
open
(view: View)
(view: View)
Promise<void>
getViewState()
setViewState
(viewState: ViewState, eState?: any)
(viewState: ViewState, eState?: any)
Promise<void>
getEphemeralState()
any
setEphemeralState
(state: any)
(state: any)
void
togglePinned()
void
setPinned
(pinned: boolean)
(pinned: boolean)
void
setGroupMember
(other: WorkspaceLeaf)
(other: WorkspaceLeaf)
void
setGroup
(group: string)
(group: string)
void
detach()
void
getIcon()
getDisplayText()
onResize()
void
on
on(name: 'pinned-change', callback: (pinned: boolean) => any, ctx?: any)
on(name: 'group-change', callback: (group: string) => any, ctx?: any)
TFile
stat
basename
extension
文件后缀
FileStats
ctime
mtime
size
WorkspaceSidedock
toggle()
切换左边工作区展开状态
collapse()
关闭左边工作区
expand()
展开左边工作区
collapsed
WorkspaceRibbon
WorkspaceSplit
ViewState
type: string;
state?: any;
active?: boolean;
pinned?: boolean;
group?: WorkspaceLeaf;
TFolder
children
isRoot
lastEvent
type UserEvent = MouseEvent | KeyboardEvent | TouchEvent | PointerEvent
The last known user interaction event, to help commands find out what modifier keys are pressed
收藏
0 条评论
下一页