MDE (Markdown Editor)

Markdown editor React component. An instance of this class will be loaded when you opened a note. You can access it as following:

const mde = inkdrop.getActiveEditorOrThrowError()

If you are building a plugin that extends the editor, you have to subscribe events to know when it is loaded/unloaded:

module.exports = {
  activate() {
    global.inkdrop.onEditorLoad(this.handleEditorDidLoad.bind(this))
  },

  deactivate() {
    const editor = global.inkdrop.getActiveEditor()
    if (editor) {
      // unload
    }
  },

  handleEditorDidLoad(editor) {
    // extend the editor
    const { cm } = editor
  }
}

For more information about accessing the editor, refer to Environment.

Extending Inkdrop Editor

Inkdrop's editor is built on top of CodeMirror. You can access its instance via mde.cm. For example, you can change the editor option like so:

const mde = inkdrop.getActiveEditorOrThrowError()
mde.cm.setOption('lineNumbers', true)

All available CodeMirror APIs are documented here.

Properties

cm

A CodeMirror instance

wrapper

A React component that wraps CodeMirror.

Can you help us improve these docs?

The source of these docs is here on GitHub. If you see a way these docs can be improved, please fork us!