diff --git a/shared/editor/nodes/HardBreak.ts b/shared/editor/nodes/HardBreak.ts index ecd3248ea..4e27c825e 100644 --- a/shared/editor/nodes/HardBreak.ts +++ b/shared/editor/nodes/HardBreak.ts @@ -2,6 +2,7 @@ import { NodeSpec, NodeType } from "prosemirror-model"; import { EditorState } from "prosemirror-state"; import { isInTable } from "prosemirror-tables"; import { MarkdownSerializerState } from "../lib/markdown/serializer"; +import isNodeActive from "../queries/isNodeActive"; import breakRule from "../rules/breaks"; import { Dispatch } from "../types"; import Node from "./Node"; @@ -36,7 +37,10 @@ export default class HardBreak extends Node { keys({ type }: { type: NodeType }) { return { "Shift-Enter": (state: EditorState, dispatch: Dispatch) => { - if (!isInTable(state)) { + if ( + !isInTable(state) && + !isNodeActive(state.schema.nodes.paragraph)(state) + ) { return false; } dispatch(state.tr.replaceSelectionWith(type.create()).scrollIntoView()); diff --git a/shared/editor/nodes/Paragraph.ts b/shared/editor/nodes/Paragraph.ts index 94b08caa4..ac9de1cc8 100644 --- a/shared/editor/nodes/Paragraph.ts +++ b/shared/editor/nodes/Paragraph.ts @@ -1,9 +1,6 @@ import { setBlockType } from "prosemirror-commands"; import { NodeSpec, NodeType, Node as ProsemirrorNode } from "prosemirror-model"; -import { EditorState } from "prosemirror-state"; import { MarkdownSerializerState } from "../lib/markdown/serializer"; -import isNodeActive from "../queries/isNodeActive"; -import { Dispatch } from "../types"; import Node from "./Node"; export default class Paragraph extends Node { @@ -23,14 +20,6 @@ export default class Paragraph extends Node { keys({ type }: { type: NodeType }) { return { "Shift-Ctrl-0": setBlockType(type), - "Shift-Enter": (state: EditorState, dispatch: Dispatch) => { - if (!isNodeActive(type)(state)) { - return false; - } - - dispatch(state.tr.insertText("\n")); - return true; - }, }; }