fix(app): refocus the editor before text context menu actions (#3292)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-08 17:37:40 +02:00
1 parent 0906a85d6f
commit c3d790f664
2 files changed
+13 -7

No files matched your search

@@ -140,12 +140,6 @@ export const TextareaContextMenu = observer(
}
targetElement.focus({preventScroll: true});
};
const handleReplaceMisspelling = async (suggestion: string) => {
if (electronAPI?.spellcheckReplaceMisspelling) {
await electronAPI.spellcheckReplaceMisspelling(suggestion);
}
onClose();
};
const handleAddToDictionary = async () => {
if (!misspelledWord) return;
Spellcheck.addPersonalWord(misspelledWord);
@@ -167,6 +161,11 @@ export const TextareaContextMenu = observer(
requestAnimationFrame(action);
});
};
const handleReplaceMisspelling = (suggestion: string) => {
runAfterClose(() => {
void electronAPI?.spellcheckReplaceMisspelling?.(suggestion);
});
};
const execCommand = (command: string) => {
runAfterClose(() => {
document.execCommand(command);