obsidian-typings 2.3.2 → 2.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/implementations.cjs +198 -1
- package/dist/implementations.d.ts +3891 -0
- package/dist/types.d.ts +932 -932
- package/package.json +1 -1
|
@@ -1,3 +1,3894 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
|
+
import { Extension } from '@codemirror/state';
|
|
4
|
+
import { EditorView, ViewUpdate } from '@codemirror/view';
|
|
5
|
+
import { App, CachedMetadata, CloseableComponent, Command, Component, DataAdapter, Debouncer, Editor, EditorPosition, EditorRange, EditorSuggest, EmbedCache, Events, FileStats, FileView, FrontmatterLinkCache, HoverLinkSource, HoverPopover, IconName, ItemView, KeymapInfo, LinkCache, Loc, MarkdownFileInfo, MarkdownView, Menu, Modal, PaneType, Plugin as Plugin$1, PluginManifest, PluginSettingTab, Reference, ReferenceCache, Scope, SearchComponent, SearchResult, SettingTab, SplitDirection, TAbstractFile, TFile, TFolder, TextFileView, Vault, View, ViewCreator, ViewState, Workspace, WorkspaceLeaf, WorkspaceTabs } from 'obsidian';
|
|
6
|
+
|
|
7
|
+
export declare function parentFolderPath(path: string): string;
|
|
8
|
+
export type StyleModule = {};
|
|
9
|
+
export type StyleSpec = {};
|
|
10
|
+
/**
|
|
11
|
+
* Creates and properly initializes the instance of TFolder even the underlying folder does not exist.
|
|
12
|
+
* This doesn't create the missing folder on the file system.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createTFolderInstance(vault: Vault, path: string): TFolder;
|
|
15
|
+
/** @todo Documentation incomplete */
|
|
16
|
+
/** @public */
|
|
17
|
+
export interface CustomArrayDict<T> {
|
|
18
|
+
data: Map<string, T[]>;
|
|
19
|
+
add(key: string, value: T): void;
|
|
20
|
+
clear(key: string): void;
|
|
21
|
+
clearAll(): void;
|
|
22
|
+
contains(key: string, value: T): boolean;
|
|
23
|
+
count(): number;
|
|
24
|
+
get(key: string): T[] | null;
|
|
25
|
+
keys(): string[];
|
|
26
|
+
remove(key: string, value: T): void;
|
|
27
|
+
}
|
|
28
|
+
export declare class CustomArrayDictImpl<T> implements CustomArrayDict<T> {
|
|
29
|
+
data: Map<string, T[]>;
|
|
30
|
+
add(key: string, value: T): void;
|
|
31
|
+
remove(key: string, value: T): void;
|
|
32
|
+
get(key: string): T[] | null;
|
|
33
|
+
keys(): string[];
|
|
34
|
+
clear(key: string): void;
|
|
35
|
+
clearAll(): void;
|
|
36
|
+
contains(key: string, value: T): boolean;
|
|
37
|
+
count(): number;
|
|
38
|
+
}
|
|
39
|
+
export declare const InternalPluginName: {
|
|
40
|
+
readonly AudioRecorder: "audio-recorder";
|
|
41
|
+
readonly Backlink: "backlink";
|
|
42
|
+
readonly Bookmarks: "bookmarks";
|
|
43
|
+
readonly Canvas: "canvas";
|
|
44
|
+
readonly CommandPalette: "command-palette";
|
|
45
|
+
readonly DailyNotes: "daily-notes";
|
|
46
|
+
readonly EditorStatus: "editor-status";
|
|
47
|
+
readonly FileExplorer: "file-explorer";
|
|
48
|
+
readonly FileRecovery: "file-recovery";
|
|
49
|
+
readonly GlobalSearch: "global-search";
|
|
50
|
+
readonly Graph: "graph";
|
|
51
|
+
readonly MarkdownImporter: "markdown-importer";
|
|
52
|
+
readonly NoteComposer: "note-composer";
|
|
53
|
+
readonly OutgoingLink: "outgoing-link";
|
|
54
|
+
readonly Outline: "outline";
|
|
55
|
+
readonly PagePreview: "page-preview";
|
|
56
|
+
readonly Properties: "properties";
|
|
57
|
+
readonly Publish: "publish";
|
|
58
|
+
readonly RandomNote: "random-note";
|
|
59
|
+
readonly SlashCommand: "slash-command";
|
|
60
|
+
readonly Slides: "slides";
|
|
61
|
+
readonly Switcher: "switcher";
|
|
62
|
+
readonly Sync: "sync";
|
|
63
|
+
readonly TagPane: "tag-pane";
|
|
64
|
+
readonly Templates: "templates";
|
|
65
|
+
readonly WordCount: "word-count";
|
|
66
|
+
readonly Workspaces: "workspaces";
|
|
67
|
+
readonly ZkPrefixer: "zk-prefixer";
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Creates and properly initializes the instance of TFile even the underlying file does not exist.
|
|
71
|
+
* This doesn't create the missing file on the file system.
|
|
72
|
+
*/
|
|
73
|
+
export declare function createTFileInstance(vault: Vault, path: string): TFile;
|
|
74
|
+
export declare function isEmbedCache(reference: Reference): reference is EmbedCache;
|
|
75
|
+
export declare function isFrontmatterLinkCache(reference: Reference): reference is FrontmatterLinkCache;
|
|
76
|
+
export declare function isReferenceCache(reference: Reference): reference is ReferenceCache;
|
|
77
|
+
export declare function isLinkCache(reference: Reference): reference is LinkCache;
|
|
78
|
+
/**
|
|
79
|
+
* Constructs a new TFolder instance.
|
|
80
|
+
*
|
|
81
|
+
* @param vault - The vault to which the folder belongs.
|
|
82
|
+
* @param path - The path of the folder.
|
|
83
|
+
* @returns The constructed TFolder instance.
|
|
84
|
+
*/
|
|
85
|
+
export declare function constructTFolder(vault: Vault, path: string): TFolder;
|
|
86
|
+
/** @public */
|
|
87
|
+
export interface MobileFileInfo {
|
|
88
|
+
renderCallback(el: HTMLElement): void;
|
|
89
|
+
}
|
|
90
|
+
/** @public */
|
|
91
|
+
export interface RibbonItem {
|
|
92
|
+
hidden: boolean;
|
|
93
|
+
icon: IconName;
|
|
94
|
+
id: string;
|
|
95
|
+
title: string;
|
|
96
|
+
callback(): Promise<void>;
|
|
97
|
+
}
|
|
98
|
+
/** @todo Documentation incomplete */
|
|
99
|
+
/** @public */
|
|
100
|
+
export interface InternalPlugin<InternalPluginInstance> extends Component {
|
|
101
|
+
addedButtonEls: HTMLDivElement[];
|
|
102
|
+
app: App;
|
|
103
|
+
commands: Command[];
|
|
104
|
+
enabled: boolean;
|
|
105
|
+
hasStatusBarItem: boolean;
|
|
106
|
+
instance: InternalPluginInstance;
|
|
107
|
+
lastSave: number;
|
|
108
|
+
manager: InternalPlugins;
|
|
109
|
+
mobileFileInfo: MobileFileInfo[];
|
|
110
|
+
onConfigFileChange: Debouncer<[
|
|
111
|
+
], Promise<void>>;
|
|
112
|
+
ribbonItems: RibbonItem[];
|
|
113
|
+
statusBarEl: HTMLDivElement | null;
|
|
114
|
+
views: Record<string, ViewCreator>;
|
|
115
|
+
addSettingTab(settingTab: PluginSettingTab): void;
|
|
116
|
+
deleteData(): Promise<void>;
|
|
117
|
+
disable(isDisabledByUser?: boolean): void;
|
|
118
|
+
enable(isEnabledByUser?: boolean): Promise<void>;
|
|
119
|
+
getModifiedTime(): Promise<number | undefined>;
|
|
120
|
+
handleConfigFileChange(): Promise<void>;
|
|
121
|
+
init(): void;
|
|
122
|
+
loadData(): Promise<object | null>;
|
|
123
|
+
registerGlobalCommand(command: Command): void;
|
|
124
|
+
registerMobileFileInfo(renderCallback: (el: HTMLElement) => void): void;
|
|
125
|
+
registerRibbonItem(title: string, icon: IconName, callback: () => Promise<void>): void;
|
|
126
|
+
registerStatusBarItem(): void;
|
|
127
|
+
registerViewType(type: string, creator: ViewCreator): void;
|
|
128
|
+
saveData(data: object): Promise<void>;
|
|
129
|
+
}
|
|
130
|
+
/** @public */
|
|
131
|
+
export interface InternalPluginInstance<InternalPlugin> {
|
|
132
|
+
description: string;
|
|
133
|
+
id: string;
|
|
134
|
+
name: string;
|
|
135
|
+
init(app: App, plugin: InternalPlugin): void;
|
|
136
|
+
}
|
|
137
|
+
/** @public */
|
|
138
|
+
export interface AudioRecorderPlugin extends InternalPlugin<AudioRecorderPluginInstance> {
|
|
139
|
+
}
|
|
140
|
+
/** @public */
|
|
141
|
+
export interface AudioRecorderPluginInstance extends InternalPluginInstance<AudioRecorderPlugin> {
|
|
142
|
+
app: App;
|
|
143
|
+
extension: string;
|
|
144
|
+
plugin: AudioRecorderPlugin;
|
|
145
|
+
recorder: MediaRecorder | null;
|
|
146
|
+
recording: boolean;
|
|
147
|
+
checkPermission(): Promise<boolean>;
|
|
148
|
+
onRecordAudio(): Promise<void>;
|
|
149
|
+
onStartRecording(): Promise<void>;
|
|
150
|
+
onStopRecording(): void;
|
|
151
|
+
saveRecording(audioBuffer: ArrayBuffer): Promise<void>;
|
|
152
|
+
showRecordingMessage(message: string, isError: boolean): void;
|
|
153
|
+
startRecording(stream: MediaStream): void;
|
|
154
|
+
}
|
|
155
|
+
/** @todo This is probably not the right term */
|
|
156
|
+
/** @public */
|
|
157
|
+
export interface InfoFileView extends FileView {
|
|
158
|
+
/**
|
|
159
|
+
* Called when a file is opened. Loads the file and requests a content update
|
|
160
|
+
* @param file - The opened file
|
|
161
|
+
*/
|
|
162
|
+
onFileOpen(file: TFile): void;
|
|
163
|
+
}
|
|
164
|
+
/** @todo Documentation incomplete */
|
|
165
|
+
/** @public */
|
|
166
|
+
export interface BacklinkView extends InfoFileView {
|
|
167
|
+
/**
|
|
168
|
+
* Get the current view type
|
|
169
|
+
*/
|
|
170
|
+
getViewType(): "backlink";
|
|
171
|
+
/**
|
|
172
|
+
* Shows the search
|
|
173
|
+
*/
|
|
174
|
+
showSearch(): void;
|
|
175
|
+
/** @todo Documentation incomplete */
|
|
176
|
+
update(): void;
|
|
177
|
+
}
|
|
178
|
+
/** @public */
|
|
179
|
+
export interface BacklinkPlugin extends InternalPlugin<BacklinkPluginInstance> {
|
|
180
|
+
views: {
|
|
181
|
+
backlink(left: WorkspaceLeaf): BacklinkView;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
/** @public */
|
|
185
|
+
export interface BacklinkPluginInstance extends InternalPluginInstance<BacklinkPlugin> {
|
|
186
|
+
app: App;
|
|
187
|
+
defaultOn: boolean;
|
|
188
|
+
file?: TFile | null;
|
|
189
|
+
options: {
|
|
190
|
+
backlinkInDocument?: boolean;
|
|
191
|
+
};
|
|
192
|
+
plugin: BacklinkPlugin;
|
|
193
|
+
initLeaf(): void;
|
|
194
|
+
onEnable(app: App, plugin: BacklinkPlugin): Promise<void>;
|
|
195
|
+
onExternalSettingsChange(): Promise<void>;
|
|
196
|
+
onFileMenu(menu: Menu, file: TAbstractFile, title: string, leaf?: WorkspaceLeaf): Menu;
|
|
197
|
+
onFileOpen(file: TAbstractFile): void;
|
|
198
|
+
onUserDisable(app: App): void;
|
|
199
|
+
onUserEnable(): void;
|
|
200
|
+
openBacklinksForActiveFile(skipSplit: boolean): boolean | undefined;
|
|
201
|
+
toggleBacklinksInDocument(skip: boolean): boolean | undefined;
|
|
202
|
+
updateBacklinks(): void;
|
|
203
|
+
}
|
|
204
|
+
/** @todo Documentation incomplete */
|
|
205
|
+
/** @public */
|
|
206
|
+
export interface GlobalSearchLeaf extends WorkspaceLeaf {
|
|
207
|
+
}
|
|
208
|
+
/** @public */
|
|
209
|
+
export interface BookmarkItem {
|
|
210
|
+
query: string;
|
|
211
|
+
subpath: string;
|
|
212
|
+
title: string;
|
|
213
|
+
type: "file" | "folder" | "search";
|
|
214
|
+
}
|
|
215
|
+
/** @todo Documentation incomplete */
|
|
216
|
+
/** @public */
|
|
217
|
+
export interface BookmarksView extends ItemView {
|
|
218
|
+
/** @todo Documentation incomplete */
|
|
219
|
+
_copyToClipboard(e: unknown, t: unknown): void;
|
|
220
|
+
/** @todo Documentation incomplete */
|
|
221
|
+
_getActiveBookmarks(): unknown[];
|
|
222
|
+
/**
|
|
223
|
+
* Attaches the handleDrag of DragManager
|
|
224
|
+
*/
|
|
225
|
+
attachDragHandler(e: unknown): void;
|
|
226
|
+
/**
|
|
227
|
+
* Attaches the handleDrop of DragManager to containerEl
|
|
228
|
+
*/
|
|
229
|
+
attachDropHandler(): void;
|
|
230
|
+
/** @todo Documentation incomplete */
|
|
231
|
+
createNewGroup(e: unknown): void;
|
|
232
|
+
/** @todo Documentation incomplete */
|
|
233
|
+
dragSelectedBookmarks(e: unknown, t: unknown): unknown | null;
|
|
234
|
+
/** @todo Documentation incomplete */
|
|
235
|
+
getItemDom(e: unknown): unknown;
|
|
236
|
+
/** @todo Documentation incomplete */
|
|
237
|
+
getNodeId(e: unknown): string;
|
|
238
|
+
/**
|
|
239
|
+
* Get the current view type
|
|
240
|
+
*/
|
|
241
|
+
getViewType(): "bookmarks";
|
|
242
|
+
/** @todo Documentation incomplete */
|
|
243
|
+
handleCollapseAll(e: unknown): void;
|
|
244
|
+
/** @todo Documentation incomplete */
|
|
245
|
+
isItem(item: unknown): boolean;
|
|
246
|
+
/** @todo Documentation incomplete */
|
|
247
|
+
onContextMenu(event: unknown): void;
|
|
248
|
+
/**
|
|
249
|
+
* Called when delete is requested
|
|
250
|
+
* @param event - The event triggered this function
|
|
251
|
+
*/
|
|
252
|
+
onDeleteSelectedItems(event: unknown): unknown;
|
|
253
|
+
/**
|
|
254
|
+
* Called when a file is created.
|
|
255
|
+
* @param file - The created file
|
|
256
|
+
*/
|
|
257
|
+
onFileCreate(file: TFile): void;
|
|
258
|
+
/**
|
|
259
|
+
* Called when a file is deleted.
|
|
260
|
+
* @param file - The deleted file
|
|
261
|
+
*/
|
|
262
|
+
onFileDelete(file: TFile): void;
|
|
263
|
+
/** @todo Documentation incomplete */
|
|
264
|
+
onFileOpen(file: TFile): void;
|
|
265
|
+
/**
|
|
266
|
+
* Called when the rename shortcut is pressed
|
|
267
|
+
* @param event - The event triggered this function
|
|
268
|
+
*/
|
|
269
|
+
onRenameKey(event: KeyboardEvent): void;
|
|
270
|
+
/** @todo Documentation incomplete */
|
|
271
|
+
update(): void;
|
|
272
|
+
}
|
|
273
|
+
/** @public */
|
|
274
|
+
export interface BookmarksPlugin extends InternalPlugin<BookmarksPluginInstance> {
|
|
275
|
+
views: {
|
|
276
|
+
bookmarks(left: WorkspaceLeaf): BookmarksView;
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
/** @public */
|
|
280
|
+
export interface BookmarksPluginInstance extends InternalPluginInstance<BookmarksPlugin>, Events {
|
|
281
|
+
app: App;
|
|
282
|
+
bookmarkedViews: WeakMap<View, HTMLElement>;
|
|
283
|
+
bookmarkLookup: Record<string, BookmarkItem>;
|
|
284
|
+
defaultOn: boolean;
|
|
285
|
+
hasValidData: boolean;
|
|
286
|
+
items: BookmarkItem[];
|
|
287
|
+
onItemsChanged: Debouncer<[
|
|
288
|
+
boolean
|
|
289
|
+
], void>;
|
|
290
|
+
plugin: BookmarksPlugin;
|
|
291
|
+
urlBookmarkLookup: Record<string, BookmarkItem>;
|
|
292
|
+
_onItemsChanged(arg1: boolean): void;
|
|
293
|
+
addItem(item: BookmarkItem, instance: BookmarksPluginInstance): void;
|
|
294
|
+
editItem(item: BookmarkItem): void;
|
|
295
|
+
findBookmarkByView(view: FileView): BookmarkItem | null | undefined;
|
|
296
|
+
getBookmarks(): BookmarkItem[];
|
|
297
|
+
getItemTitle(item: BookmarkItem): string;
|
|
298
|
+
initLeaf(): void;
|
|
299
|
+
loadData(): Promise<boolean>;
|
|
300
|
+
moveItem(item: BookmarkItem, instance: BookmarksPluginInstance, arg3: number): void;
|
|
301
|
+
onEditorMenu(menu: Menu, editor: Editor, info: MarkdownView | MarkdownFileInfo): void;
|
|
302
|
+
onEnable(app: App, plugin: BookmarksPlugin): Promise<void>;
|
|
303
|
+
onExternalSettingsChange(): Promise<void>;
|
|
304
|
+
onFileMenu(menu: Menu, files: TAbstractFile[], source: string, leaf?: WorkspaceLeaf): void;
|
|
305
|
+
onFileRename(file: TFile, oldPath: string): void;
|
|
306
|
+
onFilesMenu(menu: Menu, files: TAbstractFile[], source: string, leaf?: WorkspaceLeaf): void;
|
|
307
|
+
onLeafMenu(menu: Menu, leaf: WorkspaceLeaf): void;
|
|
308
|
+
onSearchResultsMenu(menu: Menu, search: GlobalSearchLeaf): void;
|
|
309
|
+
onTabGroupMenu(menu: Menu, tabsLeaf: WorkspaceTabs): void;
|
|
310
|
+
onUserEnable(): void;
|
|
311
|
+
openBookmark(item: BookmarkItem, newLeaf: PaneType | boolean, newLeaf2?: PaneType | boolean): Promise<void>;
|
|
312
|
+
openBookmarkInLeaf(item: BookmarkItem, leaf: WorkspaceLeaf, newLeaf?: PaneType | boolean): Promise<void>;
|
|
313
|
+
openBookmarks(items: BookmarkItem[], newLeaf?: PaneType | boolean): Promise<void>;
|
|
314
|
+
rebuildBookmarkCache(): void;
|
|
315
|
+
removeItem(item: BookmarkItem): void;
|
|
316
|
+
saveData(): void;
|
|
317
|
+
updateTabHeaders(): void;
|
|
318
|
+
}
|
|
319
|
+
/** @public */
|
|
320
|
+
export interface PromisedQueue {
|
|
321
|
+
promise: Promise<void>;
|
|
322
|
+
queue(next: () => void | Promise<void>): Promise<void>;
|
|
323
|
+
}
|
|
324
|
+
/** @public */
|
|
325
|
+
export interface CanvasDataManager {
|
|
326
|
+
app: App;
|
|
327
|
+
handleDelete(arg1: unknown): unknown;
|
|
328
|
+
handleRename(arg1: unknown, arg2: unknown): unknown;
|
|
329
|
+
load(arg1: unknown): unknown;
|
|
330
|
+
remove(arg1: unknown): unknown;
|
|
331
|
+
save(arg1: unknown, arg2: unknown): unknown;
|
|
332
|
+
}
|
|
333
|
+
/** @public */
|
|
334
|
+
export interface CanvasEmbed {
|
|
335
|
+
file: string;
|
|
336
|
+
subpath?: string;
|
|
337
|
+
}
|
|
338
|
+
/** @public */
|
|
339
|
+
export interface CanvasIndexEntry {
|
|
340
|
+
caches: Record<string, CachedMetadata>;
|
|
341
|
+
embeds: CanvasEmbed[];
|
|
342
|
+
}
|
|
343
|
+
/** @public */
|
|
344
|
+
export interface CanvasIndex extends Component {
|
|
345
|
+
app: App;
|
|
346
|
+
fileQueue: unknown[];
|
|
347
|
+
frame: null;
|
|
348
|
+
index: Record<string, CanvasIndexEntry>;
|
|
349
|
+
refNodeIds: WeakMap<object, unknown>;
|
|
350
|
+
canProcess(arg1: unknown): unknown;
|
|
351
|
+
get(arg1: unknown): unknown;
|
|
352
|
+
getAll(): unknown;
|
|
353
|
+
getForPath(arg1: unknown): unknown;
|
|
354
|
+
onCreate(arg1: unknown): unknown;
|
|
355
|
+
onDelete(arg1: unknown): unknown;
|
|
356
|
+
onload(): unknown;
|
|
357
|
+
onModify(arg1: unknown): unknown;
|
|
358
|
+
onRename(arg1: unknown, arg2: unknown): unknown;
|
|
359
|
+
onunload(): unknown;
|
|
360
|
+
parseText(arg1: unknown): Promise<unknown>;
|
|
361
|
+
process(arg1: unknown): Promise<unknown>;
|
|
362
|
+
queue(arg1: unknown): unknown;
|
|
363
|
+
requestFrame(): unknown;
|
|
364
|
+
run(): Promise<unknown>;
|
|
365
|
+
}
|
|
366
|
+
/** @public */
|
|
367
|
+
export interface CanvasPlugin extends InternalPlugin<CanvasPluginInstance> {
|
|
368
|
+
}
|
|
369
|
+
/** @public */
|
|
370
|
+
export interface CanvasPluginInstance extends InternalPluginInstance<CanvasPlugin> {
|
|
371
|
+
app: App;
|
|
372
|
+
defaultOn: boolean;
|
|
373
|
+
index: CanvasIndex;
|
|
374
|
+
localDataManager: CanvasDataManager;
|
|
375
|
+
options: {
|
|
376
|
+
cardLabelVisibility?: "always" | "hover" | "never";
|
|
377
|
+
defaultModDragBehavior?: "card" | "group" | "media" | "menu" | "note" | "webpage";
|
|
378
|
+
defaultWheelBehavior?: "pan" | "zoom";
|
|
379
|
+
newFileLocation?: "root" | "current" | "folder";
|
|
380
|
+
newFileFolderPath?: string;
|
|
381
|
+
snapToGrid?: boolean;
|
|
382
|
+
snapToObjects?: boolean;
|
|
383
|
+
zoomBreakpoint?: number;
|
|
384
|
+
};
|
|
385
|
+
plugin: CanvasPlugin;
|
|
386
|
+
renameQueue: PromisedQueue;
|
|
387
|
+
renames: unknown[];
|
|
388
|
+
requestProcessRename: Debouncer<[
|
|
389
|
+
], unknown>;
|
|
390
|
+
}
|
|
391
|
+
/** @public */
|
|
392
|
+
export interface CommandPalettePlugin extends InternalPlugin<CommandPalettePluginInstance> {
|
|
393
|
+
}
|
|
394
|
+
/** @public */
|
|
395
|
+
export interface CommandPalettePluginInstance extends InternalPluginInstance<CommandPalettePlugin> {
|
|
396
|
+
app: App;
|
|
397
|
+
defaultOn: boolean;
|
|
398
|
+
plugin: CommandPalettePlugin;
|
|
399
|
+
}
|
|
400
|
+
/** @public */
|
|
401
|
+
export interface DailyNotesPlugin extends InternalPlugin<DailyNotesPluginInstance> {
|
|
402
|
+
}
|
|
403
|
+
/** @public */
|
|
404
|
+
export interface DailyNotesPluginInstance extends InternalPluginInstance<DailyNotesPlugin> {
|
|
405
|
+
app: App;
|
|
406
|
+
defaultOn: boolean;
|
|
407
|
+
plugin: DailyNotesPlugin;
|
|
408
|
+
}
|
|
409
|
+
/** @public */
|
|
410
|
+
export interface EditorStatusPlugin extends InternalPlugin<EditorStatusPluginInstance> {
|
|
411
|
+
}
|
|
412
|
+
/** @public */
|
|
413
|
+
export interface EditorStatusPluginInstance extends InternalPluginInstance<EditorStatusPlugin> {
|
|
414
|
+
app: App;
|
|
415
|
+
defaultOn: boolean;
|
|
416
|
+
plugin: EditorStatusPlugin;
|
|
417
|
+
}
|
|
418
|
+
/** @todo Documentation incomplete */
|
|
419
|
+
/** @public */
|
|
420
|
+
export interface FileExplorerPlugin extends InternalPlugin<FileExplorerPluginInstance> {
|
|
421
|
+
/**
|
|
422
|
+
* Reveals a file or folder in the file explorer view, opens the view if it is not already
|
|
423
|
+
* open/visible
|
|
424
|
+
*/
|
|
425
|
+
revealInFolder(item: TFile | TFolder): void;
|
|
426
|
+
}
|
|
427
|
+
/** @todo Documentation incomplete */
|
|
428
|
+
/** @public */
|
|
429
|
+
export interface FileExplorerPluginInstance extends InternalPluginInstance<FileExplorerPlugin> {
|
|
430
|
+
app: App;
|
|
431
|
+
defaultOn: boolean;
|
|
432
|
+
plugin: FileExplorerPlugin;
|
|
433
|
+
/**
|
|
434
|
+
* Reveals a file or folder in the file explorer view, opens the view if it is not already
|
|
435
|
+
* open/visible
|
|
436
|
+
*/
|
|
437
|
+
revealInFolder(item: TFile | TFolder): void;
|
|
438
|
+
}
|
|
439
|
+
/** @public */
|
|
440
|
+
export interface FileRecoveryPlugin extends InternalPlugin<FileRecoveryPluginInstance> {
|
|
441
|
+
}
|
|
442
|
+
/** @public */
|
|
443
|
+
export interface FileRecoveryPluginInstance extends InternalPluginInstance<FileRecoveryPlugin> {
|
|
444
|
+
app: App;
|
|
445
|
+
defaultOn: boolean;
|
|
446
|
+
}
|
|
447
|
+
/** @todo Documentation incomplete */
|
|
448
|
+
/** @public */
|
|
449
|
+
export interface GlobalSearchPlugin extends InternalPlugin<GlobalSearchPluginInstance> {
|
|
450
|
+
}
|
|
451
|
+
/** @todo Documentation incomplete */
|
|
452
|
+
/** @public */
|
|
453
|
+
export interface GlobalSearchPluginInstance extends InternalPluginInstance<GlobalSearchPlugin> {
|
|
454
|
+
app: App;
|
|
455
|
+
defaultOn: boolean;
|
|
456
|
+
plugin: GlobalSearchPlugin;
|
|
457
|
+
}
|
|
458
|
+
/** @public */
|
|
459
|
+
export interface GraphPlugin extends InternalPlugin<GraphPluginInstance> {
|
|
460
|
+
}
|
|
461
|
+
/** @public */
|
|
462
|
+
export interface GraphPluginInstance extends InternalPluginInstance<GraphPlugin> {
|
|
463
|
+
app: App;
|
|
464
|
+
defaultOn: boolean;
|
|
465
|
+
plugin: GraphPlugin;
|
|
466
|
+
}
|
|
467
|
+
declare const InternalPluginName$1: {
|
|
468
|
+
readonly AudioRecorder: "audio-recorder";
|
|
469
|
+
readonly Backlink: "backlink";
|
|
470
|
+
readonly Bookmarks: "bookmarks";
|
|
471
|
+
readonly Canvas: "canvas";
|
|
472
|
+
readonly CommandPalette: "command-palette";
|
|
473
|
+
readonly DailyNotes: "daily-notes";
|
|
474
|
+
readonly EditorStatus: "editor-status";
|
|
475
|
+
readonly FileExplorer: "file-explorer";
|
|
476
|
+
readonly FileRecovery: "file-recovery";
|
|
477
|
+
readonly GlobalSearch: "global-search";
|
|
478
|
+
readonly Graph: "graph";
|
|
479
|
+
readonly MarkdownImporter: "markdown-importer";
|
|
480
|
+
readonly NoteComposer: "note-composer";
|
|
481
|
+
readonly OutgoingLink: "outgoing-link";
|
|
482
|
+
readonly Outline: "outline";
|
|
483
|
+
readonly PagePreview: "page-preview";
|
|
484
|
+
readonly Properties: "properties";
|
|
485
|
+
readonly Publish: "publish";
|
|
486
|
+
readonly RandomNote: "random-note";
|
|
487
|
+
readonly SlashCommand: "slash-command";
|
|
488
|
+
readonly Slides: "slides";
|
|
489
|
+
readonly Switcher: "switcher";
|
|
490
|
+
readonly Sync: "sync";
|
|
491
|
+
readonly TagPane: "tag-pane";
|
|
492
|
+
readonly Templates: "templates";
|
|
493
|
+
readonly WordCount: "word-count";
|
|
494
|
+
readonly Workspaces: "workspaces";
|
|
495
|
+
readonly ZkPrefixer: "zk-prefixer";
|
|
496
|
+
};
|
|
497
|
+
/** @public */
|
|
498
|
+
export interface MarkdownImporterPlugin extends InternalPlugin<MarkdownImporterPluginInstance> {
|
|
499
|
+
}
|
|
500
|
+
/** @public */
|
|
501
|
+
export interface MarkdownImporterPluginInstance extends InternalPluginInstance<MarkdownImporterPlugin> {
|
|
502
|
+
app: App;
|
|
503
|
+
}
|
|
504
|
+
/** @public */
|
|
505
|
+
export interface NoteComposerPlugin extends InternalPlugin<NoteComposerPluginInstance> {
|
|
506
|
+
}
|
|
507
|
+
/** @public */
|
|
508
|
+
export interface NoteComposerPluginInstance extends InternalPluginInstance<NoteComposerPlugin> {
|
|
509
|
+
app: App;
|
|
510
|
+
defaultOn: boolean;
|
|
511
|
+
}
|
|
512
|
+
/** @public */
|
|
513
|
+
export interface OutgoingLinkPlugin extends InternalPlugin<OutgoingLinkPluginInstance> {
|
|
514
|
+
}
|
|
515
|
+
/** @public */
|
|
516
|
+
export interface OutgoingLinkPluginInstance extends InternalPluginInstance<OutgoingLinkPlugin> {
|
|
517
|
+
app: App;
|
|
518
|
+
defaultOn: boolean;
|
|
519
|
+
plugin: OutgoingLinkPlugin;
|
|
520
|
+
}
|
|
521
|
+
/** @public */
|
|
522
|
+
export interface OutlinePlugin extends InternalPlugin<OutlinePluginInstance> {
|
|
523
|
+
}
|
|
524
|
+
/** @public */
|
|
525
|
+
export interface OutlinePluginInstance extends InternalPluginInstance<OutlinePlugin> {
|
|
526
|
+
app: App;
|
|
527
|
+
defaultOn: boolean;
|
|
528
|
+
plugin: OutlinePlugin;
|
|
529
|
+
}
|
|
530
|
+
/** @public */
|
|
531
|
+
export interface PagePreviewPlugin extends InternalPlugin<PagePreviewPluginInstance> {
|
|
532
|
+
}
|
|
533
|
+
/** @public */
|
|
534
|
+
export interface PagePreviewPluginInstance extends InternalPluginInstance<PagePreviewPlugin> {
|
|
535
|
+
app: App;
|
|
536
|
+
defaultOn: boolean;
|
|
537
|
+
}
|
|
538
|
+
/** @public */
|
|
539
|
+
export interface PropertiesPlugin extends InternalPlugin<PropertiesPluginInstance> {
|
|
540
|
+
}
|
|
541
|
+
/** @public */
|
|
542
|
+
export interface PropertiesPluginInstance extends InternalPluginInstance<PropertiesPlugin> {
|
|
543
|
+
app: App;
|
|
544
|
+
defaultOn: boolean;
|
|
545
|
+
plugin: PropertiesPlugin;
|
|
546
|
+
}
|
|
547
|
+
/** @public */
|
|
548
|
+
export interface PublishPlugin extends InternalPlugin<PublishPluginInstance> {
|
|
549
|
+
}
|
|
550
|
+
/** @public */
|
|
551
|
+
export interface PublishPluginInstance extends InternalPluginInstance<PublishPlugin> {
|
|
552
|
+
app: App;
|
|
553
|
+
plugin: PublishPlugin;
|
|
554
|
+
}
|
|
555
|
+
/** @public */
|
|
556
|
+
export interface RandomNotePlugin extends InternalPlugin<RandomNotePluginInstance> {
|
|
557
|
+
}
|
|
558
|
+
/** @public */
|
|
559
|
+
export interface RandomNotePluginInstance extends InternalPluginInstance<RandomNotePlugin> {
|
|
560
|
+
app: App;
|
|
561
|
+
}
|
|
562
|
+
/** @public */
|
|
563
|
+
export interface SlashCommandPlugin extends InternalPlugin<SlashCommandPluginInstance> {
|
|
564
|
+
}
|
|
565
|
+
/** @public */
|
|
566
|
+
export interface SlashCommandPluginInstance extends InternalPluginInstance<SlashCommandPlugin> {
|
|
567
|
+
defaultOn: boolean;
|
|
568
|
+
}
|
|
569
|
+
/** @public */
|
|
570
|
+
export interface SlidesPlugin extends InternalPlugin<SlidesPluginInstance> {
|
|
571
|
+
}
|
|
572
|
+
/** @public */
|
|
573
|
+
export interface SlidesPluginInstance extends InternalPluginInstance<SlidesPlugin> {
|
|
574
|
+
app: App;
|
|
575
|
+
}
|
|
576
|
+
/** @public */
|
|
577
|
+
export interface SwitcherPlugin extends InternalPlugin<SwitcherPluginInstance> {
|
|
578
|
+
}
|
|
579
|
+
/** @public */
|
|
580
|
+
export interface SwitcherPluginInstance extends InternalPluginInstance<SwitcherPlugin> {
|
|
581
|
+
app: App;
|
|
582
|
+
defaultOn: boolean;
|
|
583
|
+
plugin: SwitcherPlugin;
|
|
584
|
+
}
|
|
585
|
+
/** @public */
|
|
586
|
+
export interface SyncPlugin extends InternalPlugin<SyncPluginInstance> {
|
|
587
|
+
}
|
|
588
|
+
/** @public */
|
|
589
|
+
export interface SyncPluginInstance extends InternalPluginInstance<SyncPlugin> {
|
|
590
|
+
app: App;
|
|
591
|
+
plugin: SyncPlugin;
|
|
592
|
+
}
|
|
593
|
+
/** @public */
|
|
594
|
+
export interface TagPanePlugin extends InternalPlugin<TagPanePluginInstance> {
|
|
595
|
+
}
|
|
596
|
+
/** @public */
|
|
597
|
+
export interface TagPanePluginInstance extends InternalPluginInstance<TagPanePlugin> {
|
|
598
|
+
app: App;
|
|
599
|
+
defaultOn: boolean;
|
|
600
|
+
plugin: TagPanePlugin;
|
|
601
|
+
}
|
|
602
|
+
/** @public */
|
|
603
|
+
export interface TemplatesPlugin extends InternalPlugin<TemplatesPluginInstance> {
|
|
604
|
+
}
|
|
605
|
+
/** @public */
|
|
606
|
+
export interface TemplatesPluginInstance extends InternalPluginInstance<TemplatesPlugin> {
|
|
607
|
+
app: App;
|
|
608
|
+
defaultOn: boolean;
|
|
609
|
+
plugin: TemplatesPlugin;
|
|
610
|
+
}
|
|
611
|
+
/** @public */
|
|
612
|
+
export interface WordCountPlugin extends InternalPlugin<WordCountPluginInstance> {
|
|
613
|
+
}
|
|
614
|
+
/** @public */
|
|
615
|
+
export interface WordCountPluginInstance extends InternalPluginInstance<WordCountPlugin> {
|
|
616
|
+
app: App;
|
|
617
|
+
defaultOn: boolean;
|
|
618
|
+
plugin: WordCountPlugin;
|
|
619
|
+
}
|
|
620
|
+
/** @public */
|
|
621
|
+
export interface WorkspacesPlugin extends InternalPlugin<WorkspacesPluginInstance> {
|
|
622
|
+
}
|
|
623
|
+
/** @public */
|
|
624
|
+
export interface WorkspacesPluginInstance extends InternalPluginInstance<WorkspacesPlugin> {
|
|
625
|
+
app: App;
|
|
626
|
+
plugin: WorkspacesPlugin;
|
|
627
|
+
}
|
|
628
|
+
/** @public */
|
|
629
|
+
export interface ZkPrefixerPlugin extends InternalPlugin<ZkPrefixerPluginInstance> {
|
|
630
|
+
}
|
|
631
|
+
/** @public */
|
|
632
|
+
export interface ZkPrefixerPluginInstance extends InternalPluginInstance<ZkPrefixerPlugin> {
|
|
633
|
+
app: App;
|
|
634
|
+
plugin: ZkPrefixerPlugin;
|
|
635
|
+
}
|
|
636
|
+
/** @public */
|
|
637
|
+
export type InternalPluginNameInstancesMapping = {
|
|
638
|
+
[InternalPluginName$1.AudioRecorder]: AudioRecorderPluginInstance;
|
|
639
|
+
[InternalPluginName$1.Backlink]: BacklinkPluginInstance;
|
|
640
|
+
[InternalPluginName$1.Bookmarks]: BookmarksPluginInstance;
|
|
641
|
+
[InternalPluginName$1.Canvas]: CanvasPluginInstance;
|
|
642
|
+
[InternalPluginName$1.CommandPalette]: CommandPalettePluginInstance;
|
|
643
|
+
[InternalPluginName$1.DailyNotes]: DailyNotesPluginInstance;
|
|
644
|
+
[InternalPluginName$1.EditorStatus]: EditorStatusPluginInstance;
|
|
645
|
+
[InternalPluginName$1.FileExplorer]: FileExplorerPluginInstance;
|
|
646
|
+
[InternalPluginName$1.FileRecovery]: FileRecoveryPluginInstance;
|
|
647
|
+
[InternalPluginName$1.GlobalSearch]: GlobalSearchPluginInstance;
|
|
648
|
+
[InternalPluginName$1.Graph]: GraphPluginInstance;
|
|
649
|
+
[InternalPluginName$1.MarkdownImporter]: MarkdownImporterPluginInstance;
|
|
650
|
+
[InternalPluginName$1.NoteComposer]: NoteComposerPluginInstance;
|
|
651
|
+
[InternalPluginName$1.OutgoingLink]: OutgoingLinkPluginInstance;
|
|
652
|
+
[InternalPluginName$1.Outline]: OutlinePluginInstance;
|
|
653
|
+
[InternalPluginName$1.PagePreview]: PagePreviewPluginInstance;
|
|
654
|
+
[InternalPluginName$1.Properties]: PropertiesPluginInstance;
|
|
655
|
+
[InternalPluginName$1.Publish]: PublishPluginInstance;
|
|
656
|
+
[InternalPluginName$1.RandomNote]: RandomNotePluginInstance;
|
|
657
|
+
[InternalPluginName$1.SlashCommand]: SlashCommandPluginInstance;
|
|
658
|
+
[InternalPluginName$1.Slides]: SlidesPluginInstance;
|
|
659
|
+
[InternalPluginName$1.Switcher]: SwitcherPluginInstance;
|
|
660
|
+
[InternalPluginName$1.Sync]: SyncPluginInstance;
|
|
661
|
+
[InternalPluginName$1.TagPane]: TagPanePluginInstance;
|
|
662
|
+
[InternalPluginName$1.Templates]: TemplatesPluginInstance;
|
|
663
|
+
[InternalPluginName$1.WordCount]: WordCountPluginInstance;
|
|
664
|
+
[InternalPluginName$1.Workspaces]: WorkspacesPluginInstance;
|
|
665
|
+
[InternalPluginName$1.ZkPrefixer]: ZkPrefixerPluginInstance;
|
|
666
|
+
};
|
|
667
|
+
/** @public */
|
|
668
|
+
export type InternalPluginNamePluginsMapping = {
|
|
669
|
+
[InternalPluginName$1.AudioRecorder]: AudioRecorderPlugin;
|
|
670
|
+
[InternalPluginName$1.Backlink]: BacklinkPlugin;
|
|
671
|
+
[InternalPluginName$1.Bookmarks]: BookmarksPlugin;
|
|
672
|
+
[InternalPluginName$1.Canvas]: CanvasPlugin;
|
|
673
|
+
[InternalPluginName$1.CommandPalette]: CommandPalettePlugin;
|
|
674
|
+
[InternalPluginName$1.DailyNotes]: DailyNotesPlugin;
|
|
675
|
+
[InternalPluginName$1.EditorStatus]: EditorStatusPlugin;
|
|
676
|
+
[InternalPluginName$1.FileExplorer]: FileExplorerPlugin;
|
|
677
|
+
[InternalPluginName$1.FileRecovery]: FileRecoveryPlugin;
|
|
678
|
+
[InternalPluginName$1.GlobalSearch]: GlobalSearchPlugin;
|
|
679
|
+
[InternalPluginName$1.Graph]: GraphPlugin;
|
|
680
|
+
[InternalPluginName$1.MarkdownImporter]: MarkdownImporterPlugin;
|
|
681
|
+
[InternalPluginName$1.NoteComposer]: NoteComposerPlugin;
|
|
682
|
+
[InternalPluginName$1.OutgoingLink]: OutgoingLinkPlugin;
|
|
683
|
+
[InternalPluginName$1.Outline]: OutlinePlugin;
|
|
684
|
+
[InternalPluginName$1.PagePreview]: PagePreviewPlugin;
|
|
685
|
+
[InternalPluginName$1.Properties]: PropertiesPlugin;
|
|
686
|
+
[InternalPluginName$1.Publish]: PublishPlugin;
|
|
687
|
+
[InternalPluginName$1.RandomNote]: RandomNotePlugin;
|
|
688
|
+
[InternalPluginName$1.SlashCommand]: SlashCommandPlugin;
|
|
689
|
+
[InternalPluginName$1.Slides]: SlidesPlugin;
|
|
690
|
+
[InternalPluginName$1.Switcher]: SwitcherPlugin;
|
|
691
|
+
[InternalPluginName$1.Sync]: SyncPlugin;
|
|
692
|
+
[InternalPluginName$1.TagPane]: TagPanePlugin;
|
|
693
|
+
[InternalPluginName$1.Templates]: TemplatesPlugin;
|
|
694
|
+
[InternalPluginName$1.WordCount]: WordCountPlugin;
|
|
695
|
+
[InternalPluginName$1.Workspaces]: WorkspacesPlugin;
|
|
696
|
+
[InternalPluginName$1.ZkPrefixer]: ZkPrefixerPlugin;
|
|
697
|
+
};
|
|
698
|
+
/** @public */
|
|
699
|
+
export type InternalPluginNameType = (typeof InternalPluginName$1)[keyof typeof InternalPluginName$1];
|
|
700
|
+
/** @public */
|
|
701
|
+
export interface InternalPluginsConfigRecord extends Record<InternalPluginNameType, boolean> {
|
|
702
|
+
}
|
|
703
|
+
/** @public */
|
|
704
|
+
export interface InternalPlugins extends Events {
|
|
705
|
+
/**
|
|
706
|
+
* Reference to App
|
|
707
|
+
*/
|
|
708
|
+
app: App;
|
|
709
|
+
/**
|
|
710
|
+
* Mapping of whether an internal plugin is enabled
|
|
711
|
+
*/
|
|
712
|
+
config: InternalPluginsConfigRecord;
|
|
713
|
+
/**
|
|
714
|
+
* Plugin configs for internal plugins
|
|
715
|
+
*
|
|
716
|
+
* @remark Prefer usage of getPluginById to access a plugin
|
|
717
|
+
*/
|
|
718
|
+
plugins: {
|
|
719
|
+
[ID in InternalPluginNameType]: InternalPluginNamePluginsMapping[ID];
|
|
720
|
+
};
|
|
721
|
+
/** @internal Request save of plugin configs */
|
|
722
|
+
requestSaveConfig: Debouncer<[
|
|
723
|
+
], Promise<void>>;
|
|
724
|
+
/** @internal - Load plugin configs and enable plugins */
|
|
725
|
+
enable(): Promise<void>;
|
|
726
|
+
/**
|
|
727
|
+
* Get an enabled internal plugin by ID
|
|
728
|
+
*
|
|
729
|
+
* @param id - ID of the plugin to get
|
|
730
|
+
*/
|
|
731
|
+
getEnabledPluginById<ID extends InternalPluginNameType>(id: ID): InternalPluginNameInstancesMapping[ID] | null;
|
|
732
|
+
/**
|
|
733
|
+
* Get all enabled internal plugins
|
|
734
|
+
*/
|
|
735
|
+
getEnabledPlugins(): InternalPlugin<unknown>[];
|
|
736
|
+
/**
|
|
737
|
+
* Get an internal plugin by ID
|
|
738
|
+
*
|
|
739
|
+
* @param id - ID of the plugin to get
|
|
740
|
+
*/
|
|
741
|
+
getPluginById<ID extends InternalPluginNameType>(id: ID): InternalPluginNamePluginsMapping[ID] | null;
|
|
742
|
+
/** @internal */
|
|
743
|
+
loadPlugin<Instance extends InternalPluginInstance<unknown>>(internalPluginInstance: Instance): Instance;
|
|
744
|
+
/** @internal */
|
|
745
|
+
onRaw(configPath: string): void;
|
|
746
|
+
/** @internal - Save current plugin configs */
|
|
747
|
+
saveConfig(): Promise<void>;
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* Constructs a new InternalPlugins instance.
|
|
751
|
+
*
|
|
752
|
+
* @param app - The app instance.
|
|
753
|
+
* @returns The constructed InternalPlugins instance.
|
|
754
|
+
*/
|
|
755
|
+
export declare function constructInternalPlugins(app: App): InternalPlugins;
|
|
756
|
+
/**
|
|
757
|
+
* Constructs a new InternalPlugin instance.
|
|
758
|
+
*
|
|
759
|
+
* @param app - The app instance.
|
|
760
|
+
* @param instance - The instance of the plugin.
|
|
761
|
+
* @param internalPlugins - The internal plugins instance.
|
|
762
|
+
* @returns The constructed InternalPlugin instance.
|
|
763
|
+
*/
|
|
764
|
+
export declare function constructInternalPlugin<Instance>(app: App, instance: Instance, internalPlugins: InternalPlugins): InternalPlugin<Instance>;
|
|
765
|
+
/**
|
|
766
|
+
* Constructs a new App instance.
|
|
767
|
+
*
|
|
768
|
+
* @param adapter - The data adapter to use.
|
|
769
|
+
* @param appId - The ID of the app.
|
|
770
|
+
* @returns The constructed App instance.
|
|
771
|
+
*/
|
|
772
|
+
export declare function constructApp(adapter: DataAdapter, appId: string): App;
|
|
773
|
+
/**
|
|
774
|
+
* Constructs a new TFile instance.
|
|
775
|
+
*
|
|
776
|
+
* @param vault - The vault to which the file belongs.
|
|
777
|
+
* @param path - The path of the file.
|
|
778
|
+
* @returns The constructed TFile instance.
|
|
779
|
+
*/
|
|
780
|
+
export declare function constructTFile(vault: Vault, path: string): TFile;
|
|
781
|
+
/** @public */
|
|
782
|
+
export interface EditorViewState {
|
|
783
|
+
printing: boolean;
|
|
784
|
+
}
|
|
785
|
+
/** @todo Documentation incomplete */
|
|
786
|
+
/** @public */
|
|
787
|
+
export interface VimState {
|
|
788
|
+
vim: {
|
|
789
|
+
inputState: {
|
|
790
|
+
changeQueue: null;
|
|
791
|
+
keyBuffer: [
|
|
792
|
+
];
|
|
793
|
+
motion: null;
|
|
794
|
+
motionArgs: null;
|
|
795
|
+
motionRepeat: [
|
|
796
|
+
];
|
|
797
|
+
operator: null;
|
|
798
|
+
operatorArgs: null;
|
|
799
|
+
prefixRepeat: [
|
|
800
|
+
];
|
|
801
|
+
registerName: null;
|
|
802
|
+
};
|
|
803
|
+
insertMode: false;
|
|
804
|
+
insertModeRepeat: undefined;
|
|
805
|
+
lastEditActionCommand: undefined;
|
|
806
|
+
lastEditInputState: undefined;
|
|
807
|
+
lastHPos: number;
|
|
808
|
+
lastHSPos: number;
|
|
809
|
+
lastMotion: {
|
|
810
|
+
name?: string;
|
|
811
|
+
};
|
|
812
|
+
lastPastedText: null;
|
|
813
|
+
lastSelection: null;
|
|
814
|
+
};
|
|
815
|
+
vimPlugin: {
|
|
816
|
+
lastKeydown: string;
|
|
817
|
+
};
|
|
818
|
+
}
|
|
819
|
+
/** @todo Documentation incomplete */
|
|
820
|
+
/** @public */
|
|
821
|
+
export interface VimEditor {
|
|
822
|
+
state: VimState;
|
|
823
|
+
}
|
|
824
|
+
/** @public */
|
|
825
|
+
export interface AppVaultConfigHotkeysRecord extends Record<string, string> {
|
|
826
|
+
}
|
|
827
|
+
/** @public */
|
|
828
|
+
export interface AppVaultConfig {
|
|
829
|
+
/**
|
|
830
|
+
* Appearance \> Accent color
|
|
831
|
+
*/
|
|
832
|
+
accentColor: "" | string;
|
|
833
|
+
/**
|
|
834
|
+
* Files & Links \> Automatically update internal links
|
|
835
|
+
*/
|
|
836
|
+
alwaysUpdateLinks?: false | boolean;
|
|
837
|
+
/**
|
|
838
|
+
* Files & Links \> Attachment folder path
|
|
839
|
+
*/
|
|
840
|
+
attachmentFolderPath?: "/" | string;
|
|
841
|
+
/**
|
|
842
|
+
* Editor \> Auto convert HTML
|
|
843
|
+
*/
|
|
844
|
+
autoConvertHtml?: true | boolean;
|
|
845
|
+
/**
|
|
846
|
+
* Editor \> Auto pair brackets
|
|
847
|
+
*/
|
|
848
|
+
autoPairBrackets?: true | boolean;
|
|
849
|
+
/**
|
|
850
|
+
* Editor \> Auto pair Markdown syntax
|
|
851
|
+
*/
|
|
852
|
+
autoPairMarkdown?: true | boolean;
|
|
853
|
+
/**
|
|
854
|
+
* Appearance \> Font size
|
|
855
|
+
*/
|
|
856
|
+
baseFontSize?: 16 | number;
|
|
857
|
+
/**
|
|
858
|
+
* Appearance \> Quick font size adjustment
|
|
859
|
+
*/
|
|
860
|
+
baseFontSizeAction?: true | boolean;
|
|
861
|
+
/**
|
|
862
|
+
* Community Plugins \> Browse \> Sort order
|
|
863
|
+
*/
|
|
864
|
+
communityPluginSortOrder: "download" | "update" | "release" | "alphabetical";
|
|
865
|
+
/**
|
|
866
|
+
* Themes \> Browse \> Sort order
|
|
867
|
+
*/
|
|
868
|
+
communityThemeSortOrder: "download" | "update" | "release" | "alphabetical";
|
|
869
|
+
/**
|
|
870
|
+
* Appearance \> Theme
|
|
871
|
+
*
|
|
872
|
+
* @remark is the default Obsidian theme
|
|
873
|
+
*/
|
|
874
|
+
cssTheme?: "" | string;
|
|
875
|
+
/**
|
|
876
|
+
* Editor \> Default view for new tabs
|
|
877
|
+
*/
|
|
878
|
+
defaultViewMode?: "source" | "preview";
|
|
879
|
+
emacsyKeys?: true | boolean;
|
|
880
|
+
/**
|
|
881
|
+
* Appearance \> CSS snippets
|
|
882
|
+
*/
|
|
883
|
+
enabledCssSnippets?: string[];
|
|
884
|
+
fileSortOrder?: "alphabetical";
|
|
885
|
+
/**
|
|
886
|
+
* Editor \> Always focus new tabs
|
|
887
|
+
*/
|
|
888
|
+
focusNewTab?: true | boolean;
|
|
889
|
+
/**
|
|
890
|
+
* Editor \> Fold heading
|
|
891
|
+
*/
|
|
892
|
+
foldHeading?: true | boolean;
|
|
893
|
+
/**
|
|
894
|
+
* Editor \> Fold indent
|
|
895
|
+
*/
|
|
896
|
+
foldIndent?: true | boolean;
|
|
897
|
+
/**
|
|
898
|
+
* Hotkeys
|
|
899
|
+
*
|
|
900
|
+
* @deprecated Likely not used anymore
|
|
901
|
+
*/
|
|
902
|
+
hotkeys?: AppVaultConfigHotkeysRecord;
|
|
903
|
+
/**
|
|
904
|
+
* Appearance \> Interface font
|
|
905
|
+
*/
|
|
906
|
+
interfaceFontFamily?: "" | string;
|
|
907
|
+
/**
|
|
908
|
+
* Editor \> Use legacy editor
|
|
909
|
+
*/
|
|
910
|
+
legacyEditor?: false | boolean;
|
|
911
|
+
livePreview?: true | boolean;
|
|
912
|
+
/**
|
|
913
|
+
* Mobile \> Configure mobile Quick Action
|
|
914
|
+
*/
|
|
915
|
+
mobilePullAction?: "command-palette:open" | string;
|
|
916
|
+
mobileQuickRibbonItem?: "" | string;
|
|
917
|
+
/**
|
|
918
|
+
* Mobile \> Manage toolbar options
|
|
919
|
+
*/
|
|
920
|
+
mobileToolbarCommands?: string[];
|
|
921
|
+
monospaceFontFamily?: "" | string;
|
|
922
|
+
/**
|
|
923
|
+
* Appearance \> Native menus
|
|
924
|
+
*/
|
|
925
|
+
nativeMenus?: null | boolean;
|
|
926
|
+
/**
|
|
927
|
+
* Files & Links \> Default location for new notes | 'folder' \> Folder to create new notes in
|
|
928
|
+
*/
|
|
929
|
+
newFileFolderPath?: "/" | string;
|
|
930
|
+
/**
|
|
931
|
+
* Files & Links \> Default location for new notes
|
|
932
|
+
*/
|
|
933
|
+
newFileLocation?: "root" | "current" | "folder";
|
|
934
|
+
/**
|
|
935
|
+
* Files & Links \> New link format
|
|
936
|
+
*/
|
|
937
|
+
newLinkFormat?: "shortest" | "relative" | "absolute";
|
|
938
|
+
/**
|
|
939
|
+
* Saved on executing 'Export to PDF' command
|
|
940
|
+
*/
|
|
941
|
+
pdfExportSettings?: {
|
|
942
|
+
pageSize: "letter" | string;
|
|
943
|
+
landscape: false | boolean;
|
|
944
|
+
margin: "0" | string;
|
|
945
|
+
downscalePercent: 100 | number;
|
|
946
|
+
};
|
|
947
|
+
/**
|
|
948
|
+
* Files & Links \> Confirm line deletion
|
|
949
|
+
*/
|
|
950
|
+
promptDelete?: true | boolean;
|
|
951
|
+
/**
|
|
952
|
+
* Editor \> Properties in document
|
|
953
|
+
*/
|
|
954
|
+
propertiesInDocument?: "visible" | "hidden" | "source";
|
|
955
|
+
/**
|
|
956
|
+
* Editor \> Readable line length
|
|
957
|
+
*/
|
|
958
|
+
readableLineLength?: true | boolean;
|
|
959
|
+
/**
|
|
960
|
+
* Editor \> Right-to-left (RTL)
|
|
961
|
+
*/
|
|
962
|
+
rightToLeft?: false | boolean;
|
|
963
|
+
/** @deprecated Removed as of version 1.4.3 */
|
|
964
|
+
showFrontmatter?: false | boolean;
|
|
965
|
+
/**
|
|
966
|
+
* Editor \> Show indentation guides
|
|
967
|
+
*/
|
|
968
|
+
showIndentGuide?: true | boolean;
|
|
969
|
+
/**
|
|
970
|
+
* Editor \> Show inline title
|
|
971
|
+
*/
|
|
972
|
+
showInlineTitle?: true | boolean;
|
|
973
|
+
/**
|
|
974
|
+
* Editor \> Show line numbers
|
|
975
|
+
*/
|
|
976
|
+
showLineNumber?: false | boolean;
|
|
977
|
+
/**
|
|
978
|
+
* Appearance \> Show ribbon
|
|
979
|
+
*/
|
|
980
|
+
showRibbon?: true | boolean;
|
|
981
|
+
/**
|
|
982
|
+
* Files & Links \> Detect all file extensions
|
|
983
|
+
*/
|
|
984
|
+
showUnsupportedFiles?: false | boolean;
|
|
985
|
+
/**
|
|
986
|
+
* Appearance \> Show tab title bar
|
|
987
|
+
*/
|
|
988
|
+
showViewHeader?: false | boolean;
|
|
989
|
+
/**
|
|
990
|
+
* Editor \> Smart indent lists
|
|
991
|
+
*/
|
|
992
|
+
smartIndentList?: true | boolean;
|
|
993
|
+
/**
|
|
994
|
+
* Editor \> Spellcheck
|
|
995
|
+
*/
|
|
996
|
+
spellcheck?: false | boolean;
|
|
997
|
+
/**
|
|
998
|
+
* @deprecated Deprecated
|
|
999
|
+
* @todo
|
|
1000
|
+
*/
|
|
1001
|
+
spellcheckDictionary?: [
|
|
1002
|
+
] | string[];
|
|
1003
|
+
/**
|
|
1004
|
+
* Editor \> Spellcheck languages
|
|
1005
|
+
*/
|
|
1006
|
+
spellcheckLanguages?: null | string[];
|
|
1007
|
+
/**
|
|
1008
|
+
* Editor \> Strict line breaks
|
|
1009
|
+
*/
|
|
1010
|
+
strictLineBreaks?: false | boolean;
|
|
1011
|
+
/**
|
|
1012
|
+
* Editor \> Tab indent size
|
|
1013
|
+
*/
|
|
1014
|
+
tabSize?: 4 | number;
|
|
1015
|
+
/**
|
|
1016
|
+
* Appearance \> Text font
|
|
1017
|
+
*/
|
|
1018
|
+
textFontFamily?: "" | string;
|
|
1019
|
+
/**
|
|
1020
|
+
* Appearance \> Base color scheme
|
|
1021
|
+
*
|
|
1022
|
+
* @remark Not be confused with cssTheme, this setting is for the light/dark mode
|
|
1023
|
+
* @remark moonstone is light theme, 'obsidian' is dark theme
|
|
1024
|
+
*/
|
|
1025
|
+
theme?: "moonstone" | "obsidian";
|
|
1026
|
+
/**
|
|
1027
|
+
* Appearance \> Translucent window
|
|
1028
|
+
*/
|
|
1029
|
+
translucency?: false | boolean;
|
|
1030
|
+
/**
|
|
1031
|
+
* Files & Links \> Deleted files
|
|
1032
|
+
*/
|
|
1033
|
+
trashOption?: "system" | "local" | "none";
|
|
1034
|
+
/** @deprecated Probably left-over code from old properties type storage */
|
|
1035
|
+
types: object;
|
|
1036
|
+
/**
|
|
1037
|
+
* Files & Links \> Use [[Wikilinks]]
|
|
1038
|
+
*/
|
|
1039
|
+
useMarkdownLinks?: false | boolean;
|
|
1040
|
+
/**
|
|
1041
|
+
* Files & Links \> Excluded files
|
|
1042
|
+
*/
|
|
1043
|
+
userIgnoreFilters?: null | string[];
|
|
1044
|
+
/**
|
|
1045
|
+
* Editor \> Indent using tabs
|
|
1046
|
+
*/
|
|
1047
|
+
useTab?: true | boolean;
|
|
1048
|
+
/**
|
|
1049
|
+
* Editor \> Vim key bindings
|
|
1050
|
+
*/
|
|
1051
|
+
vimMode?: false | boolean;
|
|
1052
|
+
}
|
|
1053
|
+
/** @todo Documentation incomplete */
|
|
1054
|
+
/** @public */
|
|
1055
|
+
export type ConfigItem = "accentColor" | "alwaysUpdateLinks" | "attachmentFolderPath" | "autoConvertHtml" | "autoPairBrackets" | "autoPairMarkdown" | "baseFontSize" | "baseFontSizeAction" | "cssTheme" | "defaultViewMode" | "enabledCssSnippets" | "focusNewTab" | "foldHeading" | "foldIndent" | "hotkeys" | "interfaceFontFamily" | "livePreview" | "mobilePullAction" | "mobileQuickRibbonItem" | "mobileToolbarCommands" | "monospaceFontFamily" | "nativeMenus" | "newFileFolderPath" | "newFileLocation" | "newLinkFormat" | "pdfExportSettings" | "promptDelete" | "propertiesInDocument" | "readableLineLength" | "rightToLeft" | "showIndentGuide" | "showInlineTitle" | "showLineNumber" | "showRibbon" | "showUnsupportedFiles" | "showViewHeader" | "smartIndentList" | "spellcheck" | "spellcheckLanguages" | "strictLineBreaks" | "tabSize" | "textFontFamily" | "theme" | "translucency" | "trashOption" | "types" | "uriCallbacks" | "useMarkdownLinks" | "useTab" | "userIgnoreFilters" | "vimMode";
|
|
1056
|
+
/** @public */
|
|
1057
|
+
export type FileSystemWatchHandler = (eventType: string, path: string, oldPath?: string, stats?: FileStats) => void;
|
|
1058
|
+
/** @public */
|
|
1059
|
+
export interface VaultFileMapRecord extends Record<string, TAbstractFile> {
|
|
1060
|
+
}
|
|
1061
|
+
/** @public */
|
|
1062
|
+
export interface SerializedWorkspaceItem {
|
|
1063
|
+
dimension?: number;
|
|
1064
|
+
id: string;
|
|
1065
|
+
type: string;
|
|
1066
|
+
}
|
|
1067
|
+
/** @public */
|
|
1068
|
+
export interface AppMenuBarManager {
|
|
1069
|
+
app: App;
|
|
1070
|
+
constructor: {
|
|
1071
|
+
updateMenuItems(arg1: unknown, arg2: unknown): unknown;
|
|
1072
|
+
};
|
|
1073
|
+
onLayoutChange: Debouncer<[
|
|
1074
|
+
], unknown>;
|
|
1075
|
+
onWindowFrameChange: Debouncer<[
|
|
1076
|
+
], unknown>;
|
|
1077
|
+
requestRender: Debouncer<[
|
|
1078
|
+
], unknown>;
|
|
1079
|
+
_onLayoutChange(): unknown;
|
|
1080
|
+
applyHotkeys(arg1: unknown): unknown;
|
|
1081
|
+
buildMenu(): unknown;
|
|
1082
|
+
getAcceleratorFromHotkey(arg1: unknown): unknown;
|
|
1083
|
+
hideUnregisteredCommands(arg1: unknown): unknown;
|
|
1084
|
+
render(): unknown;
|
|
1085
|
+
updateShareMenuItem(arg1: unknown): unknown;
|
|
1086
|
+
updateViewState(): unknown;
|
|
1087
|
+
updateWorkspace(): unknown;
|
|
1088
|
+
}
|
|
1089
|
+
/** @public */
|
|
1090
|
+
export interface HotkeysSettingTab extends SettingTab {
|
|
1091
|
+
searchComponent: SearchComponent;
|
|
1092
|
+
updateHotkeyVisibility(): void;
|
|
1093
|
+
}
|
|
1094
|
+
/** @public */
|
|
1095
|
+
export interface AppSetting extends Modal {
|
|
1096
|
+
/**
|
|
1097
|
+
* Current active tab of the settings modal
|
|
1098
|
+
*/
|
|
1099
|
+
activeTab: SettingTab | null;
|
|
1100
|
+
/**
|
|
1101
|
+
* Closeable component for the active tab
|
|
1102
|
+
*/
|
|
1103
|
+
activeTabCloseable: CloseableComponent | null;
|
|
1104
|
+
/** @internal Container element containing the community plugins */
|
|
1105
|
+
communityPluginTabContainer: HTMLElement;
|
|
1106
|
+
/** @internal Container element containing the community plugins header */
|
|
1107
|
+
communityPluginTabHeaderGroup: HTMLElement;
|
|
1108
|
+
/** @internal Container element containing the core plugins */
|
|
1109
|
+
corePluginTabContainer: HTMLElement;
|
|
1110
|
+
/** @internal Container element containing the core plugins header */
|
|
1111
|
+
corePluginTabHeaderGroup: HTMLElement;
|
|
1112
|
+
/**
|
|
1113
|
+
* Previously opened tab ID
|
|
1114
|
+
*/
|
|
1115
|
+
lastTabId: string;
|
|
1116
|
+
/**
|
|
1117
|
+
* List of all plugin tabs (core and community, ordered by precedence)
|
|
1118
|
+
*/
|
|
1119
|
+
pluginTabs: SettingTab[];
|
|
1120
|
+
/**
|
|
1121
|
+
* List of all core settings tabs (editor, files & links, ...)
|
|
1122
|
+
*/
|
|
1123
|
+
settingTabs: SettingTab[];
|
|
1124
|
+
/** @internal Container element containing the core settings */
|
|
1125
|
+
tabContainer: HTMLElement;
|
|
1126
|
+
/** @internal Container for currently active settings tab */
|
|
1127
|
+
tabContentContainer: HTMLElement;
|
|
1128
|
+
/** @internal Container for all settings tabs */
|
|
1129
|
+
tabHeadersEl: HTMLElement;
|
|
1130
|
+
/**
|
|
1131
|
+
* @param tab - Tab to add
|
|
1132
|
+
* @internal Add a new plugin tab to the settings modal
|
|
1133
|
+
*/
|
|
1134
|
+
addSettingTab(tab: SettingTab): void;
|
|
1135
|
+
/** @internal Closes the currently active tab */
|
|
1136
|
+
closeActiveTab(): void;
|
|
1137
|
+
/**
|
|
1138
|
+
* @param tab - Tab to check
|
|
1139
|
+
* @internal Check whether tab is a plugin tab
|
|
1140
|
+
*/
|
|
1141
|
+
isPluginSettingTab(tab: SettingTab): boolean;
|
|
1142
|
+
/**
|
|
1143
|
+
* @param tab - Tab to open
|
|
1144
|
+
* @internal Open a specific tab by tab reference
|
|
1145
|
+
*/
|
|
1146
|
+
openTab(tab: SettingTab): void;
|
|
1147
|
+
openTabById(id: "hotkeys"): HotkeysSettingTab;
|
|
1148
|
+
/**
|
|
1149
|
+
* Open a specific tab by ID
|
|
1150
|
+
*
|
|
1151
|
+
* @param id - ID of the tab to open
|
|
1152
|
+
*/
|
|
1153
|
+
openTabById(id: string): SettingTab;
|
|
1154
|
+
/**
|
|
1155
|
+
* @param tab - Tab to remove
|
|
1156
|
+
* @internal Remove a plugin tab from the settings modal
|
|
1157
|
+
*/
|
|
1158
|
+
removeSettingTab(tab: SettingTab): void;
|
|
1159
|
+
/**
|
|
1160
|
+
* @param tab - Tab to update the title to
|
|
1161
|
+
* @internal Update the title of the modal
|
|
1162
|
+
*/
|
|
1163
|
+
updateModalTitle(tab: SettingTab): void;
|
|
1164
|
+
/** @internal Update a tab section */
|
|
1165
|
+
updatePluginSection(): void;
|
|
1166
|
+
}
|
|
1167
|
+
/** @public */
|
|
1168
|
+
export interface CommandsCommandsRecord extends Record<string, Command> {
|
|
1169
|
+
}
|
|
1170
|
+
/** @public */
|
|
1171
|
+
export interface CommandsEditorCommandsRecord extends Record<string, Command> {
|
|
1172
|
+
}
|
|
1173
|
+
/** @public */
|
|
1174
|
+
export interface Commands {
|
|
1175
|
+
/**
|
|
1176
|
+
* Reference to App
|
|
1177
|
+
*/
|
|
1178
|
+
app: App;
|
|
1179
|
+
/**
|
|
1180
|
+
* Commands *without* editor callback, will always be available in the command palette
|
|
1181
|
+
*
|
|
1182
|
+
* @example
|
|
1183
|
+
* `app:open-vault` or `app:reload`
|
|
1184
|
+
*/
|
|
1185
|
+
commands: CommandsCommandsRecord;
|
|
1186
|
+
/**
|
|
1187
|
+
* Commands *with* editor callback, will only be available when editor is active and callback returns
|
|
1188
|
+
* true
|
|
1189
|
+
*
|
|
1190
|
+
* @example
|
|
1191
|
+
* `editor:fold-all` or `command-palette:open`
|
|
1192
|
+
*/
|
|
1193
|
+
editorCommands: CommandsEditorCommandsRecord;
|
|
1194
|
+
/**
|
|
1195
|
+
* Add a command to the command registry
|
|
1196
|
+
*
|
|
1197
|
+
* @param command - Command to add
|
|
1198
|
+
*/
|
|
1199
|
+
addCommand(command: Command): void;
|
|
1200
|
+
/**
|
|
1201
|
+
* Execute a command by reference
|
|
1202
|
+
*
|
|
1203
|
+
* @param command - Command to execute
|
|
1204
|
+
*/
|
|
1205
|
+
executeCommand(command: Command): boolean;
|
|
1206
|
+
/**
|
|
1207
|
+
* Execute a command by ID
|
|
1208
|
+
*
|
|
1209
|
+
* @param commandId - ID of command to execute
|
|
1210
|
+
*/
|
|
1211
|
+
executeCommandById(commandId: string): boolean;
|
|
1212
|
+
/**
|
|
1213
|
+
* Find a command by ID
|
|
1214
|
+
*
|
|
1215
|
+
* @param commandId - ID of command to find
|
|
1216
|
+
*/
|
|
1217
|
+
findCommand(commandId: string): Command | undefined;
|
|
1218
|
+
/**
|
|
1219
|
+
* Lists **all** commands, both with and without editor callback
|
|
1220
|
+
*/
|
|
1221
|
+
listCommands(): Command[];
|
|
1222
|
+
/**
|
|
1223
|
+
* Remove a command from the command registry
|
|
1224
|
+
*
|
|
1225
|
+
* @param commandId - ID of command to remove
|
|
1226
|
+
*/
|
|
1227
|
+
removeCommand(commandId: string): void;
|
|
1228
|
+
}
|
|
1229
|
+
/** @public */
|
|
1230
|
+
export interface ThemeManifest {
|
|
1231
|
+
/**
|
|
1232
|
+
* Name of the author of the theme
|
|
1233
|
+
*/
|
|
1234
|
+
author: string;
|
|
1235
|
+
/**
|
|
1236
|
+
* URL to the author's website
|
|
1237
|
+
*/
|
|
1238
|
+
authorUrl?: string;
|
|
1239
|
+
/**
|
|
1240
|
+
* Storage location of the theme relative to the vault root
|
|
1241
|
+
*/
|
|
1242
|
+
dir: string;
|
|
1243
|
+
/**
|
|
1244
|
+
* URL for funding the author
|
|
1245
|
+
*/
|
|
1246
|
+
fundingUrl?: string;
|
|
1247
|
+
/**
|
|
1248
|
+
* Minimum Obsidian version compatible with the theme
|
|
1249
|
+
*/
|
|
1250
|
+
minAppVersion: string;
|
|
1251
|
+
/**
|
|
1252
|
+
* Name of the theme
|
|
1253
|
+
*/
|
|
1254
|
+
name: string;
|
|
1255
|
+
/**
|
|
1256
|
+
* Version of the theme
|
|
1257
|
+
*
|
|
1258
|
+
* @remark Defaults to '0.0.0' if no theme manifest was provided in the repository
|
|
1259
|
+
*/
|
|
1260
|
+
version: "0.0.0" | string;
|
|
1261
|
+
}
|
|
1262
|
+
/** @public */
|
|
1263
|
+
export interface CustomCSSThemesRecord extends Record<string, ThemeManifest> {
|
|
1264
|
+
}
|
|
1265
|
+
/** @public */
|
|
1266
|
+
export interface CustomCSSUpdatesRecord extends Record<string, unknown> {
|
|
1267
|
+
}
|
|
1268
|
+
/** @todo Documentation incomplete */
|
|
1269
|
+
/** @public */
|
|
1270
|
+
export interface CustomCSS extends Component {
|
|
1271
|
+
/**
|
|
1272
|
+
* Reference to App
|
|
1273
|
+
*/
|
|
1274
|
+
app: App;
|
|
1275
|
+
/** @internal Cache of CSS snippet filepath (relative to vault root) to CSS snippet contents */
|
|
1276
|
+
csscache: Map<string, string>;
|
|
1277
|
+
/**
|
|
1278
|
+
* Set of enabled snippet, given by filenames
|
|
1279
|
+
*/
|
|
1280
|
+
enabledSnippets: Set<string>;
|
|
1281
|
+
/**
|
|
1282
|
+
* @internal
|
|
1283
|
+
* Contains references to Style elements containing custom CSS snippets
|
|
1284
|
+
*/
|
|
1285
|
+
extraStyleEls: HTMLStyleElement[];
|
|
1286
|
+
/**
|
|
1287
|
+
* List of theme names not fully updated to post v1.0.0 theme guidelines
|
|
1288
|
+
*/
|
|
1289
|
+
oldThemes: string[];
|
|
1290
|
+
/** @internal */
|
|
1291
|
+
queue: PromisedQueue;
|
|
1292
|
+
/** @internal */
|
|
1293
|
+
requestLoadSnippets: Debouncer<[
|
|
1294
|
+
], void>;
|
|
1295
|
+
/** @internal */
|
|
1296
|
+
requestLoadTheme: Debouncer<[
|
|
1297
|
+
], void>;
|
|
1298
|
+
/** @internal */
|
|
1299
|
+
requestReadThemes: Debouncer<[
|
|
1300
|
+
], void>;
|
|
1301
|
+
/**
|
|
1302
|
+
* List of snippets detected by Obsidian, given by their filenames
|
|
1303
|
+
*/
|
|
1304
|
+
snippets: string[];
|
|
1305
|
+
/**
|
|
1306
|
+
* Currently active theme, given by its name
|
|
1307
|
+
*
|
|
1308
|
+
* @remark is the default Obsidian theme
|
|
1309
|
+
*/
|
|
1310
|
+
theme: "" | string;
|
|
1311
|
+
/**
|
|
1312
|
+
* Mapping of theme names to their manifest
|
|
1313
|
+
*/
|
|
1314
|
+
themes: CustomCSSThemesRecord;
|
|
1315
|
+
/** @internal */
|
|
1316
|
+
updates: CustomCSSUpdatesRecord;
|
|
1317
|
+
/** @internal */
|
|
1318
|
+
boundRaw(themeName: string): void;
|
|
1319
|
+
/**
|
|
1320
|
+
* Check whether a specific theme can be updated
|
|
1321
|
+
*
|
|
1322
|
+
* @param themeName - Name of the theme to check
|
|
1323
|
+
*/
|
|
1324
|
+
checkForUpdate(themeName: string): void;
|
|
1325
|
+
/**
|
|
1326
|
+
* Check all themes for updates
|
|
1327
|
+
*/
|
|
1328
|
+
checkForUpdates(): void;
|
|
1329
|
+
/**
|
|
1330
|
+
* Disable translucency of application background
|
|
1331
|
+
*/
|
|
1332
|
+
disableTranslucency(): void;
|
|
1333
|
+
/**
|
|
1334
|
+
* Fetch legacy theme CSS using the pre-v1.0.0 theme download pipeline
|
|
1335
|
+
*
|
|
1336
|
+
* @returns String obsidian.css contents
|
|
1337
|
+
*/
|
|
1338
|
+
downloadLegacyTheme(arg: {
|
|
1339
|
+
repo: string;
|
|
1340
|
+
}): Promise<string>;
|
|
1341
|
+
/**
|
|
1342
|
+
* Enable translucency of application background
|
|
1343
|
+
*/
|
|
1344
|
+
enableTranslucency(): void;
|
|
1345
|
+
/**
|
|
1346
|
+
* Fetch a theme's manifest using repository URL
|
|
1347
|
+
*
|
|
1348
|
+
* @remark Do **not** include github prefix, only `username/repo`
|
|
1349
|
+
*/
|
|
1350
|
+
getManifest(repoUrl: string): Promise<ThemeManifest>;
|
|
1351
|
+
/**
|
|
1352
|
+
* Convert snippet name to its corresponding filepath (relative to vault root)
|
|
1353
|
+
*
|
|
1354
|
+
* @returns String `.obsidian/snippets/${snippetName}.css`
|
|
1355
|
+
*/
|
|
1356
|
+
getSnippetPath(snippetName: string): string;
|
|
1357
|
+
/**
|
|
1358
|
+
* Returns the folder path where snippets are stored (relative to vault root)
|
|
1359
|
+
*/
|
|
1360
|
+
getSnippetsFolder(): string;
|
|
1361
|
+
/**
|
|
1362
|
+
* Returns the folder path where themes are stored (relative to vault root)
|
|
1363
|
+
*/
|
|
1364
|
+
getThemeFolder(): string;
|
|
1365
|
+
/**
|
|
1366
|
+
* Convert theme name to its corresponding filepath (relative to vault root)
|
|
1367
|
+
*
|
|
1368
|
+
* @returns String `.obsidian/themes/${themeName}/theme.css`
|
|
1369
|
+
*/
|
|
1370
|
+
getThemePath(themeName: string): string;
|
|
1371
|
+
/**
|
|
1372
|
+
* Returns whether there are themes that can be updated
|
|
1373
|
+
*/
|
|
1374
|
+
hasUpdates(): boolean;
|
|
1375
|
+
/**
|
|
1376
|
+
* Install a legacy theme using the pre-v1.0.0 theme download pipeline<br> Will create a corresponding
|
|
1377
|
+
* dummy manifest for the theme
|
|
1378
|
+
*
|
|
1379
|
+
* @remark Name will be used as the folder name for the theme
|
|
1380
|
+
*/
|
|
1381
|
+
installLegacyTheme(arg: {
|
|
1382
|
+
name: string;
|
|
1383
|
+
repo: string;
|
|
1384
|
+
author: string;
|
|
1385
|
+
}): Promise<void>;
|
|
1386
|
+
/**
|
|
1387
|
+
* Install a theme using the regular theme download pipeline
|
|
1388
|
+
*/
|
|
1389
|
+
installTheme(arg: {
|
|
1390
|
+
name: string;
|
|
1391
|
+
repo: string;
|
|
1392
|
+
author: string;
|
|
1393
|
+
}, version: string): Promise<void>;
|
|
1394
|
+
/**
|
|
1395
|
+
* Check whether a specific theme is installed by theme name
|
|
1396
|
+
*/
|
|
1397
|
+
isThemeInstalled(themeName: string): boolean;
|
|
1398
|
+
loadCss(arg1: unknown): Promise<unknown>;
|
|
1399
|
+
loadData(): unknown;
|
|
1400
|
+
loadSnippets(): unknown;
|
|
1401
|
+
loadTheme(arg1: unknown): unknown;
|
|
1402
|
+
/** @internal */
|
|
1403
|
+
onload(): void;
|
|
1404
|
+
/** @internal */
|
|
1405
|
+
onRaw(themeName: string): void;
|
|
1406
|
+
/** @internal */
|
|
1407
|
+
readSnippets(): void;
|
|
1408
|
+
/** @internal */
|
|
1409
|
+
readThemes(): void;
|
|
1410
|
+
/**
|
|
1411
|
+
* Remove a theme by theme name
|
|
1412
|
+
*/
|
|
1413
|
+
removeTheme(themeName: string): Promise<void>;
|
|
1414
|
+
/**
|
|
1415
|
+
* Set the activation status of a snippet by snippet name
|
|
1416
|
+
*/
|
|
1417
|
+
setCssEnabledStatus(snippetName: string, enabled: boolean): void;
|
|
1418
|
+
/**
|
|
1419
|
+
* Set the active theme by theme name
|
|
1420
|
+
*/
|
|
1421
|
+
setTheme(themeName: string): void;
|
|
1422
|
+
/**
|
|
1423
|
+
* Set the translucency of application background
|
|
1424
|
+
*/
|
|
1425
|
+
setTranslucency(translucency: boolean): void;
|
|
1426
|
+
}
|
|
1427
|
+
/** @public */
|
|
1428
|
+
export interface Draggable {
|
|
1429
|
+
file?: TAbstractFile;
|
|
1430
|
+
files?: TAbstractFile[];
|
|
1431
|
+
icon: string;
|
|
1432
|
+
linktext?: string;
|
|
1433
|
+
source?: unknown;
|
|
1434
|
+
sourcePath?: string;
|
|
1435
|
+
title: string;
|
|
1436
|
+
type: string;
|
|
1437
|
+
}
|
|
1438
|
+
/** @public */
|
|
1439
|
+
export interface DragStartEvent {
|
|
1440
|
+
evt: DragEvent;
|
|
1441
|
+
moved: boolean;
|
|
1442
|
+
}
|
|
1443
|
+
/** @public */
|
|
1444
|
+
export interface DropResult {
|
|
1445
|
+
action: string | null;
|
|
1446
|
+
dropEffect: "none" | "copy" | "link" | "move";
|
|
1447
|
+
hoverClass: string;
|
|
1448
|
+
hoverEl: HTMLElement | null;
|
|
1449
|
+
}
|
|
1450
|
+
/** @todo Documentation incomplete */
|
|
1451
|
+
/** @public */
|
|
1452
|
+
export interface DragManager {
|
|
1453
|
+
actionEl: HTMLElement | null;
|
|
1454
|
+
app: App;
|
|
1455
|
+
draggable: Draggable | null;
|
|
1456
|
+
dragStart: DragStartEvent | null;
|
|
1457
|
+
ghostEl: HTMLElement | null;
|
|
1458
|
+
hoverClass: string;
|
|
1459
|
+
hoverEl: HTMLElement | null;
|
|
1460
|
+
isDragOverHandled: boolean;
|
|
1461
|
+
overlayEl: HTMLElement;
|
|
1462
|
+
shouldHideOverlay: boolean;
|
|
1463
|
+
sourceClass: string;
|
|
1464
|
+
sourceEls: HTMLElement[] | null;
|
|
1465
|
+
dragFile(event: DragEvent, file: TFile, source?: unknown): Draggable;
|
|
1466
|
+
dragFiles(event: DragEvent, files: TAbstractFile[], source?: unknown): Draggable | null;
|
|
1467
|
+
dragFolder(event: DragEvent, folder: TFolder, source?: unknown): Draggable;
|
|
1468
|
+
dragLink(event: DragEvent, linkText: string, sourcePath: string, title?: string, source?: unknown): Draggable;
|
|
1469
|
+
handleDrag(el: HTMLElement, draggableGetter: (event: DragEvent) => Draggable | null): void;
|
|
1470
|
+
handleDrop(el: HTMLElement, dropHandler: (event: DragEvent, draggable: Draggable, isOver: boolean) => DropResult | null, draggable?: boolean): void;
|
|
1471
|
+
hideOverlay(): void;
|
|
1472
|
+
onDragEnd(): void;
|
|
1473
|
+
onDragLeave(event: DragEvent): void;
|
|
1474
|
+
onDragOver(event: DragEvent): void;
|
|
1475
|
+
onDragOverFirst(): void;
|
|
1476
|
+
onDragStart(event: DragEvent, draggable: Draggable): void;
|
|
1477
|
+
onDragStartGlobal(event: DragEvent): void;
|
|
1478
|
+
onTouchEnd(event: TouchEvent): void;
|
|
1479
|
+
removeOverlay(): void;
|
|
1480
|
+
setAction(action: string | null): void;
|
|
1481
|
+
showOverlay(doc: Document, rect: DOMRect): void;
|
|
1482
|
+
updateHover(hoverEl: HTMLElement | null, hoverClass: string): void;
|
|
1483
|
+
updateSource(sourceEls: HTMLElement[] | null, sourceClass: string): void;
|
|
1484
|
+
}
|
|
1485
|
+
/** @public */
|
|
1486
|
+
export interface EmbedContext {
|
|
1487
|
+
/**
|
|
1488
|
+
* Reference to the app
|
|
1489
|
+
*/
|
|
1490
|
+
app: App;
|
|
1491
|
+
/**
|
|
1492
|
+
* Element where the embed should be displayed
|
|
1493
|
+
*/
|
|
1494
|
+
containerEl: HTMLElement;
|
|
1495
|
+
/**
|
|
1496
|
+
* Depth of the embed within its container (how many levels of embeds are above it)
|
|
1497
|
+
*/
|
|
1498
|
+
depth?: number;
|
|
1499
|
+
/**
|
|
1500
|
+
* Whether the embed should be dynamic (CM) or static (postProcessed)
|
|
1501
|
+
*/
|
|
1502
|
+
displayMode?: boolean;
|
|
1503
|
+
/**
|
|
1504
|
+
* Text that should be displayed in the embed
|
|
1505
|
+
*/
|
|
1506
|
+
linktext?: string;
|
|
1507
|
+
/**
|
|
1508
|
+
* Whether the embed should be an inline embed
|
|
1509
|
+
*/
|
|
1510
|
+
showInline?: boolean;
|
|
1511
|
+
/**
|
|
1512
|
+
* Optional path to the current open file
|
|
1513
|
+
*/
|
|
1514
|
+
sourcePath?: string;
|
|
1515
|
+
/** @internal */
|
|
1516
|
+
state?: unknown;
|
|
1517
|
+
}
|
|
1518
|
+
/** @todo Documentation incomplete */
|
|
1519
|
+
/** @public */
|
|
1520
|
+
export type EmbeddableConstructor = (context: EmbedContext, file: TFile, path?: string) => Component;
|
|
1521
|
+
/** @public */
|
|
1522
|
+
export interface EmbedRegistryEmbedByExtensionRecord extends Record<string, EmbeddableConstructor> {
|
|
1523
|
+
}
|
|
1524
|
+
/** @public */
|
|
1525
|
+
export interface EmbedRegistry extends Events {
|
|
1526
|
+
/**
|
|
1527
|
+
* Mapping of file extensions to constructors for embeddable widgets
|
|
1528
|
+
*/
|
|
1529
|
+
embedByExtension: EmbedRegistryEmbedByExtensionRecord;
|
|
1530
|
+
/**
|
|
1531
|
+
* Get the embed constructor for a specific file type
|
|
1532
|
+
*/
|
|
1533
|
+
getEmbedCreator(file: TFile): EmbeddableConstructor | null;
|
|
1534
|
+
/**
|
|
1535
|
+
* Check whether a file extension has a registered embed constructor
|
|
1536
|
+
*/
|
|
1537
|
+
isExtensionRegistered(extension: string): boolean;
|
|
1538
|
+
/**
|
|
1539
|
+
* Register an embed constructor for a specific file extension
|
|
1540
|
+
*/
|
|
1541
|
+
registerExtension(extension: string, embedCreator: EmbeddableConstructor): void;
|
|
1542
|
+
/**
|
|
1543
|
+
* Register an embed constructor for a list of file extensions
|
|
1544
|
+
*/
|
|
1545
|
+
registerExtensions(extensions: string[], embedCreator: EmbeddableConstructor): void;
|
|
1546
|
+
/**
|
|
1547
|
+
* Unregister an embed constructor for a specific file extension
|
|
1548
|
+
*/
|
|
1549
|
+
unregisterExtension(extension: string): void;
|
|
1550
|
+
/**
|
|
1551
|
+
* Unregister an embed constructor for a list of file extensions
|
|
1552
|
+
*/
|
|
1553
|
+
unregisterExtensions(extensions: string[]): void;
|
|
1554
|
+
}
|
|
1555
|
+
/** @public */
|
|
1556
|
+
export interface FoldManager {
|
|
1557
|
+
app: App;
|
|
1558
|
+
cleanup(): unknown;
|
|
1559
|
+
load(arg1: unknown): unknown;
|
|
1560
|
+
loadPath(arg1: unknown): unknown;
|
|
1561
|
+
save(arg1: unknown, arg2: unknown): unknown;
|
|
1562
|
+
savePath(arg1: unknown, arg2: unknown): unknown;
|
|
1563
|
+
}
|
|
1564
|
+
/** @public */
|
|
1565
|
+
export interface HotkeyManagerCustomKeysRecord extends Record<string, KeymapInfo[]> {
|
|
1566
|
+
}
|
|
1567
|
+
/** @public */
|
|
1568
|
+
export interface HotkeyManagerDefaultKeysRecord extends Record<string, KeymapInfo[]> {
|
|
1569
|
+
}
|
|
1570
|
+
/** @public */
|
|
1571
|
+
export interface HotkeyManager {
|
|
1572
|
+
/**
|
|
1573
|
+
* Reference to App
|
|
1574
|
+
*/
|
|
1575
|
+
app: App;
|
|
1576
|
+
/** @internal Whether hotkeys have been baked (checks completed) */
|
|
1577
|
+
baked: boolean;
|
|
1578
|
+
/**
|
|
1579
|
+
* Assigned hotkeys
|
|
1580
|
+
*/
|
|
1581
|
+
bakedHotkeys: KeymapInfo[];
|
|
1582
|
+
/**
|
|
1583
|
+
* Array of hotkey index to command ID
|
|
1584
|
+
*/
|
|
1585
|
+
bakedIds: string[];
|
|
1586
|
+
/**
|
|
1587
|
+
* Custom (non-Obsidian default) hotkeys, one to many mapping of command ID to assigned hotkey
|
|
1588
|
+
*/
|
|
1589
|
+
customKeys: HotkeyManagerCustomKeysRecord;
|
|
1590
|
+
/**
|
|
1591
|
+
* Default hotkeys, one to many mapping of command ID to assigned hotkey
|
|
1592
|
+
*/
|
|
1593
|
+
defaultKeys: HotkeyManagerDefaultKeysRecord;
|
|
1594
|
+
/** @internal */
|
|
1595
|
+
onConfigFileChange: Debouncer<[
|
|
1596
|
+
], Promise<void>>;
|
|
1597
|
+
/**
|
|
1598
|
+
* Add a hotkey to the default hotkeys
|
|
1599
|
+
*
|
|
1600
|
+
* @param command - Command ID to add hotkey to
|
|
1601
|
+
* @param keys - Hotkeys to add
|
|
1602
|
+
*/
|
|
1603
|
+
addDefaultHotkeys(command: string, keys: KeymapInfo[]): void;
|
|
1604
|
+
/** @internal Bake hotkeys (create mapping of pressed key to command ID) */
|
|
1605
|
+
bake(): void;
|
|
1606
|
+
/**
|
|
1607
|
+
* Get hotkey associated with command ID
|
|
1608
|
+
*
|
|
1609
|
+
* @param command - Command ID to get hotkey for
|
|
1610
|
+
*/
|
|
1611
|
+
getDefaultHotkeys(command: string): KeymapInfo[];
|
|
1612
|
+
/**
|
|
1613
|
+
* Get hotkey associated with command ID
|
|
1614
|
+
*
|
|
1615
|
+
* @param command - Command ID to get hotkey for
|
|
1616
|
+
*/
|
|
1617
|
+
getHotkeys(command: string): KeymapInfo[];
|
|
1618
|
+
/** @internal Load hotkeys from storage */
|
|
1619
|
+
load(): void;
|
|
1620
|
+
/** @internal */
|
|
1621
|
+
onRaw(e: unknown): void;
|
|
1622
|
+
/**
|
|
1623
|
+
* Trigger a command by keyboard event
|
|
1624
|
+
*
|
|
1625
|
+
* @param event - Keyboard event to trigger command with
|
|
1626
|
+
* @param keypress - Pressed key information
|
|
1627
|
+
*/
|
|
1628
|
+
onTrigger(event: KeyboardEvent, keypress: KeymapInfo): boolean;
|
|
1629
|
+
/**
|
|
1630
|
+
* Pretty-print hotkey of a command
|
|
1631
|
+
*
|
|
1632
|
+
* @param commandId - Command ID to print hotkey for
|
|
1633
|
+
*/
|
|
1634
|
+
printHotkeyForCommand(commandId: string): string;
|
|
1635
|
+
/** @internal */
|
|
1636
|
+
registerListeners(): void;
|
|
1637
|
+
/**
|
|
1638
|
+
* Remove a hotkey from the default hotkeys
|
|
1639
|
+
*
|
|
1640
|
+
* @param command - Command ID to remove hotkey from
|
|
1641
|
+
*/
|
|
1642
|
+
removeDefaultHotkeys(command: string): void;
|
|
1643
|
+
/**
|
|
1644
|
+
* Remove a hotkey from the custom hotkeys
|
|
1645
|
+
*
|
|
1646
|
+
* @param command - Command ID to remove hotkey from
|
|
1647
|
+
*/
|
|
1648
|
+
removeHotkeys(command: string): void;
|
|
1649
|
+
/** @internal Save custom hotkeys to storage */
|
|
1650
|
+
save(): void;
|
|
1651
|
+
/**
|
|
1652
|
+
* Add a hotkey to the custom hotkeys (overrides default hotkeys)
|
|
1653
|
+
*
|
|
1654
|
+
* @param command - Command ID to add hotkey to
|
|
1655
|
+
* @param keys - Hotkeys to add
|
|
1656
|
+
*/
|
|
1657
|
+
setHotkeys(command: string, keys: KeymapInfo[]): void;
|
|
1658
|
+
}
|
|
1659
|
+
/** @todo Documentation incomplete */
|
|
1660
|
+
/** @public */
|
|
1661
|
+
export interface ImportedAttachments {
|
|
1662
|
+
data: Promise<ArrayBuffer>;
|
|
1663
|
+
extension: string;
|
|
1664
|
+
filename: string;
|
|
1665
|
+
name: string;
|
|
1666
|
+
}
|
|
1667
|
+
/** @todo Documentation incomplete */
|
|
1668
|
+
/** @public */
|
|
1669
|
+
export interface LoadProgress {
|
|
1670
|
+
}
|
|
1671
|
+
/** @public */
|
|
1672
|
+
export interface PropertyInfo {
|
|
1673
|
+
/**
|
|
1674
|
+
* Usage count of property
|
|
1675
|
+
*/
|
|
1676
|
+
count: number;
|
|
1677
|
+
/**
|
|
1678
|
+
* Name of property
|
|
1679
|
+
*/
|
|
1680
|
+
name: string;
|
|
1681
|
+
/**
|
|
1682
|
+
* Type of property
|
|
1683
|
+
*/
|
|
1684
|
+
type: string;
|
|
1685
|
+
}
|
|
1686
|
+
/** @public */
|
|
1687
|
+
export interface PropertyEntryData<T> {
|
|
1688
|
+
/**
|
|
1689
|
+
* Property key
|
|
1690
|
+
*/
|
|
1691
|
+
key: string;
|
|
1692
|
+
/**
|
|
1693
|
+
* Property widget type
|
|
1694
|
+
*/
|
|
1695
|
+
type: string;
|
|
1696
|
+
/**
|
|
1697
|
+
* Property value
|
|
1698
|
+
*/
|
|
1699
|
+
value: T;
|
|
1700
|
+
}
|
|
1701
|
+
/** @public */
|
|
1702
|
+
export interface MetadataWidget {
|
|
1703
|
+
}
|
|
1704
|
+
/** @public */
|
|
1705
|
+
export interface MetadataEditorProperty extends Component {
|
|
1706
|
+
/**
|
|
1707
|
+
* Reference to the app
|
|
1708
|
+
*/
|
|
1709
|
+
app: App;
|
|
1710
|
+
/**
|
|
1711
|
+
* Container element for the metadata editor property
|
|
1712
|
+
*/
|
|
1713
|
+
containerEl: HTMLElement;
|
|
1714
|
+
/**
|
|
1715
|
+
* Entry information for the property
|
|
1716
|
+
*/
|
|
1717
|
+
entry: PropertyEntryData<unknown>;
|
|
1718
|
+
/**
|
|
1719
|
+
* Icon element of the property
|
|
1720
|
+
*/
|
|
1721
|
+
iconEl: HTMLSpanElement;
|
|
1722
|
+
/**
|
|
1723
|
+
* Key value of the property
|
|
1724
|
+
*/
|
|
1725
|
+
keyEl: HTMLElement;
|
|
1726
|
+
/**
|
|
1727
|
+
* Input field for key value of the property
|
|
1728
|
+
*/
|
|
1729
|
+
keyInputEl: HTMLInputElement;
|
|
1730
|
+
/**
|
|
1731
|
+
* Metadata editor the property is attached to
|
|
1732
|
+
*/
|
|
1733
|
+
metadataEditor: MetadataEditor;
|
|
1734
|
+
/**
|
|
1735
|
+
* Widget that handles user input for this property widget type
|
|
1736
|
+
*/
|
|
1737
|
+
rendered: MetadataWidget | null;
|
|
1738
|
+
/**
|
|
1739
|
+
* Info about the inferred and expected property widget given key-value pair
|
|
1740
|
+
*/
|
|
1741
|
+
typeInfo: {
|
|
1742
|
+
expected: PropertyWidget<unknown>;
|
|
1743
|
+
inferred: PropertyWidget<unknown>;
|
|
1744
|
+
};
|
|
1745
|
+
/**
|
|
1746
|
+
* Element that contains the value input or widget
|
|
1747
|
+
*/
|
|
1748
|
+
valueEl: HTMLElement;
|
|
1749
|
+
/**
|
|
1750
|
+
* Element containing the displayed warning on malformed property field
|
|
1751
|
+
*/
|
|
1752
|
+
warningEl: HTMLElement;
|
|
1753
|
+
/**
|
|
1754
|
+
* Focus on the key input element
|
|
1755
|
+
*/
|
|
1756
|
+
focusKey(): void;
|
|
1757
|
+
/**
|
|
1758
|
+
* Focus on the property (container element)
|
|
1759
|
+
*/
|
|
1760
|
+
focusProperty(): void;
|
|
1761
|
+
/**
|
|
1762
|
+
* Focus on the value input element
|
|
1763
|
+
*/
|
|
1764
|
+
focusValue(which?: "both" | "end" | "start"): void;
|
|
1765
|
+
/**
|
|
1766
|
+
* Reveal the property menu on click event
|
|
1767
|
+
*/
|
|
1768
|
+
handleItemClick(event: MouseEvent): void;
|
|
1769
|
+
/**
|
|
1770
|
+
* Focus on property on blur event
|
|
1771
|
+
*/
|
|
1772
|
+
handlePropertyBlur(): void;
|
|
1773
|
+
/**
|
|
1774
|
+
* Update key of property and saves, returns false if error
|
|
1775
|
+
*/
|
|
1776
|
+
handleUpdateKey(key: string): boolean;
|
|
1777
|
+
/**
|
|
1778
|
+
* Update value of property and saves
|
|
1779
|
+
*/
|
|
1780
|
+
handleUpdateValue(value: unknown): void;
|
|
1781
|
+
/**
|
|
1782
|
+
* Loads as draggable property element
|
|
1783
|
+
*/
|
|
1784
|
+
onload(): void;
|
|
1785
|
+
/**
|
|
1786
|
+
* Render property widget based on type
|
|
1787
|
+
*/
|
|
1788
|
+
renderProperty(entry: PropertyEntryData<unknown>, check_errors?: boolean, use_expected_type?: boolean): void;
|
|
1789
|
+
/**
|
|
1790
|
+
* Set the selected class of property
|
|
1791
|
+
*/
|
|
1792
|
+
setSelected(selected: boolean): void;
|
|
1793
|
+
/**
|
|
1794
|
+
* Reveal property selection menu at mouse event
|
|
1795
|
+
*/
|
|
1796
|
+
showPropertyMenu(event: MouseEvent): void;
|
|
1797
|
+
}
|
|
1798
|
+
/** @public */
|
|
1799
|
+
export interface MetadataEditor extends Component {
|
|
1800
|
+
/**
|
|
1801
|
+
* Button element for adding a new property
|
|
1802
|
+
*/
|
|
1803
|
+
addPropertyButtonEl: HTMLButtonElement;
|
|
1804
|
+
/**
|
|
1805
|
+
* Reference to the app
|
|
1806
|
+
*/
|
|
1807
|
+
app: App;
|
|
1808
|
+
/**
|
|
1809
|
+
* Whether the frontmatter editor is collapsed
|
|
1810
|
+
*/
|
|
1811
|
+
collapsed: boolean;
|
|
1812
|
+
/**
|
|
1813
|
+
* Container element for the metadata editor
|
|
1814
|
+
*/
|
|
1815
|
+
containerEl: HTMLElement;
|
|
1816
|
+
/**
|
|
1817
|
+
* Element containing metadata table and addPropertyButton
|
|
1818
|
+
*/
|
|
1819
|
+
contentEl: HTMLElement;
|
|
1820
|
+
/**
|
|
1821
|
+
* The currently focused property
|
|
1822
|
+
*/
|
|
1823
|
+
focusedLine: null | MetadataEditorProperty;
|
|
1824
|
+
/**
|
|
1825
|
+
* Fold button for folding away the frontmatter editor on hovering over headingEl
|
|
1826
|
+
*/
|
|
1827
|
+
foldEl: HTMLElement;
|
|
1828
|
+
/**
|
|
1829
|
+
* Heading element for the metadata editor
|
|
1830
|
+
*/
|
|
1831
|
+
headingEl: HTMLElement;
|
|
1832
|
+
/**
|
|
1833
|
+
* Hover element container
|
|
1834
|
+
*/
|
|
1835
|
+
hoverPopover: null | HoverPopover;
|
|
1836
|
+
/**
|
|
1837
|
+
* Owner of the metadata editor
|
|
1838
|
+
*/
|
|
1839
|
+
owner: MarkdownView;
|
|
1840
|
+
/**
|
|
1841
|
+
* All properties existing in the metadata editor
|
|
1842
|
+
*/
|
|
1843
|
+
properties: PropertyEntryData<unknown>[];
|
|
1844
|
+
/**
|
|
1845
|
+
* Element containing all property elements
|
|
1846
|
+
*/
|
|
1847
|
+
propertyListEl: HTMLElement;
|
|
1848
|
+
/**
|
|
1849
|
+
* List of all property field editors
|
|
1850
|
+
*/
|
|
1851
|
+
rendered: MetadataEditorProperty[];
|
|
1852
|
+
/**
|
|
1853
|
+
* Set of all selected property editors
|
|
1854
|
+
*/
|
|
1855
|
+
selectedLines: Set<MetadataEditorProperty>;
|
|
1856
|
+
/**
|
|
1857
|
+
* Convert given properties to a serialized object and store in clipboard as obsidian/properties
|
|
1858
|
+
*/
|
|
1859
|
+
_copyToClipboard(event: ClipboardEvent, properties: MetadataEditorProperty[]): void;
|
|
1860
|
+
/**
|
|
1861
|
+
* Uncollapse editor if collapsed and create a new property row
|
|
1862
|
+
*/
|
|
1863
|
+
addProperty(): void;
|
|
1864
|
+
/**
|
|
1865
|
+
* Clear all properties
|
|
1866
|
+
*/
|
|
1867
|
+
clear(): void;
|
|
1868
|
+
/**
|
|
1869
|
+
* Unselect all lines
|
|
1870
|
+
*/
|
|
1871
|
+
clearSelection(): void;
|
|
1872
|
+
/**
|
|
1873
|
+
* Focus on property field with given key
|
|
1874
|
+
*/
|
|
1875
|
+
focusKey(key: string): void;
|
|
1876
|
+
/**
|
|
1877
|
+
* Focus on property
|
|
1878
|
+
*/
|
|
1879
|
+
focusProperty(property: MetadataEditorProperty): void;
|
|
1880
|
+
/**
|
|
1881
|
+
* Focus on property at specified index
|
|
1882
|
+
*/
|
|
1883
|
+
focusPropertyAtIndex(index: number): void;
|
|
1884
|
+
/**
|
|
1885
|
+
* Focus on property with value
|
|
1886
|
+
*/
|
|
1887
|
+
focusValue(value: string, which: "both" | "end" | "start"): void;
|
|
1888
|
+
/**
|
|
1889
|
+
* Handle copy event on selection and serialize properties
|
|
1890
|
+
*/
|
|
1891
|
+
handleCopy(event: ClipboardEvent): void;
|
|
1892
|
+
/**
|
|
1893
|
+
* Handle cut event and serialize and remove properties
|
|
1894
|
+
*/
|
|
1895
|
+
handleCut(event: ClipboardEvent): void;
|
|
1896
|
+
/**
|
|
1897
|
+
* Handle selection of item for drag handling
|
|
1898
|
+
*/
|
|
1899
|
+
handleItemSelection(event: PointerEvent, property: MetadataEditorProperty): boolean;
|
|
1900
|
+
/**
|
|
1901
|
+
* Handle key press event for controlling selection or movement of property up/down
|
|
1902
|
+
*/
|
|
1903
|
+
handleKeypress(event: KeyboardEvent): void;
|
|
1904
|
+
/**
|
|
1905
|
+
* Handle paste event of properties into metadata editor
|
|
1906
|
+
*/
|
|
1907
|
+
handlePaste(event: ClipboardEvent): void;
|
|
1908
|
+
/**
|
|
1909
|
+
* Whether the editor has focus
|
|
1910
|
+
*/
|
|
1911
|
+
hasFocus(): boolean;
|
|
1912
|
+
/**
|
|
1913
|
+
* Whether there is a property that is focused
|
|
1914
|
+
*/
|
|
1915
|
+
hasPropertyFocused(): boolean;
|
|
1916
|
+
/**
|
|
1917
|
+
* Add new properties to the metadata editor and save
|
|
1918
|
+
*/
|
|
1919
|
+
insertProperties(properties: Record<string, any>): void;
|
|
1920
|
+
/**
|
|
1921
|
+
* On loading of the metadata editor, register on metadata type change event
|
|
1922
|
+
*/
|
|
1923
|
+
onload(): void;
|
|
1924
|
+
/**
|
|
1925
|
+
* On vault metadata update, update property render
|
|
1926
|
+
*/
|
|
1927
|
+
onMetadataTypeChange(property: MetadataEditorProperty): void;
|
|
1928
|
+
/**
|
|
1929
|
+
* Remove specified properties from the metadata editor and save, and reset focus if specified
|
|
1930
|
+
*/
|
|
1931
|
+
removeProperties(properties: MetadataEditorProperty[], reset_focus?: boolean): unknown;
|
|
1932
|
+
/**
|
|
1933
|
+
* Reorder the entry to specified index position and save
|
|
1934
|
+
*/
|
|
1935
|
+
reorderKey(entry: PropertyEntryData<unknown>, index: number): unknown;
|
|
1936
|
+
/**
|
|
1937
|
+
* Serialize the properties and save frontmatter
|
|
1938
|
+
*/
|
|
1939
|
+
save(): void;
|
|
1940
|
+
/**
|
|
1941
|
+
* Select all property fields
|
|
1942
|
+
*/
|
|
1943
|
+
selectAll(): void;
|
|
1944
|
+
/**
|
|
1945
|
+
* Mark specified property as selected
|
|
1946
|
+
*/
|
|
1947
|
+
selectProperty(property: MetadataEditorProperty | undefined, select: boolean): void;
|
|
1948
|
+
/**
|
|
1949
|
+
* Convert properties to a serialized object
|
|
1950
|
+
*/
|
|
1951
|
+
serialize(): Record<string, any>;
|
|
1952
|
+
/**
|
|
1953
|
+
* Sets frontmatter as collapsed or uncollapsed
|
|
1954
|
+
*/
|
|
1955
|
+
setCollapse(collapsed: boolean, x: boolean): void;
|
|
1956
|
+
/**
|
|
1957
|
+
* On context menu event on header element, show property menu
|
|
1958
|
+
*/
|
|
1959
|
+
showPropertiesMenu(event: MouseEvent): void;
|
|
1960
|
+
/**
|
|
1961
|
+
* Synchronize data with given properties and re-render them
|
|
1962
|
+
*/
|
|
1963
|
+
synchronize(data: Record<string, any>): void;
|
|
1964
|
+
/**
|
|
1965
|
+
* Toggle collapsed state of the metadata editor
|
|
1966
|
+
*/
|
|
1967
|
+
toggleCollapse(): void;
|
|
1968
|
+
}
|
|
1969
|
+
/** @public */
|
|
1970
|
+
export interface PropertyRenderContext {
|
|
1971
|
+
/**
|
|
1972
|
+
* Reference to the app
|
|
1973
|
+
*/
|
|
1974
|
+
app: App;
|
|
1975
|
+
/**
|
|
1976
|
+
* Key of the property field
|
|
1977
|
+
*/
|
|
1978
|
+
key: string;
|
|
1979
|
+
/**
|
|
1980
|
+
* Reference to the metadata editor
|
|
1981
|
+
*/
|
|
1982
|
+
metadataEditor: MetadataEditor;
|
|
1983
|
+
/**
|
|
1984
|
+
* Determine the source path of current context
|
|
1985
|
+
*/
|
|
1986
|
+
sourcePath: string;
|
|
1987
|
+
/**
|
|
1988
|
+
* Callback called on property field unfocus
|
|
1989
|
+
*/
|
|
1990
|
+
blur(): void;
|
|
1991
|
+
/**
|
|
1992
|
+
* Callback called on property value change
|
|
1993
|
+
*/
|
|
1994
|
+
onChange(value: unknown): void;
|
|
1995
|
+
}
|
|
1996
|
+
/** @public */
|
|
1997
|
+
export interface PropertyWidget<T> {
|
|
1998
|
+
/**
|
|
1999
|
+
* Lucide-dev icon associated with the widget
|
|
2000
|
+
*/
|
|
2001
|
+
icon: string;
|
|
2002
|
+
/**
|
|
2003
|
+
* Reserved keys for the widget
|
|
2004
|
+
*/
|
|
2005
|
+
reservedKeys?: string[];
|
|
2006
|
+
/**
|
|
2007
|
+
* Identifier for the widget
|
|
2008
|
+
*/
|
|
2009
|
+
type: string;
|
|
2010
|
+
/**
|
|
2011
|
+
* Get the default value for the property widget
|
|
2012
|
+
*/
|
|
2013
|
+
default(): T;
|
|
2014
|
+
/**
|
|
2015
|
+
* Returns the I18N name of the widget
|
|
2016
|
+
*/
|
|
2017
|
+
name(): string;
|
|
2018
|
+
/**
|
|
2019
|
+
* Render function for the widget on field container given context and data
|
|
2020
|
+
*/
|
|
2021
|
+
render(containerEl: HTMLElement, data: PropertyEntryData<T>, context: PropertyRenderContext): Component | void;
|
|
2022
|
+
/**
|
|
2023
|
+
* Validate whether the input value to the widget is correct
|
|
2024
|
+
*/
|
|
2025
|
+
validate(value: T): boolean;
|
|
2026
|
+
}
|
|
2027
|
+
/**
|
|
2028
|
+
* @todo Documentation incomplete
|
|
2029
|
+
*/
|
|
2030
|
+
/** @public */
|
|
2031
|
+
export type PropertyWidgetType = "aliases" | "checkbox" | "date" | "datetime" | "multitext" | "number" | "tags" | "text" | (string & any);
|
|
2032
|
+
/** @public */
|
|
2033
|
+
export interface MetadataTypeManagerPropertiesRecord extends Record<string, PropertyInfo> {
|
|
2034
|
+
}
|
|
2035
|
+
/** @public */
|
|
2036
|
+
export interface MetadataTypeManagerRegisteredTypeWidgetsRecord extends Record<PropertyWidgetType, PropertyWidget<unknown>> {
|
|
2037
|
+
}
|
|
2038
|
+
/** @public */
|
|
2039
|
+
export interface MetadataTypeManagerTypesRecord extends Record<string, PropertyWidgetType> {
|
|
2040
|
+
}
|
|
2041
|
+
/** @public */
|
|
2042
|
+
export interface MetadataTypeManager extends Events {
|
|
2043
|
+
/**
|
|
2044
|
+
* Reference to App
|
|
2045
|
+
*/
|
|
2046
|
+
app: App;
|
|
2047
|
+
onConfigFileChange: Debouncer<[
|
|
2048
|
+
], Promise<void>>;
|
|
2049
|
+
/**
|
|
2050
|
+
* Registered properties of the vault
|
|
2051
|
+
*/
|
|
2052
|
+
properties: MetadataTypeManagerPropertiesRecord;
|
|
2053
|
+
/** @internal Registered type widgets */
|
|
2054
|
+
registeredTypeWidgets: MetadataTypeManagerRegisteredTypeWidgetsRecord;
|
|
2055
|
+
/**
|
|
2056
|
+
* Associated widget types for each property
|
|
2057
|
+
*/
|
|
2058
|
+
types: MetadataTypeManagerTypesRecord;
|
|
2059
|
+
/**
|
|
2060
|
+
* Get all registered properties of the vault
|
|
2061
|
+
*/
|
|
2062
|
+
getAllProperties(): Record<string, PropertyInfo>;
|
|
2063
|
+
/**
|
|
2064
|
+
* Get assigned widget type for property
|
|
2065
|
+
*/
|
|
2066
|
+
getAssignedType(property: string): PropertyWidgetType | null;
|
|
2067
|
+
/**
|
|
2068
|
+
* Get info for property
|
|
2069
|
+
*/
|
|
2070
|
+
getPropertyInfo(property: string): PropertyInfo;
|
|
2071
|
+
/** @internal Get expected widget type for property and the one inferred from the property value */
|
|
2072
|
+
getTypeInfo(arg: {
|
|
2073
|
+
key: string;
|
|
2074
|
+
type: string;
|
|
2075
|
+
value: unknown;
|
|
2076
|
+
}): {
|
|
2077
|
+
inferred: PropertyWidget<unknown>;
|
|
2078
|
+
expected: PropertyWidget<unknown>;
|
|
2079
|
+
};
|
|
2080
|
+
/**
|
|
2081
|
+
* Get all properties with an assigned widget type
|
|
2082
|
+
*/
|
|
2083
|
+
getTypes(): string[];
|
|
2084
|
+
/** @internal Load property types from config */
|
|
2085
|
+
loadData(): Promise<void>;
|
|
2086
|
+
/** @internal */
|
|
2087
|
+
onRaw(e: unknown): void;
|
|
2088
|
+
/** @internal */
|
|
2089
|
+
registerListeners(): void;
|
|
2090
|
+
/** @internal Save property types to config */
|
|
2091
|
+
save(): Promise<void>;
|
|
2092
|
+
/** @internal Get all properties from metadata cache */
|
|
2093
|
+
savePropertyInfo(): void;
|
|
2094
|
+
/** @internal Set widget type for property */
|
|
2095
|
+
setType(property: string, type: PropertyWidgetType): Promise<void>;
|
|
2096
|
+
/** @internal Unset widget type for property */
|
|
2097
|
+
unsetType(property: string): Promise<void>;
|
|
2098
|
+
}
|
|
2099
|
+
/** @todo Documentation incomplete */
|
|
2100
|
+
/** @public */
|
|
2101
|
+
export interface MobileNavbar {
|
|
2102
|
+
}
|
|
2103
|
+
/** @public */
|
|
2104
|
+
export interface MobileTabSwitcher {
|
|
2105
|
+
app: App;
|
|
2106
|
+
cacheDir: string;
|
|
2107
|
+
containerEl: HTMLDivElement;
|
|
2108
|
+
innerScrollEl: HTMLDivElement;
|
|
2109
|
+
isVisible: boolean;
|
|
2110
|
+
requestRender: Debouncer<[
|
|
2111
|
+
], void>;
|
|
2112
|
+
scrollEl: HTMLDivElement;
|
|
2113
|
+
tabPreviewLookup: WeakMap<object, unknown>;
|
|
2114
|
+
close(): void;
|
|
2115
|
+
hide(): void;
|
|
2116
|
+
onLayoutChange(): void;
|
|
2117
|
+
render(): void;
|
|
2118
|
+
setupCacheDir(): Promise<void>;
|
|
2119
|
+
show(): Promise<void>;
|
|
2120
|
+
showTabManagementMenu(e: MouseEvent): void;
|
|
2121
|
+
}
|
|
2122
|
+
/** @todo Documentation incomplete */
|
|
2123
|
+
/** @public */
|
|
2124
|
+
export interface MobileToolbar {
|
|
2125
|
+
}
|
|
2126
|
+
/** @public */
|
|
2127
|
+
export interface ObsidianDOM {
|
|
2128
|
+
/**
|
|
2129
|
+
* Root element of the application
|
|
2130
|
+
*/
|
|
2131
|
+
appContainerEl: HTMLElement;
|
|
2132
|
+
/**
|
|
2133
|
+
* Child of `appContainerEl` containing the main content of the application
|
|
2134
|
+
*/
|
|
2135
|
+
horizontalMainContainerEl: HTMLElement;
|
|
2136
|
+
/**
|
|
2137
|
+
* Status bar element containing word count among other things
|
|
2138
|
+
*/
|
|
2139
|
+
statusBarEl: HTMLElement;
|
|
2140
|
+
/**
|
|
2141
|
+
* Child of `horizontalMainContainerEl` containing the workspace DOM
|
|
2142
|
+
*/
|
|
2143
|
+
workspaceEl: HTMLElement;
|
|
2144
|
+
}
|
|
2145
|
+
/** @public */
|
|
2146
|
+
export interface PluginUpdateManifest {
|
|
2147
|
+
/**
|
|
2148
|
+
* Manifest of the plugin
|
|
2149
|
+
*/
|
|
2150
|
+
manifest: PluginManifest;
|
|
2151
|
+
/**
|
|
2152
|
+
* Repository of the plugin
|
|
2153
|
+
*/
|
|
2154
|
+
repo: string;
|
|
2155
|
+
/**
|
|
2156
|
+
* New version of the plugin
|
|
2157
|
+
*/
|
|
2158
|
+
version: string;
|
|
2159
|
+
}
|
|
2160
|
+
/** @public */
|
|
2161
|
+
export interface PluginsManifestsRecord extends Record<string, PluginManifest> {
|
|
2162
|
+
}
|
|
2163
|
+
/** @public */
|
|
2164
|
+
export interface PluginsPluginsRecord extends Record<string, Plugin$1> {
|
|
2165
|
+
}
|
|
2166
|
+
/** @public */
|
|
2167
|
+
export interface Plugins {
|
|
2168
|
+
/**
|
|
2169
|
+
* Reference to App
|
|
2170
|
+
*/
|
|
2171
|
+
app: App;
|
|
2172
|
+
/**
|
|
2173
|
+
* Set of enabled plugin IDs
|
|
2174
|
+
*
|
|
2175
|
+
* @remark The plugin ids aren't guaranteed to be either active (in `app.plugins.plugins`) or installed (in `app.plugins.manifests`)
|
|
2176
|
+
*/
|
|
2177
|
+
enabledPlugins: Set<string>;
|
|
2178
|
+
/** @internal Plugin ID that is currently being enabled */
|
|
2179
|
+
loadingPluginId: string | null;
|
|
2180
|
+
/**
|
|
2181
|
+
* Manifests of all the plugins that are installed
|
|
2182
|
+
*/
|
|
2183
|
+
manifests: PluginsManifestsRecord;
|
|
2184
|
+
/**
|
|
2185
|
+
* Mapping of plugin ID to active plugin instance
|
|
2186
|
+
*
|
|
2187
|
+
* @remark Prefer usage of getPlugin to access a plugin
|
|
2188
|
+
*/
|
|
2189
|
+
plugins: PluginsPluginsRecord;
|
|
2190
|
+
requestSaveConfig: Debouncer<[
|
|
2191
|
+
], Promise<void>>;
|
|
2192
|
+
/**
|
|
2193
|
+
* Mapping of plugin ID to available updates
|
|
2194
|
+
*/
|
|
2195
|
+
updates: Map<string, PluginUpdateManifest>;
|
|
2196
|
+
/** @internal Check online list for deprecated plugins to automatically disable */
|
|
2197
|
+
checkForDeprecations(): Promise<void>;
|
|
2198
|
+
/**
|
|
2199
|
+
* Check for plugin updates
|
|
2200
|
+
*/
|
|
2201
|
+
checkForUpdates(): Promise<void>;
|
|
2202
|
+
/**
|
|
2203
|
+
* Unload a plugin by ID
|
|
2204
|
+
*/
|
|
2205
|
+
disablePlugin(id: string): Promise<void>;
|
|
2206
|
+
/**
|
|
2207
|
+
* Unload a plugin by ID and save config for persistence
|
|
2208
|
+
*/
|
|
2209
|
+
disablePluginAndSave(id: string): Promise<void>;
|
|
2210
|
+
/**
|
|
2211
|
+
* Enable a plugin by ID
|
|
2212
|
+
*/
|
|
2213
|
+
enablePlugin(id: string): Promise<void>;
|
|
2214
|
+
/**
|
|
2215
|
+
* Enable a plugin by ID and save config for persistence
|
|
2216
|
+
*/
|
|
2217
|
+
enablePluginAndSave(id: string): Promise<void>;
|
|
2218
|
+
/**
|
|
2219
|
+
* Get a plugin by ID
|
|
2220
|
+
*/
|
|
2221
|
+
getPlugin(id: string): Plugin$1 | null;
|
|
2222
|
+
/**
|
|
2223
|
+
* Get the folder where plugins are stored
|
|
2224
|
+
*/
|
|
2225
|
+
getPluginFolder(): string;
|
|
2226
|
+
/** @internal Load plugin manifests and enable plugins from config */
|
|
2227
|
+
initialize(): Promise<void>;
|
|
2228
|
+
/**
|
|
2229
|
+
* Install a plugin from a given URL
|
|
2230
|
+
*/
|
|
2231
|
+
installPlugin(repo: string, version: string, manifest: PluginManifest): Promise<void>;
|
|
2232
|
+
/**
|
|
2233
|
+
* Check whether a plugin is deprecated
|
|
2234
|
+
*/
|
|
2235
|
+
isDeprecated(id: string): boolean;
|
|
2236
|
+
/**
|
|
2237
|
+
* Check whether community plugins are enabled
|
|
2238
|
+
*/
|
|
2239
|
+
isEnabled(): boolean;
|
|
2240
|
+
/**
|
|
2241
|
+
* Load a specific plugin's manifest by its folder path
|
|
2242
|
+
*/
|
|
2243
|
+
loadManifest(path: string): Promise<void>;
|
|
2244
|
+
/** @internal Load all plugin manifests from plugin folder */
|
|
2245
|
+
loadManifests(): Promise<void>;
|
|
2246
|
+
/**
|
|
2247
|
+
* Load a plugin by its ID
|
|
2248
|
+
*/
|
|
2249
|
+
loadPlugin(id: string): Promise<Plugin$1>;
|
|
2250
|
+
/** @internal */
|
|
2251
|
+
onRaw(e: unknown): void;
|
|
2252
|
+
/** @internal - Save current plugin configs */
|
|
2253
|
+
saveConfig(): Promise<void>;
|
|
2254
|
+
/** @internal Toggle whether community plugins are enabled */
|
|
2255
|
+
setEnable(enabled: boolean): Promise<void>;
|
|
2256
|
+
/**
|
|
2257
|
+
* Uninstall a plugin by ID
|
|
2258
|
+
*/
|
|
2259
|
+
uninstallPlugin(id: string): Promise<void>;
|
|
2260
|
+
/**
|
|
2261
|
+
* Unload a plugin by ID
|
|
2262
|
+
*/
|
|
2263
|
+
unloadPlugin(id: string): Promise<void>;
|
|
2264
|
+
}
|
|
2265
|
+
/** @public */
|
|
2266
|
+
export interface SharedFile {
|
|
2267
|
+
name: string;
|
|
2268
|
+
uri: string;
|
|
2269
|
+
}
|
|
2270
|
+
/** @public */
|
|
2271
|
+
export interface ShareReceiver {
|
|
2272
|
+
app: App;
|
|
2273
|
+
/**
|
|
2274
|
+
* Handles shared files.
|
|
2275
|
+
*
|
|
2276
|
+
* @param files - Shared files
|
|
2277
|
+
*/
|
|
2278
|
+
handleShareFiles(files: SharedFile[]): Promise<void>;
|
|
2279
|
+
/**
|
|
2280
|
+
* Handles shared text.
|
|
2281
|
+
*
|
|
2282
|
+
* @param text - Shared text
|
|
2283
|
+
*/
|
|
2284
|
+
handleShareText(text: string): Promise<void>;
|
|
2285
|
+
/**
|
|
2286
|
+
* Imports shared files.
|
|
2287
|
+
*
|
|
2288
|
+
* @param files - Shared files
|
|
2289
|
+
*/
|
|
2290
|
+
importFiles(files: SharedFile[]): Promise<void>;
|
|
2291
|
+
/**
|
|
2292
|
+
* Configures mobile native events to handle file and text sharing.
|
|
2293
|
+
*/
|
|
2294
|
+
setupNative(): void;
|
|
2295
|
+
/**
|
|
2296
|
+
* Configures the workspace to handle file and text sharing.
|
|
2297
|
+
*/
|
|
2298
|
+
setupWorkspace(): void;
|
|
2299
|
+
}
|
|
2300
|
+
/** @public */
|
|
2301
|
+
export interface PositionedReference extends Reference {
|
|
2302
|
+
/**
|
|
2303
|
+
* Position of the reference in the file
|
|
2304
|
+
*/
|
|
2305
|
+
position: {
|
|
2306
|
+
start: Loc;
|
|
2307
|
+
end: Loc;
|
|
2308
|
+
};
|
|
2309
|
+
}
|
|
2310
|
+
/** @public */
|
|
2311
|
+
export interface LinkUpdate {
|
|
2312
|
+
/**
|
|
2313
|
+
* Reference to App
|
|
2314
|
+
*/
|
|
2315
|
+
app: App;
|
|
2316
|
+
/**
|
|
2317
|
+
* Link position in the file
|
|
2318
|
+
*/
|
|
2319
|
+
reference: PositionedReference;
|
|
2320
|
+
/**
|
|
2321
|
+
* File that was resolved
|
|
2322
|
+
*/
|
|
2323
|
+
resolvedFile: TFile;
|
|
2324
|
+
/**
|
|
2325
|
+
* Paths the file could have been resolved to
|
|
2326
|
+
*/
|
|
2327
|
+
resolvedPaths: string[];
|
|
2328
|
+
/**
|
|
2329
|
+
* File that contains the link
|
|
2330
|
+
*/
|
|
2331
|
+
sourceFile: TFile;
|
|
2332
|
+
}
|
|
2333
|
+
/** @public */
|
|
2334
|
+
export type LinkUpdateHandler = (link: LinkUpdate) => void | Promise<void>;
|
|
2335
|
+
/** @public */
|
|
2336
|
+
export interface LinkChangeUpdate {
|
|
2337
|
+
change: string;
|
|
2338
|
+
reference: ReferenceCache;
|
|
2339
|
+
sourcePath: string;
|
|
2340
|
+
}
|
|
2341
|
+
/** @public */
|
|
2342
|
+
export interface LinkUpdater {
|
|
2343
|
+
applyUpdates(file: TFile, updates: LinkChangeUpdate[]): Promise<void>;
|
|
2344
|
+
iterateReferences(callback: (path: string, reference: ReferenceCache) => void): void;
|
|
2345
|
+
renameSubpath(file: TFile, oldSubpath: string, newSubpath: string): Promise<void>;
|
|
2346
|
+
}
|
|
2347
|
+
/** @public */
|
|
2348
|
+
export interface CanvasLinkUpdater extends LinkUpdater {
|
|
2349
|
+
app: App;
|
|
2350
|
+
canvas: CanvasPluginInstance;
|
|
2351
|
+
}
|
|
2352
|
+
/** @public */
|
|
2353
|
+
export interface LinkUpdaters extends Record<string, LinkUpdater> {
|
|
2354
|
+
canvas?: CanvasLinkUpdater;
|
|
2355
|
+
}
|
|
2356
|
+
/** @public */
|
|
2357
|
+
export interface FileEntry extends Partial<FileStats> {
|
|
2358
|
+
/**
|
|
2359
|
+
* Name of file or folder
|
|
2360
|
+
*/
|
|
2361
|
+
name?: string;
|
|
2362
|
+
/**
|
|
2363
|
+
* Full path to file or folder
|
|
2364
|
+
*
|
|
2365
|
+
* @remark Might be used for resolving symlinks
|
|
2366
|
+
*/
|
|
2367
|
+
realpath: string;
|
|
2368
|
+
/**
|
|
2369
|
+
* Type of entry
|
|
2370
|
+
*/
|
|
2371
|
+
type: "file" | "folder";
|
|
2372
|
+
/**
|
|
2373
|
+
* URI of file or folder
|
|
2374
|
+
*/
|
|
2375
|
+
uri?: string;
|
|
2376
|
+
}
|
|
2377
|
+
/** @public */
|
|
2378
|
+
export interface DataAdapterFilesRecord extends Record<string, FileEntry> {
|
|
2379
|
+
}
|
|
2380
|
+
/** @todo Documentation incomplete */
|
|
2381
|
+
/** @public */
|
|
2382
|
+
export interface KeyScope {
|
|
2383
|
+
/**
|
|
2384
|
+
* Key to match
|
|
2385
|
+
*/
|
|
2386
|
+
key: string | null;
|
|
2387
|
+
/**
|
|
2388
|
+
* Modifiers to match
|
|
2389
|
+
*/
|
|
2390
|
+
modifiers: string | null;
|
|
2391
|
+
/**
|
|
2392
|
+
* Scope where the key interceptor is registered
|
|
2393
|
+
*/
|
|
2394
|
+
scope: Scope;
|
|
2395
|
+
/**
|
|
2396
|
+
* Callback of function to execute when key is pressed
|
|
2397
|
+
*/
|
|
2398
|
+
func(): void;
|
|
2399
|
+
}
|
|
2400
|
+
/** @public */
|
|
2401
|
+
export interface CanvasConnection {
|
|
2402
|
+
}
|
|
2403
|
+
/** @public */
|
|
2404
|
+
export interface CanvasNode {
|
|
2405
|
+
}
|
|
2406
|
+
/** @todo Documentation incomplete */
|
|
2407
|
+
/** @public */
|
|
2408
|
+
export interface FileTreeItem {
|
|
2409
|
+
file: TAbstractFile;
|
|
2410
|
+
}
|
|
2411
|
+
/** @todo Documentation incomplete */
|
|
2412
|
+
/** @public */
|
|
2413
|
+
export interface InfinityScroll {
|
|
2414
|
+
height: number;
|
|
2415
|
+
lastScroll: number;
|
|
2416
|
+
queued: unknown | null;
|
|
2417
|
+
renderBlockSize: number;
|
|
2418
|
+
rootEl: unknown;
|
|
2419
|
+
scrollEl: HTMLElement;
|
|
2420
|
+
setWidth: boolean;
|
|
2421
|
+
width: number;
|
|
2422
|
+
_layout(x: unknown, y: unknown): unknown;
|
|
2423
|
+
_measure(x: unknown): unknown;
|
|
2424
|
+
_precompute(x: unknown): unknown;
|
|
2425
|
+
compute(x: unknown): unknown;
|
|
2426
|
+
findElementTop(x: unknown, y: unknown, z: unknown): unknown;
|
|
2427
|
+
getRootTop(): unknown;
|
|
2428
|
+
invalidate(x: unknown, y: unknown): unknown;
|
|
2429
|
+
invalidateAll(): unknown;
|
|
2430
|
+
measure(x: unknown, y: unknown): unknown;
|
|
2431
|
+
onResize(): unknown;
|
|
2432
|
+
onScroll(): unknown;
|
|
2433
|
+
queueCompute(): unknown;
|
|
2434
|
+
scrollIntoView(x: unknown, y: unknown): unknown;
|
|
2435
|
+
update(x: unknown, y: unknown, z: unknown, u: unknown, v: unknown, w: unknown): unknown;
|
|
2436
|
+
updateVirtualDisplay(x: unknown): unknown;
|
|
2437
|
+
}
|
|
2438
|
+
/**
|
|
2439
|
+
* @todo Documentation incomplete
|
|
2440
|
+
*/
|
|
2441
|
+
/** @public */
|
|
2442
|
+
export type TreeNode<T = object> = T & {
|
|
2443
|
+
childrenEl: HTMLElement;
|
|
2444
|
+
el: HTMLElement;
|
|
2445
|
+
info: {
|
|
2446
|
+
childLeft: number;
|
|
2447
|
+
childLeftPadding: number;
|
|
2448
|
+
childTop: number;
|
|
2449
|
+
computed: boolean;
|
|
2450
|
+
height: number;
|
|
2451
|
+
hidden: boolean;
|
|
2452
|
+
next: boolean;
|
|
2453
|
+
queued: boolean;
|
|
2454
|
+
width: number;
|
|
2455
|
+
};
|
|
2456
|
+
pusherEl: HTMLElement;
|
|
2457
|
+
vChildren: {
|
|
2458
|
+
_children: TreeNode<T>[];
|
|
2459
|
+
owner: TreeNode<T>;
|
|
2460
|
+
};
|
|
2461
|
+
};
|
|
2462
|
+
/** @public */
|
|
2463
|
+
export interface Tree<T> {
|
|
2464
|
+
/**
|
|
2465
|
+
* Currently active item in tree view
|
|
2466
|
+
*/
|
|
2467
|
+
activeDom: TreeNode<T> | null;
|
|
2468
|
+
/**
|
|
2469
|
+
* Reference to App
|
|
2470
|
+
*/
|
|
2471
|
+
app: App;
|
|
2472
|
+
/**
|
|
2473
|
+
* Container element of the tree view
|
|
2474
|
+
*/
|
|
2475
|
+
containerEl: HTMLElement;
|
|
2476
|
+
/**
|
|
2477
|
+
* Currently focused item in tree view
|
|
2478
|
+
*/
|
|
2479
|
+
focusedItem: TreeNode<T> | null;
|
|
2480
|
+
/**
|
|
2481
|
+
* Handle collapsing of all nodes
|
|
2482
|
+
*/
|
|
2483
|
+
handleCollapseAll: () => void;
|
|
2484
|
+
/**
|
|
2485
|
+
* Handle renaming of focused item
|
|
2486
|
+
*/
|
|
2487
|
+
handleRenameFocusedItem: () => void;
|
|
2488
|
+
/**
|
|
2489
|
+
* ID of the view the tree is associated with
|
|
2490
|
+
*/
|
|
2491
|
+
id: string;
|
|
2492
|
+
/** @internal Facilitates rendering of tree view */
|
|
2493
|
+
infinityScroll: InfinityScroll;
|
|
2494
|
+
/**
|
|
2495
|
+
* Whether all items in the tree are collapsed
|
|
2496
|
+
*/
|
|
2497
|
+
isAllCollapsed: boolean;
|
|
2498
|
+
/**
|
|
2499
|
+
* Whether tree items should default to collapsed state
|
|
2500
|
+
*/
|
|
2501
|
+
prefersCollapsed: boolean;
|
|
2502
|
+
/**
|
|
2503
|
+
* Request saving of the current fold states
|
|
2504
|
+
*/
|
|
2505
|
+
requestSaveFolds: () => void;
|
|
2506
|
+
/**
|
|
2507
|
+
* Key scope for tree view
|
|
2508
|
+
*/
|
|
2509
|
+
scope: Scope;
|
|
2510
|
+
/**
|
|
2511
|
+
* Currently selected items in tree view
|
|
2512
|
+
*/
|
|
2513
|
+
selectedDoms: Set<TreeNode<T>>;
|
|
2514
|
+
/**
|
|
2515
|
+
* The view the tree is associated with
|
|
2516
|
+
*/
|
|
2517
|
+
view: View;
|
|
2518
|
+
/**
|
|
2519
|
+
* Root item of the tree view
|
|
2520
|
+
*/
|
|
2521
|
+
get root(): TreeNode<T>;
|
|
2522
|
+
/**
|
|
2523
|
+
* Change the focused item to the next item in specified direction
|
|
2524
|
+
*/
|
|
2525
|
+
changeFocusedItem(direction: "forwards" | "backwards"): void;
|
|
2526
|
+
/**
|
|
2527
|
+
* Unselect all selected items in the tree view
|
|
2528
|
+
*/
|
|
2529
|
+
clearSelectedDoms(): void;
|
|
2530
|
+
/**
|
|
2531
|
+
* Mark tree item as deselected
|
|
2532
|
+
*/
|
|
2533
|
+
deselectItem(node: TreeNode<T>): void;
|
|
2534
|
+
/**
|
|
2535
|
+
* Get the local storage key for the saved tree view folds
|
|
2536
|
+
*/
|
|
2537
|
+
getFoldKey(): string;
|
|
2538
|
+
/**
|
|
2539
|
+
* Gets the ID of a tree item given its Node
|
|
2540
|
+
*/
|
|
2541
|
+
getNodeId(node: TreeNode<T>): string | undefined;
|
|
2542
|
+
/**
|
|
2543
|
+
* Handle deletion of selected nodes
|
|
2544
|
+
*/
|
|
2545
|
+
handleDeleteSelectedItems(event: KeyboardEvent): Promise<void>;
|
|
2546
|
+
/**
|
|
2547
|
+
* Handle selection of tree item via keyboard event
|
|
2548
|
+
*/
|
|
2549
|
+
handleItemSelection(event: MouseEvent, node: TreeNode<T>): void;
|
|
2550
|
+
/** @internal Registers all keyboard actions to the tree view keyscope */
|
|
2551
|
+
initializeKeyboardNav(): void;
|
|
2552
|
+
/**
|
|
2553
|
+
* Check whether item is a valid tree item
|
|
2554
|
+
*/
|
|
2555
|
+
isItem(node: TreeNode<T> | undefined): boolean;
|
|
2556
|
+
/**
|
|
2557
|
+
* Load the saved fold states of the tree view from local storage
|
|
2558
|
+
*/
|
|
2559
|
+
loadFolds(): void;
|
|
2560
|
+
/**
|
|
2561
|
+
* Handle keyboard event for moving/selecting tree item below
|
|
2562
|
+
*/
|
|
2563
|
+
onKeyArrowDown(event: KeyboardEvent): void;
|
|
2564
|
+
/**
|
|
2565
|
+
* Handle keyboard event for moving through the hierarchy of tree items (and/or folding/unfolding)
|
|
2566
|
+
*/
|
|
2567
|
+
onKeyArrowLeft(event: KeyboardEvent): void;
|
|
2568
|
+
/**
|
|
2569
|
+
* Handle keyboard event for moving through the hierarchy of tree items (and/or folding/unfolding)
|
|
2570
|
+
*/
|
|
2571
|
+
onKeyArrowRight(event: KeyboardEvent): void;
|
|
2572
|
+
/**
|
|
2573
|
+
* Handle keyboard event for moving/selecting tree item above
|
|
2574
|
+
*/
|
|
2575
|
+
onKeyArrowUp(event: KeyboardEvent): void;
|
|
2576
|
+
/**
|
|
2577
|
+
* Handle keyboard event for opening tree item
|
|
2578
|
+
*/
|
|
2579
|
+
onKeyOpen(event: KeyboardEvent): void;
|
|
2580
|
+
/** @internal Update scroll representation on resize */
|
|
2581
|
+
onResize(): void;
|
|
2582
|
+
/**
|
|
2583
|
+
* Save the current fold states of the tree view to local storage
|
|
2584
|
+
*/
|
|
2585
|
+
saveFolds(): void;
|
|
2586
|
+
/**
|
|
2587
|
+
* Mark tree item as selected
|
|
2588
|
+
*/
|
|
2589
|
+
selectItem(node: TreeNode<T>): void;
|
|
2590
|
+
/**
|
|
2591
|
+
* Set all items in the tree view to be collapsed or expanded
|
|
2592
|
+
*/
|
|
2593
|
+
setCollapseAll(collapse: boolean): void;
|
|
2594
|
+
/**
|
|
2595
|
+
* Set the focused item in the tree view
|
|
2596
|
+
*/
|
|
2597
|
+
setFocusedItem(node: TreeNode<T>, scrollIntoView?: boolean): void;
|
|
2598
|
+
/**
|
|
2599
|
+
* (Un)Collapse all items in the tree view
|
|
2600
|
+
*/
|
|
2601
|
+
toggleCollapseAll(): void;
|
|
2602
|
+
}
|
|
2603
|
+
/** @public */
|
|
2604
|
+
export interface WeakMapWrapper<K extends object, V> extends WeakMap<K, V> {
|
|
2605
|
+
map: WeakMap<K, V>;
|
|
2606
|
+
}
|
|
2607
|
+
/** @todo Documentation incomplete */
|
|
2608
|
+
/** @public */
|
|
2609
|
+
export type TreeItem<T> = TreeNode<T> & {
|
|
2610
|
+
collapseEl: HTMLElement;
|
|
2611
|
+
/**
|
|
2612
|
+
* @deprecated Potentially removed in 1.6.0 for some tree-likes
|
|
2613
|
+
*/
|
|
2614
|
+
collapsed: boolean;
|
|
2615
|
+
/**
|
|
2616
|
+
* @deprecated Potentially removed in 1.6.0 for some tree-likes
|
|
2617
|
+
*/
|
|
2618
|
+
collapsible: boolean;
|
|
2619
|
+
coverEl: HTMLElement;
|
|
2620
|
+
innerEl: HTMLElement;
|
|
2621
|
+
parent: TreeNode<T> | undefined;
|
|
2622
|
+
selfEl: HTMLElement;
|
|
2623
|
+
view: View;
|
|
2624
|
+
/**
|
|
2625
|
+
* Execute collapse functionality on mouse click
|
|
2626
|
+
*/
|
|
2627
|
+
onCollapseClick(event: MouseEvent): void;
|
|
2628
|
+
/**
|
|
2629
|
+
* Execute item functionality on clicking tree item
|
|
2630
|
+
*/
|
|
2631
|
+
onSelfClick(event: MouseEvent): void;
|
|
2632
|
+
/**
|
|
2633
|
+
* Set clickable state of tree item
|
|
2634
|
+
*/
|
|
2635
|
+
setClickable(clickable: boolean): void;
|
|
2636
|
+
/**
|
|
2637
|
+
* Set collapsed state of tree item
|
|
2638
|
+
*/
|
|
2639
|
+
setCollapsed(collapsed: boolean, check: boolean): Promise<undefined>;
|
|
2640
|
+
/**
|
|
2641
|
+
* Set collapsible state of tree item
|
|
2642
|
+
*/
|
|
2643
|
+
setCollapsible(collapsible: boolean): void;
|
|
2644
|
+
/**
|
|
2645
|
+
* Toggle collapsed state of tree item
|
|
2646
|
+
*/
|
|
2647
|
+
toggleCollapsed(check: boolean): Promise<undefined>;
|
|
2648
|
+
/**
|
|
2649
|
+
* @internal Update the tree item's cover element
|
|
2650
|
+
*/
|
|
2651
|
+
updateCollapsed(check: boolean): Promise<undefined>;
|
|
2652
|
+
};
|
|
2653
|
+
/** @public */
|
|
2654
|
+
export interface FileExplorerViewFileItemsRecord extends Record<string, TreeItem<FileTreeItem>> {
|
|
2655
|
+
}
|
|
2656
|
+
/** @todo Documentation incomplete */
|
|
2657
|
+
/** @public */
|
|
2658
|
+
export interface FileExplorerView extends View {
|
|
2659
|
+
/**
|
|
2660
|
+
* Mapping of file path to tree item
|
|
2661
|
+
*/
|
|
2662
|
+
fileItems: FileExplorerViewFileItemsRecord;
|
|
2663
|
+
/**
|
|
2664
|
+
* Mapping of tree self element to abstract file
|
|
2665
|
+
*/
|
|
2666
|
+
files: WeakMapWrapper<HTMLElement, TAbstractFile>;
|
|
2667
|
+
/**
|
|
2668
|
+
* Tree view of files
|
|
2669
|
+
*/
|
|
2670
|
+
tree: Tree<FileTreeItem>;
|
|
2671
|
+
/**
|
|
2672
|
+
* Try to rename the file
|
|
2673
|
+
*/
|
|
2674
|
+
acceptRename(): Promise<void>;
|
|
2675
|
+
/**
|
|
2676
|
+
* Is Executed after creating the file or folder and opens the view and/or starts the rename
|
|
2677
|
+
* @param file - The created file
|
|
2678
|
+
* @param newLeaf - Where to open the view for this file
|
|
2679
|
+
*/
|
|
2680
|
+
afterCreate(file: TFile, newLeaf: PaneType | boolean): Promise<void>;
|
|
2681
|
+
/** @todo Documentation incomplete */
|
|
2682
|
+
attachFileEvents(e: unknown): void;
|
|
2683
|
+
/**
|
|
2684
|
+
* Creates an file or folder
|
|
2685
|
+
* @param type - The type of file to create
|
|
2686
|
+
* @param location - The location where to create the file
|
|
2687
|
+
* @param newLeaf - Where to open the view for this file
|
|
2688
|
+
*/
|
|
2689
|
+
createAbstractFile(type: "file" | "folder", location: TFolder, newLeaf: PaneType | boolean): Promise<void>;
|
|
2690
|
+
/** @todo Documentation incomplete */
|
|
2691
|
+
createFolderDom(folder: TFolder): unknown;
|
|
2692
|
+
/** @todo Documentation incomplete */
|
|
2693
|
+
createItemDom(file: TFile): unknown;
|
|
2694
|
+
/** @todo Documentation incomplete */
|
|
2695
|
+
displayError(message: string, fileItem: unknown): void;
|
|
2696
|
+
/** @todo Documentation incomplete */
|
|
2697
|
+
dragFiles(event: DragEvent, t: unknown): unknown;
|
|
2698
|
+
/**
|
|
2699
|
+
* Quits the rename
|
|
2700
|
+
*/
|
|
2701
|
+
exitRename(): void;
|
|
2702
|
+
/** @todo Documentation incomplete */
|
|
2703
|
+
getNodeId(e: unknown): unknown;
|
|
2704
|
+
/**
|
|
2705
|
+
* Get the current view type
|
|
2706
|
+
*/
|
|
2707
|
+
getViewType(): "file-explorer";
|
|
2708
|
+
/** @todo Documentation incomplete maybe FileTreeItem */
|
|
2709
|
+
isItem(item: unknown): boolean;
|
|
2710
|
+
/**
|
|
2711
|
+
* Is called when a new file is created in vault. Updates the file tree
|
|
2712
|
+
* @param file - The new file
|
|
2713
|
+
*/
|
|
2714
|
+
onCreate(file: TFile): void;
|
|
2715
|
+
/**
|
|
2716
|
+
* Is called when on the new folder icon is clicked. Call createAbstractFile()
|
|
2717
|
+
* @param event - The MouseEvent which triggered this function
|
|
2718
|
+
*/
|
|
2719
|
+
onCreateNewFolderClick(event: MouseEvent): Promise<void>;
|
|
2720
|
+
/**
|
|
2721
|
+
* Is called when on the new note icon is clicked. Call createAbstractFile()
|
|
2722
|
+
* @param event - The MouseEvent which triggered this function
|
|
2723
|
+
*/
|
|
2724
|
+
onCreateNewNoteClick(event: MouseEvent): Promise<void>;
|
|
2725
|
+
/**
|
|
2726
|
+
* Is called when a file in vault is deleted. Updates the file tree
|
|
2727
|
+
* @param file - The deleted file
|
|
2728
|
+
*/
|
|
2729
|
+
onDelete(file: TFile): void;
|
|
2730
|
+
/**
|
|
2731
|
+
* Called when delete is requested
|
|
2732
|
+
* @param event - The event triggered this function
|
|
2733
|
+
*/
|
|
2734
|
+
onDeleteSelectedFiles(event: unknown): unknown;
|
|
2735
|
+
/**
|
|
2736
|
+
* Called when a extensions update is triggered
|
|
2737
|
+
* Event: 'extensions-updated'
|
|
2738
|
+
*/
|
|
2739
|
+
onExtensionsUpdated(): void;
|
|
2740
|
+
/**
|
|
2741
|
+
* Called when the mouse pointer moves away from an element.
|
|
2742
|
+
* Event: 'mouseout'
|
|
2743
|
+
* @param event - The event triggered this function
|
|
2744
|
+
* @param targetEl - The target Element
|
|
2745
|
+
*/
|
|
2746
|
+
onFileMouseout(event: MouseEvent, targetEl: HTMLElement): void;
|
|
2747
|
+
/**
|
|
2748
|
+
* Called when the mouse pointer is moved over an element. Updates the tooltip information
|
|
2749
|
+
* Event: 'mouseover'
|
|
2750
|
+
* @param event - The event triggered this function
|
|
2751
|
+
* @param targetEl - The target Element
|
|
2752
|
+
*/
|
|
2753
|
+
onFileMouseover(event: MouseEvent, targetEl: HTMLElement): void;
|
|
2754
|
+
/**
|
|
2755
|
+
* Called when a file is opened. Brings the file to the front.
|
|
2756
|
+
* @param file - The opened file
|
|
2757
|
+
*/
|
|
2758
|
+
onFileOpen(file: TFile): void;
|
|
2759
|
+
/** @todo Documentation incomplete */
|
|
2760
|
+
onFileRenameInput(e: unknown): void;
|
|
2761
|
+
/**
|
|
2762
|
+
* Called when 'Enter' is pressed while rename. Accepts the rename
|
|
2763
|
+
* @param event - The event triggered this function
|
|
2764
|
+
*/
|
|
2765
|
+
onKeyEnterInRename(event: KeyboardEvent): void;
|
|
2766
|
+
/**
|
|
2767
|
+
* Called when 'ESC' is pressed while rename. Denies the rename
|
|
2768
|
+
*/
|
|
2769
|
+
onKeyEscInRename(): void;
|
|
2770
|
+
/**
|
|
2771
|
+
* Called when the rename shortcut is pressed
|
|
2772
|
+
* @param event - The event triggered this function
|
|
2773
|
+
*/
|
|
2774
|
+
onKeyRename(event: KeyboardEvent): void;
|
|
2775
|
+
/**
|
|
2776
|
+
* Request a sort if not sorted properly
|
|
2777
|
+
*/
|
|
2778
|
+
onModify(): void;
|
|
2779
|
+
/**
|
|
2780
|
+
* Is called when a file in vault is renamed. Updates the file tree
|
|
2781
|
+
* @param file - The renamed file
|
|
2782
|
+
* @param oldPath - The old file path
|
|
2783
|
+
*/
|
|
2784
|
+
onRename(file: TFile, oldPath: string): void;
|
|
2785
|
+
/**
|
|
2786
|
+
* Called when the title is deselected. Calls acceptRename()
|
|
2787
|
+
*/
|
|
2788
|
+
onTitleBlur(): void;
|
|
2789
|
+
/**
|
|
2790
|
+
* Opens the context menu for the file item
|
|
2791
|
+
* @param event - The event
|
|
2792
|
+
* @param fileItemEl - The file item clicked on
|
|
2793
|
+
*/
|
|
2794
|
+
openFileContextMenu(event: Event, fileItemEl: HTMLElement): void;
|
|
2795
|
+
/**
|
|
2796
|
+
* Reveal a file or folder in the file tree
|
|
2797
|
+
*/
|
|
2798
|
+
revealInFolder(file: TFile | TFolder): void;
|
|
2799
|
+
/** @todo Documentation incomplete */
|
|
2800
|
+
setIsAllCollapsed(e: unknown): void;
|
|
2801
|
+
/**
|
|
2802
|
+
* Updates the sort order and sort by it
|
|
2803
|
+
* @param order - The sort order
|
|
2804
|
+
*/
|
|
2805
|
+
setSortOrder(order: unknown): void;
|
|
2806
|
+
/**
|
|
2807
|
+
* Sorts the file items in this view
|
|
2808
|
+
*/
|
|
2809
|
+
sort(): void;
|
|
2810
|
+
/** @todo Documentation incomplete */
|
|
2811
|
+
startRenameFile(e: unknown): unknown;
|
|
2812
|
+
/**
|
|
2813
|
+
* Reloads the config from vault and update all items
|
|
2814
|
+
*/
|
|
2815
|
+
updateConfig(): void;
|
|
2816
|
+
}
|
|
2817
|
+
/** @todo Documentation incomplete */
|
|
2818
|
+
/** @public */
|
|
2819
|
+
export interface FileExplorerLeaf extends WorkspaceLeaf {
|
|
2820
|
+
view: FileExplorerView;
|
|
2821
|
+
/** @internal */
|
|
2822
|
+
attachDropHandler(x: unknown, y: unknown, z: unknown): unknown;
|
|
2823
|
+
/** @internal Get a sorted list of the tree items for a specific folder) */
|
|
2824
|
+
getSortedFolderItems(folder: TFolder): FileTreeItem[];
|
|
2825
|
+
}
|
|
2826
|
+
/** @todo Documentation incomplete */
|
|
2827
|
+
/** @public */
|
|
2828
|
+
export interface HoverLinkEvent {
|
|
2829
|
+
event: MouseEvent;
|
|
2830
|
+
hoverParent: WorkspaceLeaf;
|
|
2831
|
+
linktext: string;
|
|
2832
|
+
source: "search" | "editor" | "preview" | "properties" | "graph" | "file-explorer" | "hover-link";
|
|
2833
|
+
sourcePath?: string;
|
|
2834
|
+
state?: {
|
|
2835
|
+
scroll: unknown;
|
|
2836
|
+
};
|
|
2837
|
+
targetEl: HTMLElement | null;
|
|
2838
|
+
}
|
|
2839
|
+
/** @todo Documentation incomplete */
|
|
2840
|
+
/** @public */
|
|
2841
|
+
export interface LeafEntry {
|
|
2842
|
+
children?: LeafEntry[];
|
|
2843
|
+
direction?: SplitDirection;
|
|
2844
|
+
id: string;
|
|
2845
|
+
state?: ViewState;
|
|
2846
|
+
type: string;
|
|
2847
|
+
width?: number;
|
|
2848
|
+
}
|
|
2849
|
+
/** @public */
|
|
2850
|
+
export interface AbstractSearchComponent {
|
|
2851
|
+
/**
|
|
2852
|
+
* Reference to the app
|
|
2853
|
+
*/
|
|
2854
|
+
app: App;
|
|
2855
|
+
/**
|
|
2856
|
+
* The container element in which the search component exists (i.e. Editor)
|
|
2857
|
+
*/
|
|
2858
|
+
containerEl: HTMLElement;
|
|
2859
|
+
/**
|
|
2860
|
+
* Container for the replacement input field
|
|
2861
|
+
*/
|
|
2862
|
+
replaceInputEl: HTMLInputElement;
|
|
2863
|
+
/**
|
|
2864
|
+
* Keyscope for search component
|
|
2865
|
+
*/
|
|
2866
|
+
scope: Scope;
|
|
2867
|
+
/**
|
|
2868
|
+
* Container for all the action buttons
|
|
2869
|
+
*/
|
|
2870
|
+
searchButtonContainerEl: HTMLElement;
|
|
2871
|
+
/**
|
|
2872
|
+
* Container for the search component itself
|
|
2873
|
+
*/
|
|
2874
|
+
searchContainerEl: HTMLElement;
|
|
2875
|
+
/**
|
|
2876
|
+
* Container for the search input field
|
|
2877
|
+
*/
|
|
2878
|
+
searchInputEl: HTMLInputElement;
|
|
2879
|
+
/**
|
|
2880
|
+
* Returns the current search query
|
|
2881
|
+
*/
|
|
2882
|
+
getQuery(): string;
|
|
2883
|
+
/**
|
|
2884
|
+
* Switch to the next inputElement
|
|
2885
|
+
*/
|
|
2886
|
+
goToNextInput(event: KeyboardEvent): unknown;
|
|
2887
|
+
/**
|
|
2888
|
+
* Invokes findNextOrReplace
|
|
2889
|
+
*/
|
|
2890
|
+
onEnter(event: KeyboardEvent): unknown;
|
|
2891
|
+
/**
|
|
2892
|
+
* Invokes findPrevious
|
|
2893
|
+
*/
|
|
2894
|
+
onShiftEnter(event: KeyboardEvent): unknown;
|
|
2895
|
+
}
|
|
2896
|
+
/** @public */
|
|
2897
|
+
export interface SearchCursor {
|
|
2898
|
+
/**
|
|
2899
|
+
* Current editor search position
|
|
2900
|
+
*/
|
|
2901
|
+
current(): {
|
|
2902
|
+
from: EditorPosition;
|
|
2903
|
+
to: EditorPosition;
|
|
2904
|
+
};
|
|
2905
|
+
/**
|
|
2906
|
+
* All search results
|
|
2907
|
+
*/
|
|
2908
|
+
findAll(): {
|
|
2909
|
+
from: EditorPosition;
|
|
2910
|
+
to: EditorPosition;
|
|
2911
|
+
}[];
|
|
2912
|
+
/**
|
|
2913
|
+
* Next editor search position
|
|
2914
|
+
*/
|
|
2915
|
+
findNext(): {
|
|
2916
|
+
from: EditorPosition;
|
|
2917
|
+
to: EditorPosition;
|
|
2918
|
+
};
|
|
2919
|
+
/**
|
|
2920
|
+
* Previous editor search position
|
|
2921
|
+
*/
|
|
2922
|
+
findPrevious(): {
|
|
2923
|
+
from: EditorPosition;
|
|
2924
|
+
to: EditorPosition;
|
|
2925
|
+
};
|
|
2926
|
+
/**
|
|
2927
|
+
* Replace current search result with specified text
|
|
2928
|
+
*
|
|
2929
|
+
* @remark origin is used by CodeMirror to determine which component was responsible for the change
|
|
2930
|
+
*/
|
|
2931
|
+
replace(replacement: string, origin: string): void;
|
|
2932
|
+
/**
|
|
2933
|
+
* Replace all search results with specified text
|
|
2934
|
+
*/
|
|
2935
|
+
replaceAll(replacement: string, origin: string): void;
|
|
2936
|
+
}
|
|
2937
|
+
/** @public */
|
|
2938
|
+
export interface EditorSearchComponent extends AbstractSearchComponent {
|
|
2939
|
+
/**
|
|
2940
|
+
* Search cursor for editor, handles search and replace functionality for editor
|
|
2941
|
+
*/
|
|
2942
|
+
cursor: null | SearchCursor;
|
|
2943
|
+
/**
|
|
2944
|
+
* Linked editor for search component
|
|
2945
|
+
*/
|
|
2946
|
+
editor: Editor;
|
|
2947
|
+
/**
|
|
2948
|
+
* Whether search component is currently rendering
|
|
2949
|
+
*/
|
|
2950
|
+
isActive: boolean;
|
|
2951
|
+
/**
|
|
2952
|
+
* Whether search component is replacing text (includes 'Replace' input field)
|
|
2953
|
+
*/
|
|
2954
|
+
isReplace: boolean;
|
|
2955
|
+
/**
|
|
2956
|
+
* Remove all highlights from editor
|
|
2957
|
+
*/
|
|
2958
|
+
clear(): void;
|
|
2959
|
+
/**
|
|
2960
|
+
* Find next search results from cursor and highlights it
|
|
2961
|
+
*/
|
|
2962
|
+
findNext(): void;
|
|
2963
|
+
/**
|
|
2964
|
+
* Replace cursor with replacement string if not null and moves to next search result
|
|
2965
|
+
*/
|
|
2966
|
+
findNextOrReplace(): void;
|
|
2967
|
+
/**
|
|
2968
|
+
* Find previous search results from cursor and highlights it
|
|
2969
|
+
*/
|
|
2970
|
+
findPrevious(): void;
|
|
2971
|
+
/**
|
|
2972
|
+
* Hide/detaches the search component and removes cursor highlights
|
|
2973
|
+
*/
|
|
2974
|
+
hide(): void;
|
|
2975
|
+
/**
|
|
2976
|
+
* Add highlights for specified ranges
|
|
2977
|
+
*
|
|
2978
|
+
* @remark Invokes editor.addHighlights
|
|
2979
|
+
*/
|
|
2980
|
+
highlight(ranges: EditorRange[]): void;
|
|
2981
|
+
/**
|
|
2982
|
+
* Highlights all matches if search element focused
|
|
2983
|
+
*/
|
|
2984
|
+
onAltEnter(e?: KeyboardEvent): void;
|
|
2985
|
+
/**
|
|
2986
|
+
* Replace all search results with specified text if replace mode and replacement element is focused
|
|
2987
|
+
*/
|
|
2988
|
+
onModAltEnter(e?: KeyboardEvent): void;
|
|
2989
|
+
/**
|
|
2990
|
+
* Updates search cursor on new input query and highlights search results
|
|
2991
|
+
*/
|
|
2992
|
+
onSearchInput(): void;
|
|
2993
|
+
/**
|
|
2994
|
+
* Replaces all search results with replacement query
|
|
2995
|
+
*/
|
|
2996
|
+
replaceAll(): void;
|
|
2997
|
+
/**
|
|
2998
|
+
* Replace current search result, if any, with replacement query
|
|
2999
|
+
*/
|
|
3000
|
+
replaceCurrentMatch(): void;
|
|
3001
|
+
/**
|
|
3002
|
+
* Find all matches of search query and highlights them
|
|
3003
|
+
*/
|
|
3004
|
+
searchAll(): void;
|
|
3005
|
+
/**
|
|
3006
|
+
* Reveal the search (and replace) component
|
|
3007
|
+
*/
|
|
3008
|
+
show(replace: boolean): void;
|
|
3009
|
+
}
|
|
3010
|
+
/** @public */
|
|
3011
|
+
export interface ClipBoardManager {
|
|
3012
|
+
/**
|
|
3013
|
+
* Reference to the app
|
|
3014
|
+
*/
|
|
3015
|
+
app: App;
|
|
3016
|
+
/**
|
|
3017
|
+
* Reference to the Editor View
|
|
3018
|
+
*/
|
|
3019
|
+
info: MarkdownView;
|
|
3020
|
+
/**
|
|
3021
|
+
* Get current path of editor view for determining storage location embed
|
|
3022
|
+
*/
|
|
3023
|
+
getPath(): string;
|
|
3024
|
+
/**
|
|
3025
|
+
* Process incoming data (image, text, url, html)
|
|
3026
|
+
*
|
|
3027
|
+
* @remark When processing HTML, function will be async
|
|
3028
|
+
*/
|
|
3029
|
+
handleDataTransfer(data: DataTransfer): null | Promise<void>;
|
|
3030
|
+
/**
|
|
3031
|
+
* Handle an incoming drag-over event
|
|
3032
|
+
*/
|
|
3033
|
+
handleDragOver(event: DragEvent): void;
|
|
3034
|
+
/**
|
|
3035
|
+
* Handle an incoming drag-drop event
|
|
3036
|
+
*/
|
|
3037
|
+
handleDrop(event: DragEvent): boolean;
|
|
3038
|
+
/**
|
|
3039
|
+
* Process a drop event into the editor
|
|
3040
|
+
*/
|
|
3041
|
+
handleDropIntoEditor(event: DragEvent): null | string;
|
|
3042
|
+
/**
|
|
3043
|
+
* Handle an incoming paste event
|
|
3044
|
+
*/
|
|
3045
|
+
handlePaste(event: ClipboardEvent): boolean;
|
|
3046
|
+
/**
|
|
3047
|
+
* Insert single file as embed into the editor
|
|
3048
|
+
*/
|
|
3049
|
+
insertAttachmentEmbed(file: TAbstractFile, replace: boolean): Promise<void>;
|
|
3050
|
+
/**
|
|
3051
|
+
* Insert files from drop-event into the editor
|
|
3052
|
+
*/
|
|
3053
|
+
insertFiles(files: ImportedAttachments[]): Promise<void>;
|
|
3054
|
+
/**
|
|
3055
|
+
* Save an attachment of specified name and extension to the vault
|
|
3056
|
+
*
|
|
3057
|
+
* @remark Invokes insertAttachmentEmbed
|
|
3058
|
+
*/
|
|
3059
|
+
saveAttachment(name: string, extension: string, data: ArrayBuffer, replace: boolean): Promise<void>;
|
|
3060
|
+
}
|
|
3061
|
+
/** @public */
|
|
3062
|
+
export interface EditorSuggests {
|
|
3063
|
+
/**
|
|
3064
|
+
* Currently active and rendered editor suggestion popup
|
|
3065
|
+
*/
|
|
3066
|
+
currentSuggest: null | EditorSuggest<any>;
|
|
3067
|
+
/**
|
|
3068
|
+
* Registered editor suggestions
|
|
3069
|
+
*
|
|
3070
|
+
* @remark Used for providing autocompletions for specific strings
|
|
3071
|
+
* @tutorial Reference official documentation under EditorSuggest<T> for usage
|
|
3072
|
+
*/
|
|
3073
|
+
suggests: EditorSuggest<any>[];
|
|
3074
|
+
/**
|
|
3075
|
+
* Add a new editor suggestion to the list of registered suggestion providers
|
|
3076
|
+
*/
|
|
3077
|
+
addSuggest(suggest: EditorSuggest<any>): void;
|
|
3078
|
+
/**
|
|
3079
|
+
* Close the currently active editor suggestion popup
|
|
3080
|
+
*/
|
|
3081
|
+
close(): void;
|
|
3082
|
+
/**
|
|
3083
|
+
* Whether there is a editor suggestion popup active and visible
|
|
3084
|
+
*/
|
|
3085
|
+
isShowingSuggestion(): boolean;
|
|
3086
|
+
/**
|
|
3087
|
+
* Remove a registered editor suggestion from the list of registered suggestion providers
|
|
3088
|
+
*/
|
|
3089
|
+
removeSuggest(suggest: EditorSuggest<any>): void;
|
|
3090
|
+
/**
|
|
3091
|
+
* Update position of currently active and rendered editor suggestion popup
|
|
3092
|
+
*/
|
|
3093
|
+
reposition(): void;
|
|
3094
|
+
/**
|
|
3095
|
+
* Set the currently active editor suggestion popup to specified suggester
|
|
3096
|
+
*/
|
|
3097
|
+
setCurrentSuggest(suggest: EditorSuggest<any>): void;
|
|
3098
|
+
/**
|
|
3099
|
+
* Run check on focused editor to see whether a suggestion should be triggered and rendered
|
|
3100
|
+
*/
|
|
3101
|
+
trigger(editor: MarkdownBaseView, t: TFile, n: boolean): void;
|
|
3102
|
+
}
|
|
3103
|
+
/** @todo Documentation incomplete */
|
|
3104
|
+
/** @public */
|
|
3105
|
+
export interface FoldInfo {
|
|
3106
|
+
folds: {
|
|
3107
|
+
from: number;
|
|
3108
|
+
to: number;
|
|
3109
|
+
}[];
|
|
3110
|
+
lines: number;
|
|
3111
|
+
}
|
|
3112
|
+
/** @todo Documentation incomplete */
|
|
3113
|
+
/** @public */
|
|
3114
|
+
export interface TableCellEditor extends MarkdownBaseView, TableCell {
|
|
3115
|
+
}
|
|
3116
|
+
/** @todo Documentation incomplete */
|
|
3117
|
+
/** @public */
|
|
3118
|
+
export interface TableCell {
|
|
3119
|
+
col: number;
|
|
3120
|
+
contentEl: HTMLElement;
|
|
3121
|
+
dirty: boolean;
|
|
3122
|
+
el: HTMLElement;
|
|
3123
|
+
end: number;
|
|
3124
|
+
padEnd: number;
|
|
3125
|
+
padStart: number;
|
|
3126
|
+
row: number;
|
|
3127
|
+
start: number;
|
|
3128
|
+
table: TableCellEditor;
|
|
3129
|
+
text: string;
|
|
3130
|
+
}
|
|
3131
|
+
/** @todo Documentation incomplete */
|
|
3132
|
+
/** @public */
|
|
3133
|
+
export interface TableEditor {
|
|
3134
|
+
}
|
|
3135
|
+
/** @todo Documentation incomplete */
|
|
3136
|
+
/** @public */
|
|
3137
|
+
export interface Token extends EditorRange {
|
|
3138
|
+
text: string;
|
|
3139
|
+
type: "tag" | "external-link" | "internal-link";
|
|
3140
|
+
}
|
|
3141
|
+
/** @public */
|
|
3142
|
+
export interface MarkdownBaseView extends Component {
|
|
3143
|
+
/**
|
|
3144
|
+
* Reference to the app
|
|
3145
|
+
*/
|
|
3146
|
+
app: App;
|
|
3147
|
+
/**
|
|
3148
|
+
* Callback to clear all elements
|
|
3149
|
+
*/
|
|
3150
|
+
cleanupLivePreview: null | (() => void);
|
|
3151
|
+
/**
|
|
3152
|
+
* Manager that handles pasting text, html and images into the editor
|
|
3153
|
+
*/
|
|
3154
|
+
clipboardManager: ClipBoardManager;
|
|
3155
|
+
/**
|
|
3156
|
+
* Codemirror editor instance
|
|
3157
|
+
*/
|
|
3158
|
+
cm: EditorView;
|
|
3159
|
+
/**
|
|
3160
|
+
* Whether CodeMirror is initialized
|
|
3161
|
+
*/
|
|
3162
|
+
cmInit: boolean;
|
|
3163
|
+
/**
|
|
3164
|
+
* Container element of the editor view
|
|
3165
|
+
*/
|
|
3166
|
+
containerEl: HTMLElement;
|
|
3167
|
+
/**
|
|
3168
|
+
* Popup element for internal link
|
|
3169
|
+
*/
|
|
3170
|
+
cursorPopupEl: HTMLElement | null;
|
|
3171
|
+
/**
|
|
3172
|
+
* Obsidian editor instance
|
|
3173
|
+
*
|
|
3174
|
+
* @remark Handles formatting, table creation, highlight adding, etc.
|
|
3175
|
+
*/
|
|
3176
|
+
editor?: Editor;
|
|
3177
|
+
/**
|
|
3178
|
+
* Element in which the CodeMirror editor resides
|
|
3179
|
+
*/
|
|
3180
|
+
editorEl: HTMLElement;
|
|
3181
|
+
/**
|
|
3182
|
+
* Editor suggester for autocompleting files, links, aliases, etc.
|
|
3183
|
+
*/
|
|
3184
|
+
editorSuggest: EditorSuggests;
|
|
3185
|
+
/**
|
|
3186
|
+
* The CodeMirror plugins that handle the rendering of, and interaction with Obsidian's Markdown
|
|
3187
|
+
*/
|
|
3188
|
+
livePreviewPlugin: Extension[];
|
|
3189
|
+
/**
|
|
3190
|
+
* Local (always active) extensions for the editor
|
|
3191
|
+
*/
|
|
3192
|
+
localExtensions: Extension[];
|
|
3193
|
+
/**
|
|
3194
|
+
* Controller of the editor view
|
|
3195
|
+
*/
|
|
3196
|
+
owner: MarkdownFileInfo;
|
|
3197
|
+
/**
|
|
3198
|
+
* Whether live preview rendering is disabled
|
|
3199
|
+
*/
|
|
3200
|
+
sourceMode: boolean;
|
|
3201
|
+
/**
|
|
3202
|
+
* Reference to editor attached to table cell, if any
|
|
3203
|
+
*/
|
|
3204
|
+
tableCell: null | TableCellEditor;
|
|
3205
|
+
/**
|
|
3206
|
+
* Currently active CM instance (table cell CM or main CM)
|
|
3207
|
+
*/
|
|
3208
|
+
get activeCM(): EditorView;
|
|
3209
|
+
/**
|
|
3210
|
+
* Returns attached file of the owner instance
|
|
3211
|
+
*/
|
|
3212
|
+
get file(): TFile | null;
|
|
3213
|
+
/**
|
|
3214
|
+
* Returns path of the attached file
|
|
3215
|
+
*/
|
|
3216
|
+
get path(): string;
|
|
3217
|
+
/**
|
|
3218
|
+
* Apply fold history to editor
|
|
3219
|
+
*/
|
|
3220
|
+
applyFoldInfo(info: FoldInfo): void;
|
|
3221
|
+
/**
|
|
3222
|
+
* Constructs local (always active) extensions for the editor
|
|
3223
|
+
*
|
|
3224
|
+
* @remark Creates extensions for handling dom events, editor info state fields, update listener, suggestions
|
|
3225
|
+
*/
|
|
3226
|
+
buildLocalExtensions(): Extension[];
|
|
3227
|
+
/**
|
|
3228
|
+
* Cleanup live preview, remove and then re-add all editor extensions
|
|
3229
|
+
*/
|
|
3230
|
+
clear(): void;
|
|
3231
|
+
/**
|
|
3232
|
+
* Clean up live preview, remove all extensions, destroy editor
|
|
3233
|
+
*/
|
|
3234
|
+
destroy(): void;
|
|
3235
|
+
/**
|
|
3236
|
+
* Removes specified tablecell
|
|
3237
|
+
*/
|
|
3238
|
+
destroyTableCell(cell?: TableCellEditor): void;
|
|
3239
|
+
/**
|
|
3240
|
+
* Edit a specified table cell, creating a table cell editor
|
|
3241
|
+
*/
|
|
3242
|
+
editTableCell(cell: TableEditor, new_cell: TableCell): TableCellEditor;
|
|
3243
|
+
/**
|
|
3244
|
+
* Get the current editor document as a string
|
|
3245
|
+
*/
|
|
3246
|
+
get(): string;
|
|
3247
|
+
/**
|
|
3248
|
+
* Constructs extensions for the editor based on user settings
|
|
3249
|
+
*
|
|
3250
|
+
* @remark Creates extension for tab size, RTL rendering, spellchecking, pairing markdown syntax, live preview and vim
|
|
3251
|
+
*/
|
|
3252
|
+
getDynamicExtensions(): Extension[];
|
|
3253
|
+
/**
|
|
3254
|
+
* Get the current folds of the editor
|
|
3255
|
+
*/
|
|
3256
|
+
getFoldInfo(): null | FoldInfo;
|
|
3257
|
+
/**
|
|
3258
|
+
* Builds all local extensions and assigns to this.localExtensions
|
|
3259
|
+
*
|
|
3260
|
+
* @remark Will build extensions if they were not already built
|
|
3261
|
+
*/
|
|
3262
|
+
getLocalExtensions(): unknown;
|
|
3263
|
+
/**
|
|
3264
|
+
* Creates menu on right mouse click
|
|
3265
|
+
*/
|
|
3266
|
+
onContextMenu(event: PointerEvent, x: boolean): Promise<void>;
|
|
3267
|
+
/**
|
|
3268
|
+
* Execute click functionality on token on mouse click
|
|
3269
|
+
*/
|
|
3270
|
+
onEditorClick(event: MouseEvent, element?: HTMLElement): void;
|
|
3271
|
+
/**
|
|
3272
|
+
* Execute drag functionality on drag start
|
|
3273
|
+
*
|
|
3274
|
+
* @remark Interfaces with dragManager
|
|
3275
|
+
*/
|
|
3276
|
+
onEditorDragStart(event: DragEvent): void;
|
|
3277
|
+
/**
|
|
3278
|
+
* Execute hover functionality on mouse over event
|
|
3279
|
+
*/
|
|
3280
|
+
onEditorLinkMouseover(event: MouseEvent, target: HTMLElement): void;
|
|
3281
|
+
/**
|
|
3282
|
+
* Execute context menu functionality on right mouse click
|
|
3283
|
+
*
|
|
3284
|
+
* @deprecated Use onContextMenu instead
|
|
3285
|
+
*/
|
|
3286
|
+
onMenu(event: MouseEvent): void;
|
|
3287
|
+
/**
|
|
3288
|
+
* Reposition suggest and scroll position on resize
|
|
3289
|
+
*/
|
|
3290
|
+
onResize(): void;
|
|
3291
|
+
/**
|
|
3292
|
+
* Execute functionality on CM editor state update
|
|
3293
|
+
*/
|
|
3294
|
+
onUpdate(update: ViewUpdate, changed: boolean): void;
|
|
3295
|
+
/**
|
|
3296
|
+
* Reinitialize the editor inside new container
|
|
3297
|
+
*/
|
|
3298
|
+
reinit(): void;
|
|
3299
|
+
/**
|
|
3300
|
+
* Move the editor into the new container
|
|
3301
|
+
*/
|
|
3302
|
+
reparent(new_container: HTMLElement): void;
|
|
3303
|
+
/**
|
|
3304
|
+
* Bodge to reset the syntax highlighting
|
|
3305
|
+
*
|
|
3306
|
+
* @remark Uses single-character replacement transaction
|
|
3307
|
+
*/
|
|
3308
|
+
resetSyntaxHighlighting(): void;
|
|
3309
|
+
/** @internal Save history of file and data (for caching, for faster reopening of same file in editor) */
|
|
3310
|
+
saveHistory(): void;
|
|
3311
|
+
/**
|
|
3312
|
+
* Set the state of the editor
|
|
3313
|
+
*/
|
|
3314
|
+
set(data: string, clear: boolean): void;
|
|
3315
|
+
/**
|
|
3316
|
+
* Enables/disables frontmatter folding
|
|
3317
|
+
*/
|
|
3318
|
+
toggleFoldFrontmatter(): void;
|
|
3319
|
+
/**
|
|
3320
|
+
* Toggle source mode for editor and dispatch effect
|
|
3321
|
+
*/
|
|
3322
|
+
toggleSource(): void;
|
|
3323
|
+
/**
|
|
3324
|
+
* Execute functionality of token (open external link, open internal link in leaf, ...)
|
|
3325
|
+
*/
|
|
3326
|
+
triggerClickableToken(token: Token, new_leaf: boolean): void;
|
|
3327
|
+
/** @internal Callback for onUpdate functionality added as an extension */
|
|
3328
|
+
updateEvent(): (update: ViewUpdate) => void;
|
|
3329
|
+
/**
|
|
3330
|
+
* In mobile, creates a popover link on clickable token, if exists
|
|
3331
|
+
*/
|
|
3332
|
+
updateLinkPopup(): void;
|
|
3333
|
+
/**
|
|
3334
|
+
* Reconfigure/re-add all the dynamic extensions
|
|
3335
|
+
*/
|
|
3336
|
+
updateOptions(): void;
|
|
3337
|
+
}
|
|
3338
|
+
/** @public */
|
|
3339
|
+
export interface MarkdownScrollableEditView extends MarkdownBaseView {
|
|
3340
|
+
/**
|
|
3341
|
+
* List of CSS classes applied to the editor
|
|
3342
|
+
*/
|
|
3343
|
+
cssClasses: [
|
|
3344
|
+
];
|
|
3345
|
+
/**
|
|
3346
|
+
* Whether the editor is currently scrolling
|
|
3347
|
+
*/
|
|
3348
|
+
isScrolling: boolean;
|
|
3349
|
+
/**
|
|
3350
|
+
* Scope for the search component, if exists
|
|
3351
|
+
*/
|
|
3352
|
+
scope: Scope | undefined;
|
|
3353
|
+
/**
|
|
3354
|
+
* Search component for the editor, provides highlight and search functionality
|
|
3355
|
+
*/
|
|
3356
|
+
search: EditorSearchComponent;
|
|
3357
|
+
/**
|
|
3358
|
+
* Container for the editor, handles editor size
|
|
3359
|
+
*/
|
|
3360
|
+
sizerEl: HTMLElement;
|
|
3361
|
+
/**
|
|
3362
|
+
* Set the scroll count of the editor scrollbar
|
|
3363
|
+
*/
|
|
3364
|
+
applyScroll(scroll: number): void;
|
|
3365
|
+
/**
|
|
3366
|
+
* Constructs local (always active) extensions for the editor
|
|
3367
|
+
*
|
|
3368
|
+
* @remark Creates extensions for list indentation, tab indentations
|
|
3369
|
+
*/
|
|
3370
|
+
buildLocalExtensions(): Extension[];
|
|
3371
|
+
/**
|
|
3372
|
+
* Focus the editor (and for mobile: render keyboard)
|
|
3373
|
+
*/
|
|
3374
|
+
focus(): void;
|
|
3375
|
+
/**
|
|
3376
|
+
* Constructs extensions for the editor based on user settings
|
|
3377
|
+
*
|
|
3378
|
+
* @remark Creates toggleable extensions for showing line numbers, indentation guides,
|
|
3379
|
+
* folding, brackets pairing and properties rendering
|
|
3380
|
+
*/
|
|
3381
|
+
getDynamicExtensions(): Extension[];
|
|
3382
|
+
/**
|
|
3383
|
+
* Get the current scroll count of the editor scrollbar
|
|
3384
|
+
*/
|
|
3385
|
+
getScroll(): number;
|
|
3386
|
+
/**
|
|
3387
|
+
* Invokes onMarkdownScroll on scroll
|
|
3388
|
+
*/
|
|
3389
|
+
handleScroll(): void;
|
|
3390
|
+
/**
|
|
3391
|
+
* Hides the editor (sets display: none)
|
|
3392
|
+
*/
|
|
3393
|
+
hide(): void;
|
|
3394
|
+
/**
|
|
3395
|
+
* Clear editor cache and refreshes editor on app css change
|
|
3396
|
+
*/
|
|
3397
|
+
onCssChange(): void;
|
|
3398
|
+
/**
|
|
3399
|
+
* Update editor size and bottom padding on resize
|
|
3400
|
+
*/
|
|
3401
|
+
onResize(): void;
|
|
3402
|
+
/**
|
|
3403
|
+
* Update editor suggest position and invokes handleScroll on scroll
|
|
3404
|
+
*/
|
|
3405
|
+
onScroll(): void;
|
|
3406
|
+
/**
|
|
3407
|
+
* Execute functionality on CM editor state update
|
|
3408
|
+
*/
|
|
3409
|
+
onUpdate(update: ViewUpdate, changed: boolean): void;
|
|
3410
|
+
/**
|
|
3411
|
+
* Close editor suggest and removes highlights on click
|
|
3412
|
+
*/
|
|
3413
|
+
onViewClick(event?: MouseEvent): void;
|
|
3414
|
+
/**
|
|
3415
|
+
* Add classes to the editor, functions as a toggle
|
|
3416
|
+
*/
|
|
3417
|
+
setCssClass(classes: string[]): void;
|
|
3418
|
+
/**
|
|
3419
|
+
* Reveal the editor (sets display: block)
|
|
3420
|
+
*/
|
|
3421
|
+
show(): void;
|
|
3422
|
+
/**
|
|
3423
|
+
* Reveal the search (and replace) component
|
|
3424
|
+
*/
|
|
3425
|
+
showSearch(replace: boolean): void;
|
|
3426
|
+
/**
|
|
3427
|
+
* Update the bottom padding of the CodeMirror contentdom
|
|
3428
|
+
*/
|
|
3429
|
+
updateBottomPadding(height: number): void;
|
|
3430
|
+
}
|
|
3431
|
+
/** @todo Documentation incomplete */
|
|
3432
|
+
/** @public */
|
|
3433
|
+
export interface ObsidianTouchEvent {
|
|
3434
|
+
direction: "x" | "y";
|
|
3435
|
+
evt: TouchEvent;
|
|
3436
|
+
points: number;
|
|
3437
|
+
registerCallback: {
|
|
3438
|
+
move(x: number): void;
|
|
3439
|
+
cancel(): void;
|
|
3440
|
+
finish(x: number, y: number, z: number): void;
|
|
3441
|
+
};
|
|
3442
|
+
startX: number;
|
|
3443
|
+
startY: number;
|
|
3444
|
+
targetEl: HTMLElement;
|
|
3445
|
+
touch: Touch;
|
|
3446
|
+
x: number;
|
|
3447
|
+
y: number;
|
|
3448
|
+
}
|
|
3449
|
+
/** @public */
|
|
3450
|
+
export interface RecentFileTracker {
|
|
3451
|
+
/**
|
|
3452
|
+
* List of last opened file paths, limited to 50
|
|
3453
|
+
*/
|
|
3454
|
+
lastOpenFiles: string[];
|
|
3455
|
+
/**
|
|
3456
|
+
* Reference to Vault
|
|
3457
|
+
*/
|
|
3458
|
+
vault: Vault;
|
|
3459
|
+
/**
|
|
3460
|
+
* Reference to Workspace
|
|
3461
|
+
*/
|
|
3462
|
+
workspace: Workspace;
|
|
3463
|
+
/** @internal */
|
|
3464
|
+
collect(file: TFile): void;
|
|
3465
|
+
/**
|
|
3466
|
+
* Returns the last 10 opened files
|
|
3467
|
+
*/
|
|
3468
|
+
getLastOpenFiles(): string[];
|
|
3469
|
+
/**
|
|
3470
|
+
* Get last n files of type (defaults to 10)
|
|
3471
|
+
*/
|
|
3472
|
+
getRecentFiles(arg?: {
|
|
3473
|
+
showMarkdown: boolean;
|
|
3474
|
+
showCanvas: boolean;
|
|
3475
|
+
showNonImageAttachments: boolean;
|
|
3476
|
+
showImages: boolean;
|
|
3477
|
+
maxCount: number;
|
|
3478
|
+
}): string[];
|
|
3479
|
+
/**
|
|
3480
|
+
* Set the last opened files
|
|
3481
|
+
*/
|
|
3482
|
+
load(savedFiles: string[]): void;
|
|
3483
|
+
/** @internal On file create, save file to last opened files */
|
|
3484
|
+
onFileCreated(file: TFile): void;
|
|
3485
|
+
/** @internal On file open, save file to last opened files */
|
|
3486
|
+
onFileOpen(prevFile: TFile, file: TFile): void;
|
|
3487
|
+
/** @internal On file rename, update file path in last opened files */
|
|
3488
|
+
onRename(file: TFile, oldPath: string): void;
|
|
3489
|
+
/** @internal Get last opened files */
|
|
3490
|
+
serialize(): string[];
|
|
3491
|
+
}
|
|
3492
|
+
/** @public */
|
|
3493
|
+
export interface StateHistory {
|
|
3494
|
+
/**
|
|
3495
|
+
* Ephemeral cursor state within Editor of leaf
|
|
3496
|
+
*/
|
|
3497
|
+
eState: {
|
|
3498
|
+
cursor: EditorRange;
|
|
3499
|
+
scroll: number;
|
|
3500
|
+
};
|
|
3501
|
+
/**
|
|
3502
|
+
* Icon of the leaf
|
|
3503
|
+
*/
|
|
3504
|
+
icon?: string;
|
|
3505
|
+
/**
|
|
3506
|
+
* History of previous and future states of leaf
|
|
3507
|
+
*/
|
|
3508
|
+
leafHistory?: {
|
|
3509
|
+
backHistory: StateHistory[];
|
|
3510
|
+
forwardHistory: StateHistory[];
|
|
3511
|
+
};
|
|
3512
|
+
/**
|
|
3513
|
+
* Id of parent to which the leaf belonged
|
|
3514
|
+
*/
|
|
3515
|
+
parentId?: string;
|
|
3516
|
+
/**
|
|
3517
|
+
* Id of root to which the leaf belonged
|
|
3518
|
+
*/
|
|
3519
|
+
rootId?: string;
|
|
3520
|
+
/**
|
|
3521
|
+
* Last state of the leaf
|
|
3522
|
+
*/
|
|
3523
|
+
state: ViewState;
|
|
3524
|
+
/**
|
|
3525
|
+
* Title of the leaf
|
|
3526
|
+
*/
|
|
3527
|
+
title?: string;
|
|
3528
|
+
}
|
|
3529
|
+
/** @todo Documentation incomplete */
|
|
3530
|
+
/** @public */
|
|
3531
|
+
export interface CanvasView extends TextFileView {
|
|
3532
|
+
/**
|
|
3533
|
+
* Loads the local data of the canvas
|
|
3534
|
+
*/
|
|
3535
|
+
getLocalData(): unknown;
|
|
3536
|
+
/**
|
|
3537
|
+
* Get the current view type
|
|
3538
|
+
*/
|
|
3539
|
+
getViewType(): "canvas";
|
|
3540
|
+
/**
|
|
3541
|
+
* Saves the local data of the canvas
|
|
3542
|
+
*/
|
|
3543
|
+
saveLocalData(): void;
|
|
3544
|
+
}
|
|
3545
|
+
/** @public */
|
|
3546
|
+
export interface SerializedWorkspaceLeftRibbonHiddenItemsRecord extends Record<string, boolean> {
|
|
3547
|
+
}
|
|
3548
|
+
/** @public */
|
|
3549
|
+
export interface SerializedWorkspace {
|
|
3550
|
+
/**
|
|
3551
|
+
* Last active leaf
|
|
3552
|
+
*/
|
|
3553
|
+
active: string;
|
|
3554
|
+
/**
|
|
3555
|
+
* Last opened files
|
|
3556
|
+
*/
|
|
3557
|
+
lastOpenFiles: string[];
|
|
3558
|
+
/**
|
|
3559
|
+
* Left opened leaf
|
|
3560
|
+
*/
|
|
3561
|
+
left: LeafEntry;
|
|
3562
|
+
/**
|
|
3563
|
+
* Left ribbon
|
|
3564
|
+
*/
|
|
3565
|
+
leftRibbon: {
|
|
3566
|
+
hiddenItems: SerializedWorkspaceLeftRibbonHiddenItemsRecord;
|
|
3567
|
+
};
|
|
3568
|
+
/**
|
|
3569
|
+
* Main (center) workspace leaf
|
|
3570
|
+
*/
|
|
3571
|
+
main: LeafEntry;
|
|
3572
|
+
/**
|
|
3573
|
+
* Right opened leaf
|
|
3574
|
+
*/
|
|
3575
|
+
right: LeafEntry;
|
|
3576
|
+
}
|
|
3577
|
+
/** @public */
|
|
3578
|
+
export interface WorkspaceHoverLinkSourcesRecord extends Record<string, HoverLinkSource> {
|
|
3579
|
+
}
|
|
3580
|
+
/** @todo Documentation incomplete */
|
|
3581
|
+
/** @public */
|
|
3582
|
+
export interface WindowSelection {
|
|
3583
|
+
focusEl: HTMLElement;
|
|
3584
|
+
range: Range;
|
|
3585
|
+
win: Window;
|
|
3586
|
+
}
|
|
3587
|
+
/** @todo Documentation incomplete */
|
|
3588
|
+
/** @public */
|
|
3589
|
+
export interface RendererSection {
|
|
3590
|
+
el: HTMLElement;
|
|
3591
|
+
html: string;
|
|
3592
|
+
rendered: boolean;
|
|
3593
|
+
}
|
|
3594
|
+
/** @todo Documentation incomplete */
|
|
3595
|
+
/** @public */
|
|
3596
|
+
export interface ReadViewRenderer {
|
|
3597
|
+
addBottomPadding: boolean;
|
|
3598
|
+
asyncSections: unknown[];
|
|
3599
|
+
lastRender: number;
|
|
3600
|
+
lastScroll: number;
|
|
3601
|
+
lastText: string;
|
|
3602
|
+
previewEl: HTMLElement;
|
|
3603
|
+
pusherEl: HTMLElement;
|
|
3604
|
+
recycledSections: unknown[];
|
|
3605
|
+
rendered: unknown[];
|
|
3606
|
+
sections: RendererSection[];
|
|
3607
|
+
text: string;
|
|
3608
|
+
clear(): void;
|
|
3609
|
+
parseAsync(): void;
|
|
3610
|
+
parseSync(): void;
|
|
3611
|
+
queueRender(): void;
|
|
3612
|
+
set(text: string): void;
|
|
3613
|
+
}
|
|
3614
|
+
/** @public */
|
|
3615
|
+
export interface ViewRegistryTypeByExtensionRecord extends Record<string, string> {
|
|
3616
|
+
}
|
|
3617
|
+
/** @public */
|
|
3618
|
+
export interface ViewRegistryViewByTypeRecord extends Record<string, (leaf: WorkspaceLeaf) => View> {
|
|
3619
|
+
}
|
|
3620
|
+
/** @public */
|
|
3621
|
+
export interface MenuSubmenuConfigRecord extends Record<string, {
|
|
3622
|
+
title: string;
|
|
3623
|
+
icon: string;
|
|
3624
|
+
}> {
|
|
3625
|
+
}
|
|
3626
|
+
/** @public */
|
|
3627
|
+
export interface EventsEntry {
|
|
3628
|
+
ctx: unknown;
|
|
3629
|
+
e: Events;
|
|
3630
|
+
name: string;
|
|
3631
|
+
fn(...data: unknown[]): unknown;
|
|
3632
|
+
}
|
|
3633
|
+
/** @public */
|
|
3634
|
+
export interface FileCacheEntry {
|
|
3635
|
+
/**
|
|
3636
|
+
* Hash of file contents
|
|
3637
|
+
*/
|
|
3638
|
+
hash: string;
|
|
3639
|
+
/**
|
|
3640
|
+
* Last modified time of file
|
|
3641
|
+
*/
|
|
3642
|
+
mtime: number;
|
|
3643
|
+
/**
|
|
3644
|
+
* Size of file in bytes
|
|
3645
|
+
*/
|
|
3646
|
+
size: number;
|
|
3647
|
+
}
|
|
3648
|
+
/** @todo Documentation incomplete */
|
|
3649
|
+
/** @public */
|
|
3650
|
+
export interface Runnable {
|
|
3651
|
+
cancelled: boolean;
|
|
3652
|
+
onCancel: null | (() => void);
|
|
3653
|
+
onStart: null | (() => void);
|
|
3654
|
+
onStop: null | (() => void);
|
|
3655
|
+
running: boolean;
|
|
3656
|
+
cancel(): void;
|
|
3657
|
+
isCancelled(): boolean;
|
|
3658
|
+
isRunning(): boolean;
|
|
3659
|
+
start(): void;
|
|
3660
|
+
stop(): void;
|
|
3661
|
+
}
|
|
3662
|
+
/** @public */
|
|
3663
|
+
export interface QueueItems<T> {
|
|
3664
|
+
length: number;
|
|
3665
|
+
offset: number;
|
|
3666
|
+
queue: T[];
|
|
3667
|
+
clear(): void;
|
|
3668
|
+
dequeue(): T | undefined;
|
|
3669
|
+
enqueue(item: T): void;
|
|
3670
|
+
enqueueArray(items: T[]): void;
|
|
3671
|
+
get(): T[];
|
|
3672
|
+
isEmpty(): boolean;
|
|
3673
|
+
peek(): T | undefined;
|
|
3674
|
+
remove(item: T): void;
|
|
3675
|
+
}
|
|
3676
|
+
/** @public */
|
|
3677
|
+
export interface LinkResolverQueue {
|
|
3678
|
+
items: QueueItems<TFile | null>;
|
|
3679
|
+
promise: PromiseWithResolvers<TFile | null> | null;
|
|
3680
|
+
runnable: Runnable;
|
|
3681
|
+
add(item: TFile | null): void;
|
|
3682
|
+
addList(items: TFile[]): void;
|
|
3683
|
+
cancel(): void;
|
|
3684
|
+
clear(): void;
|
|
3685
|
+
generator(): AsyncGenerator<TFile | null>;
|
|
3686
|
+
notify(): void;
|
|
3687
|
+
remove(file: TFile): void;
|
|
3688
|
+
}
|
|
3689
|
+
/**
|
|
3690
|
+
* @public
|
|
3691
|
+
* Suggestion for a link to a file
|
|
3692
|
+
*/
|
|
3693
|
+
export interface LinkSuggestion {
|
|
3694
|
+
/**
|
|
3695
|
+
* Resolved link note alias.
|
|
3696
|
+
*/
|
|
3697
|
+
alias?: string;
|
|
3698
|
+
/**
|
|
3699
|
+
* File that is suggested. `null` if the link cannot be resolved.
|
|
3700
|
+
*/
|
|
3701
|
+
file: TFile | null;
|
|
3702
|
+
/**
|
|
3703
|
+
* Path to the file if the link can be resolved.
|
|
3704
|
+
* Link text if the link cannot be resolved.
|
|
3705
|
+
*/
|
|
3706
|
+
path: string;
|
|
3707
|
+
}
|
|
3708
|
+
/** @public */
|
|
3709
|
+
export interface MetadataCacheFileCacheRecord extends Record<string, FileCacheEntry> {
|
|
3710
|
+
}
|
|
3711
|
+
/** @public */
|
|
3712
|
+
export interface MetadataCacheMetadataCacheRecord extends Record<string, CachedMetadata> {
|
|
3713
|
+
}
|
|
3714
|
+
/** @public */
|
|
3715
|
+
export interface SuggestionContainer<T> {
|
|
3716
|
+
/**
|
|
3717
|
+
* Which suggestions should be picked from
|
|
3718
|
+
*/
|
|
3719
|
+
chooser: EditorSuggest<T>;
|
|
3720
|
+
/**
|
|
3721
|
+
* Pop-up element that displays the suggestions
|
|
3722
|
+
*/
|
|
3723
|
+
containerEl: HTMLElement;
|
|
3724
|
+
/**
|
|
3725
|
+
* The currently focused item
|
|
3726
|
+
*/
|
|
3727
|
+
selectedItem: number;
|
|
3728
|
+
/**
|
|
3729
|
+
* List of all possible suggestions as elements
|
|
3730
|
+
*/
|
|
3731
|
+
suggestions: HTMLElement[];
|
|
3732
|
+
/**
|
|
3733
|
+
* List of all possible suggestions as data
|
|
3734
|
+
*/
|
|
3735
|
+
values: SearchResult[];
|
|
3736
|
+
/**
|
|
3737
|
+
* Amount of suggestions that can be displayed at once within containerEl
|
|
3738
|
+
*/
|
|
3739
|
+
get numVisibleItems(): number;
|
|
3740
|
+
/**
|
|
3741
|
+
* Height in pixels of the selected item
|
|
3742
|
+
*/
|
|
3743
|
+
get rowHeight(): number;
|
|
3744
|
+
/**
|
|
3745
|
+
* Add an empty message with provided text
|
|
3746
|
+
*/
|
|
3747
|
+
addMessage(text: string): HTMLElement;
|
|
3748
|
+
/**
|
|
3749
|
+
* Add suggestion to container
|
|
3750
|
+
*/
|
|
3751
|
+
addSuggestion(suggestion: SearchResult): void;
|
|
3752
|
+
/**
|
|
3753
|
+
* Set selected item to one specified by index, if keyboard navigation, force scroll into view
|
|
3754
|
+
*
|
|
3755
|
+
* @remark Prefer setSelectedItem, which clamps the index to within suggestions array
|
|
3756
|
+
*/
|
|
3757
|
+
forceSetSelectedItem(index: number, event: Event): void;
|
|
3758
|
+
/**
|
|
3759
|
+
* Move selected item to next suggestion
|
|
3760
|
+
*/
|
|
3761
|
+
moveDown(event: KeyboardEvent): boolean;
|
|
3762
|
+
/**
|
|
3763
|
+
* Move selected item to previous suggestion
|
|
3764
|
+
*/
|
|
3765
|
+
moveUp(event: KeyboardEvent): boolean;
|
|
3766
|
+
/**
|
|
3767
|
+
* Process click on suggestion item
|
|
3768
|
+
*/
|
|
3769
|
+
onSuggestionClick(event: MouseEvent, element: HTMLElement): void;
|
|
3770
|
+
/**
|
|
3771
|
+
* Process hover on suggestion item
|
|
3772
|
+
*/
|
|
3773
|
+
onSuggestionMouseover(event: MouseEvent, element: HTMLElement): unknown;
|
|
3774
|
+
/**
|
|
3775
|
+
* Move selected item to the one in the next 'page' (next visible block)
|
|
3776
|
+
*/
|
|
3777
|
+
pageDown(event: KeyboardEvent): boolean;
|
|
3778
|
+
/**
|
|
3779
|
+
* Move selected item to the one in the previous 'page' (previous visible block)
|
|
3780
|
+
*/
|
|
3781
|
+
pageUp(event: KeyboardEvent): boolean;
|
|
3782
|
+
/**
|
|
3783
|
+
* Set selected item to one specified by index, invokes forceSetSelectedItem
|
|
3784
|
+
*/
|
|
3785
|
+
setSelectedItem(index: number, event: Event): void;
|
|
3786
|
+
/**
|
|
3787
|
+
* Empties original container and adds multiple suggestions
|
|
3788
|
+
*/
|
|
3789
|
+
setSuggestions(suggestions: SearchResult[]): void;
|
|
3790
|
+
/**
|
|
3791
|
+
* Use currently selected suggestion as the accepted one
|
|
3792
|
+
*/
|
|
3793
|
+
useSelectedItem(event: Event): boolean;
|
|
3794
|
+
}
|
|
3795
|
+
/**
|
|
3796
|
+
* @remark `BaseEditor` is never used in the Obsidian codebase, but is exposed in the Obsidian module as `Editor`.
|
|
3797
|
+
* However, most editor components actually make use of the extended `Editor`, so this interface is purposely
|
|
3798
|
+
* named to `BaseEditor` to not require any casting for most purposes (or overriding the `editor` property type
|
|
3799
|
+
* for all components).
|
|
3800
|
+
* @todo Potential risk of confusion when `Editor` is constructed from the Obsidian module, as it only has the
|
|
3801
|
+
* methods from `BaseEditor`, *not* `Editor`
|
|
3802
|
+
*/
|
|
3803
|
+
/** @public */
|
|
3804
|
+
export interface BaseEditor {
|
|
3805
|
+
/**
|
|
3806
|
+
* CodeMirror editor instance
|
|
3807
|
+
*/
|
|
3808
|
+
cm: EditorView;
|
|
3809
|
+
/**
|
|
3810
|
+
* HTML instance the CM editor is attached to
|
|
3811
|
+
*/
|
|
3812
|
+
containerEl: HTMLElement;
|
|
3813
|
+
/**
|
|
3814
|
+
* Clean-up function executed after indenting lists
|
|
3815
|
+
*/
|
|
3816
|
+
afterIndent(): void;
|
|
3817
|
+
/**
|
|
3818
|
+
* Expand text
|
|
3819
|
+
*
|
|
3820
|
+
* @internal
|
|
3821
|
+
*/
|
|
3822
|
+
expandText(): void;
|
|
3823
|
+
/**
|
|
3824
|
+
* Indents a list by one level
|
|
3825
|
+
*/
|
|
3826
|
+
indentList(): void;
|
|
3827
|
+
/**
|
|
3828
|
+
* Insert a template callout at the current cursor position
|
|
3829
|
+
*/
|
|
3830
|
+
insertCallout(): void;
|
|
3831
|
+
/**
|
|
3832
|
+
* Insert a template code block at the current cursor position
|
|
3833
|
+
*/
|
|
3834
|
+
insertCodeblock(): void;
|
|
3835
|
+
/**
|
|
3836
|
+
* Insert a markdown link at the current cursor position
|
|
3837
|
+
*/
|
|
3838
|
+
insertLink(): void;
|
|
3839
|
+
/**
|
|
3840
|
+
* Insert a mathjax equation block at the current cursor position
|
|
3841
|
+
*/
|
|
3842
|
+
insertMathJax(): void;
|
|
3843
|
+
/**
|
|
3844
|
+
* Insert specified text at the current cursor position
|
|
3845
|
+
*
|
|
3846
|
+
* @remark Might be broken, inserts at the end of the document
|
|
3847
|
+
*/
|
|
3848
|
+
insertText(text: string): void;
|
|
3849
|
+
/**
|
|
3850
|
+
* Inserts a new line and continues a markdown bullet point list at the same level
|
|
3851
|
+
*/
|
|
3852
|
+
newlineAndIndentContinueMarkdownList(): void;
|
|
3853
|
+
/**
|
|
3854
|
+
* Inserts a new line at the same indent level
|
|
3855
|
+
*/
|
|
3856
|
+
newlineAndIndentOnly(): void;
|
|
3857
|
+
/**
|
|
3858
|
+
* Get the character position at a mouse event
|
|
3859
|
+
*/
|
|
3860
|
+
posAtMouse(e: MouseEvent): EditorPosition;
|
|
3861
|
+
/**
|
|
3862
|
+
* Toggles blockquote syntax on paragraph under cursor
|
|
3863
|
+
*/
|
|
3864
|
+
toggleBlockquote(): void;
|
|
3865
|
+
/**
|
|
3866
|
+
* Toggle bullet point list syntax on paragraph under cursor
|
|
3867
|
+
*/
|
|
3868
|
+
toggleBulletList(): void;
|
|
3869
|
+
/**
|
|
3870
|
+
* Toggle checkbox syntax on paragraph under cursor
|
|
3871
|
+
*/
|
|
3872
|
+
toggleCheckList(): void;
|
|
3873
|
+
/**
|
|
3874
|
+
* Toggle numbered list syntax on paragraph under cursor
|
|
3875
|
+
*/
|
|
3876
|
+
toggleNumberList(): void;
|
|
3877
|
+
/**
|
|
3878
|
+
* Convert word under cursor into a wikilink
|
|
3879
|
+
*
|
|
3880
|
+
* @param embed - Whether to embed the link or not
|
|
3881
|
+
*/
|
|
3882
|
+
triggerWikiLink(embed: boolean): void;
|
|
3883
|
+
/**
|
|
3884
|
+
* Unindents a list by one level
|
|
3885
|
+
*/
|
|
3886
|
+
unindentList(): void;
|
|
3887
|
+
}
|
|
3888
|
+
/** @public */
|
|
3889
|
+
export interface SerializedWorkspaceSidedock extends SerializedWorkspaceItem {
|
|
3890
|
+
collapsed: boolean;
|
|
3891
|
+
width: number;
|
|
3892
|
+
}
|
|
3893
|
+
|
|
3
3894
|
export {};
|