toast-ui.react-editor
toast-ui.react-editor copied to clipboard
focus() won't work
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
Could you explain the situation in more detail? What is getCurrentModeEditor
?