Skip to content

Commit 9f4907e

Browse files
Fixed paragraph shortcut (#556)
1 parent c70ee4d commit 9f4907e

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

packages/core/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
} from "../../schema";
55
import { createDefaultBlockDOMOutputSpec } from "../defaultBlockHelpers";
66
import { defaultProps } from "../defaultProps";
7+
import { handleEnter } from "../ListItemBlockContent/ListItemKeyboardShortcuts";
78

89
export const paragraphPropSchema = {
910
...defaultProps,
@@ -13,6 +14,18 @@ export const ParagraphBlockContent = createStronglyTypedTiptapNode({
1314
name: "paragraph",
1415
content: "inline*",
1516
group: "blockContent",
17+
18+
addKeyboardShortcuts() {
19+
return {
20+
Enter: () => handleEnter(this.editor),
21+
"Mod-Alt-0": () =>
22+
this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor, {
23+
type: "paragraph",
24+
props: {},
25+
}),
26+
};
27+
},
28+
1629
parseHTML() {
1730
return [
1831
{ tag: "div[data-content-type=" + this.name + "]" },

packages/core/src/pm-nodes/BlockContainer.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -693,10 +693,6 @@ export const BlockContainer = Node.create<{
693693
this.editor.commands.liftListItem("blockContainer");
694694
return true;
695695
},
696-
"Mod-Alt-0": () =>
697-
this.editor.commands.BNCreateBlock(
698-
this.editor.state.selection.anchor + 2
699-
),
700696
};
701697
},
702698
});

0 commit comments

Comments
 (0)