FileExplorerView
Extends
Properties
_children
_children:
Component
[]
Child Components attached to current component, will be unloaded on unloading parent component
Inherited from
_events
_events:
EventRef
[]
Events that are attached to the current component, will be detached on unloading parent component
Inherited from
_loaded
_loaded:
boolean
Whether the component and its children are loaded
Inherited from
app
app:
App
Inherited from
closeable
closeable:
boolean
Whether the leaf may close the view
Inherited from
containerEl
containerEl:
HTMLElement
Inherited from
fileItems
fileItems:
FileExplorerViewFileItemsRecord
Mapping of file path to tree item
files
files:
WeakMapWrapper
<HTMLElement
,TAbstractFile
>
Mapping of tree self element to abstract file
icon
icon:
string
Inherited from
leaf
leaf:
WorkspaceLeaf
Inherited from
navigation
navigation:
boolean
Whether or not the view is intended for navigation. If your view is a static view that is not intended to be navigated away, set this to false. (For example: File explorer, calendar, etc.) If your view opens a file or can be otherwise navigated, set this to true. (For example: Markdown editor view, Kanban view, PDF view, etc.)
Inherited from
scope
scope:
null
|Scope
Assign an optional scope to your view to register hotkeys for when the view is in focus.
Example
Default
Inherited from
tree
tree:
Tree
<FileTreeItem
>
Tree view of files
Methods
acceptRename()
acceptRename():
Promise
<void
>
Try to rename the file
Returns
Promise
<void
>
addChild()
addChild<
T
>(component
):T
Adds a child component, loading it if this component is loaded
Type Parameters
• T extends Component
Parameters
• component: T
Returns
T
Inherited from
afterCreate()
afterCreate(
file
,newLeaf
):Promise
<void
>
Is Executed after creating the file or folder and opens the view and/or starts the rename
Parameters
• file: TFile
The created file
• newLeaf: boolean
| PaneType
Where to open the view for this file
Returns
Promise
<void
>
attachFileEvents()
attachFileEvents(
e
):void
Parameters
• e: unknown
Returns
void
close()
close():
Promise
<void
>
Closes the view
Returns
Promise
<void
>
Inherited from
createAbstractFile()
createAbstractFile(
type
,location
,newLeaf
):Promise
<void
>
Creates an file or folder
Parameters
• type: "file"
| "folder"
The type of file to create
• location: TFolder
The location where to create the file
• newLeaf: boolean
| PaneType
Where to open the view for this file
Returns
Promise
<void
>
createFolderDom()
createFolderDom(
folder
):unknown
Parameters
• folder: TFolder
Returns
unknown
createItemDom()
createItemDom(
file
):unknown
Parameters
• file: TFile
Returns
unknown
displayError()
displayError(
message
,fileItem
):void
Parameters
• message: string
• fileItem: unknown
Returns
void
dragFiles()
dragFiles(
event
,t
):unknown
Parameters
• event: DragEvent
• t: unknown
Returns
unknown
exitRename()
exitRename():
void
Quits the rename
Returns
void
getDisplayText()
abstract
getDisplayText():string
Returns
string
Inherited from
getEphemeralState()
getEphemeralState()
getEphemeralState():
Record
<string
,unknown
>
Returns
Record
<string
, unknown
>
Inherited from
getEphemeralState()
getEphemeralState():
object
Gets the ephemeral (non-persistent) state of the editor
Returns
object
Inherited from
getIcon()
getIcon()
getIcon():
string
Returns
string
Inherited from
getIcon()
getIcon():
string
Returns the icon name
Returns
string
Inherited from
getNodeId()
getNodeId(
e
):unknown
Parameters
• e: unknown
Returns
unknown
getSideTooltipPlacement()
getSideTooltipPlacement():
undefined
|"left"
|"right"
Returns the placement of the tooltip
Returns
undefined
| "left"
| "right"
Inherited from
getState()
getState()
getState():
Record
<string
,unknown
>
Returns
Record
<string
, unknown
>
Inherited from
getState()
getState():
object
Returns the current state of the view
Returns
object
Inherited from
getViewType()
getViewType():
"file-explorer"
Get the current view type
Returns
"file-explorer"
Overrides
handleCopy()
handleCopy(
event
):void
Handle copy event on metadata editor and serialize properties
Parameters
• event: ClipboardEvent
Returns
void
Inherited from
handleCut()
handleCut(
event
):void
Handle cut event on metadata editor and serialize and remove properties
Parameters
• event: ClipboardEvent
Returns
void
Inherited from
handlePaste()
handlePaste(
event
):void
Handle paste event of properties on metadata editor
Parameters
• event: ClipboardEvent
Returns
void
Inherited from
isItem()
isItem(
item
):boolean
Parameters
• item: unknown
Returns
boolean
load()
load():
void
Load this component and its children
Returns
void
Inherited from
onClose()
onClose():
Promise
<void
>
Returns
Promise
<void
>
Inherited from
onCreate()
onCreate(
file
):void
Is called when a new file is created in vault. Updates the file tree
Parameters
• file: TFile
The new file
Returns
void
onCreateNewFolderClick()
onCreateNewFolderClick(
event
):Promise
<void
>
Is called when on the new folder icon is clicked. Call createAbstractFile()
Parameters
• event: MouseEvent
The MouseEvent which triggered this function
Returns
Promise
<void
>
onCreateNewNoteClick()
onCreateNewNoteClick(
event
):Promise
<void
>
Is called when on the new note icon is clicked. Call createAbstractFile()
Parameters
• event: MouseEvent
The MouseEvent which triggered this function
Returns
Promise
<void
>
onDelete()
onDelete(
file
):void
Is called when a file in vault is deleted. Updates the file tree
Parameters
• file: TFile
The deleted file
Returns
void
onDeleteSelectedFiles()
onDeleteSelectedFiles(
event
):unknown
Called when delete is requested
Parameters
• event: unknown
The event triggered this function
Returns
unknown
onExtensionsUpdated()
onExtensionsUpdated():
void
Called when a extensions update is triggered Event: ‘extensions-updated’
Returns
void
onFileMouseout()
onFileMouseout(
event
,targetEl
):void
Called when the mouse pointer moves away from an element. Event: ‘mouseout’
Parameters
• event: MouseEvent
The event triggered this function
• targetEl: HTMLElement
The target Element
Returns
void
onFileMouseover()
onFileMouseover(
event
,targetEl
):void
Called when the mouse pointer is moved over an element. Updates the tooltip information Event: ‘mouseover’
Parameters
• event: MouseEvent
The event triggered this function
• targetEl: HTMLElement
The target Element
Returns
void
onFileOpen()
onFileOpen(
file
):void
Called when a file is opened. Brings the file to the front.
Parameters
• file: TFile
The opened file
Returns
void
onFileRenameInput()
onFileRenameInput(
e
):void
Parameters
• e: unknown
Returns
void
onHeaderMenu()
onHeaderMenu(
e
):void
Parameters
• e: unknown
Returns
void
Inherited from
onKeyEnterInRename()
onKeyEnterInRename(
event
):void
Called when ‘Enter’ is pressed while rename. Accepts the rename
Parameters
• event: KeyboardEvent
The event triggered this function
Returns
void
onKeyEscInRename()
onKeyEscInRename():
void
Called when ‘ESC’ is pressed while rename. Denies the rename
Returns
void
onKeyRename()
onKeyRename(
event
):void
Called when the rename shortcut is pressed
Parameters
• event: KeyboardEvent
The event triggered this function
Returns
void
onload()
onload():
void
Override this to load your component
Returns
void
Inherited from
onModify()
onModify():
void
Request a sort if not sorted properly
Returns
void
onOpen()
onOpen():
Promise
<void
>
Returns
Promise
<void
>
Inherited from
onPaneMenu()
onPaneMenu(
menu
,source
):void
Populates the pane menu.
(Replaces the previously removed onHeaderMenu
and onMoreOptionsMenu
)
Parameters
• menu: Menu
• source: string
Returns
void
Inherited from
onRename()
onRename(
file
,oldPath
):void
Is called when a file in vault is renamed. Updates the file tree
Parameters
• file: TFile
The renamed file
• oldPath: string
The old file path
Returns
void
onResize()
onResize():
void
Called when the size of this view is changed.
Returns
void
Inherited from
onTabMenu()
onTabMenu(
menu
):void
Adds the menu items to the menu
Parameters
• menu: Menu
the menu to fill
Returns
void
Inherited from
onTitleBlur()
onTitleBlur():
void
Called when the title is deselected. Calls acceptRename()
Returns
void
onunload()
onunload():
void
Override this to unload your component
Returns
void
Inherited from
open()
open(
parentEl
):Promise
<void
>
Opens the view
Parameters
• parentEl: Node
The node the view get attached to
Returns
Promise
<void
>
Inherited from
openFileContextMenu()
openFileContextMenu(
event
,fileItemEl
):void
Opens the context menu for the file item
Parameters
• event: Event
The event
• fileItemEl: HTMLElement
The file item clicked on
Returns
void
register()
register(
cb
):void
Registers a callback to be called when unloading
Parameters
• cb
Returns
void
Inherited from
registerDomEvent()
registerDomEvent(el, type, callback, options)
registerDomEvent<
K
>(el
,type
,callback
,options
?):void
Registers an DOM event to be detached when unloading
Type Parameters
• K extends keyof WindowEventMap
Parameters
• el: Window
• type: K
• callback
• options?: boolean
| AddEventListenerOptions
Returns
void
Inherited from
registerDomEvent(el, type, callback, options)
registerDomEvent<
K
>(el
,type
,callback
,options
?):void
Registers an DOM event to be detached when unloading
Type Parameters
• K extends keyof DocumentEventMap
Parameters
• el: Document
• type: K
• callback
• options?: boolean
| AddEventListenerOptions
Returns
void
Inherited from
registerDomEvent(el, type, callback, options)
registerDomEvent<
K
>(el
,type
,callback
,options
?):void
Registers an DOM event to be detached when unloading
Type Parameters
• K extends keyof HTMLElementEventMap
Parameters
• el: HTMLElement
• type: K
• callback
• options?: boolean
| AddEventListenerOptions
Returns
void
Inherited from
registerEvent()
registerEvent(
eventRef
):void
Registers an event to be detached when unloading
Parameters
• eventRef: EventRef
Returns
void
Inherited from
registerInterval()
registerInterval(
id
):number
Registers an interval (from setInterval) to be cancelled when unloading Use setInterval instead of setInterval to avoid TypeScript confusing between NodeJS vs Browser API
Parameters
• id: number
Returns
number
Inherited from
registerScopeEvent()
registerScopeEvent(
keymapEventHandler
):void
Parameters
• keymapEventHandler: KeymapEventHandler
Returns
void
Inherited from
removeChild()
removeChild<
T
>(component
):T
Removes a child component, unloading it
Type Parameters
• T extends Component
Parameters
• component: T
Returns
T
Inherited from
revealInFolder()
revealInFolder(
file
):void
Reveal a file or folder in the file tree
Parameters
Returns
void
setEphemeralState()
setEphemeralState(state)
setEphemeralState(
state
):void
Parameters
• state: unknown
Returns
void
Inherited from
setEphemeralState(state)
setEphemeralState(
state
):void
Set the ephemeral (non-persistent) state of the editor
Parameters
• state: any
Returns
void
Inherited from
setIsAllCollapsed()
setIsAllCollapsed(
e
):void
Parameters
• e: unknown
Returns
void
setSortOrder()
setSortOrder(
order
):void
Updates the sort order and sort by it
Parameters
• order: unknown
The sort order
Returns
void
setState()
setState(state, result)
setState(
state
,result
):Promise
<void
>
Parameters
• state: unknown
• result: ViewStateResult
Returns
Promise
<void
>
Inherited from
setState(state, result)
setState(
state
,result
):Promise
<void
>
Parameters
• state: any
• result: ViewStateResult
Returns
Promise
<void
>
Inherited from
sort()
sort():
void
Sorts the file items in this view
Returns
void
startRenameFile()
startRenameFile(
e
):unknown
Parameters
• e: unknown
Returns
unknown
unload()
unload():
void
Unload this component and its children
Returns
void
Inherited from
updateConfig()
updateConfig():
void
Reloads the config from vault and update all items
Returns
void