MarkdownEditor
A mounted editor (mountEditor): the CodeMirror view plus the operations a
host needs. Call destroy when the editor leaves the page.
Properties
Section titled “Properties”view:
EditorView
The underlying CodeMirror view — the escape hatch for anything not covered here.
Methods
Section titled “Methods”destroy()
Section titled “destroy()”destroy():
void
Tear the view down and drop the color-scheme subscription.
Returns
Section titled “Returns”void
docPath()
Section titled “docPath()”docPath():
string|null
The shown state's document path, or null for an unsaved document (it travels with the state).
Returns
Section titled “Returns”string | null
getDoc()
Section titled “getDoc()”getDoc():
string
The current Markdown source, byte for byte what is being edited.
Returns
Section titled “Returns”string
mode()
Section titled “mode()”mode():
EditorMode
The shown state's mode (it travels with the state).
Returns
Section titled “Returns”refreshImages()
Section titled “refreshImages()”refreshImages():
void
Ask the host's resolveImage again for every image, after its answer
changed (the reader allowed remote images, say). An image that resolved to
null showed its source; it now shows the picture if the new answer is a URL.
Returns
Section titled “Returns”void
setDoc()
Section titled “setDoc()”setDoc(
doc):void
Make doc the document, for example after the file changed on disk. Only
the range that differs is replaced, so the scroll position, selection and
folds outside it stay where they were (an agent appending a line does not
move the reader). The same text does nothing. Not an undo step, and not a
user edit: onChange reports it with isUserEdit false.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
setDocPath()
Section titled “setDocPath()”setDocPath(
path):void
The shown state's document moved (rename) or was given a path (empty state → note).
Parameters
Section titled “Parameters”string | null
Returns
Section titled “Returns”void
setMode()
Section titled “setMode()”setMode(
mode):void
Switch between live preview, source and reading mode; document, selection and history are kept.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
syncAmbient()
Section titled “syncAmbient()”syncAmbient():
void
After swapping a state in (editor.view.setState(state)): bring what is the
window's, not the document's — the light / dark half of CodeMirror's base
theme — in line with now. A parked state kept the value it had when it left.
Returns
Section titled “Returns”void