From 4599371bd1466f6da726d3750a2e79185ad9f9f0 Mon Sep 17 00:00:00 2001
From: thororen1234 <78185467+thororen1234@users.noreply.github.com>
Date: Sat, 6 Jul 2024 13:11:19 -0400
Subject: [PATCH] Update
---
src/plugins/betterNotes/index.tsx | 43 +++++++++++++++++--------------
1 file changed, 24 insertions(+), 19 deletions(-)
diff --git a/src/plugins/betterNotes/index.tsx b/src/plugins/betterNotes/index.tsx
index cacdba5fd..b97076bf4 100644
--- a/src/plugins/betterNotes/index.tsx
+++ b/src/plugins/betterNotes/index.tsx
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-import { Settings } from "@api/Settings";
+import { definePluginSettings, Settings } from "@api/Settings";
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import { canonicalizeMatch } from "@utils/patches";
@@ -25,10 +25,26 @@ import { findByPropsLazy } from "@webpack";
const UserPopoutSectionCssClasses = findByPropsLazy("section", "lastSection");
+const settings = definePluginSettings({
+ hide: {
+ type: OptionType.BOOLEAN,
+ description: "Hide notes",
+ default: false,
+ restartNeeded: true
+ },
+ noSpellCheck: {
+ type: OptionType.BOOLEAN,
+ description: "Disable spellcheck in notes",
+ disabled: () => Settings.plugins.BetterNotesBox.hide,
+ default: false
+ }
+});
+
export default definePlugin({
name: "BetterNotesBox",
description: "Hide notes or disable spellcheck (Configure in settings!!)",
authors: [Devs.Ven],
+ settings,
patches: [
{
@@ -36,7 +52,7 @@ export default definePlugin({
all: true,
// Some modules match the find but the replacement is returned untouched
noWarn: true,
- predicate: () => Vencord.Settings.plugins.BetterNotesBox.hide,
+ predicate: () => settings.store.hide,
replacement: {
match: /hideNote:.+?(?=([,}].*?\)))/g,
replace: (m, rest) => {
@@ -54,7 +70,7 @@ export default definePlugin({
find: "Messages.NOTE_PLACEHOLDER",
replacement: {
match: /\.NOTE_PLACEHOLDER,/,
- replace: "$&spellCheck:!Vencord.Settings.plugins.BetterNotesBox.noSpellCheck,"
+ replace: "$&spellCheck:!$self.noSpellCheck,"
}
},
{
@@ -66,25 +82,14 @@ export default definePlugin({
}
],
- options: {
- hide: {
- type: OptionType.BOOLEAN,
- description: "Hide notes",
- default: false,
- restartNeeded: true
- },
- noSpellCheck: {
- type: OptionType.BOOLEAN,
- description: "Disable spellcheck in notes",
- disabled: () => Settings.plugins.BetterNotesBox.hide,
- default: false
- }
- },
-
patchPadding: ErrorBoundary.wrap(({ lastSection }) => {
if (!lastSection) return null;
return (
);
- })
+ }),
+
+ get noSpellCheck() {
+ return settings.store.noSpellCheck;
+ }
});