fix: Cannot hit enter after sentance starting with forward slash

closes #3879
This commit is contained in:
Tom Moor
2022-07-29 09:15:48 +01:00
parent 383bac241e
commit f9d9a82e47
2 changed files with 10 additions and 3 deletions

View File

@ -36,7 +36,7 @@ export type Props<T extends MenuItem = MenuItem> = {
onFileUploadStop?: () => void;
onShowToast: (message: string) => void;
onLinkToolbarOpen?: () => void;
onClose: () => void;
onClose: (insertNewLine?: boolean) => void;
onClearSearch: () => void;
embeds?: EmbedDescriptor[];
renderMenuItem: (
@ -123,7 +123,7 @@ class CommandMenu<T = MenuItem> extends React.Component<Props<T>, State> {
if (item) {
this.insertItem(item);
} else {
this.props.onClose();
this.props.onClose(true);
}
}

View File

@ -554,7 +554,14 @@ export class Editor extends React.PureComponent<
this.setState({ blockMenuOpen: true, blockMenuSearch: search });
};
private handleCloseBlockMenu = () => {
private handleCloseBlockMenu = (insertNewLine?: boolean) => {
if (insertNewLine) {
const transaction = this.view.state.tr.split(
this.view.state.selection.to
);
this.view.dispatch(transaction);
this.view.focus();
}
if (!this.state.blockMenuOpen) {
return;
}