constructor() {
    this.exportPublicMethods({
      getPosition: () => this.getPosition(),
      getRemoteCursors: () => this.getRemoteCursors(),
      getContents: () => this.getContents(),
      getContentsRich: () => this.getContentsRich(),
      getContentsHtml: () => this.getContentsHtml(),
      getContentsText: () => this.getContentsText(),
      getSelection: () => this.getSelection(),
      getSelectionRich: () => this.getSelectionRich(),
      getSelectionHtml: () => this.getSelectionHtml(),
      getSelectionText: () => this.getSelectionText()
    })

    this.bindActions(EditorActions)

    this.on('error', (err) => {
      console.group('Error Handler')
      console.error('Error during dispatch, please report this to https://github.com/ritzyed/ritzy/issues, ideally with a reproduction recipe.')
      console.log(err.error.message)
      console.log(err.error.stack)
      console.log('Payload:')
      console.dir(err.payload)
      console.log('State:')
      console.dir(_.clone(err.state)) // not sure why we need the clone here, err.state.error is updated if not
      console.groupEnd()
      this.registerEditorError(err.error)
      this.emitChange()
      throw err.error
    })

    this.config = null
    this.replica = null

    this.state = {
      position: BASE_CHAR,
      positionEolStart: true,
      cursorMotion: false,
      selectionActive: false,
      remoteCursors: {},
      remoteNameReveal: new Set(),
      activeAttributes: {},
      focus: false,
      loaded: false,
      lines: [],
      error: null
    }
  }
The EditorStore is the editor's single source of truth for application state and logic related to the editor.
View state updates are provided to the view components in setState callbacks. This uses the Facebook Flux
unidirectional flow idea: actions (from the view and elsewhere) -> dispatcher -> store -> view.

See https://facebook.github.io/flux/docs/overview.html