Suggestion --> AutoSuggestion

merge-requests/1496/head
Alex Gleason 2022-06-04 18:36:34 -05:00
rodzic 318b9f0d3b
commit 328d3b9b59
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
2 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -3,7 +3,7 @@ import { throttle } from 'lodash';
import React, { useState, useRef, useCallback, useEffect } from 'react';
import { accountSearch } from 'soapbox/actions/accounts';
import AutosuggestInput, { Suggestion } from 'soapbox/components/autosuggest_input';
import AutosuggestInput, { AutoSuggestion } from 'soapbox/components/autosuggest_input';
import { useAppDispatch } from 'soapbox/hooks';
import type { Menu } from 'soapbox/components/dropdown_menu';
@ -59,7 +59,7 @@ const AutosuggestAccountInput: React.FC<IAutosuggestAccountInput> = ({
onChange(e);
};
const handleSelected = (_tokenStart: number, _lastToken: string | null, suggestion: Suggestion) => {
const handleSelected = (_tokenStart: number, _lastToken: string | null, suggestion: AutoSuggestion) => {
if (typeof suggestion === 'string' && suggestion[0] !== '#') {
onSelected(suggestion);
}

Wyświetl plik

@ -15,7 +15,7 @@ type CursorMatch = [
token: string | null,
];
export type Suggestion = string | Emoji;
export type AutoSuggestion = string | Emoji;
const textAtCursorMatchesToken = (str: string, caretPosition: number, searchTokens: string[]): CursorMatch => {
let word: string;
@ -47,7 +47,7 @@ interface IAutosuggestInput extends Pick<React.HTMLAttributes<HTMLInputElement>,
suggestions: ImmutableList<any>,
disabled?: boolean,
placeholder?: string,
onSuggestionSelected: (tokenStart: number, lastToken: string | null, suggestion: Suggestion) => void,
onSuggestionSelected: (tokenStart: number, lastToken: string | null, suggestion: AutoSuggestion) => void,
onSuggestionsClearRequested: () => void,
onSuggestionsFetchRequested: (token: string) => void,
autoFocus: boolean,
@ -195,7 +195,7 @@ export default class AutosuggestInput extends ImmutablePureComponent<IAutosugges
this.input = c;
}
renderSuggestion = (suggestion: Suggestion, i: number) => {
renderSuggestion = (suggestion: AutoSuggestion, i: number) => {
const { selectedSuggestion } = this.state;
let inner, key;