Skip to content

Commit

Permalink
Fix a regression in TableCellSelection (#1357)
Browse files Browse the repository at this point in the history
* Fix a regression in Table Selection

* Handle Home and End key
  • Loading branch information
JiuqingSong authored Oct 24, 2022
1 parent 0fcb359 commit b9630a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
VTable,
Position,
contains,
isCtrlOrMetaPressed,
} from 'roosterjs-editor-dom';

const TABLE_CELL_SELECTOR = 'td,th';
Expand Down Expand Up @@ -210,7 +211,10 @@ export default class TableCellSelection implements EditorPlugin {
this.tableSelection = false;
}
});
} else if (this.editor.getSelectionRangeEx()?.type == SelectionRangeTypes.TableSelection) {
} else if (
this.editor.getSelectionRangeEx()?.type == SelectionRangeTypes.TableSelection &&
(!isCtrlOrMetaPressed(event.rawEvent) || which == Keys.HOME || which == Keys.END)
) {
this.editor.select(null);
}
}
Expand Down
2 changes: 2 additions & 0 deletions packages/roosterjs-editor-types/lib/enum/Keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export const enum Keys {
ESCAPE = 27,
SPACE = 32,
PAGEUP = 33,
END = 35,
HOME = 36,
LEFT = 37,
UP = 38,
RIGHT = 39,
Expand Down

0 comments on commit b9630a6

Please sign in to comment.