From a244bcbfeefb27c785097b00eea57d9fe730e397 Mon Sep 17 00:00:00 2001 From: celine Date: Tue, 2 Jul 2024 23:17:36 -0400 Subject: [PATCH] hitting the esc key now also blurs blocks that are not text blocks (like linked cards) --- components/Blocks.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/Blocks.tsx b/components/Blocks.tsx index 42bcd659..b53763ad 100644 --- a/components/Blocks.tsx +++ b/components/Blocks.tsx @@ -207,6 +207,10 @@ function Block(props: BlockProps) { document.getElementById(elementId.block(newEntityID).text)?.focus(); }, 10); } + if (e.key === "Escape") { + e.preventDefault(); + useUIState.setState({ selectedBlock: [] }); + } }; window.addEventListener("keydown", listener); return () => window.removeEventListener("keydown", listener); -- 2.51.2