editor.selection not updating after insertText
See original GitHub issueDescription
Prior to 0.66.0 editor.selection was updating after insertText to account for the next text. However, any text entry after the first does not update the selection and the offset stays at the previous.
Recording
I tested on the Link slate example by adding console.log(editor.selection)
before and after this line.
Below is the console logs after inserting 3 f
s
Sandbox I made a simplified sandbox of it showing the console logs of the editor selection https://codesandbox.io/s/slate-reproductions-forked-9ub7c?file=/index.js
Steps To reproduce the behavior:
- go to above sandbox
- insert text in slate editor
- see the console and see that the editor selection stays the same.
- change slate versions to 0.65 and repeat
- see that editor selection updates
Expectation
I expected the editor selection to update after insertText
because that it how it used to work before the update.
Environment
- Slate Version: 0.66
- Operating System: macOS
- Browser: Chrome
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
setState() will block editor.insertText() before it. #2549 - GitHub
Update : If I add a editor.flush() after insertText(), then when I press 'a', it first show '11a' and then an error page...
Read more >Insert text at cursor in a content editable div - Stack Overflow
The following function will insert text at the caret position and delete the existing selection. It works in all the mainstream desktop browsers:...
Read more >Editor options (Advanced) - Microsoft Support
Editor options let you select options for your content in Outlook. ... ARROW key after you scroll, the cursor responds at the page...
Read more >API - Quill Rich Text Editor
Changes to text may cause changes to the selection (ex. typing advances the cursor), however during the text-change handler, the selection is not...
Read more >Updating Fields in Word – How it Works - DocTools
Why does Word not update all fields when I select all and press F9 to ... You can read more about the different...
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 FreeTop 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
Top GitHub Comments
@codewitch Thanks. @nemanja-tosic and I have been discussing it and trying to come up with a good solution and we haven’t come up with something easy yet or we would have already fixed it. We should also see if @bkrausz has thoughts.
Mostly we just need time to figure out a good solution that hopefully doesn’t break something else along the way.
Hi @dylans, im currently facing the same issue in version 0.86.0.
Are there any updates on this? Should this already be fixed?