site-logo-fallback
Justin 2022-05-16 11:21:17 -04:00
rodzic beb58a7d86
commit 7b9db5299a
1 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -14,7 +14,7 @@ import AutosuggestEmoji from './autosuggest_emoji';
const textAtCursorMatchesToken = (str, caretPosition) => {
let word;
const left = str.slice(0, caretPosition).search(/\S+$/);
const left = str.slice(0, caretPosition).search(/\S+$/);
const right = str.slice(caretPosition).search(/\s/);
if (right < 0) {
@ -69,7 +69,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
};
onChange = (e) => {
const [ tokenStart, token ] = textAtCursorMatchesToken(e.target.value, e.target.selectionStart);
const [tokenStart, token] = textAtCursorMatchesToken(e.target.value, e.target.selectionStart);
if (token !== null && this.state.lastToken !== token) {
this.setState({ lastToken: token, selectedSuggestion: 0, tokenStart });
@ -123,7 +123,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
break;
case 'Enter':
case 'Tab':
// Select suggestion
// Select suggestion
if (this.state.lastToken !== null && suggestions.size > 0 && !suggestionsHidden) {
e.preventDefault();
e.stopPropagation();
@ -200,13 +200,13 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
if (typeof suggestion === 'object') {
inner = <AutosuggestEmoji emoji={suggestion} />;
key = suggestion.id;
key = suggestion.id;
} else if (suggestion[0] === '#') {
inner = suggestion;
key = suggestion;
key = suggestion;
} else {
inner = <AutosuggestAccount id={suggestion} />;
key = suggestion;
key = suggestion;
}
return (