diff --git a/src/api/ContextMenu.ts b/src/api/ContextMenu.ts index fdd4facf..114942ff 100644 --- a/src/api/ContextMenu.ts +++ b/src/api/ContextMenu.ts @@ -90,19 +90,20 @@ export function removeGlobalContextMenuPatch(patch: GlobalContextMenuPatchCallba * A helper function for finding the children array of a group nested inside a context menu based on the id(s) of its children * @param id The id of the child. If an array is specified, all ids will be tried * @param children The context menu children + * @param matchSubstring Whether to check if the id is a substring of the child id */ -export function findGroupChildrenByChildId(id: string | string[], children: Array): Array | null { +export function findGroupChildrenByChildId(id: string | string[], children: Array, matchSubstring = false): Array | null { for (const child of children) { if (child == null) continue; if (Array.isArray(child)) { - const found = findGroupChildrenByChildId(id, child); + const found = findGroupChildrenByChildId(id, child, matchSubstring); if (found !== null) return found; } if ( - (Array.isArray(id) && id.some(id => child.props?.id === id)) - || child.props?.id === id + (Array.isArray(id) && id.some(id => matchSubstring ? child.props?.id?.includes(id) : child.props?.id === id)) + || (matchSubstring ? child.props?.id?.includes(id) : child.props?.id === id) ) return children; let nextChildren = child.props?.children; @@ -112,7 +113,7 @@ export function findGroupChildrenByChildId(id: string | string[], children: Arra child.props.children = nextChildren; } - const found = findGroupChildrenByChildId(id, nextChildren); + const found = findGroupChildrenByChildId(id, nextChildren, matchSubstring); if (found !== null) return found; } } diff --git a/src/components/PluginSettings/components/SettingNumericComponent.tsx b/src/components/PluginSettings/components/SettingNumericComponent.tsx index 446d2504..b724717d 100644 --- a/src/components/PluginSettings/components/SettingNumericComponent.tsx +++ b/src/components/PluginSettings/components/SettingNumericComponent.tsx @@ -16,6 +16,8 @@ * along with this program. If not, see . */ +import { Margins } from "@utils/margins"; +import { wordsFromCamel, wordsToTitle } from "@utils/text"; import { OptionType, PluginOptionNumber } from "@utils/types"; import { Forms, React, TextInput } from "@webpack/common"; @@ -54,7 +56,8 @@ export function SettingNumericComponent({ option, pluginSettings, definedSetting return ( - {option.description} + {wordsToTitle(wordsFromCamel(id))} + {option.description} . */ +import { Margins } from "@utils/margins"; +import { wordsFromCamel, wordsToTitle } from "@utils/text"; import { PluginOptionSelect } from "@utils/types"; import { Forms, React, Select } from "@webpack/common"; @@ -44,7 +46,8 @@ export function SettingSelectComponent({ option, pluginSettings, definedSettings return ( - {option.description} + {wordsToTitle(wordsFromCamel(id))} + {option.description}