Skip to content

Commit 1f2bb17

Browse files
committed
add editor focus condition for link shortcut behavior
1 parent 4f9b6b5 commit 1f2bb17

File tree

1 file changed

+2
-2
lines changed
  • src/components/ui/coaching-sessions/coaching-notes

1 file changed

+2
-2
lines changed

src/components/ui/coaching-sessions/coaching-notes/toolbar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ export const Toolbar = () => {
2828
// Add keyboard shortcut handler
2929
useEffect(() => {
3030
const handleKeyDown = (e: KeyboardEvent) => {
31-
if ((e.metaKey || e.ctrlKey) && e.key === "k") {
31+
if ((e.metaKey || e.ctrlKey) && e.key === "k" && editor?.isFocused) {
3232
e.preventDefault();
3333
setIsLinkDialogOpen(true);
3434
}
3535
};
3636

3737
document.addEventListener("keydown", handleKeyDown);
3838
return () => document.removeEventListener("keydown", handleKeyDown);
39-
}, []);
39+
}, [editor]);
4040

4141
return (
4242
<>

0 commit comments

Comments
 (0)