Auto-complete clicked suggestions
This commit is contained in:
parent
0dbb8d5294
commit
e541ddb060
5 changed files with 44 additions and 15 deletions
|
@ -93,6 +93,7 @@ module.exports = React.createClass({
|
|||
wordSuffix: " ",
|
||||
allowLooping: false,
|
||||
autoEnterTabComplete: true,
|
||||
onClickCompletes: true,
|
||||
onStateChange: (isCompleting) => {
|
||||
this.forceUpdate();
|
||||
}
|
||||
|
|
|
@ -201,8 +201,8 @@ module.exports = React.createClass({
|
|||
this.onEnter(ev);
|
||||
}
|
||||
else if (ev.keyCode === KeyCode.TAB) {
|
||||
var memberList = [];
|
||||
if (this.props.room) {
|
||||
if (this.props.tabComplete && this.props.room) {
|
||||
var memberList = [];
|
||||
// TODO: We should cache this list and only update it when the
|
||||
// member list changes. It's also horrendous that this is done here.
|
||||
memberList = this.props.room.getJoinedMembers().sort(function(a, b) {
|
||||
|
@ -231,8 +231,6 @@ module.exports = React.createClass({
|
|||
}).map(function(m) {
|
||||
return new MemberEntry(m);
|
||||
});
|
||||
}
|
||||
if (this.props.tabComplete) {
|
||||
this.props.tabComplete.setCompletionList(memberList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,10 +31,11 @@ module.exports = React.createClass({
|
|||
<div className="mx_TabCompleteBar">
|
||||
{this.props.entries.map(function(entry, i) {
|
||||
return (
|
||||
<div key={entry.getKey() || i + ""} className="mx_TabCompleteBar_item">
|
||||
<div key={entry.getKey() || i + ""} className="mx_TabCompleteBar_item"
|
||||
onClick={entry.onClick.bind(entry)} >
|
||||
{entry.getImageJsx()}
|
||||
<span className="mx_TabCompleteBar_text">
|
||||
{entry.text}
|
||||
{entry.getText()}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue