Skip to content

Commit cc4e860

Browse files
authored
fix: table enter and minimal rows (#1738)
1 parent 23b7846 commit cc4e860

File tree

1 file changed

+4
-6
lines changed
  • packages/plugins/preset-gfm/src/node/table

1 file changed

+4
-6
lines changed

Diff for: packages/plugins/preset-gfm/src/node/table/input.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@ export const insertTableInputRule = $inputRule(
3030
)
3131
return null
3232

33-
const tableNode = createTable(
34-
ctx,
35-
Number(match.groups?.row),
36-
Number(match.groups?.col)
37-
)
33+
const row = Math.max(Number(match.groups?.row ?? 0), 2)
34+
35+
const tableNode = createTable(ctx, row, Number(match.groups?.col))
3836
const tr = state.tr.replaceRangeWith(start, end, tableNode)
3937
return tr
4038
.setSelection(TextSelection.create(tr.doc, start + 3))
@@ -70,7 +68,7 @@ export const tableKeymap = $useKeymap('tableKeymap', {
7068
},
7169
},
7270
ExitTable: {
73-
shortcuts: ['Mod-Enter'],
71+
shortcuts: ['Mod-Enter', 'Enter'],
7472
command: (ctx) => {
7573
const commands = ctx.get(commandsCtx)
7674

0 commit comments

Comments
 (0)