Closed rcbevans closed 2 years ago
I added
onBlur={() => {
editor.sendCursorPosition(null);
}}
to the Editable component and this does seem to clear the cursor position when the editor loses focus, however on focus again, the cursor position is not synced again until the user moves the cursor to a new position in the editor text.
Sorry for taking so long to come back to this, will add a option for it in https://github.com/BitPhinix/slate-yjs/pull/363 🙏
It's included via the useUnsetCursorPositionOnBlur
hook in https://github.com/BitPhinix/slate-yjs/pull/363/files#diff-5f9695b6035d0b13922dc5a300a83513b0dc0d4a93790b85c9b58d0acb257f0d. Will merge and release a new version of slate-react in 1-2 days
On my page I am using two slate editors for different parts of the same document.
Currently, once a user clicks into the editor, their cursor position is shared with all other collaborators and renders correctly (thanks for the hint to use
cursorStateField
to differentiate the cursor position data for each), but the cursor position persistes even once the user blurs the editor.If a user clicks into each editor, other users see a cursor for the user in each of the editors, rather than the editor where their cursor currently is. Is it possible to clear the cursor position data on blur of the slate editor?