Skip to content

Commit

Permalink
Fix tableEditing arrows keymap when table cell content is inline inst…
Browse files Browse the repository at this point in the history
…ead of block or paragraph
  • Loading branch information
segevfiner committed Sep 11, 2023
1 parent 0cc29c6 commit b5e9a8d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ export function handleMouseDown(
function atEndOfCell(view: EditorView, axis: Axis, dir: number): null | number {
if (!(view.state.selection instanceof TextSelection)) return null;
const { $head } = view.state.selection;
if ($head.parent.type.spec.tableRole == "cell" || $head.parent.type.spec.tableRole == "header_cell") {
const cellPos = $head.before();
const dirStr = axis == "vert" ? dir > 0 ? "down" : "up" : dir > 0 ? "right" : "left";
return view.endOfTextblock(dirStr) ? cellPos : null;
}
for (let d = $head.depth - 1; d >= 0; d--) {
const parent = $head.node(d),
index = dir < 0 ? $head.index(d) : $head.indexAfter(d);
Expand Down

0 comments on commit b5e9a8d

Please sign in to comment.