From 0b20a2e211878cc2bbb836f7d38a965fa5a440a9 Mon Sep 17 00:00:00 2001 From: camila314 <47485054+camila314@users.noreply.github.com> Date: Mon, 24 Jun 2024 02:58:56 -0500 Subject: [PATCH] fix being able to delete first item --- src/plugins/contentWarning/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/contentWarning/index.tsx b/src/plugins/contentWarning/index.tsx index 31d0d3b78..52e1e7c5b 100644 --- a/src/plugins/contentWarning/index.tsx +++ b/src/plugins/contentWarning/index.tsx @@ -60,6 +60,9 @@ function FlaggedInput({ index, forceUpdate }) { }; const removeSelf = () => { + if (triggerWords.length == 1) { + return; + } triggerWords = triggerWords.slice(0, index).concat(triggerWords.slice(index + 1)); forceUpdate(); }; @@ -117,7 +120,7 @@ const settings = definePluginSettings({ export default definePlugin({ name: "ContentWarning", authors: [Devs.camila314], - description: "Allows you to specify certain trigger words that will be blurred by default. Clicking on the blurred content will reveal it.", + description: "Allows you to specify certain trigger words", settings, patches: [ { @@ -130,6 +133,7 @@ export default definePlugin({ ], beforeSave() { + console.log(triggerWords); DataStore.set(WORDS_KEY, triggerWords); return true; }, @@ -144,5 +148,6 @@ export default definePlugin({ async start() { triggerWords = await DataStore.get(WORDS_KEY) ?? [""]; + console.log(triggerWords); } });