Skip to content

Commit d6902f3

Browse files
committed
Added table enter handling
1 parent bd8b3be commit d6902f3

File tree

1 file changed

+6
-1
lines changed
  • packages/core/src/extensions/Blocks/nodes/BlockContent/TableBlockContent

1 file changed

+6
-1
lines changed

packages/core/src/extensions/Blocks/nodes/BlockContent/TableBlockContent/TableExtension.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Extension, callOrReturn, getExtensionField } from "@tiptap/core";
1+
import { callOrReturn, Extension, getExtensionField } from "@tiptap/core";
22
import { columnResizing, tableEditing } from "prosemirror-tables";
33

44
export const TableExtension = Extension.create({
@@ -15,6 +15,11 @@ export const TableExtension = Extension.create({
1515

1616
addKeyboardShortcuts() {
1717
return {
18+
// Makes enter create a new line within the cell.
19+
Enter: () => {
20+
this.editor.commands.setHardBreak();
21+
return true;
22+
},
1823
// Ensures that backspace won't delete the table if the text cursor is at
1924
// the start of a cell and the selection is empty.
2025
Backspace: () => {

0 commit comments

Comments
 (0)