From 738fa588a606bb6ebddca1187a0c94152707c62e Mon Sep 17 00:00:00 2001 From: Vendicated Date: Tue, 12 Mar 2024 01:28:30 +0100 Subject: [PATCH] Adapt spellcheck to new context menu api --- src/renderer/patches/spellCheck.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/renderer/patches/spellCheck.tsx b/src/renderer/patches/spellCheck.tsx index 038f06a..9f0dbbd 100644 --- a/src/renderer/patches/spellCheck.tsx +++ b/src/renderer/patches/spellCheck.tsx @@ -6,7 +6,7 @@ import { addContextMenuPatch } from "@vencord/types/api/ContextMenu"; import { findStoreLazy } from "@vencord/types/webpack"; -import { ContextMenu, FluxDispatcher, Menu } from "@vencord/types/webpack/common"; +import { FluxDispatcher, Menu, useStateFromStores } from "@vencord/types/webpack/common"; import { addPatch } from "./shared"; @@ -46,7 +46,8 @@ addPatch({ } }); -addContextMenuPatch("textarea-context", children => () => { +addContextMenuPatch("textarea-context", children => { + const spellCheckEnabled = useStateFromStores([SpellCheckStore], () => SpellCheckStore.isEnabled()); const hasCorrections = Boolean(word && corrections?.length); children.push( @@ -71,11 +72,9 @@ addContextMenuPatch("textarea-context", children => () => { { FluxDispatcher.dispatch({ type: "SPELLCHECK_TOGGLE" }); - // Haven't found a good way to update state, so just close for now 🤷‍♀️ - ContextMenu.close(); }} />