Skip to content

How to blur #1515

Answered by linonetwo
linonetwo asked this question in Q&A
Discussion options

You must be logged in to vote

This is not working:

import { ReactEditor } from 'slate-react';

const { resetEditor, value: updateEditorValue } = getPlateActions(editorID);
const editorRef = usePlateEditorRef(editorID);

      // reset selection, so if you delete wikitext, selection won't goto some empty space and cause error
      platesActions.set(editorID); // don't need platesActions.unset(editorID); , this means reset to initial state I think
      ReactEditor.blur(editorRef);

I also tried Transforms.select(editorRef, SlateEditor.start(editorRef, [])) but still not working.

Note that to avoid tiddly-gittly/slate-write#3 bug I'm turning autoFocus: true,


This works:

const { resetEditor, value: updateEditorValue } = 

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by linonetwo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant