Settings: add textarea options
This commit is contained in:
parent
d8dbbf0c81
commit
816243e702
8 changed files with 37 additions and 19 deletions
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
import { PluginOptionString } from "@utils/types";
|
||||
import { React, TextInput, useState } from "@webpack/common";
|
||||
import { React, TextArea, TextInput, useState } from "@webpack/common";
|
||||
|
||||
import { resolveError, SettingProps, SettingsSection } from "./Common";
|
||||
|
||||
|
|
@ -38,15 +38,23 @@ export function TextSetting({ option, pluginSettings, definedSettings, id, onCha
|
|||
|
||||
return (
|
||||
<SettingsSection name={id} description={option.description} error={error}>
|
||||
<TextInput
|
||||
type="text"
|
||||
placeholder={option.placeholder ?? "Enter a value"}
|
||||
value={state}
|
||||
onChange={handleChange}
|
||||
maxLength={null}
|
||||
disabled={option.disabled?.call(definedSettings) ?? false}
|
||||
{...option.componentProps}
|
||||
/>
|
||||
{option.multiline
|
||||
? <TextArea
|
||||
placeholder={option.placeholder ?? "Enter a value"}
|
||||
value={state}
|
||||
onChange={handleChange}
|
||||
disabled={option.disabled?.call(definedSettings) ?? false}
|
||||
{...option.componentProps} />
|
||||
: <TextInput
|
||||
type="text"
|
||||
placeholder={option.placeholder ?? "Enter a value"}
|
||||
value={state}
|
||||
onChange={handleChange}
|
||||
maxLength={null}
|
||||
disabled={option.disabled?.call(definedSettings) ?? false}
|
||||
{...option.componentProps}
|
||||
/>
|
||||
}
|
||||
</SettingsSection>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,8 +82,9 @@ const settings = definePluginSettings({
|
|||
},
|
||||
whitelistedLoggers: {
|
||||
type: OptionType.STRING,
|
||||
description: "Semi colon separated list of loggers to allow even if others are hidden",
|
||||
description: "Semicolon (;) separated list of loggers to allow even if others are hidden",
|
||||
default: "GatewaySocket; Routing/Utils",
|
||||
multiline: true,
|
||||
onChange(newVal: string) {
|
||||
logAllow.clear();
|
||||
newVal.split(";").map(x => x.trim()).forEach(logAllow.add.bind(logAllow));
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import { Flex } from "@components/Flex";
|
|||
import { Devs } from "@utils/constants";
|
||||
import { Margins } from "@utils/margins";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { Button, Forms, RunningGameStore, showToast, TextInput, Toasts, Tooltip, useEffect, useState } from "@webpack/common";
|
||||
import { Button, Forms, RunningGameStore, showToast, TextArea, Toasts, Tooltip, useEffect, useState } from "@webpack/common";
|
||||
|
||||
const enum ActivitiesTypes {
|
||||
Game,
|
||||
|
|
@ -131,7 +131,7 @@ function IdsListComponent(props: { setValue: (value: string) => void; }) {
|
|||
<section>
|
||||
<Forms.FormTitle tag="h3">Filter List</Forms.FormTitle>
|
||||
<Forms.FormText className={Margins.bottom8}>Comma separated list of activity IDs to filter (Useful for filtering specific RPC activities and CustomRPC</Forms.FormText>
|
||||
<TextInput
|
||||
<TextArea
|
||||
type="text"
|
||||
value={idsList}
|
||||
onChange={handleChange}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ const settings = definePluginSettings({
|
|||
description: "Additional custom quotes to possibly appear, separated by the below delimiter",
|
||||
type: OptionType.STRING,
|
||||
default: "",
|
||||
multiline: true
|
||||
},
|
||||
additionalQuotesDelimiter: {
|
||||
description: "Delimiter for additional quotes",
|
||||
|
|
|
|||
|
|
@ -115,7 +115,8 @@ const settings = definePluginSettings({
|
|||
idList: {
|
||||
description: "Guild/channel/user IDs to blacklist or whitelist (separate with comma)",
|
||||
type: OptionType.STRING,
|
||||
default: ""
|
||||
default: "",
|
||||
multiline: true,
|
||||
},
|
||||
clearMessageCache: {
|
||||
type: OptionType.COMPONENT,
|
||||
|
|
|
|||
|
|
@ -237,17 +237,20 @@ export default definePlugin({
|
|||
ignoreUsers: {
|
||||
type: OptionType.STRING,
|
||||
description: "Comma-separated list of user IDs to ignore",
|
||||
default: ""
|
||||
default: "",
|
||||
multiline: true
|
||||
},
|
||||
ignoreChannels: {
|
||||
type: OptionType.STRING,
|
||||
description: "Comma-separated list of channel IDs to ignore",
|
||||
default: ""
|
||||
default: "",
|
||||
multiline: true
|
||||
},
|
||||
ignoreGuilds: {
|
||||
type: OptionType.STRING,
|
||||
description: "Comma-separated list of guild IDs to ignore",
|
||||
default: ""
|
||||
default: "",
|
||||
multiline: true
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -25,15 +25,17 @@ import { ChannelStore, GuildMemberStore } from "@webpack/common";
|
|||
const settings = definePluginSettings({
|
||||
userList: {
|
||||
description:
|
||||
"List of users to allow or exempt pings for (separated by commas or spaces)",
|
||||
"List of user ids to allow or exempt pings for (separated by commas or spaces)",
|
||||
type: OptionType.STRING,
|
||||
default: "1234567890123445,1234567890123445",
|
||||
multiline: true
|
||||
},
|
||||
roleList: {
|
||||
description:
|
||||
"List of roles to allow or exempt pings for (separated by commas or spaces)",
|
||||
"List of role ids to allow or exempt pings for (separated by commas or spaces)",
|
||||
type: OptionType.STRING,
|
||||
default: "1234567890123445,1234567890123445",
|
||||
multiline: true
|
||||
},
|
||||
shouldPingListed: {
|
||||
description: "Behaviour",
|
||||
|
|
|
|||
|
|
@ -293,6 +293,8 @@ interface IsValid<T, D = unknown> {
|
|||
export interface PluginSettingStringDef {
|
||||
type: OptionType.STRING;
|
||||
default?: string;
|
||||
/** Whether to use a multiline text area */
|
||||
multiline?: boolean;
|
||||
}
|
||||
export interface PluginSettingNumberDef {
|
||||
type: OptionType.NUMBER;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue