fix: CMD-Enter in table within toggle block does not add row (#13226)

* fix: CMD-Enter in table within toggle block does not add newline

* simplify
This commit is contained in:
Tom Moor
2026-08-01 16:15:40 +00:00
committed by GitHub
parent d949199aee
commit f5b39aba8f
+16
View File
@@ -4,6 +4,7 @@ import {
splitBlock,
} from "prosemirror-commands";
import { Slice, Fragment } from "prosemirror-model";
import { isInTable } from "prosemirror-tables";
import type { Command } from "prosemirror-state";
import { NodeSelection, TextSelection } from "prosemirror-state";
import { liftTarget, ReplaceAroundStep } from "prosemirror-transform";
@@ -202,6 +203,11 @@ export const indentBlock: Command = (state, dispatch) => {
return false;
}
// If inside a table, allow the table's Tab handler to move cells instead.
if (isInTable(state)) {
return false;
}
const { $from } = state.selection;
let before = -1;
@@ -242,6 +248,11 @@ export const toggleBlock: Command = (state, dispatch) => {
return false;
}
// If inside a table, allow the table's handler to add a row instead.
if (isInTable(state)) {
return false;
}
const isToggle = isToggleBlock(state);
const toggle = nearest(ancestors($cursor!).filter(isToggle));
if (!toggle) {
@@ -353,6 +364,11 @@ export const dedentBlocks: Command = (state, dispatch) => {
return false;
}
// If inside a table, allow the table's Shift-Tab handler to move cells instead.
if (isInTable(state)) {
return false;
}
const { $from } = state.selection;
const isToggle = isToggleBlock(state);