Merge branch 'poll-form-autosuggest' into 'develop'
PollForm: autosuggest fix See merge request soapbox-pub/soapbox-fe!1500
This commit is contained in:
commit
7922d3974c
1 changed files with 7 additions and 2 deletions
|
@ -10,6 +10,8 @@ import IconButton from 'soapbox/components/icon_button';
|
|||
import { HStack } from 'soapbox/components/ui';
|
||||
import { useAppSelector } from 'soapbox/hooks';
|
||||
|
||||
import type { AutoSuggestion } from 'soapbox/components/autosuggest_input';
|
||||
|
||||
const messages = defineMessages({
|
||||
option_placeholder: { id: 'compose_form.poll.option_placeholder', defaultMessage: 'Choice {number}' },
|
||||
add_option: { id: 'compose_form.poll.add_option', defaultMessage: 'Add a choice' },
|
||||
|
@ -83,8 +85,11 @@ const Option = (props: IOption) => {
|
|||
|
||||
const onSuggestionsFetchRequested = (token: string) => onFetchSuggestions(token);
|
||||
|
||||
const onSuggestionSelected = (tokenStart: number, token: string, value: string) =>
|
||||
props.onSuggestionSelected(tokenStart, token, value, ['poll', 'options', index]);
|
||||
const onSuggestionSelected = (tokenStart: number, token: string | null, value: AutoSuggestion) => {
|
||||
if (token && typeof value === 'string') {
|
||||
props.onSuggestionSelected(tokenStart, token, value, ['poll', 'options', index]);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<li>
|
||||
|
|
Loading…
Reference in a new issue