Add support for disabling spell checking (#8604)

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Šimon Brandner 2022-07-28 10:10:04 +02:00 committed by GitHub
parent 8379f5624e
commit bd30b75f79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 52 additions and 17 deletions

View file

@ -82,6 +82,8 @@ interface IProps {
// width.
menuWidth?: number;
searchEnabled?: boolean;
// Placeholder to show when no value is selected
placeholder?: string;
// Called when the selected option changes
onOptionChange(dropdownKey: string): void;
// Called when the value of the search field changes
@ -362,7 +364,7 @@ export default class Dropdown extends React.Component<IProps, IState> {
this.props.getShortOption(this.props.value) :
this.childrenByKey[this.props.value];
currentValue = <div className="mx_Dropdown_option" id={`${this.props.id}_value`}>
{ selectedChild }
{ selectedChild || this.props.placeholder }
</div>;
}

View file

@ -116,7 +116,9 @@ export default class SpellCheckLanguagesDropdown extends React.Component<SpellCh
onSearchChange={this.onSearchChange}
searchEnabled={true}
value={value}
label={_t("Language Dropdown")}>
label={_t("Language Dropdown")}
placeholder={_t("Choose a locale")}
>
{ options }
</Dropdown>;
}

View file

@ -25,7 +25,7 @@ interface IProps {
checked: boolean;
// Whether or not the user can interact with the switch
disabled: boolean;
disabled?: boolean;
// Called when the checked state changes. First argument will be the new state.
onChange(checked: boolean): void;