Remove behaviour where backspace re-focuses on title field

This commit is contained in:
Toby Zerner 2015-10-20 12:49:19 +10:30
parent 26a821e3e2
commit a9eb62880e

View File

@ -65,23 +65,6 @@ export default class DiscussionComposer extends ComposerBody {
m.redraw.strategy('none');
}
config(isInitialized, context) {
super.config(isInitialized, context);
// If the user presses the backspace key in the text editor, and the cursor
// is already at the start, then we'll move the focus back into the title
// input.
this.editor.$('textarea').keydown((e) => {
if (e.which === 8 && e.target.selectionStart === 0 && e.target.selectionEnd === 0) {
e.preventDefault();
const $title = this.$(':input:enabled:visible:first')[0];
$title.focus();
$title.selectionStart = $title.selectionEnd = $title.value.length;
}
});
}
preventExit() {
return (this.title() || this.content()) && this.props.confirmExit;
}