Skip to content

Commit 5c10110

Browse files
Verify that table cell is selected (#302)
Fixes: #300 We were not verifying that the table cell is actually selected vs cursor being in the cell.
1 parent 5b3ceb4 commit 5c10110

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

blocks/edit/prose/plugins/keyHandlers.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const isColumnSelected = (rect) => rect.top === 0 && rect.bottom === rect.map.he
4949
const isTableSelected = (rect) => isRowSelected(rect) && isColumnSelected(rect);
5050

5151
export function handleTableBackspace(state, dispatch) {
52-
if (!isInTable(state)) return false;
52+
if (!isInTable(state) || !state.selection.$anchorCell) return false;
5353

5454
const rect = selectedRect(state);
5555
if (!rect || rect.top === null) return false;
@@ -61,12 +61,10 @@ export function handleTableBackspace(state, dispatch) {
6161
deleteTable(state, dispatch);
6262
return true;
6363
}
64-
6564
if (isRowSelected(rect)) {
6665
deleteRow(state, dispatch);
6766
return true;
6867
}
69-
7068
if (isColumnSelected(rect)) {
7169
deleteColumn(state, dispatch);
7270
return true;

0 commit comments

Comments
 (0)