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.
package/dist/types.d.ts CHANGED
@@ -12,6 +12,10 @@ import * as path from 'node:path';
12
12
  import { App, BlockCache, CachedMetadata, CloseableComponent, Command, Component, Constructor, Debouncer, EditableFileView, Editor, EditorPosition, EditorRange, EditorSuggest, Events, FileStats, FileView, HoverLinkSource, HoverPopover, IconName, ItemView, KeymapInfo, Loc, MarkdownFileInfo, MarkdownPostProcessorContext, MarkdownPreviewView, MarkdownView, Menu, Modal, Notice as _Notice, ObsidianProtocolData, PaneType, Plugin as Plugin, PluginManifest, PluginSettingTab, Reference, ReferenceCache, Scope, SearchComponent, SearchResult, SettingTab, SplitDirection, TAbstractFile, TFile, TFolder, TextFileView, Vault, View, ViewCreator, ViewState, Workspace, WorkspaceLeaf, WorkspaceTabs, request as _request, requestUrl as _requestUrl } from 'obsidian';
13
13
  import _TurndownService from 'turndown';
14
14
 
15
+ /** @public */
16
+ export interface EditorViewState {
17
+ printing: boolean;
18
+ }
15
19
  /** @todo Documentation incomplete */
16
20
  /** @public */
17
21
  export interface VimState {
@@ -55,6 +59,8 @@ declare module "@codemirror/view" {
55
59
  /** @todo Documentation incomplete */
56
60
  interface EditorView {
57
61
  cm?: VimEditor;
62
+ viewState: EditorViewState;
63
+ measure(): void;
58
64
  }
59
65
  }
60
66
  /** @public */
@@ -6645,525 +6651,33 @@ declare module "obsidian" {
6645
6651
  setSize(size: number): void;
6646
6652
  }
6647
6653
  }
6648
- declare module "obsidian" {
6649
- interface TextFileView extends EditableFileView {
6650
- /**
6651
- * Whether current file is dirty (different from saved contents)
6652
- */
6653
- dirty: boolean;
6654
- /**
6655
- * Whether editor should be rendered as plaintext
6656
- */
6657
- isPlaintext: boolean;
6658
- /**
6659
- * The data that was last saved
6660
- */
6661
- lastSavedData: null | string;
6662
- /**
6663
- * Whether on saving, the file should be saved again (for dirtiness checks)
6664
- */
6665
- saveAgain: boolean;
6666
- /**
6667
- * Whether the file is currently saving
6668
- */
6669
- saving: boolean;
6670
- /** @todo Documentation incomplete */
6671
- loadFileInternal(file: TFile, clear: boolean): Promise<unknown>;
6672
- /**
6673
- * Is called when the vault has a 'modify' event. Reloads the file if the view is currently not saving the file and the modified file is the file in this view.
6674
- * @param file The modified file
6675
- */
6676
- onModify(file: TFile): void;
6677
- /**
6678
- * Saves the opened file
6679
- * @param clear If set clears the editor under certain conditions
6680
- */
6681
- save(clear?: boolean): Promise<void>;
6682
- /**
6683
- * If any changes(dirty = true) in the file forces the file to save
6684
- */
6685
- saveImmediately(): void;
6686
- /**
6687
- * Set the data to the editor. This is used to load the file contents.
6688
- * @param data The new data
6689
- * @param clear If clear is set, then it means we're opening a completely different file. In that case, you should call clear(), or implement a slightly more efficient clearing mechanism given the new data to be set.
6690
- */
6691
- setData(data: string, clear: boolean): void;
6692
- }
6654
+ /** @public */
6655
+ export interface ElectronWindow extends BrowserWindow {
6656
+ _browserViews: unknown;
6657
+ _events: unknown;
6658
+ _eventsCount: unknown;
6659
+ devToolsWebContents: unknown;
6693
6660
  }
6694
- declare module "obsidian" {
6695
- /** @todo Documentation incomplete */
6696
- interface View extends Component {
6697
- app: App;
6698
- /**
6699
- * Whether the leaf may close the view
6700
- */
6701
- closeable: boolean;
6702
- containerEl: HTMLElement;
6703
- /**
6704
- * The icon string
6705
- */
6706
- icon: IconName;
6707
- leaf: WorkspaceLeaf;
6708
- /**
6709
- * Closes the view
6710
- */
6711
- close(): Promise<void>;
6712
- /**
6713
- * Gets the ephemeral (non-persistent) state of the editor
6714
- */
6715
- getEphemeralState(): {};
6716
- /**
6717
- * Returns the icon name
6718
- */
6719
- getIcon(): IconName;
6720
- /**
6721
- * Returns the placement of the tooltip
6722
- */
6723
- getSideTooltipPlacement(): "left" | "right" | undefined;
6724
- /**
6725
- * Returns the current state of the view
6726
- */
6727
- getState(): {};
6728
- /**
6729
- * Handle copy event on metadata editor and serialize properties
6730
- */
6731
- handleCopy(event: ClipboardEvent): void;
6732
- /**
6733
- * Handle cut event on metadata editor and serialize and remove properties
6734
- */
6735
- handleCut(event: ClipboardEvent): void;
6736
- /**
6737
- * Handle paste event of properties on metadata editor
6738
- */
6739
- handlePaste(event: ClipboardEvent): void;
6740
- /** @deprecated use `onPaneMenu` instead */
6741
- onHeaderMenu(e: unknown): void;
6742
- /**
6743
- * Adds the menu items to the menu
6744
- * @param menu the menu to fill
6745
- */
6746
- onTabMenu(menu: Menu): void;
6747
- /**
6748
- * Opens the view
6749
- * @param parentEl The node the view get attached to
6750
- */
6751
- open(parentEl: Node): Promise<void>;
6752
- /**
6753
- * Set the ephemeral (non-persistent) state of the editor
6754
- */
6755
- setEphemeralState(state: any & {
6756
- focus: boolean;
6757
- focusOnMobile: boolean;
6758
- cursor: EditorRangeOrCaret;
6759
- }): void;
6760
- /** @todo Documentation incomplete */
6761
- setState(state: any, result: ViewStateResult): Promise<void>;
6762
- }
6661
+ /** @public */
6662
+ export interface FrameDom {
6663
+ eWin: Electron.BrowserWindow;
6664
+ isMac: boolean;
6665
+ leftButtonContainerEl: HTMLDivElement;
6666
+ titleBarEl: HTMLDivElement;
6667
+ titleBarInnerEl: HTMLDivElement;
6668
+ titleBarTextEl: HTMLDivElement;
6669
+ win: Window;
6670
+ updateStatus(): void;
6671
+ updateTitle(): void;
6763
6672
  }
6764
- declare module "obsidian" {
6765
- interface EditableFileView extends FileView {
6766
- /**
6767
- * The file that is currently being renamed
6768
- */
6769
- fileBeingRenamed: null | TFile;
6770
- /**
6771
- * Is called when the titleEl looses focus
6772
- * Event type: 'blur'
6773
- */
6774
- onTitleBlur(): Promise<void>;
6775
- /**
6776
- * Is called when the titleEl is changed
6777
- * Event type: 'input'
6778
- * @param titleEl The titleEl of the view
6779
- */
6780
- onTitleChange(titleEl: HTMLElement): void;
6781
- /**
6782
- * Is called when the titleEl gains focus
6783
- * Event type: 'focus'
6784
- */
6785
- onTitleFocus(): void;
6786
- /**
6787
- * Is called when the titleEl is focused and a keydown is triggered
6788
- * Event type: 'keydown'
6789
- * @param event The KeyboardEvent which triggered this function
6790
- */
6791
- onTitleKeydown(event: KeyboardEvent): void;
6792
- /**
6793
- * Is called when the titleEl is focused and a paste event is triggered
6794
- * Event type: 'paste'
6795
- * @param titleEl The titleEl of the view
6796
- * @param event The ClipboardEvent which triggered this function
6797
- */
6798
- onTitlePaste(titleEl: HTMLElement, event: ClipboardEvent): void;
6799
- /**
6800
- * Updates the file to match the updated title
6801
- * @param titleEl The current titleEl
6802
- */
6803
- saveTitle(titleEl: HTMLElement): Promise<void>;
6804
- }
6673
+ /** @public */
6674
+ export interface Localization {
6675
+ [key: string]: string | Localization;
6805
6676
  }
6806
- declare module "obsidian" {
6807
- /** @todo Documentation incomplete */
6808
- interface ItemView extends View {
6809
- /**
6810
- * Container of actions for the view
6811
- */
6812
- actionsEl: HTMLElement;
6813
- /**
6814
- * Back button element for changing view history
6815
- */
6816
- backButtonEl: HTMLButtonElement;
6817
- /**
6818
- * Whether the view may be dropped anywhere in workspace
6819
- */
6820
- canDropAnywhere: boolean;
6821
- /**
6822
- * Forward button element for changing view history
6823
- */
6824
- forwardButtonEl: HTMLButtonElement;
6825
- /**
6826
- * Header bar container of view
6827
- */
6828
- headerEl: HTMLElement;
6829
- /**
6830
- * Icon element for the view (for dragging)
6831
- */
6832
- iconEl: HTMLElement;
6833
- /**
6834
- * Anchor button for revealing more view actions
6835
- */
6836
- moreOptionsButtonEl: HTMLAnchorElement;
6837
- /**
6838
- * Container for the title of the view
6839
- */
6840
- titleContainerEl: HTMLElement;
6841
- /**
6842
- * Title element for the view
6843
- */
6844
- titleEl: HTMLElement;
6845
- /**
6846
- * Title of the parent
6847
- *
6848
- * @remark Used for breadcrumbs rendering
6849
- */
6850
- titleParentEl: HTMLElement;
6851
- /**
6852
- * Adds an action button to the header of the view
6853
- * @param icon - The icon for the action
6854
- * @param title - The title for the action
6855
- * @param callback - Callback to execute on click
6856
- */
6857
- addAction(icon: IconName, title: string, callback: (evt: MouseEvent) => any): HTMLElement;
6858
- /** @todo Documentation incomplete */
6859
- handleDrop(event: DragEvent, t: unknown, n: unknown): unknown;
6860
- /** @todo Documentation incomplete */
6861
- onGroupChange(): void;
6862
- /** @todo Documentation incomplete */
6863
- onMoreOptions(event: Event): void;
6864
- /** @deprecated use onPaneMenu instead */
6865
- onMoreOptionsMenu(e: unknown): void;
6866
- /**
6867
- * Updates the navigation buttons depending on the history
6868
- */
6869
- updateNavButtons(): void;
6870
- }
6871
- }
6872
- declare module "obsidian" {
6873
- interface MarkdownView extends TextFileView {
6874
- /**
6875
- * Backlinks component
6876
- * @todo Documentation incomplete
6877
- */
6878
- backlinks: null | unknown;
6879
- /**
6880
- * The embedded backlinks element for the current file
6881
- */
6882
- backlinksEl: HTMLElement;
6883
- /**
6884
- * The currently active markdown view (preview or edit view)
6885
- */
6886
- currentMode: MarkdownSubView;
6887
- /**
6888
- * Editor component of the view
6889
- */
6890
- editMode: MarkdownEditView;
6891
- /**
6892
- * Editable title element of the view
6893
- */
6894
- inlineTitleEl: HTMLElement;
6895
- /**
6896
- * Frontmatter editor of the editor
6897
- */
6898
- metadataEditor: MetadataEditor;
6899
- /**
6900
- * Button for switching between different modes of the view
6901
- */
6902
- modeButtonEl: HTMLAnchorElement;
6903
- /**
6904
- * The registered modes of the view
6905
- */
6906
- modes: {
6907
- source: MarkdownEditView;
6908
- preview: MarkdownPreviewView;
6909
- };
6910
- /**
6911
- * Preview component of the view
6912
- */
6913
- previewMode: MarkdownPreviewView;
6914
- /**
6915
- * File frontmatter as a raw string
6916
- */
6917
- rawFrontmatter: string;
6918
- /**
6919
- * Current scroll position of the editor
6920
- */
6921
- scroll: null | number;
6922
- /**
6923
- * Whether to show backlinks in the editor
6924
- */
6925
- showBacklinks: boolean;
6926
- /** @deprecated CM5 Editor */
6927
- sourceMode: {
6928
- cmEditor: any;
6929
- };
6930
- /**
6931
- * Add property to inline metadata editor or properties plugin
6932
- *
6933
- * @deprecated Removed in 1.6.0
6934
- * @remark Parameter is not used
6935
- */
6936
- addProperty(unused: undefined): void;
6937
- /**
6938
- * Whether the editor can render properties according to the current mode and config
6939
- */
6940
- canShowProperties(): boolean;
6941
- /**
6942
- * Whether the editor can toggle backlinks according to current mode
6943
- */
6944
- canToggleBacklinks(): boolean;
6945
- /**
6946
- * Collapse the properties editor
6947
- */
6948
- collapseProperties(collapse: boolean): void;
6949
- /**
6950
- * Edit the focused property in the metadata editor
6951
- *
6952
- * @remark Parameter is not used
6953
- */
6954
- editProperty(unused: undefined): void;
6955
- /**
6956
- * Focus on the metadata editor given property information
6957
- */
6958
- focusMetadata(focus?: {
6959
- focusHeading: boolean;
6960
- propertyIdx?: number;
6961
- propertyKey?: string;
6962
- }): void;
6963
- /**
6964
- * Gets the ephemeral (non-persistent) state of the editor
6965
- */
6966
- getEphemeralState(): any & {
6967
- scroll: number;
6968
- };
6969
- /**
6970
- * Get the file attached to the view
6971
- */
6972
- getFile(): TFile | null;
6973
- /** @internal Get the current mode of the editor */
6974
- getHoverSource(): string;
6975
- /**
6976
- * Get the current mode of the editor
6977
- */
6978
- getMode(): MarkdownViewModeType;
6979
- /**
6980
- * Get selection of current mode
6981
- */
6982
- getSelection(): string;
6983
- /**
6984
- * Get the current view type
6985
- */
6986
- getViewType(): "markdown";
6987
- /**
6988
- * Validate correctness of frontmatter and update metadata editor
6989
- */
6990
- loadFrontmatter(data: string): void;
6991
- /**
6992
- * Whether the metadata editor has focus
6993
- */
6994
- metadataHasFocus(): boolean;
6995
- /**
6996
- * On app css change, update source mode editor
6997
- */
6998
- onCssChange(): void;
6999
- /**
7000
- * Update editor on external data change (from sync plugin)
7001
- */
7002
- onExternalDataChange(file: TFile, data: string): void;
7003
- /**
7004
- * On blur of inline title, save new filename
7005
- */
7006
- onInlineTitleBlur(): Promise<void>;
7007
- /**
7008
- * On data change of editor, update internal data and metadata editor
7009
- */
7010
- onInternalDataChange(): void;
7011
- /**
7012
- * On loading markdown view, register resize, css-change and quick-preview events
7013
- */
7014
- onload(): void;
7015
- /**
7016
- * On fold of markdown in source editor, save fold info to fold manager
7017
- */
7018
- onMarkdownFold(): void;
7019
- /**
7020
- * On markdown scroll in editors, update scroll, sync state and trigger markdown scroll event
7021
- */
7022
- onMarkdownScroll(): void;
7023
- /**
7024
- * On mod click, opens editor of opposite mode in split view to right
7025
- */
7026
- onSwitchView(event: KeyboardEvent | MouseEvent): Promise<void>;
7027
- /**
7028
- * Opens PDF modal for exporting PDF of the current file
7029
- */
7030
- printToPdf(): void;
7031
- /**
7032
- * Redo action of source mode editor
7033
- */
7034
- redo(): void;
7035
- /**
7036
- * Register editor mode component to view
7037
- */
7038
- registerMode(component: MarkdownSubView): void;
7039
- /**
7040
- * Save the frontmatter of the file
7041
- */
7042
- saveFrontmatter(properties: Record<string, any>): void;
7043
- /**
7044
- * Set the mode of the editor
7045
- */
7046
- setMode(component: MarkdownSubView): Promise<void>;
7047
- /**
7048
- * Shift focus to first line of editor
7049
- */
7050
- shiftFocusAfter(): void;
7051
- /**
7052
- * Shift focus to inline title
7053
- */
7054
- shiftFocusBefore(): void;
7055
- /**
7056
- * Toggle backlinks on editor
7057
- */
7058
- toggleBacklinks(): Promise<void>;
7059
- /**
7060
- * Toggle collapse status of properties editor if allowed
7061
- */
7062
- toggleCollapseProperties(): void;
7063
- /**
7064
- * Toggle between source and preview mode
7065
- */
7066
- toggleMode(): void;
7067
- /**
7068
- * Execute functionality of token (open external link, open internal link in leaf, ...)
7069
- */
7070
- triggerClickableToken(token: Token, new_leaf: boolean): void;
7071
- /**
7072
- * Undo action of source mode editor
7073
- */
7074
- undo(): void;
7075
- /**
7076
- * Update the backlinks component for new file
7077
- */
7078
- updateBacklinks(): void;
7079
- /**
7080
- * Update reading/source view action buttons of modeButtonEl with current mode
7081
- */
7082
- updateButtons(): void;
7083
- /**
7084
- * Update options of the editors from settings
7085
- */
7086
- updateOptions(): void;
7087
- /**
7088
- * Hide/render backlinks component
7089
- */
7090
- updateShowBacklinks(): void;
7091
- }
7092
- }
7093
- declare module "obsidian" {
7094
- /** @todo Documentation incomplete */
7095
- interface FileView extends ItemView {
7096
- /**
7097
- * Whether the view may be run without an attached file
7098
- */
7099
- allowNoFile: boolean;
7100
- /**
7101
- * Determines whether the specified file extension can be opened in this view.
7102
- * @param extension The file extension to be evaluated
7103
- */
7104
- canAcceptExtension(extension: string): boolean;
7105
- /**
7106
- * Get view state for sync plugin
7107
- */
7108
- getSyncViewState(): any;
7109
- /**
7110
- * Loads the file with the onLoadFile function
7111
- * @param file The File to load
7112
- */
7113
- loadFile(file: TFile): Promise<unknown>;
7114
- /**
7115
- * Updates the view if it contains the deleted file
7116
- * @param file The file that is deleted
7117
- */
7118
- onDelete(file: TFile): Promise<void>;
7119
- /**
7120
- * Is called when a file get loaded
7121
- * @param file The file that is loaded
7122
- */
7123
- onLoadFile(file: TFile): Promise<void>;
7124
- /**
7125
- * Updates the view information based on the new file name
7126
- * @param file The file that is renamed
7127
- */
7128
- onRename(file: TFile): Promise<void>;
7129
- /**
7130
- * Is called when a file get unloaded
7131
- * @param file The file that is unloaded
7132
- */
7133
- onUnloadFile(file: TFile): Promise<void>;
7134
- /** @todo Documentation incomplete */
7135
- renderBreadcrumbs(): void;
7136
- /** @todo Documentation incomplete */
7137
- syncState(e: boolean): Promise<unknown>;
7138
- }
7139
- }
7140
- /** @public */
7141
- export interface ElectronWindow extends BrowserWindow {
7142
- _browserViews: unknown;
7143
- _events: unknown;
7144
- _eventsCount: unknown;
7145
- devToolsWebContents: unknown;
7146
- }
7147
- /** @public */
7148
- export interface FrameDom {
7149
- eWin: Electron.BrowserWindow;
7150
- isMac: boolean;
7151
- leftButtonContainerEl: HTMLDivElement;
7152
- titleBarEl: HTMLDivElement;
7153
- titleBarInnerEl: HTMLDivElement;
7154
- titleBarTextEl: HTMLDivElement;
7155
- win: Window;
7156
- updateStatus(): void;
7157
- updateTitle(): void;
7158
- }
7159
- /** @public */
7160
- export interface Localization {
7161
- [key: string]: string | Localization;
7162
- }
7163
- /** @public */
7164
- export interface SQLError {
7165
- code: number;
7166
- message: string;
6677
+ /** @public */
6678
+ export interface SQLError {
6679
+ code: number;
6680
+ message: string;
7167
6681
  }
7168
6682
  /** @public */
7169
6683
  export interface SQLResultSetRowList {
@@ -7795,13 +7309,505 @@ export interface Account {
7795
7309
  seats: number;
7796
7310
  token: string;
7797
7311
  }
7798
- /** @todo Documentation incomplete */
7799
- /** @public */
7800
- export interface FileSuggest<T> extends EditorSuggest<T> {
7801
- /**
7802
- * Manages fetching of suggestions from metadatacache
7803
- */
7804
- suggestManager: FileSuggestManager;
7312
+ /** @todo Documentation incomplete */
7313
+ /** @public */
7314
+ export interface FileSuggest<T> extends EditorSuggest<T> {
7315
+ /**
7316
+ * Manages fetching of suggestions from metadatacache
7317
+ */
7318
+ suggestManager: FileSuggestManager;
7319
+ }
7320
+ declare module "obsidian" {
7321
+ interface TextFileView extends EditableFileView {
7322
+ /**
7323
+ * Whether current file is dirty (different from saved contents)
7324
+ */
7325
+ dirty: boolean;
7326
+ /**
7327
+ * Whether editor should be rendered as plaintext
7328
+ */
7329
+ isPlaintext: boolean;
7330
+ /**
7331
+ * The data that was last saved
7332
+ */
7333
+ lastSavedData: null | string;
7334
+ /**
7335
+ * Whether on saving, the file should be saved again (for dirtiness checks)
7336
+ */
7337
+ saveAgain: boolean;
7338
+ /**
7339
+ * Whether the file is currently saving
7340
+ */
7341
+ saving: boolean;
7342
+ /** @todo Documentation incomplete */
7343
+ loadFileInternal(file: TFile, clear: boolean): Promise<unknown>;
7344
+ /**
7345
+ * Is called when the vault has a 'modify' event. Reloads the file if the view is currently not saving the file and the modified file is the file in this view.
7346
+ * @param file The modified file
7347
+ */
7348
+ onModify(file: TFile): void;
7349
+ /**
7350
+ * Saves the opened file
7351
+ * @param clear If set clears the editor under certain conditions
7352
+ */
7353
+ save(clear?: boolean): Promise<void>;
7354
+ /**
7355
+ * If any changes(dirty = true) in the file forces the file to save
7356
+ */
7357
+ saveImmediately(): void;
7358
+ /**
7359
+ * Set the data to the editor. This is used to load the file contents.
7360
+ * @param data The new data
7361
+ * @param clear If clear is set, then it means we're opening a completely different file. In that case, you should call clear(), or implement a slightly more efficient clearing mechanism given the new data to be set.
7362
+ */
7363
+ setData(data: string, clear: boolean): void;
7364
+ }
7365
+ }
7366
+ declare module "obsidian" {
7367
+ /** @todo Documentation incomplete */
7368
+ interface View extends Component {
7369
+ app: App;
7370
+ /**
7371
+ * Whether the leaf may close the view
7372
+ */
7373
+ closeable: boolean;
7374
+ containerEl: HTMLElement;
7375
+ /**
7376
+ * The icon string
7377
+ */
7378
+ icon: IconName;
7379
+ leaf: WorkspaceLeaf;
7380
+ /**
7381
+ * Closes the view
7382
+ */
7383
+ close(): Promise<void>;
7384
+ /**
7385
+ * Gets the ephemeral (non-persistent) state of the editor
7386
+ */
7387
+ getEphemeralState(): {};
7388
+ /**
7389
+ * Returns the icon name
7390
+ */
7391
+ getIcon(): IconName;
7392
+ /**
7393
+ * Returns the placement of the tooltip
7394
+ */
7395
+ getSideTooltipPlacement(): "left" | "right" | undefined;
7396
+ /**
7397
+ * Returns the current state of the view
7398
+ */
7399
+ getState(): {};
7400
+ /**
7401
+ * Handle copy event on metadata editor and serialize properties
7402
+ */
7403
+ handleCopy(event: ClipboardEvent): void;
7404
+ /**
7405
+ * Handle cut event on metadata editor and serialize and remove properties
7406
+ */
7407
+ handleCut(event: ClipboardEvent): void;
7408
+ /**
7409
+ * Handle paste event of properties on metadata editor
7410
+ */
7411
+ handlePaste(event: ClipboardEvent): void;
7412
+ /** @deprecated use `onPaneMenu` instead */
7413
+ onHeaderMenu(e: unknown): void;
7414
+ /**
7415
+ * Adds the menu items to the menu
7416
+ * @param menu the menu to fill
7417
+ */
7418
+ onTabMenu(menu: Menu): void;
7419
+ /**
7420
+ * Opens the view
7421
+ * @param parentEl The node the view get attached to
7422
+ */
7423
+ open(parentEl: Node): Promise<void>;
7424
+ /**
7425
+ * Set the ephemeral (non-persistent) state of the editor
7426
+ */
7427
+ setEphemeralState(state: any & {
7428
+ focus: boolean;
7429
+ focusOnMobile: boolean;
7430
+ cursor: EditorRangeOrCaret;
7431
+ }): void;
7432
+ /** @todo Documentation incomplete */
7433
+ setState(state: any, result: ViewStateResult): Promise<void>;
7434
+ }
7435
+ }
7436
+ declare module "obsidian" {
7437
+ interface EditableFileView extends FileView {
7438
+ /**
7439
+ * The file that is currently being renamed
7440
+ */
7441
+ fileBeingRenamed: null | TFile;
7442
+ /**
7443
+ * Is called when the titleEl looses focus
7444
+ * Event type: 'blur'
7445
+ */
7446
+ onTitleBlur(): Promise<void>;
7447
+ /**
7448
+ * Is called when the titleEl is changed
7449
+ * Event type: 'input'
7450
+ * @param titleEl The titleEl of the view
7451
+ */
7452
+ onTitleChange(titleEl: HTMLElement): void;
7453
+ /**
7454
+ * Is called when the titleEl gains focus
7455
+ * Event type: 'focus'
7456
+ */
7457
+ onTitleFocus(): void;
7458
+ /**
7459
+ * Is called when the titleEl is focused and a keydown is triggered
7460
+ * Event type: 'keydown'
7461
+ * @param event The KeyboardEvent which triggered this function
7462
+ */
7463
+ onTitleKeydown(event: KeyboardEvent): void;
7464
+ /**
7465
+ * Is called when the titleEl is focused and a paste event is triggered
7466
+ * Event type: 'paste'
7467
+ * @param titleEl The titleEl of the view
7468
+ * @param event The ClipboardEvent which triggered this function
7469
+ */
7470
+ onTitlePaste(titleEl: HTMLElement, event: ClipboardEvent): void;
7471
+ /**
7472
+ * Updates the file to match the updated title
7473
+ * @param titleEl The current titleEl
7474
+ */
7475
+ saveTitle(titleEl: HTMLElement): Promise<void>;
7476
+ }
7477
+ }
7478
+ declare module "obsidian" {
7479
+ /** @todo Documentation incomplete */
7480
+ interface ItemView extends View {
7481
+ /**
7482
+ * Container of actions for the view
7483
+ */
7484
+ actionsEl: HTMLElement;
7485
+ /**
7486
+ * Back button element for changing view history
7487
+ */
7488
+ backButtonEl: HTMLButtonElement;
7489
+ /**
7490
+ * Whether the view may be dropped anywhere in workspace
7491
+ */
7492
+ canDropAnywhere: boolean;
7493
+ /**
7494
+ * Forward button element for changing view history
7495
+ */
7496
+ forwardButtonEl: HTMLButtonElement;
7497
+ /**
7498
+ * Header bar container of view
7499
+ */
7500
+ headerEl: HTMLElement;
7501
+ /**
7502
+ * Icon element for the view (for dragging)
7503
+ */
7504
+ iconEl: HTMLElement;
7505
+ /**
7506
+ * Anchor button for revealing more view actions
7507
+ */
7508
+ moreOptionsButtonEl: HTMLAnchorElement;
7509
+ /**
7510
+ * Container for the title of the view
7511
+ */
7512
+ titleContainerEl: HTMLElement;
7513
+ /**
7514
+ * Title element for the view
7515
+ */
7516
+ titleEl: HTMLElement;
7517
+ /**
7518
+ * Title of the parent
7519
+ *
7520
+ * @remark Used for breadcrumbs rendering
7521
+ */
7522
+ titleParentEl: HTMLElement;
7523
+ /**
7524
+ * Adds an action button to the header of the view
7525
+ * @param icon - The icon for the action
7526
+ * @param title - The title for the action
7527
+ * @param callback - Callback to execute on click
7528
+ */
7529
+ addAction(icon: IconName, title: string, callback: (evt: MouseEvent) => any): HTMLElement;
7530
+ /** @todo Documentation incomplete */
7531
+ handleDrop(event: DragEvent, t: unknown, n: unknown): unknown;
7532
+ /** @todo Documentation incomplete */
7533
+ onGroupChange(): void;
7534
+ /** @todo Documentation incomplete */
7535
+ onMoreOptions(event: Event): void;
7536
+ /** @deprecated use onPaneMenu instead */
7537
+ onMoreOptionsMenu(e: unknown): void;
7538
+ /**
7539
+ * Updates the navigation buttons depending on the history
7540
+ */
7541
+ updateNavButtons(): void;
7542
+ }
7543
+ }
7544
+ declare module "obsidian" {
7545
+ interface MarkdownView extends TextFileView {
7546
+ /**
7547
+ * Backlinks component
7548
+ * @todo Documentation incomplete
7549
+ */
7550
+ backlinks: null | unknown;
7551
+ /**
7552
+ * The embedded backlinks element for the current file
7553
+ */
7554
+ backlinksEl: HTMLElement;
7555
+ /**
7556
+ * The currently active markdown view (preview or edit view)
7557
+ */
7558
+ currentMode: MarkdownSubView;
7559
+ /**
7560
+ * Editor component of the view
7561
+ */
7562
+ editMode: MarkdownEditView;
7563
+ /**
7564
+ * Editable title element of the view
7565
+ */
7566
+ inlineTitleEl: HTMLElement;
7567
+ /**
7568
+ * Frontmatter editor of the editor
7569
+ */
7570
+ metadataEditor: MetadataEditor;
7571
+ /**
7572
+ * Button for switching between different modes of the view
7573
+ */
7574
+ modeButtonEl: HTMLAnchorElement;
7575
+ /**
7576
+ * The registered modes of the view
7577
+ */
7578
+ modes: {
7579
+ source: MarkdownEditView;
7580
+ preview: MarkdownPreviewView;
7581
+ };
7582
+ /**
7583
+ * Preview component of the view
7584
+ */
7585
+ previewMode: MarkdownPreviewView;
7586
+ /**
7587
+ * File frontmatter as a raw string
7588
+ */
7589
+ rawFrontmatter: string;
7590
+ /**
7591
+ * Current scroll position of the editor
7592
+ */
7593
+ scroll: null | number;
7594
+ /**
7595
+ * Whether to show backlinks in the editor
7596
+ */
7597
+ showBacklinks: boolean;
7598
+ /** @deprecated CM5 Editor */
7599
+ sourceMode: {
7600
+ cmEditor: any;
7601
+ };
7602
+ /**
7603
+ * Add property to inline metadata editor or properties plugin
7604
+ *
7605
+ * @deprecated Removed in 1.6.0
7606
+ * @remark Parameter is not used
7607
+ */
7608
+ addProperty(unused: undefined): void;
7609
+ /**
7610
+ * Whether the editor can render properties according to the current mode and config
7611
+ */
7612
+ canShowProperties(): boolean;
7613
+ /**
7614
+ * Whether the editor can toggle backlinks according to current mode
7615
+ */
7616
+ canToggleBacklinks(): boolean;
7617
+ /**
7618
+ * Collapse the properties editor
7619
+ */
7620
+ collapseProperties(collapse: boolean): void;
7621
+ /**
7622
+ * Edit the focused property in the metadata editor
7623
+ *
7624
+ * @remark Parameter is not used
7625
+ */
7626
+ editProperty(unused: undefined): void;
7627
+ /**
7628
+ * Focus on the metadata editor given property information
7629
+ */
7630
+ focusMetadata(focus?: {
7631
+ focusHeading: boolean;
7632
+ propertyIdx?: number;
7633
+ propertyKey?: string;
7634
+ }): void;
7635
+ /**
7636
+ * Gets the ephemeral (non-persistent) state of the editor
7637
+ */
7638
+ getEphemeralState(): any & {
7639
+ scroll: number;
7640
+ };
7641
+ /**
7642
+ * Get the file attached to the view
7643
+ */
7644
+ getFile(): TFile | null;
7645
+ /** @internal Get the current mode of the editor */
7646
+ getHoverSource(): string;
7647
+ /**
7648
+ * Get the current mode of the editor
7649
+ */
7650
+ getMode(): MarkdownViewModeType;
7651
+ /**
7652
+ * Get selection of current mode
7653
+ */
7654
+ getSelection(): string;
7655
+ /**
7656
+ * Get the current view type
7657
+ */
7658
+ getViewType(): "markdown";
7659
+ /**
7660
+ * Validate correctness of frontmatter and update metadata editor
7661
+ */
7662
+ loadFrontmatter(data: string): void;
7663
+ /**
7664
+ * Whether the metadata editor has focus
7665
+ */
7666
+ metadataHasFocus(): boolean;
7667
+ /**
7668
+ * On app css change, update source mode editor
7669
+ */
7670
+ onCssChange(): void;
7671
+ /**
7672
+ * Update editor on external data change (from sync plugin)
7673
+ */
7674
+ onExternalDataChange(file: TFile, data: string): void;
7675
+ /**
7676
+ * On blur of inline title, save new filename
7677
+ */
7678
+ onInlineTitleBlur(): Promise<void>;
7679
+ /**
7680
+ * On data change of editor, update internal data and metadata editor
7681
+ */
7682
+ onInternalDataChange(): void;
7683
+ /**
7684
+ * On loading markdown view, register resize, css-change and quick-preview events
7685
+ */
7686
+ onload(): void;
7687
+ /**
7688
+ * On fold of markdown in source editor, save fold info to fold manager
7689
+ */
7690
+ onMarkdownFold(): void;
7691
+ /**
7692
+ * On markdown scroll in editors, update scroll, sync state and trigger markdown scroll event
7693
+ */
7694
+ onMarkdownScroll(): void;
7695
+ /**
7696
+ * On mod click, opens editor of opposite mode in split view to right
7697
+ */
7698
+ onSwitchView(event: KeyboardEvent | MouseEvent): Promise<void>;
7699
+ /**
7700
+ * Opens PDF modal for exporting PDF of the current file
7701
+ */
7702
+ printToPdf(): void;
7703
+ /**
7704
+ * Redo action of source mode editor
7705
+ */
7706
+ redo(): void;
7707
+ /**
7708
+ * Register editor mode component to view
7709
+ */
7710
+ registerMode(component: MarkdownSubView): void;
7711
+ /**
7712
+ * Save the frontmatter of the file
7713
+ */
7714
+ saveFrontmatter(properties: Record<string, any>): void;
7715
+ /**
7716
+ * Set the mode of the editor
7717
+ */
7718
+ setMode(component: MarkdownSubView): Promise<void>;
7719
+ /**
7720
+ * Shift focus to first line of editor
7721
+ */
7722
+ shiftFocusAfter(): void;
7723
+ /**
7724
+ * Shift focus to inline title
7725
+ */
7726
+ shiftFocusBefore(): void;
7727
+ /**
7728
+ * Toggle backlinks on editor
7729
+ */
7730
+ toggleBacklinks(): Promise<void>;
7731
+ /**
7732
+ * Toggle collapse status of properties editor if allowed
7733
+ */
7734
+ toggleCollapseProperties(): void;
7735
+ /**
7736
+ * Toggle between source and preview mode
7737
+ */
7738
+ toggleMode(): void;
7739
+ /**
7740
+ * Execute functionality of token (open external link, open internal link in leaf, ...)
7741
+ */
7742
+ triggerClickableToken(token: Token, new_leaf: boolean): void;
7743
+ /**
7744
+ * Undo action of source mode editor
7745
+ */
7746
+ undo(): void;
7747
+ /**
7748
+ * Update the backlinks component for new file
7749
+ */
7750
+ updateBacklinks(): void;
7751
+ /**
7752
+ * Update reading/source view action buttons of modeButtonEl with current mode
7753
+ */
7754
+ updateButtons(): void;
7755
+ /**
7756
+ * Update options of the editors from settings
7757
+ */
7758
+ updateOptions(): void;
7759
+ /**
7760
+ * Hide/render backlinks component
7761
+ */
7762
+ updateShowBacklinks(): void;
7763
+ }
7764
+ }
7765
+ declare module "obsidian" {
7766
+ /** @todo Documentation incomplete */
7767
+ interface FileView extends ItemView {
7768
+ /**
7769
+ * Whether the view may be run without an attached file
7770
+ */
7771
+ allowNoFile: boolean;
7772
+ /**
7773
+ * Determines whether the specified file extension can be opened in this view.
7774
+ * @param extension The file extension to be evaluated
7775
+ */
7776
+ canAcceptExtension(extension: string): boolean;
7777
+ /**
7778
+ * Get view state for sync plugin
7779
+ */
7780
+ getSyncViewState(): any;
7781
+ /**
7782
+ * Loads the file with the onLoadFile function
7783
+ * @param file The File to load
7784
+ */
7785
+ loadFile(file: TFile): Promise<unknown>;
7786
+ /**
7787
+ * Updates the view if it contains the deleted file
7788
+ * @param file The file that is deleted
7789
+ */
7790
+ onDelete(file: TFile): Promise<void>;
7791
+ /**
7792
+ * Is called when a file get loaded
7793
+ * @param file The file that is loaded
7794
+ */
7795
+ onLoadFile(file: TFile): Promise<void>;
7796
+ /**
7797
+ * Updates the view information based on the new file name
7798
+ * @param file The file that is renamed
7799
+ */
7800
+ onRename(file: TFile): Promise<void>;
7801
+ /**
7802
+ * Is called when a file get unloaded
7803
+ * @param file The file that is unloaded
7804
+ */
7805
+ onUnloadFile(file: TFile): Promise<void>;
7806
+ /** @todo Documentation incomplete */
7807
+ renderBreadcrumbs(): void;
7808
+ /** @todo Documentation incomplete */
7809
+ syncState(e: boolean): Promise<unknown>;
7810
+ }
7805
7811
  }
7806
7812
  /** @todo Documentation incomplete */
7807
7813
  /** @public */