mirror of
https://github.com/flarum/core.git
synced 2025-07-21 16:51:34 +02:00
Remove behaviour where backspace re-focuses on title field
This commit is contained in:
@@ -65,23 +65,6 @@ export default class DiscussionComposer extends ComposerBody {
|
|||||||
m.redraw.strategy('none');
|
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() {
|
preventExit() {
|
||||||
return (this.title() || this.content()) && this.props.confirmExit;
|
return (this.title() || this.content()) && this.props.confirmExit;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user