Skip to content

EmbeddedEditorView

Unofficial

View for an embedded markdown editor, supporting preview and edit modes.

Import:

import type { EmbeddedEditorView } from '@obsidian-typings/obsidian-public-latest';

Signature:

export interface EmbeddedEditorView extends Component

Extends: Component

Constructor

new EmbeddedEditorView()

Constructor.

To extract the constructor type, use ExtractConstructor<Component>.

Properties

Property Type Description
_children Component[] Child Components attached to current component, will be unloaded on unloading parent component.
(Inherited from Component)
_events EventRef[] Events that are attached to the current component, will be detached on unloading parent component.
(Inherited from Component)
_loaded boolean Whether the component and its children are loaded.
(Inherited from Component)
app App Reference to the app.
containerEl HTMLElement Container element for the embedded view.
dirty boolean Whether the view is currently saving.
editable boolean Whether the editor may be edited.
editMode? IFramedMarkdownEditor | undefined Editor component of the view.
editorEl HTMLElement Container in which the editor is embedded.
file null | TFile File to which the view is attached.
hoverPopover HoverPopover | null Hover element container.
previewEl HTMLElement Element containing the preview for the embedded markdown.
previewMode MarkdownPreviewView Preview component of the view.
state unknown Current state of the editor.
text string Text contents being embedded.
useIframe boolean Whether the view renders contents using an iFrame.

Methods

Method Returns Description
addChild(component) T Adds a child component, loading it if this component is loaded.
(Inherited from Component)
destroyEditor(save?) void Destroy edit component editor and save contents if specified.
getMode() 'preview' | 'source' Gets currently active mode (editMode returns 'source').
load() void Load this component and its children.
(Inherited from Component)
onload() void On load of editor, show preview.
onMarkdownScroll() void Trigger markdown scroll on workspace.
onunload() void On unload of editor, destroy editor and unset workspace activeEditor.
register(cb) void Registers a callback to be called when unloading.
(Inherited from Component)
registerDomEvent(el, type, callback, options?) void Registers a DOM event to be detached when unloading.
(Inherited from Component)
registerDomEvent(el, type, callback, options?) void Registers a DOM event to be detached when unloading
(Inherited from Component)
registerDomEvent(el, type, callback, options?) void Registers a DOM event to be detached when unloading
(Inherited from Component)
registerEvent(eventRef) void Registers an event to be detached when unloading.
(Inherited from Component)
registerInterval(id) number Registers an interval (from setInterval) to be cancelled when unloading. Use window.setInterval instead of setInterval to avoid TypeScript confusing between NodeJS vs Browser API
(Inherited from Component)
registerScopeEvent(keymapEventHandler) void Register a scope keymap event handler to be removed on unload.
(Inherited from Component)
removeChild(component) T Removes a child component, unloading it.
(Inherited from Component)
requestSave() void Debounced save of contents.
requestSaveFolds() void Debounced save of editor folds.
save(data, save?) void Set file contents.
set(data, clear) void Set the state of the editor.
showEditor() void Reveal the editor if editable widget and applies saved state.
showPreview(save?) void Reveal preview mode and destroy editor, save if specified.
showSearch(replace?) void Reveal search component in file renderer component.
toggleMode() void Toggle between edit and preview mode.
unload() void Override this to unload your component.
(Inherited from Component)

Links to this page: