obsidian-typings 2.3.2 → 2.3.4

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
@@ -2483,7 +2483,7 @@ export interface PropertyWidget<T> {
2483
2483
  * @todo Documentation incomplete
2484
2484
  */
2485
2485
  /** @public */
2486
- export type PropertyWidgetType = "aliases" | "checkbox" | "date" | "datetime" | "multitext" | "number" | "tags" | "text" | (string & any);
2486
+ export type PropertyWidgetType = "aliases" | "checkbox" | "date" | "datetime" | "multitext" | "number" | "tags" | "text" | string;
2487
2487
  /** @public */
2488
2488
  export interface MetadataTypeManagerPropertiesRecord extends Record<string, PropertyInfo> {
2489
2489
  }
@@ -2491,7 +2491,12 @@ export interface MetadataTypeManagerPropertiesRecord extends Record<string, Prop
2491
2491
  export interface MetadataTypeManagerRegisteredTypeWidgetsRecord extends Record<PropertyWidgetType, PropertyWidget<unknown>> {
2492
2492
  }
2493
2493
  /** @public */
2494
- export interface MetadataTypeManagerTypesRecord extends Record<string, PropertyWidgetType> {
2494
+ export interface PropertyWidgetEntry {
2495
+ name: string;
2496
+ type: PropertyWidgetType;
2497
+ }
2498
+ /** @public */
2499
+ export interface MetadataTypeManagerTypesRecord extends Record<string, PropertyWidgetEntry> {
2495
2500
  }
2496
2501
  /** @public */
2497
2502
  export interface MetadataTypeManager extends Events {
@@ -6651,43 +6656,535 @@ declare module "obsidian" {
6651
6656
  setSize(size: number): void;
6652
6657
  }
6653
6658
  }
6654
- /** @public */
6655
- export interface ElectronWindow extends BrowserWindow {
6656
- _browserViews: unknown;
6657
- _events: unknown;
6658
- _eventsCount: unknown;
6659
- devToolsWebContents: unknown;
6660
- }
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;
6659
+ declare module "obsidian" {
6660
+ interface TextFileView extends EditableFileView {
6661
+ /**
6662
+ * Whether current file is dirty (different from saved contents)
6663
+ */
6664
+ dirty: boolean;
6665
+ /**
6666
+ * Whether editor should be rendered as plaintext
6667
+ */
6668
+ isPlaintext: boolean;
6669
+ /**
6670
+ * The data that was last saved
6671
+ */
6672
+ lastSavedData: null | string;
6673
+ /**
6674
+ * Whether on saving, the file should be saved again (for dirtiness checks)
6675
+ */
6676
+ saveAgain: boolean;
6677
+ /**
6678
+ * Whether the file is currently saving
6679
+ */
6680
+ saving: boolean;
6681
+ /** @todo Documentation incomplete */
6682
+ loadFileInternal(file: TFile, clear: boolean): Promise<unknown>;
6683
+ /**
6684
+ * 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.
6685
+ * @param file The modified file
6686
+ */
6687
+ onModify(file: TFile): void;
6688
+ /**
6689
+ * Saves the opened file
6690
+ * @param clear If set clears the editor under certain conditions
6691
+ */
6692
+ save(clear?: boolean): Promise<void>;
6693
+ /**
6694
+ * If any changes(dirty = true) in the file forces the file to save
6695
+ */
6696
+ saveImmediately(): void;
6697
+ /**
6698
+ * Set the data to the editor. This is used to load the file contents.
6699
+ * @param data The new data
6700
+ * @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.
6701
+ */
6702
+ setData(data: string, clear: boolean): void;
6703
+ }
6672
6704
  }
6673
- /** @public */
6674
- export interface Localization {
6675
- [key: string]: string | Localization;
6705
+ declare module "obsidian" {
6706
+ /** @todo Documentation incomplete */
6707
+ interface View extends Component {
6708
+ app: App;
6709
+ /**
6710
+ * Whether the leaf may close the view
6711
+ */
6712
+ closeable: boolean;
6713
+ containerEl: HTMLElement;
6714
+ /**
6715
+ * The icon string
6716
+ */
6717
+ icon: IconName;
6718
+ leaf: WorkspaceLeaf;
6719
+ /**
6720
+ * Closes the view
6721
+ */
6722
+ close(): Promise<void>;
6723
+ /**
6724
+ * Gets the ephemeral (non-persistent) state of the editor
6725
+ */
6726
+ getEphemeralState(): {};
6727
+ /**
6728
+ * Returns the icon name
6729
+ */
6730
+ getIcon(): IconName;
6731
+ /**
6732
+ * Returns the placement of the tooltip
6733
+ */
6734
+ getSideTooltipPlacement(): "left" | "right" | undefined;
6735
+ /**
6736
+ * Returns the current state of the view
6737
+ */
6738
+ getState(): {};
6739
+ /**
6740
+ * Handle copy event on metadata editor and serialize properties
6741
+ */
6742
+ handleCopy(event: ClipboardEvent): void;
6743
+ /**
6744
+ * Handle cut event on metadata editor and serialize and remove properties
6745
+ */
6746
+ handleCut(event: ClipboardEvent): void;
6747
+ /**
6748
+ * Handle paste event of properties on metadata editor
6749
+ */
6750
+ handlePaste(event: ClipboardEvent): void;
6751
+ /** @deprecated use `onPaneMenu` instead */
6752
+ onHeaderMenu(e: unknown): void;
6753
+ /**
6754
+ * Adds the menu items to the menu
6755
+ * @param menu the menu to fill
6756
+ */
6757
+ onTabMenu(menu: Menu): void;
6758
+ /**
6759
+ * Opens the view
6760
+ * @param parentEl The node the view get attached to
6761
+ */
6762
+ open(parentEl: Node): Promise<void>;
6763
+ /**
6764
+ * Set the ephemeral (non-persistent) state of the editor
6765
+ */
6766
+ setEphemeralState(state: any & {
6767
+ focus: boolean;
6768
+ focusOnMobile: boolean;
6769
+ cursor: EditorRangeOrCaret;
6770
+ }): void;
6771
+ /** @todo Documentation incomplete */
6772
+ setState(state: any, result: ViewStateResult): Promise<void>;
6773
+ }
6676
6774
  }
6677
- /** @public */
6678
- export interface SQLError {
6679
- code: number;
6680
- message: string;
6775
+ declare module "obsidian" {
6776
+ interface EditableFileView extends FileView {
6777
+ /**
6778
+ * The file that is currently being renamed
6779
+ */
6780
+ fileBeingRenamed: null | TFile;
6781
+ /**
6782
+ * Is called when the titleEl looses focus
6783
+ * Event type: 'blur'
6784
+ */
6785
+ onTitleBlur(): Promise<void>;
6786
+ /**
6787
+ * Is called when the titleEl is changed
6788
+ * Event type: 'input'
6789
+ * @param titleEl The titleEl of the view
6790
+ */
6791
+ onTitleChange(titleEl: HTMLElement): void;
6792
+ /**
6793
+ * Is called when the titleEl gains focus
6794
+ * Event type: 'focus'
6795
+ */
6796
+ onTitleFocus(): void;
6797
+ /**
6798
+ * Is called when the titleEl is focused and a keydown is triggered
6799
+ * Event type: 'keydown'
6800
+ * @param event The KeyboardEvent which triggered this function
6801
+ */
6802
+ onTitleKeydown(event: KeyboardEvent): void;
6803
+ /**
6804
+ * Is called when the titleEl is focused and a paste event is triggered
6805
+ * Event type: 'paste'
6806
+ * @param titleEl The titleEl of the view
6807
+ * @param event The ClipboardEvent which triggered this function
6808
+ */
6809
+ onTitlePaste(titleEl: HTMLElement, event: ClipboardEvent): void;
6810
+ /**
6811
+ * Updates the file to match the updated title
6812
+ * @param titleEl The current titleEl
6813
+ */
6814
+ saveTitle(titleEl: HTMLElement): Promise<void>;
6815
+ }
6681
6816
  }
6682
- /** @public */
6683
- export interface SQLResultSetRowList {
6684
- length: number;
6685
- item(index: number): any;
6817
+ declare module "obsidian" {
6818
+ /** @todo Documentation incomplete */
6819
+ interface ItemView extends View {
6820
+ /**
6821
+ * Container of actions for the view
6822
+ */
6823
+ actionsEl: HTMLElement;
6824
+ /**
6825
+ * Back button element for changing view history
6826
+ */
6827
+ backButtonEl: HTMLButtonElement;
6828
+ /**
6829
+ * Whether the view may be dropped anywhere in workspace
6830
+ */
6831
+ canDropAnywhere: boolean;
6832
+ /**
6833
+ * Forward button element for changing view history
6834
+ */
6835
+ forwardButtonEl: HTMLButtonElement;
6836
+ /**
6837
+ * Header bar container of view
6838
+ */
6839
+ headerEl: HTMLElement;
6840
+ /**
6841
+ * Icon element for the view (for dragging)
6842
+ */
6843
+ iconEl: HTMLElement;
6844
+ /**
6845
+ * Anchor button for revealing more view actions
6846
+ */
6847
+ moreOptionsButtonEl: HTMLAnchorElement;
6848
+ /**
6849
+ * Container for the title of the view
6850
+ */
6851
+ titleContainerEl: HTMLElement;
6852
+ /**
6853
+ * Title element for the view
6854
+ */
6855
+ titleEl: HTMLElement;
6856
+ /**
6857
+ * Title of the parent
6858
+ *
6859
+ * @remark Used for breadcrumbs rendering
6860
+ */
6861
+ titleParentEl: HTMLElement;
6862
+ /**
6863
+ * Adds an action button to the header of the view
6864
+ * @param icon - The icon for the action
6865
+ * @param title - The title for the action
6866
+ * @param callback - Callback to execute on click
6867
+ */
6868
+ addAction(icon: IconName, title: string, callback: (evt: MouseEvent) => any): HTMLElement;
6869
+ /** @todo Documentation incomplete */
6870
+ handleDrop(event: DragEvent, t: unknown, n: unknown): unknown;
6871
+ /** @todo Documentation incomplete */
6872
+ onGroupChange(): void;
6873
+ /** @todo Documentation incomplete */
6874
+ onMoreOptions(event: Event): void;
6875
+ /** @deprecated use onPaneMenu instead */
6876
+ onMoreOptionsMenu(e: unknown): void;
6877
+ /**
6878
+ * Updates the navigation buttons depending on the history
6879
+ */
6880
+ updateNavButtons(): void;
6881
+ }
6686
6882
  }
6687
- /** @public */
6688
- export interface SQLResultSet {
6689
- insertId: number;
6690
- rows: SQLResultSetRowList;
6883
+ declare module "obsidian" {
6884
+ interface MarkdownView extends TextFileView {
6885
+ /**
6886
+ * Backlinks component
6887
+ * @todo Documentation incomplete
6888
+ */
6889
+ backlinks: null | unknown;
6890
+ /**
6891
+ * The embedded backlinks element for the current file
6892
+ */
6893
+ backlinksEl: HTMLElement;
6894
+ /**
6895
+ * The currently active markdown view (preview or edit view)
6896
+ */
6897
+ currentMode: MarkdownSubView;
6898
+ /**
6899
+ * Editor component of the view
6900
+ */
6901
+ editMode: MarkdownEditView;
6902
+ /**
6903
+ * Editable title element of the view
6904
+ */
6905
+ inlineTitleEl: HTMLElement;
6906
+ /**
6907
+ * Frontmatter editor of the editor
6908
+ */
6909
+ metadataEditor: MetadataEditor;
6910
+ /**
6911
+ * Button for switching between different modes of the view
6912
+ */
6913
+ modeButtonEl: HTMLAnchorElement;
6914
+ /**
6915
+ * The registered modes of the view
6916
+ */
6917
+ modes: {
6918
+ source: MarkdownEditView;
6919
+ preview: MarkdownPreviewView;
6920
+ };
6921
+ /**
6922
+ * Preview component of the view
6923
+ */
6924
+ previewMode: MarkdownPreviewView;
6925
+ /**
6926
+ * File frontmatter as a raw string
6927
+ */
6928
+ rawFrontmatter: string;
6929
+ /**
6930
+ * Current scroll position of the editor
6931
+ */
6932
+ scroll: null | number;
6933
+ /**
6934
+ * Whether to show backlinks in the editor
6935
+ */
6936
+ showBacklinks: boolean;
6937
+ /** @deprecated CM5 Editor */
6938
+ sourceMode: {
6939
+ cmEditor: any;
6940
+ };
6941
+ /**
6942
+ * Add property to inline metadata editor or properties plugin
6943
+ *
6944
+ * @deprecated Removed in 1.6.0
6945
+ * @remark Parameter is not used
6946
+ */
6947
+ addProperty(unused: undefined): void;
6948
+ /**
6949
+ * Whether the editor can render properties according to the current mode and config
6950
+ */
6951
+ canShowProperties(): boolean;
6952
+ /**
6953
+ * Whether the editor can toggle backlinks according to current mode
6954
+ */
6955
+ canToggleBacklinks(): boolean;
6956
+ /**
6957
+ * Collapse the properties editor
6958
+ */
6959
+ collapseProperties(collapse: boolean): void;
6960
+ /**
6961
+ * Edit the focused property in the metadata editor
6962
+ *
6963
+ * @remark Parameter is not used
6964
+ */
6965
+ editProperty(unused: undefined): void;
6966
+ /**
6967
+ * Focus on the metadata editor given property information
6968
+ */
6969
+ focusMetadata(focus?: {
6970
+ focusHeading: boolean;
6971
+ propertyIdx?: number;
6972
+ propertyKey?: string;
6973
+ }): void;
6974
+ /**
6975
+ * Gets the ephemeral (non-persistent) state of the editor
6976
+ */
6977
+ getEphemeralState(): any & {
6978
+ scroll: number;
6979
+ };
6980
+ /**
6981
+ * Get the file attached to the view
6982
+ */
6983
+ getFile(): TFile | null;
6984
+ /** @internal Get the current mode of the editor */
6985
+ getHoverSource(): string;
6986
+ /**
6987
+ * Get the current mode of the editor
6988
+ */
6989
+ getMode(): MarkdownViewModeType;
6990
+ /**
6991
+ * Get selection of current mode
6992
+ */
6993
+ getSelection(): string;
6994
+ /**
6995
+ * Get the current view type
6996
+ */
6997
+ getViewType(): "markdown";
6998
+ /**
6999
+ * Validate correctness of frontmatter and update metadata editor
7000
+ */
7001
+ loadFrontmatter(data: string): void;
7002
+ /**
7003
+ * Whether the metadata editor has focus
7004
+ */
7005
+ metadataHasFocus(): boolean;
7006
+ /**
7007
+ * On app css change, update source mode editor
7008
+ */
7009
+ onCssChange(): void;
7010
+ /**
7011
+ * Update editor on external data change (from sync plugin)
7012
+ */
7013
+ onExternalDataChange(file: TFile, data: string): void;
7014
+ /**
7015
+ * On blur of inline title, save new filename
7016
+ */
7017
+ onInlineTitleBlur(): Promise<void>;
7018
+ /**
7019
+ * On data change of editor, update internal data and metadata editor
7020
+ */
7021
+ onInternalDataChange(): void;
7022
+ /**
7023
+ * On loading markdown view, register resize, css-change and quick-preview events
7024
+ */
7025
+ onload(): void;
7026
+ /**
7027
+ * On fold of markdown in source editor, save fold info to fold manager
7028
+ */
7029
+ onMarkdownFold(): void;
7030
+ /**
7031
+ * On markdown scroll in editors, update scroll, sync state and trigger markdown scroll event
7032
+ */
7033
+ onMarkdownScroll(): void;
7034
+ /**
7035
+ * On mod click, opens editor of opposite mode in split view to right
7036
+ */
7037
+ onSwitchView(event: KeyboardEvent | MouseEvent): Promise<void>;
7038
+ /**
7039
+ * Opens PDF modal for exporting PDF of the current file
7040
+ */
7041
+ printToPdf(): void;
7042
+ /**
7043
+ * Redo action of source mode editor
7044
+ */
7045
+ redo(): void;
7046
+ /**
7047
+ * Register editor mode component to view
7048
+ */
7049
+ registerMode(component: MarkdownSubView): void;
7050
+ /**
7051
+ * Save the frontmatter of the file
7052
+ */
7053
+ saveFrontmatter(properties: Record<string, any>): void;
7054
+ /**
7055
+ * Set the mode of the editor
7056
+ */
7057
+ setMode(component: MarkdownSubView): Promise<void>;
7058
+ /**
7059
+ * Shift focus to first line of editor
7060
+ */
7061
+ shiftFocusAfter(): void;
7062
+ /**
7063
+ * Shift focus to inline title
7064
+ */
7065
+ shiftFocusBefore(): void;
7066
+ /**
7067
+ * Toggle backlinks on editor
7068
+ */
7069
+ toggleBacklinks(): Promise<void>;
7070
+ /**
7071
+ * Toggle collapse status of properties editor if allowed
7072
+ */
7073
+ toggleCollapseProperties(): void;
7074
+ /**
7075
+ * Toggle between source and preview mode
7076
+ */
7077
+ toggleMode(): void;
7078
+ /**
7079
+ * Execute functionality of token (open external link, open internal link in leaf, ...)
7080
+ */
7081
+ triggerClickableToken(token: Token, new_leaf: boolean): void;
7082
+ /**
7083
+ * Undo action of source mode editor
7084
+ */
7085
+ undo(): void;
7086
+ /**
7087
+ * Update the backlinks component for new file
7088
+ */
7089
+ updateBacklinks(): void;
7090
+ /**
7091
+ * Update reading/source view action buttons of modeButtonEl with current mode
7092
+ */
7093
+ updateButtons(): void;
7094
+ /**
7095
+ * Update options of the editors from settings
7096
+ */
7097
+ updateOptions(): void;
7098
+ /**
7099
+ * Hide/render backlinks component
7100
+ */
7101
+ updateShowBacklinks(): void;
7102
+ }
7103
+ }
7104
+ declare module "obsidian" {
7105
+ /** @todo Documentation incomplete */
7106
+ interface FileView extends ItemView {
7107
+ /**
7108
+ * Whether the view may be run without an attached file
7109
+ */
7110
+ allowNoFile: boolean;
7111
+ /**
7112
+ * Determines whether the specified file extension can be opened in this view.
7113
+ * @param extension The file extension to be evaluated
7114
+ */
7115
+ canAcceptExtension(extension: string): boolean;
7116
+ /**
7117
+ * Get view state for sync plugin
7118
+ */
7119
+ getSyncViewState(): any;
7120
+ /**
7121
+ * Loads the file with the onLoadFile function
7122
+ * @param file The File to load
7123
+ */
7124
+ loadFile(file: TFile): Promise<unknown>;
7125
+ /**
7126
+ * Updates the view if it contains the deleted file
7127
+ * @param file The file that is deleted
7128
+ */
7129
+ onDelete(file: TFile): Promise<void>;
7130
+ /**
7131
+ * Is called when a file get loaded
7132
+ * @param file The file that is loaded
7133
+ */
7134
+ onLoadFile(file: TFile): Promise<void>;
7135
+ /**
7136
+ * Updates the view information based on the new file name
7137
+ * @param file The file that is renamed
7138
+ */
7139
+ onRename(file: TFile): Promise<void>;
7140
+ /**
7141
+ * Is called when a file get unloaded
7142
+ * @param file The file that is unloaded
7143
+ */
7144
+ onUnloadFile(file: TFile): Promise<void>;
7145
+ /** @todo Documentation incomplete */
7146
+ renderBreadcrumbs(): void;
7147
+ /** @todo Documentation incomplete */
7148
+ syncState(e: boolean): Promise<unknown>;
7149
+ }
7150
+ }
7151
+ /** @public */
7152
+ export interface ElectronWindow extends BrowserWindow {
7153
+ _browserViews: unknown;
7154
+ _events: unknown;
7155
+ _eventsCount: unknown;
7156
+ devToolsWebContents: unknown;
7157
+ }
7158
+ /** @public */
7159
+ export interface FrameDom {
7160
+ eWin: Electron.BrowserWindow;
7161
+ isMac: boolean;
7162
+ leftButtonContainerEl: HTMLDivElement;
7163
+ titleBarEl: HTMLDivElement;
7164
+ titleBarInnerEl: HTMLDivElement;
7165
+ titleBarTextEl: HTMLDivElement;
7166
+ win: Window;
7167
+ updateStatus(): void;
7168
+ updateTitle(): void;
7169
+ }
7170
+ /** @public */
7171
+ export interface Localization {
7172
+ [key: string]: string | Localization;
7173
+ }
7174
+ /** @public */
7175
+ export interface SQLError {
7176
+ code: number;
7177
+ message: string;
7178
+ }
7179
+ /** @public */
7180
+ export interface SQLResultSetRowList {
7181
+ length: number;
7182
+ item(index: number): any;
7183
+ }
7184
+ /** @public */
7185
+ export interface SQLResultSet {
7186
+ insertId: number;
7187
+ rows: SQLResultSetRowList;
6691
7188
  rowsAffected: number;
6692
7189
  }
6693
7190
  /** @public */
@@ -6941,11 +7438,6 @@ declare global {
6941
7438
  */
6942
7439
  var wf: typeof Object.defineProperty;
6943
7440
  }
6944
- declare global {
6945
- interface DomElementInfo {
6946
- [eventName: `on${string}`]: EventListenerOrEventListenerObject;
6947
- }
6948
- }
6949
7441
  /** @public */
6950
7442
  export interface IFramedMarkdownEditor extends MarkdownScrollableEditView {
6951
7443
  /**
@@ -7049,764 +7541,277 @@ export interface EmbeddedEditorView extends Component {
7049
7541
  */
7050
7542
  get scroll(): unknown;
7051
7543
  /**
7052
- * Destroy edit component editor and save contents if specified
7053
- */
7054
- destroyEditor(save?: boolean): void;
7055
- /**
7056
- * Gets currently active mode (editMode returns 'source')
7057
- */
7058
- getMode(): "source" | "preview";
7059
- /**
7060
- * On load of editor, show preview
7061
- */
7062
- onload(): void;
7063
- /**
7064
- * Trigger markdown scroll on workspace
7065
- */
7066
- onMarkdownScroll(): void;
7067
- /**
7068
- * On unload of editor, destroy editor and unset workspace activeEditor
7069
- */
7070
- onunload(): void;
7071
- /**
7072
- * Debounced save of contents
7073
- */
7074
- requestSave(): void;
7075
- /**
7076
- * Debounced save of editor folds
7077
- */
7078
- requestSaveFolds(): void;
7079
- /**
7080
- * Set file contents
7081
- */
7082
- save(data: string, save?: boolean): void;
7083
- /**
7084
- * Set the state of the editor
7085
- */
7086
- set(data: string, clear: boolean): void;
7087
- /**
7088
- * Reveal the editor if editable widget and applies saved state
7089
- */
7090
- showEditor(): void;
7091
- /**
7092
- * Reveal preview mode and destroy editor, save if specified
7093
- */
7094
- showPreview(save?: boolean): void;
7095
- /**
7096
- * Reveal search component in file renderer component
7097
- */
7098
- showSearch(replace?: boolean): void;
7099
- /**
7100
- * Toggle between edit and preview mode
7101
- */
7102
- toggleMode(): void;
7103
- }
7104
- /** @public */
7105
- export interface WidgetEditorView extends EmbeddedEditorView {
7106
- /**
7107
- * Data after reference
7108
- */
7109
- after: string;
7110
- /**
7111
- * Data before reference
7112
- */
7113
- before: string;
7114
- /**
7115
- * Full file contents
7116
- */
7117
- data: string;
7118
- /**
7119
- * File being currently renamed
7120
- */
7121
- fileBeingRenamed: null | TFile;
7122
- /**
7123
- * Current heading
7124
- */
7125
- heading: string;
7126
- /**
7127
- * Indent
7128
- */
7129
- indent: string;
7130
- /**
7131
- * Inline title element
7132
- */
7133
- inlineTitleEl: HTMLElement;
7134
- /**
7135
- * Full inline content string
7136
- */
7137
- lastSavedData: null | string;
7138
- /**
7139
- * Whether embedding should be saved twice on save
7140
- */
7141
- saveAgain: boolean;
7142
- /**
7143
- * Whether the widget is currently saving
7144
- */
7145
- saving: boolean;
7146
- /**
7147
- * Subpath reference of the path
7148
- */
7149
- subpath: string;
7150
- /**
7151
- * Whether the subpath was not found in the cache
7152
- */
7153
- subpathNotFound: boolean;
7154
- /**
7155
- * Push/pop current scope
7156
- */
7157
- applyScope(scope: Scope): void;
7158
- /**
7159
- * Get the current folds of the editor
7160
- */
7161
- getFoldInfo(): null | FoldInfo;
7162
- /**
7163
- * Splice incoming data at according to subpath for correct reference, then update heading and render
7164
- */
7165
- loadContents(data: string, cache: CachedMetadata): void;
7166
- /**
7167
- * Load file from cache based on stored path
7168
- */
7169
- loadFile(): Promise<void>;
7170
- /**
7171
- * Load file and check if data is different from last saved data, then loads contents
7172
- */
7173
- loadFileInternal(data: string, cache?: CachedMetadata): void;
7174
- /**
7175
- * Update representation on file finished updating
7176
- */
7177
- onFileChanged(file: TFile, data: string, cache: CachedMetadata): void;
7178
- /**
7179
- * Update representation on file rename
7180
- */
7181
- onFileRename(file: TAbstractFile, oldPath: string): void;
7182
- /**
7183
- * On loading widget, register vault change and rename events
7184
- */
7185
- onload(): void;
7186
- /**
7187
- * Save fold made in the editor to foldManager
7188
- */
7189
- onMarkdownFold(): void;
7190
- /** @internal On change of editor title element */
7191
- onTitleChange(element: HTMLElement): void;
7192
- /** @internal On keypress on editor title element */
7193
- onTitleKeydown(event: KeyboardEvent): void;
7194
- /** @internal On pasting on editor title element */
7195
- onTitlePaste(element: HTMLElement, event: ClipboardEvent): void;
7196
- /**
7197
- * On unloading widget, unload component and remove scope
7198
- */
7199
- onunload(): void;
7200
- /**
7201
- * Save changes made in editable widget
7202
- */
7203
- save(data: string, delayed?: boolean): Promise<void>;
7204
- /**
7205
- * On blur widget, save title
7206
- */
7207
- saveTitle(element: HTMLElement): void;
7208
- /**
7209
- * Show preview of widget
7210
- */
7211
- showPreview(show?: boolean): void;
7212
- }
7213
- /** @public */
7214
- export interface CanvasLeaf extends WorkspaceLeaf {
7215
- }
7216
- /** @public */
7217
- export interface FileSuggestManager {
7218
- /**
7219
- * Reference to the app
7220
- */
7221
- app: App;
7222
- /**
7223
- * Selection of files and their paths that can be matched to
7224
- */
7225
- fileSuggestions: null | {
7226
- file: TFile | null;
7227
- path: string;
7228
- }[];
7229
- /**
7230
- * Whether search should be vault-wide rather than scoped to current file
7231
- */
7232
- global: boolean;
7233
- /**
7234
- * Type of suggestions that should be provided
7235
- */
7236
- mode: "file" | "heading" | "block" | "display" | string;
7237
- /**
7238
- * Executor of the search
7239
- */
7240
- runnable: null | Runnable;
7241
- /**
7242
- * Get suggestions for block query
7243
- */
7244
- getBlockSuggestions(runner: Runnable, file: TFile, text: string): Promise<SearchResult[]>;
7245
- /**
7246
- * Get suggestions for display alias query
7247
- */
7248
- getDisplaySuggestions(runner: Runnable, linkpath: string, subpath: string, alias: string): Promise<SearchResult[]>;
7249
- /**
7250
- * Get suggestions for file query
7251
- */
7252
- getFileSuggestions(runner: Runnable, text: string): Promise<SearchResult[]>;
7253
- /**
7254
- * Get suggestions for global block query
7255
- */
7256
- getGlobalBlockSuggestions(runner: Runnable, text: string): Promise<SearchResult[]>;
7257
- /**
7258
- * Get suggestions for global heading query
7259
- */
7260
- getGlobalHeadingSuggestions(runner: Runnable, text: string): Promise<SearchResult[]>;
7261
- /**
7262
- * Get suggestions for file heading query
7263
- */
7264
- getHeadingSuggestions(runner: Runnable, file: TFile, text: string): Promise<SearchResult[]>;
7265
- /** @internal Generate instructions for specific actions in suggestion manager (e.g. accept, select, ...) */
7266
- getInstructions(): [
7267
- {
7268
- command: "string";
7269
- purpose: "string";
7270
- }
7271
- ];
7272
- /**
7273
- * Determine the source path of current context
7274
- */
7275
- getSourcePath(): null | string;
7276
- /**
7277
- * Get suggestions for current input text
7278
- *
7279
- * @remark Type is determined from text: e.g. [[Thi]] will give completions for files, [[Thi^]] for blocks, etc.
7280
- */
7281
- getSuggestionsAsync(runner: Runnable, text: string): Promise<SearchResult[]>;
7282
- /**
7283
- * Match search fragments to a block
7284
- */
7285
- matchBlock(path: string, file: TFile, block: BlockCache, sourcePath: null | string, content: string, text_parts: string[]): SearchResult | null;
7286
- }
7287
- /** @todo Documentation incomplete */
7288
- /** @public */
7289
- export interface Account {
7290
- /**
7291
- * The company associated with the activated commercial license
7544
+ * Destroy edit component editor and save contents if specified
7292
7545
  */
7293
- company: string;
7546
+ destroyEditor(save?: boolean): void;
7294
7547
  /**
7295
- * The email address associated with the account
7548
+ * Gets currently active mode (editMode returns 'source')
7296
7549
  */
7297
- email: string;
7298
- expiry: number;
7299
- key: string | undefined;
7300
- keyValidation: string;
7550
+ getMode(): "source" | "preview";
7301
7551
  /**
7302
- * The license available to the account
7552
+ * On load of editor, show preview
7303
7553
  */
7304
- license: "" | "insider";
7554
+ onload(): void;
7305
7555
  /**
7306
- * Profile name
7556
+ * Trigger markdown scroll on workspace
7307
7557
  */
7308
- name: string;
7309
- seats: number;
7310
- token: string;
7311
- }
7312
- /** @todo Documentation incomplete */
7313
- /** @public */
7314
- export interface FileSuggest<T> extends EditorSuggest<T> {
7558
+ onMarkdownScroll(): void;
7315
7559
  /**
7316
- * Manages fetching of suggestions from metadatacache
7560
+ * On unload of editor, destroy editor and unset workspace activeEditor
7317
7561
  */
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
- }
7562
+ onunload(): void;
7563
+ /**
7564
+ * Debounced save of contents
7565
+ */
7566
+ requestSave(): void;
7567
+ /**
7568
+ * Debounced save of editor folds
7569
+ */
7570
+ requestSaveFolds(): void;
7571
+ /**
7572
+ * Set file contents
7573
+ */
7574
+ save(data: string, save?: boolean): void;
7575
+ /**
7576
+ * Set the state of the editor
7577
+ */
7578
+ set(data: string, clear: boolean): void;
7579
+ /**
7580
+ * Reveal the editor if editable widget and applies saved state
7581
+ */
7582
+ showEditor(): void;
7583
+ /**
7584
+ * Reveal preview mode and destroy editor, save if specified
7585
+ */
7586
+ showPreview(save?: boolean): void;
7587
+ /**
7588
+ * Reveal search component in file renderer component
7589
+ */
7590
+ showSearch(replace?: boolean): void;
7591
+ /**
7592
+ * Toggle between edit and preview mode
7593
+ */
7594
+ toggleMode(): void;
7543
7595
  }
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
- }
7596
+ /** @public */
7597
+ export interface WidgetEditorView extends EmbeddedEditorView {
7598
+ /**
7599
+ * Data after reference
7600
+ */
7601
+ after: string;
7602
+ /**
7603
+ * Data before reference
7604
+ */
7605
+ before: string;
7606
+ /**
7607
+ * Full file contents
7608
+ */
7609
+ data: string;
7610
+ /**
7611
+ * File being currently renamed
7612
+ */
7613
+ fileBeingRenamed: null | TFile;
7614
+ /**
7615
+ * Current heading
7616
+ */
7617
+ heading: string;
7618
+ /**
7619
+ * Indent
7620
+ */
7621
+ indent: string;
7622
+ /**
7623
+ * Inline title element
7624
+ */
7625
+ inlineTitleEl: HTMLElement;
7626
+ /**
7627
+ * Full inline content string
7628
+ */
7629
+ lastSavedData: null | string;
7630
+ /**
7631
+ * Whether embedding should be saved twice on save
7632
+ */
7633
+ saveAgain: boolean;
7634
+ /**
7635
+ * Whether the widget is currently saving
7636
+ */
7637
+ saving: boolean;
7638
+ /**
7639
+ * Subpath reference of the path
7640
+ */
7641
+ subpath: string;
7642
+ /**
7643
+ * Whether the subpath was not found in the cache
7644
+ */
7645
+ subpathNotFound: boolean;
7646
+ /**
7647
+ * Push/pop current scope
7648
+ */
7649
+ applyScope(scope: Scope): void;
7650
+ /**
7651
+ * Get the current folds of the editor
7652
+ */
7653
+ getFoldInfo(): null | FoldInfo;
7654
+ /**
7655
+ * Splice incoming data at according to subpath for correct reference, then update heading and render
7656
+ */
7657
+ loadContents(data: string, cache: CachedMetadata): void;
7658
+ /**
7659
+ * Load file from cache based on stored path
7660
+ */
7661
+ loadFile(): Promise<void>;
7662
+ /**
7663
+ * Load file and check if data is different from last saved data, then loads contents
7664
+ */
7665
+ loadFileInternal(data: string, cache?: CachedMetadata): void;
7666
+ /**
7667
+ * Update representation on file finished updating
7668
+ */
7669
+ onFileChanged(file: TFile, data: string, cache: CachedMetadata): void;
7670
+ /**
7671
+ * Update representation on file rename
7672
+ */
7673
+ onFileRename(file: TAbstractFile, oldPath: string): void;
7674
+ /**
7675
+ * On loading widget, register vault change and rename events
7676
+ */
7677
+ onload(): void;
7678
+ /**
7679
+ * Save fold made in the editor to foldManager
7680
+ */
7681
+ onMarkdownFold(): void;
7682
+ /** @internal On change of editor title element */
7683
+ onTitleChange(element: HTMLElement): void;
7684
+ /** @internal On keypress on editor title element */
7685
+ onTitleKeydown(event: KeyboardEvent): void;
7686
+ /** @internal On pasting on editor title element */
7687
+ onTitlePaste(element: HTMLElement, event: ClipboardEvent): void;
7688
+ /**
7689
+ * On unloading widget, unload component and remove scope
7690
+ */
7691
+ onunload(): void;
7692
+ /**
7693
+ * Save changes made in editable widget
7694
+ */
7695
+ save(data: string, delayed?: boolean): Promise<void>;
7696
+ /**
7697
+ * On blur widget, save title
7698
+ */
7699
+ saveTitle(element: HTMLElement): void;
7700
+ /**
7701
+ * Show preview of widget
7702
+ */
7703
+ showPreview(show?: boolean): void;
7764
7704
  }
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>;
7705
+ /** @public */
7706
+ export interface CanvasLeaf extends WorkspaceLeaf {
7707
+ }
7708
+ /** @public */
7709
+ export interface FileSuggestManager {
7710
+ /**
7711
+ * Reference to the app
7712
+ */
7713
+ app: App;
7714
+ /**
7715
+ * Selection of files and their paths that can be matched to
7716
+ */
7717
+ fileSuggestions: null | {
7718
+ file: TFile | null;
7719
+ path: string;
7720
+ }[];
7721
+ /**
7722
+ * Whether search should be vault-wide rather than scoped to current file
7723
+ */
7724
+ global: boolean;
7725
+ /**
7726
+ * Type of suggestions that should be provided
7727
+ */
7728
+ mode: "file" | "heading" | "block" | "display" | string;
7729
+ /**
7730
+ * Executor of the search
7731
+ */
7732
+ runnable: null | Runnable;
7733
+ /**
7734
+ * Get suggestions for block query
7735
+ */
7736
+ getBlockSuggestions(runner: Runnable, file: TFile, text: string): Promise<SearchResult[]>;
7737
+ /**
7738
+ * Get suggestions for display alias query
7739
+ */
7740
+ getDisplaySuggestions(runner: Runnable, linkpath: string, subpath: string, alias: string): Promise<SearchResult[]>;
7741
+ /**
7742
+ * Get suggestions for file query
7743
+ */
7744
+ getFileSuggestions(runner: Runnable, text: string): Promise<SearchResult[]>;
7745
+ /**
7746
+ * Get suggestions for global block query
7747
+ */
7748
+ getGlobalBlockSuggestions(runner: Runnable, text: string): Promise<SearchResult[]>;
7749
+ /**
7750
+ * Get suggestions for global heading query
7751
+ */
7752
+ getGlobalHeadingSuggestions(runner: Runnable, text: string): Promise<SearchResult[]>;
7753
+ /**
7754
+ * Get suggestions for file heading query
7755
+ */
7756
+ getHeadingSuggestions(runner: Runnable, file: TFile, text: string): Promise<SearchResult[]>;
7757
+ /** @internal Generate instructions for specific actions in suggestion manager (e.g. accept, select, ...) */
7758
+ getInstructions(): [
7759
+ {
7760
+ command: "string";
7761
+ purpose: "string";
7762
+ }
7763
+ ];
7764
+ /**
7765
+ * Determine the source path of current context
7766
+ */
7767
+ getSourcePath(): null | string;
7768
+ /**
7769
+ * Get suggestions for current input text
7770
+ *
7771
+ * @remark Type is determined from text: e.g. [[Thi]] will give completions for files, [[Thi^]] for blocks, etc.
7772
+ */
7773
+ getSuggestionsAsync(runner: Runnable, text: string): Promise<SearchResult[]>;
7774
+ /**
7775
+ * Match search fragments to a block
7776
+ */
7777
+ matchBlock(path: string, file: TFile, block: BlockCache, sourcePath: null | string, content: string, text_parts: string[]): SearchResult | null;
7778
+ }
7779
+ /** @todo Documentation incomplete */
7780
+ /** @public */
7781
+ export interface Account {
7782
+ /**
7783
+ * The company associated with the activated commercial license
7784
+ */
7785
+ company: string;
7786
+ /**
7787
+ * The email address associated with the account
7788
+ */
7789
+ email: string;
7790
+ expiry: number;
7791
+ key: string | undefined;
7792
+ keyValidation: string;
7793
+ /**
7794
+ * The license available to the account
7795
+ */
7796
+ license: "" | "insider";
7797
+ /**
7798
+ * Profile name
7799
+ */
7800
+ name: string;
7801
+ seats: number;
7802
+ token: string;
7803
+ }
7804
+ /** @todo Documentation incomplete */
7805
+ /** @public */
7806
+ export interface FileSuggest<T> extends EditorSuggest<T> {
7807
+ /**
7808
+ * Manages fetching of suggestions from metadatacache
7809
+ */
7810
+ suggestManager: FileSuggestManager;
7811
+ }
7812
+ declare global {
7813
+ interface DomElementInfo {
7814
+ [eventName: `on${string}`]: EventListenerOrEventListenerObject;
7810
7815
  }
7811
7816
  }
7812
7817
  /** @todo Documentation incomplete */