Skip to content

EmbeddedEditorView

Extends

Extended by

Properties

_children

_children: Component[]

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

Inherited from

Component._children


_events

_events: EventRef[]

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

Inherited from

Component._events


_loaded

_loaded: boolean

Whether the component and its children are loaded

Inherited from

Component._loaded


app

app: App

Reference to the app


containerEl

containerEl: HTMLElement

Container element for the embedded view


dirty

dirty: boolean

Whether the view is currently saving


editable

editable: boolean

Whether the editor may be edited


editMode?

optional editMode: IFramedMarkdownEditor

Editor component of the view


editorEl

editorEl: HTMLElement

Container in which the editor is embedded


file

file: null | TFile

File to which the view is attached


hoverPopover

hoverPopover: null | HoverPopover

Hover element container


previewEl

previewEl: HTMLElement

Element containing the preview for the embedded markdown


previewMode

previewMode: MarkdownPreviewView

Preview component of the view


state

state: unknown

Current state of the editor


text

text: string

Text contents being embedded


useIframe

useIframe: boolean

Whether the view renders contents using an iFrame

Accessors

editor

get editor(): null | IFramedMarkdownEditor

Get the preview editor, if exists

Returns

null | IFramedMarkdownEditor


path

get path(): string

Get the path to the file, if any file registered

Returns

string


scroll

get scroll(): unknown

Get the scroll of the file renderer component

Returns

unknown

Methods

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

Component.addChild


destroyEditor()

destroyEditor(save?): void

Destroy edit component editor and save contents if specified

Parameters

save?: boolean

Returns

void


getMode()

getMode(): "source" | "preview"

Gets currently active mode (editMode returns ‘source’)

Returns

"source" | "preview"


load()

load(): void

Load this component and its children

Returns

void

Inherited from

Component.load


onload()

onload(): void

On load of editor, show preview

Returns

void

Overrides

Component.onload


onMarkdownScroll()

onMarkdownScroll(): void

Trigger markdown scroll on workspace

Returns

void


onunload()

onunload(): void

On unload of editor, destroy editor and unset workspace activeEditor

Returns

void

Overrides

Component.onunload


register()

register(cb): void

Registers a callback to be called when unloading

Parameters

cb

Returns

void

Inherited from

Component.register


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

Component.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 DocumentEventMap

Parameters

el: Document

type: K

callback

options?: boolean | AddEventListenerOptions

Returns

void

Inherited from

Component.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 HTMLElementEventMap

Parameters

el: HTMLElement

type: K

callback

options?: boolean | AddEventListenerOptions

Returns

void

Inherited from

Component.registerDomEvent


registerEvent()

registerEvent(eventRef): void

Registers an event to be detached when unloading

Parameters

eventRef: EventRef

Returns

void

Inherited from

Component.registerEvent


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

Component.registerInterval


registerScopeEvent()

registerScopeEvent(keymapEventHandler): void

Parameters

keymapEventHandler: KeymapEventHandler

Returns

void

Inherited from

Component.registerScopeEvent


removeChild()

removeChild<T>(component): T

Removes a child component, unloading it

Type Parameters

T extends Component

Parameters

component: T

Returns

T

Inherited from

Component.removeChild


requestSave()

requestSave(): void

Debounced save of contents

Returns

void


requestSaveFolds()

requestSaveFolds(): void

Debounced save of editor folds

Returns

void


save()

save(data, save?): void

Set file contents

Parameters

data: string

save?: boolean

Returns

void


set()

set(data, clear): void

Set the state of the editor

Parameters

data: string

clear: boolean

Returns

void


showEditor()

showEditor(): void

Reveal the editor if editable widget and applies saved state

Returns

void


showPreview()

showPreview(save?): void

Reveal preview mode and destroy editor, save if specified

Parameters

save?: boolean

Returns

void


showSearch()

showSearch(replace?): void

Reveal search component in file renderer component

Parameters

replace?: boolean

Returns

void


toggleMode()

toggleMode(): void

Toggle between edit and preview mode

Returns

void


unload()

unload(): void

Unload this component and its children

Returns

void

Inherited from

Component.unload