Skip to content

WidgetEditorView

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:11

Extends

Properties

_children

_children: Component[]

Defined in: src/obsidian/augmentations/Components/Component.d.ts:9

Child Components attached to current component, will be unloaded on unloading parent component

Inherited from

EmbeddedEditorView._children


_events

_events: EventRef[]

Defined in: src/obsidian/augmentations/Components/Component.d.ts:13

Events that are attached to the current component, will be detached on unloading parent component

Inherited from

EmbeddedEditorView._events


_loaded

_loaded: boolean

Defined in: src/obsidian/augmentations/Components/Component.d.ts:17

Whether the component and its children are loaded

Inherited from

EmbeddedEditorView._loaded


after

after: string

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:15

Data after reference


app

app: App

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:16

Reference to the app

Inherited from

EmbeddedEditorView.app


before

before: string

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:19

Data before reference


containerEl

containerEl: HTMLElement

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:20

Container element for the embedded view

Inherited from

EmbeddedEditorView.containerEl


data

data: string

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:23

Full file contents


dirty

dirty: boolean

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:24

Whether the view is currently saving

Inherited from

EmbeddedEditorView.dirty


editable

editable: boolean

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:31

Whether the editor may be edited

Inherited from

EmbeddedEditorView.editable


editMode?

optional editMode: IFramedMarkdownEditor

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:35

Editor component of the view

Inherited from

EmbeddedEditorView.editMode


editorEl

editorEl: HTMLElement

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:39

Container in which the editor is embedded

Inherited from

EmbeddedEditorView.editorEl


file

file: null | TFile

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:43

File to which the view is attached

Inherited from

EmbeddedEditorView.file


fileBeingRenamed

fileBeingRenamed: null | TFile

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:27

File being currently renamed


heading

heading: string

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:31

Current heading


hoverPopover

hoverPopover: null | HoverPopover

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:47

Hover element container

Inherited from

EmbeddedEditorView.hoverPopover


indent

indent: string

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:35

Indent


inlineTitleEl

inlineTitleEl: HTMLElement

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:39

Inline title element


lastSavedData

lastSavedData: null | string

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:43

Full inline content string


previewEl

previewEl: HTMLElement

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:51

Element containing the preview for the embedded markdown

Inherited from

EmbeddedEditorView.previewEl


previewMode

previewMode: MarkdownPreviewView

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:55

Preview component of the view

Inherited from

EmbeddedEditorView.previewMode


saveAgain

saveAgain: boolean

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:47

Whether embedding should be saved twice on save


saving

saving: boolean

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:51

Whether the widget is currently saving


state

state: unknown

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:59

Current state of the editor

Inherited from

EmbeddedEditorView.state


subpath

subpath: string

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:55

Subpath reference of the path


subpathNotFound

subpathNotFound: boolean

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:59

Whether the subpath was not found in the cache


text

text: string

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:63

Text contents being embedded

Inherited from

EmbeddedEditorView.text


useIframe

useIframe: boolean

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:67

Whether the view renders contents using an iFrame

Inherited from

EmbeddedEditorView.useIframe

Accessors

editor

Get Signature

get editor(): null | IFramedMarkdownEditor

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:71

Get the preview editor, if exists

Returns

null | IFramedMarkdownEditor

Inherited from

EmbeddedEditorView.editor


path

Get Signature

get path(): string

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:75

Get the path to the file, if any file registered

Returns

string

Inherited from

EmbeddedEditorView.path


scroll

Get Signature

get scroll(): unknown

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:79

Get the scroll of the file renderer component

Returns

unknown

Inherited from

EmbeddedEditorView.scroll

Methods

addChild()

addChild<T>(component): T

Defined in: obsidian.d.ts:887

Adds a child component, loading it if this component is loaded

Type Parameters

T extends Component

Parameters

component

T

Returns

T

Inherited from

EmbeddedEditorView.addChild


applyScope()

applyScope(scope): void

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:64

Push/pop current scope

Parameters

scope

Scope

Returns

void


destroyEditor()

destroyEditor(save?): void

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:84

Destroy edit component editor and save contents if specified

Parameters

save?

boolean

Returns

void

Inherited from

EmbeddedEditorView.destroyEditor


getFoldInfo()

getFoldInfo(): null | FoldInfo

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:68

Get the current folds of the editor

Returns

null | FoldInfo


getMode()

getMode(): "source" | "preview"

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:88

Gets currently active mode (editMode returns ‘source’)

Returns

"source" | "preview"

Inherited from

EmbeddedEditorView.getMode


load()

load(): void

Defined in: obsidian.d.ts:865

Load this component and its children

Returns

void

Inherited from

EmbeddedEditorView.load


loadContents()

loadContents(data, cache): void

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:72

Splice incoming data at according to subpath for correct reference, then update heading and render

Parameters

data

string

cache

CachedMetadata

Returns

void


loadFile()

loadFile(): Promise<void>

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:76

Load file from cache based on stored path

Returns

Promise<void>


loadFileInternal()

loadFileInternal(data, cache?): void

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:80

Load file and check if data is different from last saved data, then loads contents

Parameters

data

string

cache?

CachedMetadata

Returns

void


onFileChanged()

onFileChanged(file, data, cache): void

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:84

Update representation on file finished updating

Parameters

file

TFile

data

string

cache

CachedMetadata

Returns

void


onFileRename()

onFileRename(file, oldPath): void

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:88

Update representation on file rename

Parameters

file

TAbstractFile

oldPath

string

Returns

void


onload()

onload(): void

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:92

On loading widget, register vault change and rename events

Returns

void

Overrides

EmbeddedEditorView.onload


onMarkdownFold()

onMarkdownFold(): void

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:96

Save fold made in the editor to foldManager

Returns

void


onMarkdownScroll()

onMarkdownScroll(): void

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:96

Trigger markdown scroll on workspace

Returns

void

Inherited from

EmbeddedEditorView.onMarkdownScroll


onunload()

onunload(): void

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:106

On unloading widget, unload component and remove scope

Returns

void

Overrides

EmbeddedEditorView.onunload


register()

register(cb): void

Defined in: obsidian.d.ts:897

Registers a callback to be called when unloading

Parameters

cb

() => any

Returns

void

Inherited from

EmbeddedEditorView.register


registerDomEvent()

Call Signature

registerDomEvent<K>(el, type, callback, options?): void

Defined in: obsidian.d.ts:907

Registers an DOM event to be detached when unloading

Type Parameters

K extends keyof WindowEventMap

Parameters
el

Window

type

K

callback

(this, ev) => any

options?

boolean | AddEventListenerOptions

Returns

void

Inherited from

EmbeddedEditorView.registerDomEvent

Call Signature

registerDomEvent<K>(el, type, callback, options?): void

Defined in: obsidian.d.ts:912

Registers an DOM event to be detached when unloading

Type Parameters

K extends keyof DocumentEventMap

Parameters
el

Document

type

K

callback

(this, ev) => any

options?

boolean | AddEventListenerOptions

Returns

void

Inherited from

EmbeddedEditorView.registerDomEvent

Call Signature

registerDomEvent<K>(el, type, callback, options?): void

Defined in: obsidian.d.ts:917

Registers an DOM event to be detached when unloading

Type Parameters

K extends keyof HTMLElementEventMap

Parameters
el

HTMLElement

type

K

callback

(this, ev) => any

options?

boolean | AddEventListenerOptions

Returns

void

Inherited from

EmbeddedEditorView.registerDomEvent


registerEvent()

registerEvent(eventRef): void

Defined in: obsidian.d.ts:902

Registers an event to be detached when unloading

Parameters

eventRef

EventRef

Returns

void

Inherited from

EmbeddedEditorView.registerEvent


registerInterval()

registerInterval(id): number

Defined in: obsidian.d.ts:924

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

EmbeddedEditorView.registerInterval


registerScopeEvent()

registerScopeEvent(keymapEventHandler): void

Defined in: src/obsidian/augmentations/Components/Component.d.ts:19

Parameters

keymapEventHandler

KeymapEventHandler

Returns

void

Inherited from

EmbeddedEditorView.registerScopeEvent


removeChild()

removeChild<T>(component): T

Defined in: obsidian.d.ts:892

Removes a child component, unloading it

Type Parameters

T extends Component

Parameters

component

T

Returns

T

Inherited from

EmbeddedEditorView.removeChild


requestSave()

requestSave(): void

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:104

Debounced save of contents

Returns

void

Inherited from

EmbeddedEditorView.requestSave


requestSaveFolds()

requestSaveFolds(): void

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:108

Debounced save of editor folds

Returns

void

Inherited from

EmbeddedEditorView.requestSaveFolds


save()

save(data, delayed?): Promise<void>

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:110

Save changes made in editable widget

Parameters

data

string

delayed?

boolean

Returns

Promise<void>

Overrides

EmbeddedEditorView.save


saveTitle()

saveTitle(element): void

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:114

On blur widget, save title

Parameters

element

HTMLElement

Returns

void


set()

set(data, clear): void

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:116

Set the state of the editor

Parameters

data

string

clear

boolean

Returns

void

Inherited from

EmbeddedEditorView.set


showEditor()

showEditor(): void

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:120

Reveal the editor if editable widget and applies saved state

Returns

void

Inherited from

EmbeddedEditorView.showEditor


showPreview()

showPreview(show?): void

Defined in: src/obsidian/internals/WidgetEditorView.d.ts:118

Show preview of widget

Parameters

show?

boolean

Returns

void

Overrides

EmbeddedEditorView.showPreview


showSearch()

showSearch(replace?): void

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:128

Reveal search component in file renderer component

Parameters

replace?

boolean

Returns

void

Inherited from

EmbeddedEditorView.showSearch


toggleMode()

toggleMode(): void

Defined in: src/obsidian/internals/EmbeddedEditorView.d.ts:132

Toggle between edit and preview mode

Returns

void

Inherited from

EmbeddedEditorView.toggleMode


unload()

unload(): void

Defined in: obsidian.d.ts:876

Unload this component and its children

Returns

void

Inherited from

EmbeddedEditorView.unload