<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[`TextFileView`](TextFileView)
## TextFileView class
This class implements a plaintext-based editable file view, which can be loaded and saved given an editor.
Note that by default, this view only saves when it's closing. To implement auto-save, your editor should call `this.requestSave()` when the content is changed.
**Signature:**
```typescript
export abstract class TextFileView extends EditableFileView
```
**Extends:** [`EditableFileView`](EditableFileView)
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [`(constructor)(leaf)`](TextFileView/(constructor).md) | | Constructs a new instance of the <code>TextFileView</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [`allowNoFile`](FileView/allowNoFile) | | <code>boolean</code> | <p>(Inherited from [FileView](FileView)<!-- -->)</p> |
| [`app`](View/app) | | [`App`](App) | <p>(Inherited from [View](View)<!-- -->)</p> |
| [`containerEl`](View/containerEl) | | <code>HTMLElement</code> | <p>(Inherited from [View](View)<!-- -->)</p> |
| [`contentEl`](ItemView/contentEl) | | <code>HTMLElement</code> | <p>(Inherited from [ItemView](ItemView)<!-- -->)</p> |
| [`data`](TextFileView/data) | | <code>string</code> | In memory data |
| [`file`](FileView/file) | | [`TFile`](TFile)<code> | null</code> | <p>(Inherited from [FileView](FileView)<!-- -->)</p> |
| [`icon`](View/icon) | | [`IconName`](IconName) | <p>(Inherited from [View](View)<!-- -->)</p> |
| [`leaf`](View/leaf) | | [`WorkspaceLeaf`](WorkspaceLeaf) | <p>(Inherited from [View](View)<!-- -->)</p> |
| [`navigation`](FileView/navigation) | | <code>boolean</code> | <p>File views can be navigated by default. </p><p>(Inherited from [FileView](FileView)<!-- -->)</p> |
| [`requestSave`](TextFileView/requestSave) | | <code>() => void</code> | Debounced save in 2 seconds from now |
| [`scope`](View/scope) | | [`Scope`](Scope)<code> | null</code> | <p>Assign an optional scope to your view to register hotkeys for when the view is in focus.</p><p>(Inherited from [View](View)<!-- -->)</p> |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [`addAction(icon, title, callback)`](ItemView/addAction) | | <p>(Inherited from [ItemView](ItemView)<!-- -->)</p> |
| [`addChild(component)`](Component/addChild) | | <p>Adds a child component, loading it if this component is loaded</p><p>(Inherited from [Component](Component)<!-- -->)</p> |
| [`canAcceptExtension(extension)`](FileView/canAcceptExtension) | | <p>(Inherited from [FileView](FileView)<!-- -->)</p> |
| [`clear()`](TextFileView/clear) | <code>abstract</code> | Clear the editor. This is usually called when we're about to open a completely different file, so it's best to clear any editor states like undo-redo history, and any caches/indexes associated with the previous file contents. |
| [`getDisplayText()`](FileView/getDisplayText) | | <p>(Inherited from [FileView](FileView)<!-- -->)</p> |
| [`getEphemeralState()`](View/getEphemeralState) | | <p>(Inherited from [View](View)<!-- -->)</p> |
| [`getIcon()`](View/getIcon) | | <p>(Inherited from [View](View)<!-- -->)</p> |
| [`getState()`](FileView/getState) | | <p>(Inherited from [FileView](FileView)<!-- -->)</p> |
| [`getViewData()`](TextFileView/getViewData) | <code>abstract</code> | Gets the data from the editor. This will be called to save the editor contents to the file. |
| [`getViewType()`](View/getViewType) | <code>abstract</code> | <p>(Inherited from [View](View)<!-- -->)</p> |
| [`load()`](Component/load) | | <p>Load this component and its children</p><p>(Inherited from [Component](Component)<!-- -->)</p> |
| [`onClose()`](View/onClose) | <code>protected</code> | <p>(Inherited from [View](View)<!-- -->)</p> |
| [`onload()`](FileView/onload) | | <p>(Inherited from [FileView](FileView)<!-- -->)</p> |
| [`onLoadFile(file)`](TextFileView/onLoadFile) | | |
| [`onOpen()`](View/onOpen) | <code>protected</code> | <p>(Inherited from [View](View)<!-- -->)</p> |
| [`onPaneMenu(menu, source)`](View/onPaneMenu) | | <p>Populates the pane menu.</p><p>(Replaces the previously removed <code>onHeaderMenu</code> and <code>onMoreOptionsMenu</code>)</p><p>(Inherited from [View](View)<!-- -->)</p> |
| [`onRename(file)`](FileView/onRename) | | <p>(Inherited from [FileView](FileView)<!-- -->)</p> |
| [`onResize()`](View/onResize) | | <p>Called when the size of this view is changed.</p><p>(Inherited from [View](View)<!-- -->)</p> |
| [`onunload()`](Component/onunload) | | <p>Override this to unload your component</p><p>(Inherited from [Component](Component)<!-- -->)</p> |
| [`onUnloadFile(file)`](TextFileView/onUnloadFile) | | |
| [`register(cb)`](Component/register) | | <p>Registers a callback to be called when unloading</p><p>(Inherited from [Component](Component)<!-- -->)</p> |
| [`registerDomEvent(el, type, callback, options)`](Component/registerDomEvent) | | <p>Registers an DOM event to be detached when unloading</p><p>(Inherited from [Component](Component)<!-- -->)</p> |
| [`registerDomEvent(el, type, callback, options)`](Component/registerDomEvent_1) | | <p>Registers an DOM event to be detached when unloading</p><p>(Inherited from [Component](Component)<!-- -->)</p> |
| [`registerDomEvent(el, type, callback, options)`](Component/registerDomEvent_2) | | <p>Registers an DOM event to be detached when unloading</p><p>(Inherited from [Component](Component)<!-- -->)</p> |
| [`registerEvent(eventRef)`](Component/registerEvent) | | <p>Registers an event to be detached when unloading</p><p>(Inherited from [Component](Component)<!-- -->)</p> |
| [`registerInterval(id)`](Component/registerInterval) | | <p>Registers an interval (from setInterval) to be cancelled when unloading Use instead of to avoid TypeScript confusing between NodeJS vs Browser API</p><p>(Inherited from [Component](Component)<!-- -->)</p> |
| [`removeChild(component)`](Component/removeChild) | | <p>Removes a child component, unloading it</p><p>(Inherited from [Component](Component)<!-- -->)</p> |
| [`save(clear)`](TextFileView/save) | | |
| [`setEphemeralState(state)`](View/setEphemeralState) | | <p>(Inherited from [View](View)<!-- -->)</p> |
| [`setState(state, result)`](FileView/setState) | | <p>(Inherited from [FileView](FileView)<!-- -->)</p> |
| [`setViewData(data, clear)`](TextFileView/setViewData) | <code>abstract</code> | <p>Set the data to the editor. This is used to load the file contents.</p><p>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.</p> |
| [`unload()`](Component/unload) | | <p>Unload this component and its children</p><p>(Inherited from [Component](Component)<!-- -->)</p> |
Not found
This page does not exist