Skip to content

MarkdownEditView

Official

This is the editor for Obsidian Mobile as well as the upcoming WYSIWYG editor.

Import:

import { MarkdownEditView } from 'obsidian';

Signature:

export class MarkdownEditView implements MarkdownSubView, HoverParent, MarkdownFileInfo

Implements: MarkdownSubView, HoverParent, MarkdownFileInfo

Constructor

new MarkdownEditView(view: MarkdownView)

Constructor.

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

Properties

PropertyTypeDescription
appAppThe Obsidian app instance.
editor?EditorThe editor associated with the markdown edit view.
(Inherited from MarkdownFileInfo)
hoverPopoverHoverPopoverThe hover popover.
metadataEditor?MetadataEditorThe metadata (frontmatter/properties) editor for this file.
(Inherited from MarkdownFileInfo)
propertiesExtensionExtension[]Frontmatter editor extension for the editor.
type'source'Editing mode of the editor.
viewMarkdownViewView the source view editor is attached to.

Methods

MethodReturnsDescription
applyScroll(scroll)voidApply the scroll position to the edit view.
beforeUnload()voidSave functionality to execute before editor view unload.
clear()voidClear the markdown edit view.
destroy()voidDestroy/Detach the editor view.
get()stringGet the markdown content of the edit view.
getDynamicExtensions()Extension[]Constructs extensions for the editor based on user settings.
getEphemeralState(state)MarkdownEditViewEphemeralStateGets the ephemeral (non-persistent) state of the editor.
getFoldInfo()FoldInfo | nullGet the current folds of the editor.
getScroll()numberGet the scroll position of the edit view.
getSelection()stringGet the selection of the edit view.
highlightSearchMatches(ranges, style?, removePrevious?, range?)voidAdd highlights for specified ranges.
onUpdate(update, changed)voidExecute functionality on CM editor state update.
requestOnInternalDataChange()voidDebounced onInternalDataChange of view.
requestSaveFolds()unknownDebounced onMarkdownFold of view.
set(data, clear)voidSet the markdown content of the edit view.
setEphemeralState(state)voidSet the ephemeral (non-persistent) state of the editor.
setHighlight(match)voidSet highlight of any search match.
setState(state)voidSet the state of the editor (applies selections, scrolls, ...).
show()voidRender the editor and the metadata-editor element.
updateBottomPadding(height)voidUpdate the bottom padding of the CodeMirror contentdom (based on backlinksEl).
updateOptions()voidUpdate options of the editor from settings.

Links to this page: