|
|
|
@ -169,6 +169,10 @@ const Editor = forwardRef(function Editor(props: Props, ref: React.ForwardedRef<
|
|
|
|
|
if (event.shiftKey || event.ctrlKey || event.metaKey || event.altKey) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// Prevent a newline from being inserted, so that we can insert it manually later.
|
|
|
|
|
// This prevents a race condition that occurs between the newline insertion and
|
|
|
|
|
// inserting the insertText.
|
|
|
|
|
event.preventDefault()
|
|
|
|
|
|
|
|
|
|
const cursorPosition = editorActions.getCursorPosition();
|
|
|
|
|
const prevContent = editorActions.getContent().substring(0, cursorPosition);
|
|
|
|
@ -206,7 +210,7 @@ const Editor = forwardRef(function Editor(props: Props, ref: React.ForwardedRef<
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (insertText) {
|
|
|
|
|
editorActions.insertText(insertText);
|
|
|
|
|
editorActions.insertText("\n" + insertText);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|