* Upgraded fuse library * Removed the category support in the filterbox, it was buggy and hides command names * Tweaked fuse parameters for (hopefully) better matches in the page picker (and everywhere where the filter box is used)
115 lines
2.3 KiB
TypeScript
115 lines
2.3 KiB
TypeScript
import type { ParseTree } from "@silverbulletmd/silverbullet/lib/tree";
|
|
|
|
export type FilterOption = {
|
|
name: string;
|
|
description?: string;
|
|
orderId?: number;
|
|
hint?: string;
|
|
hintInactive?: boolean;
|
|
classes?: string;
|
|
prefix?: string;
|
|
} & Record<string, any>;
|
|
|
|
export type Notification = {
|
|
id: number;
|
|
message: string;
|
|
type: "info" | "error";
|
|
date: Date;
|
|
};
|
|
|
|
export type PanelMode = number;
|
|
|
|
export type CodeWidgetContent = {
|
|
html?: string;
|
|
script?: string;
|
|
width?: number;
|
|
height?: number;
|
|
url?: string;
|
|
};
|
|
|
|
// Document editors stuff
|
|
export type DocumentEditorCallback = () => Promise<DocumentEditorContent>;
|
|
export type DocumentEditorContent = {
|
|
html: string;
|
|
};
|
|
|
|
export type LintDiagnostic = {
|
|
from: number;
|
|
to: number;
|
|
severity: "error" | "warning" | "info" | "hint";
|
|
message: string;
|
|
};
|
|
|
|
export type UploadFile = {
|
|
name: string;
|
|
contentType: string;
|
|
content: Uint8Array;
|
|
};
|
|
|
|
export type AppEvent =
|
|
| "page:click"
|
|
| "minieditor:complete"
|
|
| "slash:complete"
|
|
| "editor:complete"
|
|
| "editor:lint"
|
|
| "editor:init"
|
|
| "editor:pageLoaded" // args: pageName, previousPage, isSynced
|
|
| "editor:pageReloaded"
|
|
| "editor:pageSaving"
|
|
| "editor:pageSaved"
|
|
| "editor:pageCreating"
|
|
| "editor:pageModified"
|
|
| "editor:documentSaving"
|
|
| "editor:documentSaved"
|
|
| "editor:modeswitch"
|
|
| "editor:fold"
|
|
| "editor:unfold"
|
|
| "plugs:loaded"
|
|
| "cron:secondPassed"
|
|
| "hooks:renderTopWidgets"
|
|
| "hooks:renderBottomWidgets";
|
|
|
|
export type ClickEvent = {
|
|
page: string;
|
|
pos: number;
|
|
metaKey: boolean;
|
|
ctrlKey: boolean;
|
|
altKey: boolean;
|
|
};
|
|
|
|
export type EnrichedClickEvent = ClickEvent & {
|
|
parentNodes: string[];
|
|
};
|
|
|
|
export type LintEvent = {
|
|
name: string;
|
|
tree: ParseTree;
|
|
};
|
|
|
|
export type CompleteEvent = {
|
|
pageName: string;
|
|
linePrefix: string;
|
|
pos: number;
|
|
parentNodes: string[];
|
|
};
|
|
|
|
export type SlashCompletionOption = {
|
|
label: string;
|
|
detail?: string;
|
|
invoke: string;
|
|
order?: number;
|
|
} & Record<string, any>;
|
|
|
|
export type SlashCompletions = {
|
|
// Ignore this one, only for compatibility with regular completions
|
|
from?: number;
|
|
// The actual completions
|
|
options: SlashCompletionOption[];
|
|
};
|
|
|
|
// Code widget stuff
|
|
export type CodeWidgetCallback = (
|
|
bodyText: string,
|
|
pageName: string,
|
|
) => Promise<CodeWidgetContent | null>;
|