Open
Description
Steps to reproduce
- Start at the beginning of a line, with or without text.
- Insert 3 tabs via "Tab" key.
- Tap "Backspace" key.
Expected
- 2 tabs to remain on the current line.
Actual
- All tabs are deleted.
I'm not sure what I'm doing differently from the demo, where
- a tabbed line without text correctly deletes individual tabs, while
- a tabbed line with text deletes individual spaces (instead of tabs)
Here's my relevant code:
handleKeyCommand(command) {
let { editorState } = this.state;
// enable deleting tab characters inserted by CodeUtils.handleTab
// don't limit to code blocks
let newState = CodeUtils.handleKeyCommand(editorState, command);
if (newState) {
this.setState({ editorState: newState });
return true;
}
return false;
}
handleTab(evt) {
this.setState({
editorState: CodeUtils.handleTab(evt, this.state.editorState),
});
}
handleWrote(editorState) {
this.setState({ editorState });
}
render() {
return (
<div className="project-editor">
<Editor
editorState={this.state.editorState}
handleKeyCommand={this.handleKeyCommand}
onChange={this.handleWrote}
onTab={this.handleTab}
/>
</div>
);
}
Have you seen this before? Any ideas?
Activity