obsidian-typings 2.3.0 → 2.3.2

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