fix: Shift-Enter in code block in table should behave correctly
closes #6994
This commit is contained in:
@@ -2,6 +2,7 @@ import { NodeSpec, NodeType } from "prosemirror-model";
|
||||
import { Command } from "prosemirror-state";
|
||||
import { isInTable } from "prosemirror-tables";
|
||||
import { MarkdownSerializerState } from "../lib/markdown/serializer";
|
||||
import isInCode from "../queries/isInCode";
|
||||
import isNodeActive from "../queries/isNodeActive";
|
||||
import breakRule from "../rules/breaks";
|
||||
import Node from "./Node";
|
||||
@@ -36,9 +37,12 @@ export default class HardBreak extends Node {
|
||||
keys({ type }: { type: NodeType }): Record<string, Command> {
|
||||
return {
|
||||
"Shift-Enter": (state, dispatch) => {
|
||||
const isParagraphActive = isNodeActive(state.schema.nodes.paragraph)(
|
||||
state
|
||||
);
|
||||
if (
|
||||
!isInTable(state) &&
|
||||
!isNodeActive(state.schema.nodes.paragraph)(state)
|
||||
(!isInTable(state) && !isParagraphActive) ||
|
||||
isInCode(state, { onlyBlock: true })
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user