Skip to content

Commit 6efd344

Browse files
authored
Merge pull request #104 from beNative/codex/fix-ctrl+shift+p-search-in-monaco-editor
Allow command palette shortcut while typing in Monaco editor
2 parents 8a10c1e + 9d64faa commit 6efd344

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

App.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2161,14 +2161,18 @@ const MainApp: React.FC = () => {
21612161
const shortcutMap = getShortcutMap(commands, settings.customShortcuts);
21622162

21632163
const handleKeyDown = (e: KeyboardEvent) => {
2164+
const shortcut = formatShortcut(e);
2165+
const command = shortcutMap.get(shortcut);
2166+
21642167
const activeEl = document.activeElement;
2165-
if (activeEl && ['INPUT', 'TEXTAREA', 'SELECT'].includes(activeEl.tagName) && activeEl !== commandPaletteInputRef.current) {
2168+
const isFormElement = activeEl && ['INPUT', 'TEXTAREA', 'SELECT'].includes(activeEl.tagName);
2169+
const isPaletteInput = activeEl === commandPaletteInputRef.current;
2170+
const isCommandPaletteToggle = command?.id === 'toggle-command-palette';
2171+
2172+
if (isFormElement && !isPaletteInput && !isCommandPaletteToggle) {
21662173
return;
21672174
}
21682175

2169-
const shortcut = formatShortcut(e);
2170-
const command = shortcutMap.get(shortcut);
2171-
21722176
if (command) {
21732177
e.preventDefault();
21742178
command.action();

0 commit comments

Comments
 (0)