only focus main editor on mode toggle if another editor doesn't already have focus
This commit is contained in:
parent
c86e88ff0c
commit
855b85585f
1 changed files with 4 additions and 1 deletions
|
|
@ -34,7 +34,10 @@ export function ModeSelect() {
|
|||
|
||||
const cycleMode = useCallback(() => {
|
||||
dispatch(setMode(mode === "chat" ? "agent" : "chat"));
|
||||
mainEditor?.commands.focus();
|
||||
// Only focus main editor if another one doesn't already have focus
|
||||
if (!document.activeElement?.classList?.contains("ProseMirror")) {
|
||||
mainEditor?.commands.focus();
|
||||
}
|
||||
}, [mode, mainEditor]);
|
||||
|
||||
const selectMode = useCallback(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue