Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sahejkm committed May 15, 2024
1 parent 8f1efbc commit fea7c2b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ const formatStep = (step: Step) => {
};

export function isSelectAll(event: KeyboardEvent): boolean {
return event.key === 'A' && (IS_APPLE ? event.metaKey : event.ctrlKey);
return (
event.key.toLowerCase() === 'a' &&
(IS_APPLE ? event.metaKey : event.ctrlKey)
);
}

// stolen from LexicalSelection-test
Expand Down
14 changes: 9 additions & 5 deletions packages/lexical/src/LexicalUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,9 @@ export function isBold(
metaKey: boolean,
ctrlKey: boolean,
): boolean {
return key === 'B' && !altKey && controlOrMeta(metaKey, ctrlKey);
return (
key.toLowerCase() === 'b' && !altKey && controlOrMeta(metaKey, ctrlKey)
);
}

export function isItalic(
Expand All @@ -786,7 +788,9 @@ export function isItalic(
metaKey: boolean,
ctrlKey: boolean,
): boolean {
return key === 'I' && !altKey && controlOrMeta(metaKey, ctrlKey);
return (
key.toLowerCase() === 'i' && !altKey && controlOrMeta(metaKey, ctrlKey)
);
}

export function isUnderline(
Expand All @@ -810,7 +814,7 @@ export function isLineBreak(key: string, shiftKey: boolean): boolean {

export function isOpenLineBreak(key: string, ctrlKey: boolean): boolean {
// 79 = KeyO
return IS_APPLE && ctrlKey && key === 'O';
return IS_APPLE && ctrlKey && key.toLowerCase() === 'o';
}

export function isDeleteWordBackward(
Expand Down Expand Up @@ -904,7 +908,7 @@ export function isCopy(
if (shiftKey) {
return false;
}
if (key === 'C') {
if (key.toLowerCase() === 'c') {
return IS_APPLE ? metaKey : ctrlKey;
}

Expand All @@ -920,7 +924,7 @@ export function isCut(
if (shiftKey) {
return false;
}
if (key === 'X') {
if (key.toLowerCase() === 'x') {
return IS_APPLE ? metaKey : ctrlKey;
}

Expand Down

0 comments on commit fea7c2b

Please sign in to comment.