From 2e5a59ae6e64ad9ce7d8d8cc6b0dfb310bc5d780 Mon Sep 17 00:00:00 2001 From: Felix Feng Date: Tue, 24 Sep 2024 17:22:20 +0800 Subject: [PATCH 1/2] fix --- packages/selection/src/react/onKeyDownSelection.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/selection/src/react/onKeyDownSelection.ts b/packages/selection/src/react/onKeyDownSelection.ts index fb68abc98f..8fde7acfa7 100644 --- a/packages/selection/src/react/onKeyDownSelection.ts +++ b/packages/selection/src/react/onKeyDownSelection.ts @@ -16,6 +16,8 @@ export const onKeyDownSelection: KeyboardHandler = ({ event, }) => { if (isHotkey('mod+a', event)) { + if (event.defaultPrevented) return; + const ancestorNode = getAncestorNode(editor); if (!ancestorNode) return; @@ -36,6 +38,8 @@ export const onKeyDownSelection: KeyboardHandler = ({ event.stopPropagation(); } if (isHotkey('escape', event)) { + if (event.defaultPrevented) return; + const ancestorNode = getAncestorNode(editor); const id = ancestorNode?.[0].id; From 7483acc88e0dfde2b8e3b1338c0f531d8de14f12 Mon Sep 17 00:00:00 2001 From: Felix Feng Date: Tue, 24 Sep 2024 17:23:24 +0800 Subject: [PATCH 2/2] changeset --- .changeset/fifty-walls-trade.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fifty-walls-trade.md diff --git a/.changeset/fifty-walls-trade.md b/.changeset/fifty-walls-trade.md new file mode 100644 index 0000000000..2b987aace8 --- /dev/null +++ b/.changeset/fifty-walls-trade.md @@ -0,0 +1,5 @@ +--- +'@udecode/plate-selection': patch +--- + +If `defaultPrevented` is true stop keydown handlers.