Skip to content

Commit 708bf08

Browse files
authored
Merge pull request #862 from live-codes/fix-command-menu
fix selecting languages in command menu
2 parents 4082e05 + 58efd27 commit 708bf08

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

src/livecodes/UI/command-menu-actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export const getCommandMenuActions = ({
216216
handler: async () => {
217217
document
218218
.querySelector<HTMLAnchorElement>('a[data-editor][data-lang="' + lang.name + '"]')
219-
?.dispatchEvent(new Event('mousedown'));
219+
?.click();
220220
},
221221
})),
222222
},
@@ -245,7 +245,7 @@ export const getCommandMenuActions = ({
245245
.querySelector<HTMLAnchorElement>(
246246
'.processor-item input[data-processor="' + processor.name + '"]',
247247
)
248-
?.dispatchEvent(new Event('mousedown', { bubbles: true }));
248+
?.dispatchEvent(new Event('click', { bubbles: true }));
249249
},
250250
})),
251251
},

src/livecodes/core.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2800,6 +2800,7 @@ const handleCommandMenu = async () => {
28002800
const openCommandMenu = () => {
28012801
modal.close();
28022802
ninja.close();
2803+
UI.getAppMenuHelpScroller()?.classList.add('hidden');
28032804
const { actions, loginAction, logoutAction } = getCommandMenuActions({
28042805
deps: {
28052806
getConfig,
@@ -2837,11 +2838,8 @@ const handleCommandMenu = async () => {
28372838
if (ninja.__visible == null) {
28382839
await loadNinjaKeys();
28392840
}
2840-
// eslint-disable-next-line no-underscore-dangle
2841-
if (ninja.__visible === false) {
2842-
ninja.focus();
2843-
requestAnimationFrame(() => openCommandMenu());
2844-
}
2841+
ninja.focus();
2842+
requestAnimationFrame(() => openCommandMenu());
28452843
}, 500);
28462844
};
28472845

0 commit comments

Comments
 (0)