Actually complete the autosuggestion feature

rebase/4.0.0rc2
Eugen Rochko 2016-10-30 18:21:38 +01:00
parent c49f6290eb
commit 7e35650398
2 changed files with 3 additions and 3 deletions

View File

@ -143,7 +143,7 @@ export function fetchComposeSuggestions(token) {
return (dispatch, getState) => { return (dispatch, getState) => {
const loadedCandidates = getState().get('accounts').filter(item => item.get('acct').toLowerCase().slice(0, token.length) === token).map(item => ({ const loadedCandidates = getState().get('accounts').filter(item => item.get('acct').toLowerCase().slice(0, token.length) === token).map(item => ({
label: item.get('acct'), label: item.get('acct'),
completion: item.get('acct').slice(0, token.length) completion: item.get('acct').slice(token.length)
})).toList().toJS(); })).toList().toJS();
dispatch(readyComposeSuggestions(loadedCandidates)); dispatch(readyComposeSuggestions(loadedCandidates));

View File

@ -31,10 +31,10 @@ const getTokenForSuggestions = (str, caretPosition) => {
} }
}; };
const getSuggestionValue = suggestion => suggestion; const getSuggestionValue = suggestion => suggestion.completion;
const renderSuggestion = suggestion => ( const renderSuggestion = suggestion => (
<span>{suggestion}</span> <span>{suggestion.label}</span>
); );
const textareaStyle = { const textareaStyle = {