Unwanted selection's restoring when re-focusing
See original GitHub issueSteps: - Select some characters - Click outside the editor ( or blur ) - Click inside the editor ( or focus )
Instead of creating a new collapsed selection where I clicked, it restores the same selection that I made before blurring. It doesn’t happen when I blur and the selection is collapsed
I was able to solve it “removing” the selection on blur since it doesn’t happen when the selection is collapsed, but I think this is a bug and we I should report it.
It happens on both chrome and firefox, I haven’t tested on others.
constructor(props) {
super(props);
...
this.blur = () => this.refs.editor.blur()
...
}
onBlur(e) {
setTimeout(this.moveFocusIfNotCollapsed, 0)
}
moveFocusIfNotCollapsed() {
if (!this.state.editorState.getSelection().isCollapsed()) {
this.setState({
editorState: EditorState.moveFocusToEnd(this.state.editorState)
}, this.blur)
}
}
render() {
const { editorState } = this.state;
return (
<div className="note-editor">
<Editor
ref="editor"
blockStyleFn={this.getBlockStyle}
editorState={editorState}
onBlur={this.onBlur}
onChange={this.onChange}
/>
)
}
Draft 0.8.1
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Best 5 Photo Apps to Remove Unwanted Objects on Your ...
Some software experts have designed creative apps to remove unwanted objects from photos. In this article, we are going to discuss some of ......
Read more >Detect and get rid of unwanted sneaky mobile redirects
Check your site on a mobile device or through emulation between each script/element removal, and see when the redirect stops.
Read more >10 Ways To Refocus Your Career During a Midlife Crisis
You may think that the problem is your salary, your position or a routine that you may now find undesirable. The following questions...
Read more >Adiabatic refocusing pulses for volume selection in ...
Percentage of signal recovery for (a ) two orthogonal AFP pulses and (b ) ... Unwanted coherences caused by imperfect refocusing were removed ......
Read more >Photoshop releases major update to Selections, Hole ...
Remove unwanted elements in your image faster than you can say one-click ... The Photo Restoration Neural Filter helps you bring an old...
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
So how do we fix this?
So how do we fix this? +1. I spent one hour in this bug, thought this is because moveSelectionToEnd doesn’t work, but I found out that it’s due to chrome. moveSelectionToEnd works in Safari