mirror of
https://github.com/outline/outline.git
synced 2026-01-07 11:40:08 -06:00
fix: Enable the 'e' shortcut to focus editor
This commit is contained in:
@@ -561,6 +561,14 @@ export class Editor extends React.PureComponent<
|
||||
this.view.focus();
|
||||
};
|
||||
|
||||
/**
|
||||
* Focus the editor and scroll to the current selection.
|
||||
*/
|
||||
public focus = () => {
|
||||
this.view.focus();
|
||||
this.view.dispatch(this.view.state.tr.scrollIntoView());
|
||||
};
|
||||
|
||||
/**
|
||||
* Blur the editor.
|
||||
*/
|
||||
|
||||
@@ -242,14 +242,16 @@ class DocumentScene extends React.Component<Props> {
|
||||
};
|
||||
|
||||
goToEdit = (ev: KeyboardEvent) => {
|
||||
if (!this.props.readOnly) {
|
||||
return;
|
||||
}
|
||||
ev.preventDefault();
|
||||
const { document, abilities } = this.props;
|
||||
if (this.props.readOnly) {
|
||||
ev.preventDefault();
|
||||
const { document, abilities } = this.props;
|
||||
|
||||
if (abilities.update) {
|
||||
this.props.history.push(documentEditPath(document));
|
||||
if (abilities.update) {
|
||||
this.props.history.push(documentEditPath(document));
|
||||
}
|
||||
} else if (this.editor.current?.isBlurred) {
|
||||
ev.preventDefault();
|
||||
this.editor.current?.focus();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user