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

Property Type Description
app App The Obsidian app instance.
editor? Editor The editor associated with the markdown edit view.
(Inherited from MarkdownFileInfo)
hoverPopover HoverPopover The hover popover.
metadataEditor? MetadataEditor The metadata (frontmatter/properties) editor for this file.
(Inherited from MarkdownFileInfo)
propertiesExtension Extension[] Frontmatter editor extension for the editor.
type 'source' Editing mode of the editor.
view MarkdownView View the source view editor is attached to.

Methods

Method Returns Description
applyScroll(scroll) void Apply the scroll position to the edit view.
beforeUnload() void Save functionality to execute before editor view unload.
clear() void Clear the markdown edit view.
destroy() void Destroy/Detach the editor view.
get() string Get the markdown content of the edit view.
getDynamicExtensions() Extension[] Constructs extensions for the editor based on user settings.
getEphemeralState(state) MarkdownEditViewEphemeralState Gets the ephemeral (non-persistent) state of the editor.
getFoldInfo() FoldInfo | null Get the current folds of the editor.
getScroll() number Get the scroll position of the edit view.
getSelection() string Get the selection of the edit view.
highlightSearchMatches(ranges, style?, removePrevious?, range?) void Add highlights for specified ranges.
onUpdate(update, changed) void Execute functionality on CM editor state update.
requestOnInternalDataChange() void Debounced onInternalDataChange of view.
requestSaveFolds() unknown Debounced onMarkdownFold of view.
set(data, clear) void Set the markdown content of the edit view.
setEphemeralState(state) void Set the ephemeral (non-persistent) state of the editor.
setHighlight(match) void Set highlight of any search match.
setState(state) void Set the state of the editor (applies selections, scrolls, ...).
show() void Render the editor and the metadata-editor element.
updateBottomPadding(height) void Update the bottom padding of the CodeMirror contentdom (based on backlinksEl).
updateOptions() void Update options of the editor from settings.

Links to this page: