Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix the ctrl+k shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
dbkr committed Mar 6, 2019
1 parent ce1a985 commit 3a41206
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/components/structures/LeftPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ const LeftPanel = React.createClass({
);

const searchBox = (<SearchBox
enableRoomSearchFocus={true}
placeholder={ _t('Filter room names') }
onSearch={ this.onSearch }
onCleared={ this.onSearchCleared }
Expand Down
13 changes: 13 additions & 0 deletions src/components/structures/SearchBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ module.exports = React.createClass({
onCleared: PropTypes.func,
className: PropTypes.string,
placeholder: PropTypes.string.isRequired,

// If true, the search box will focus and clear itself
// on room search focus action (it would be nicer to take
// this functionality out, but not obvious how that would work)
enableRoomSearchFocus: PropTypes.bool,
},

getDefaultProps: function() {
return {
enableRoomSearchFocus: false,
};
},

getInitialState: function() {
Expand All @@ -47,6 +58,8 @@ module.exports = React.createClass({
},

onAction: function(payload) {
if (!this.props.enableRoomSearchFocus) return;

switch (payload.action) {
case 'view_room':
if (this.refs.search && payload.clear_search) {
Expand Down

0 comments on commit 3a41206

Please sign in to comment.