How do I prevent the Toast UI Editor from getting focus when it is rendered
See original GitHub issueSummary
I have a NextJS app that contains the toast-ui/react-editor.
The editor is not visible and I have a button that controls visibility by toggling the show state variable this way:
export function MyEditor({placeholder}) {
const [show, setShow] = useState(false);
const editorRef = useRef(null);
return (
<div class="root">
<div class="editor-container">
{show && <Editor
ref={editorRef}
placeholder={placeholder}
previewStyle='tab'
theme='dark'
minHeight='300px'
height='300px'
initialEditType='markdown'
hooks={{
addImageBlobHook: onAddImageBlob,
}}
autofocus={false}
/>}
</div>
</div>
);
}
Please note that I am passing the autofocus property false but the editor’s text area gets activated as soon as the editor is rendered.
How do I turn it off?
Version
"@toast-ui/editor": "^3.1.0",
"@toast-ui/react-editor": "^3.1.0",
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Editor | TOAST UI :: Make Your Web Delicious!
The Editor allows you to edit your Markdown documents using text or WYSIWYG and comes with Syntax Highlighting, Scroll-Sync, Live Preview, ...
Read more >How do I prevent toast from taking away focus?
I'm doing an auto-save onchange of an input and toasting a “Saved” message, but if the user clicks onto the next input (triggering...
Read more >[Release News] TOAST UI Editor 3.0 is here!
Customizing the editor using options and APIs as users is a painstaking task. If a user were to customize a certain node's rendered...
Read more >@toast-ui/react-editor | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >Documentation: DevExtreme - JavaScript Data Grid Methods
Adds an empty data row and switches it to the editing state. ... The beginUpdate() and endUpdate() methods prevent the UI component from...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I have the same issue. This happens when previewStyle is the “tab”. Seems ok with “vertical” or when initialEditType is “wysiwyg”. Here’s the simplest dupe code:
Oh, its now has an option called autofocus in the
oSettingsobject