SpoilerInput: fix ref

This commit is contained in:
Alex Gleason 2022-10-31 16:23:17 -05:00
parent f51f2984a5
commit 69157097dd
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 5 additions and 3 deletions

View File

@ -316,6 +316,7 @@ const ComposeForm = <ID extends string>({ id, shouldCondense, autoFocus, clickab
onSuggestionsFetchRequested={onSuggestionsFetchRequested} onSuggestionsFetchRequested={onSuggestionsFetchRequested}
onSuggestionsClearRequested={onSuggestionsClearRequested} onSuggestionsClearRequested={onSuggestionsClearRequested}
onSuggestionSelected={onSpoilerSuggestionSelected} onSuggestionSelected={onSpoilerSuggestionSelected}
ref={spoilerTextRef}
/> />
</Stack> </Stack>
} }

View File

@ -18,12 +18,12 @@ interface ISpoilerInput extends Pick<IAutosuggestInput, 'onSuggestionsFetchReque
} }
/** Text input for content warning in composer. */ /** Text input for content warning in composer. */
const SpoilerInput: React.FC<ISpoilerInput> = ({ const SpoilerInput = React.forwardRef<AutosuggestInput, ISpoilerInput>(({
composeId, composeId,
onSuggestionsFetchRequested, onSuggestionsFetchRequested,
onSuggestionsClearRequested, onSuggestionsClearRequested,
onSuggestionSelected, onSuggestionSelected,
}) => { }, ref) => {
const intl = useIntl(); const intl = useIntl();
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const compose = useCompose(composeId); const compose = useCompose(composeId);
@ -63,6 +63,7 @@ const SpoilerInput: React.FC<ISpoilerInput> = ({
searchTokens={[':']} searchTokens={[':']}
id='cw-spoiler-input' id='cw-spoiler-input'
className='rounded-md dark:!bg-transparent !bg-transparent' className='rounded-md dark:!bg-transparent !bg-transparent'
ref={ref}
autoFocus autoFocus
/> />
@ -74,6 +75,6 @@ const SpoilerInput: React.FC<ISpoilerInput> = ({
</Stack> </Stack>
</Stack> </Stack>
); );
}; });
export default SpoilerInput; export default SpoilerInput;