From 12f659372786c9b9dd3261b4663a4e840da64372 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Tue, 31 May 2016 16:14:28 -0400 Subject: PLT-2643 Fixed asynchronous autocomplete incorrectly replacing text (#3167) * Allowed different suggestions to match different text. Added a Suggestion base component. Improved text replacement used when filling in suggestions * Fixed formatting --- webapp/components/suggestion/command_provider.jsx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'webapp/components/suggestion/command_provider.jsx') diff --git a/webapp/components/suggestion/command_provider.jsx b/webapp/components/suggestion/command_provider.jsx index 36860fa66..73ae4deaa 100644 --- a/webapp/components/suggestion/command_provider.jsx +++ b/webapp/components/suggestion/command_provider.jsx @@ -1,11 +1,13 @@ // Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. +import React from 'react'; + import * as AsyncClient from 'utils/async_client.jsx'; -import React from 'react'; +import Suggestion from './suggestion.jsx'; -class CommandSuggestion extends React.Component { +class CommandSuggestion extends Suggestion { render() { const {item, isSelection, onClick} = this.props; @@ -30,16 +32,10 @@ class CommandSuggestion extends React.Component { } } -CommandSuggestion.propTypes = { - item: React.PropTypes.object.isRequired, - isSelection: React.PropTypes.bool, - onClick: React.PropTypes.func -}; - export default class CommandProvider { handlePretextChanged(suggestionId, pretext) { if (pretext.startsWith('/')) { - AsyncClient.getSuggestedCommands(pretext, suggestionId, CommandSuggestion); + AsyncClient.getSuggestedCommands(pretext, suggestionId, CommandSuggestion, pretext); } } } -- cgit v1.2.3-1-g7c22