toast-ui.react-editor icon indicating copy to clipboard operation
toast-ui.react-editor copied to clipboard

focus() won't work

Open rico345100 opened this issue 5 years ago • 1 comments

Version

Using @toast-ui/react-editor 1.0.0

Test Environment

macOS 10.13.6 Chrome 74

Current Behavior

import React, { Component, createRef } from 'react';

class MyForm extends Component {
  ...
  editorRef = createRef();

  ...

  handleSubmit() {
    ...
    const instance = this.editorRef.current.getInstance();
    const data = instance.getHtml();

    if (!data) {
      ...
      instance.focus(); // ERROR
    }
  }

  render() {
    return (
      ...
      <Editor
        initialValue={description}
        initialEditType="wysiwyg"
        ref={this.editorRef}
      />
    );
  }
}

Check the handleSubmit function. When I use "focus" method, it fails with:

Uncaught TypeError: this.getCurrentModeEditor is not a function

rico345100 avatar May 21 '19 09:05 rico345100

Could you explain the situation in more detail? What is getCurrentModeEditor?

jung-han avatar Jul 08 '19 08:07 jung-han