diff --git a/src/plugins/characterCounter/index.tsx b/src/plugins/characterCounter/index.tsx index 0aace6c77..6bff79c50 100644 --- a/src/plugins/characterCounter/index.tsx +++ b/src/plugins/characterCounter/index.tsx @@ -11,11 +11,9 @@ import ErrorBoundary from "@components/ErrorBoundary"; import { Devs, EquicordDevs } from "@utils/constants"; import { classNameFactory } from "@utils/css"; import definePlugin, { OptionType } from "@utils/types"; -import { findByPropsLazy } from "@webpack"; import { useEffect, UserStore, useState } from "@webpack/common"; const cl = classNameFactory("vc-charCounter-"); -const SlateUtils = findByPropsLazy("getSelectedText"); const settings = definePluginSettings({ colorEffects: { @@ -66,7 +64,7 @@ export default definePlugin({ const listener = () => { if (!editorRef?.current) return setSelectedCount(0); - setTimeout(() => setSelectedCount(SlateUtils.getSelectedText(editorRef.current?.getSlateEditor())?.length ?? 0), 50); + setSelectedCount(document.getSelection()?.toString()?.length ?? 0); }; document.addEventListener("selectionchange", listener);