思源笔记社区正在搭建中,现邀您共建
SiYuan Community is under construction. Join us to co-build.
fetchPostexport function fetchPost(url: string, data?: any, callback?: (response: IWebSocketData) => void, headers?: IObject): void;url: stringdata: any (可选)callback: (response: IWebSocketData) => void (可选)headers: IObject (可选)voidfetchSyncPostexport function fetchSyncPost(url: string, data?: any): Promise<IWebSocketData>;url: stringdata: any (可选)Promise<IWebSocketData>fetchGetexport function fetchGet(url: string, callback: (response: IWebSocketData) => void): void;url: stringcallback: (response: IWebSocketData) => voidvoidopenTabexport function openTab(options: {
app: App;
doc?: {
id: string; // 块 id
action?: string[]; // cb-get-all:获取所有内容;cb-get-focus:打开后光标定位在 id 所在的块;cb-get-hl: 打开后 id 块高亮
zoomIn?: boolean; // 是否缩放
};
pdf?: {
path: string;
page?: number; // pdf 页码
id?: string; // File Annotation id
};
asset?: {
path: string;
};
search?: ISearchOption;
card?: {
type: TCardType;
id?: string; // cardType 为 all 时不传,否则传文档或笔记本 id
title?: string; // cardType 为 all 时不传,否则传文档或笔记本名称
};
custom?: {
title: string;
icon: string;
data?: any;
fn?: () => IModel;
};
position?: "bottom" | "right";
keepCursor?: boolean; // 是否跳转到新 tab 上
removeCurrentTab?: boolean; // 在当前页签打开时需移除原有页签
afterOpen?: () => void; // 打开后回调
}): ITab;options:app: Appdoc: { id: string, action?: string[], zoomIn?: boolean } (可选)pdf: { path: string, page?: number, id?: string } (可选)asset: { path: string } (可选)search: ISearchOption (可选)card: { type: TCardType, id?: string, title?: string } (可选)custom: { title: string, icon: string, data?: any, fn?: () => IModel } (可选)position: "right" | "bottom"keepCursor: boolean (可选)removeCurrentTab: boolean (可选)afterOpen: () => void (可选)ITabgetFrontendexport function getFrontend(): "browser-desktop" | "browser-mobile" | "desktop-window" | "desktop" | "mobile";"desktop" | "desktop-window" | "mobile" | "browser-desktop" | "browser-mobile"getBackendexport function getBackend(): "android" | "darwin" | "docker" | "ios" | "linux" | "windows";"windows" | "linux" | "darwin" | "docker" | "android" | "ios"adaptHotkeyexport function adaptHotkey(hotkey: string): string;hotkey: stringstringconfirmexport function confirm(title: string, text: string, confirmCallback?: () => void, cancelCallback?: () => void): void;title: stringtext: stringconfirmCallback: () => void (可选)cancelCallback: () => void (可选)voidshowMessageexport function showMessage(text: string, timeout?: number, type?: "error" | "info", id?: string): void;text: stringtimeout: number (可选) - ms. 0: manual close;-1: always show; 6000: defaulttype: "info" | "error" (可选)id: string (可选)void