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

PropertyTypeDescription
_childrenComponent[]Child Components attached to current component, will be unloaded on unloading parent component.
(Inherited from Component)
_eventsEventRef[]Events that are attached to the current component, will be detached on unloading parent component.
(Inherited from Component)
_loadedbooleanWhether the component and its children are loaded.
(Inherited from Component)
appAppReference to the app.
containerElHTMLElementContainer element for the embedded view.
dirtybooleanWhether the view is currently saving.
editablebooleanWhether the editor may be edited.
editMode?IFramedMarkdownEditor | undefinedEditor component of the view.
editorElHTMLElementContainer in which the editor is embedded.
filenull | TFileFile to which the view is attached.
hoverPopoverHoverPopover | nullHover element container.
previewElHTMLElementElement containing the preview for the embedded markdown.
previewModeMarkdownPreviewViewPreview component of the view.
stateunknownCurrent state of the editor.
textstringText contents being embedded.
useIframebooleanWhether the view renders contents using an iFrame.

Methods

MethodReturnsDescription
addChild(component)TAdds a child component, loading it if this component is loaded.
(Inherited from Component)
destroyEditor(save?)voidDestroy edit component editor and save contents if specified.
getMode()'preview' | 'source'Gets currently active mode (editMode returns 'source').
load()voidLoad this component and its children.
(Inherited from Component)
onload()voidOn load of editor, show preview.
onMarkdownScroll()voidTrigger markdown scroll on workspace.
onunload()voidOn unload of editor, destroy editor and unset workspace activeEditor.
register(cb)voidRegisters a callback to be called when unloading.
(Inherited from Component)
registerDomEvent(el, type, callback, options?)voidRegisters a DOM event to be detached when unloading.
(Inherited from Component)
registerDomEvent(el, type, callback, options?)voidRegisters a DOM event to be detached when unloading
(Inherited from Component)
registerDomEvent(el, type, callback, options?)voidRegisters a DOM event to be detached when unloading
(Inherited from Component)
registerEvent(eventRef)voidRegisters an event to be detached when unloading.
(Inherited from Component)
registerInterval(id)numberRegisters 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)voidRegister a scope keymap event handler to be removed on unload.
(Inherited from Component)
removeChild(component)TRemoves a child component, unloading it.
(Inherited from Component)
requestSave()voidDebounced save of contents.
requestSaveFolds()voidDebounced save of editor folds.
save(data, save?)voidSet file contents.
set(data, clear)voidSet the state of the editor.
showEditor()voidReveal the editor if editable widget and applies saved state.
showPreview(save?)voidReveal preview mode and destroy editor, save if specified.
showSearch(replace?)voidReveal search component in file renderer component.
toggleMode()voidToggle between edit and preview mode.
unload()voidOverride this to unload your component.
(Inherited from Component)

Links to this page: