diff --git a/web/components/config/form-textfield-with-submit.tsx b/web/components/config/form-textfield-with-submit.tsx index 0d25ab1b6..481242946 100644 --- a/web/components/config/form-textfield-with-submit.tsx +++ b/web/components/config/form-textfield-with-submit.tsx @@ -42,6 +42,7 @@ export default function TextFieldWithSubmit(props: TextFieldWithSubmitProps) { configPath = '', initialValue, useTrim, + useTrimLead, ...textFieldProps // rest of props } = props; @@ -73,7 +74,7 @@ export default function TextFieldWithSubmit(props: TextFieldWithSubmitProps) { if (onChange) { onChange({ fieldName: changedFieldName, - value: useTrim ? changedValue.trim() : changedValue, + value: useTrim ? changedValue.trim() : useTrimLead ? changedValue.replace(/^\s+/g,'') : changedValue, }); } }; diff --git a/web/components/config/form-textfield.tsx b/web/components/config/form-textfield.tsx index ea71730cf..29afc6ebf 100644 --- a/web/components/config/form-textfield.tsx +++ b/web/components/config/form-textfield.tsx @@ -29,6 +29,7 @@ export interface TextFieldProps { tip?: string; type?: string; useTrim?: boolean; + useTrimLead?: boolean; value?: string | number; onBlur?: FieldUpdaterFunc; onChange?: FieldUpdaterFunc; diff --git a/web/utils/config-constants.tsx b/web/utils/config-constants.tsx index 2ff13482b..0845a9f36 100644 --- a/web/utils/config-constants.tsx +++ b/web/utils/config-constants.tsx @@ -56,6 +56,8 @@ export const TEXTFIELD_PROPS_SERVER_NAME = { placeholder: 'Owncast site name', // like "gothland" label: 'Name', tip: 'The name of your Owncast server', + required: true, + useTrimLead: true, }; export const TEXTFIELD_PROPS_STREAM_TITLE = { apiPath: API_STREAM_TITLE,