editor

An app state of the editor. You can obtain the editor state and integrate it with React components.


Data Structure

  • Name
    changed
    Type
    boolean
    Description

    true if the note has been changed. The editor will save the note if changed is true when it is closed.

  • Name
    needsUpdatingDate
    Type
    boolean
    Description

    Whether the note's updatedAt field needs to be updated or not.

  • Name
    viewMode
    Type
    'preview' | 'sideBySide' | 'edit'
    Description

    The editor view mode which represents either 'preview', 'sideBySide' or 'edit'.

  • Name
    openingNoteId
    Type
    string | undefined
    Description

    When the app is trying to open a note, it indicates its' note ID, otherwise undefined.

  • Name
    readOnly
    Type
    boolean
    Description

    true if the editor is in read only mode.

  • Name
    savingNoteId
    Type
    string | undefined
    Description

    When the app is saving the note, it indicates its' note ID, otherwise will be undefined.

  • Name
    lastError
    Type
    AssistiveError | undefined
    Description

    The last error that occurred.

Get the editor state manually:

const { editor } = inkdrop.store.getState()

Connect the state with your React component:

import { useSelector } from 'react-redux'
const selector = ({ editor }) => editor
const MyComponent = props => {
  const editor = useSelector(selector)
  // render
}
Can you help us improve the docs? 🙏

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