From 652f432785aa540d7802c9c5568cab3f8c3400cd Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 10 Feb 2022 19:14:10 -0800 Subject: [PATCH] fix: Mod+Enter does not exit code block closes #3089 --- shared/editor/plugins/Keys.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shared/editor/plugins/Keys.ts b/shared/editor/plugins/Keys.ts index 6f15507ba..bf1903335 100644 --- a/shared/editor/plugins/Keys.ts +++ b/shared/editor/plugins/Keys.ts @@ -7,6 +7,7 @@ import { } from "prosemirror-state"; import Extension from "../lib/Extension"; import isModKey from "../lib/isModKey"; +import isInCode from "../queries/isInCode"; export default class Keys extends Extension { get name() { @@ -70,7 +71,7 @@ export default class Keys extends Extension { return true; } - if (event.key === "Enter") { + if (event.key === "Enter" && !isInCode(view.state)) { event.preventDefault(); this.options.onSaveAndExit(); return true;