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

Fix the ctrl+k shortcut #2759

Merged
merged 1 commit into from
Mar 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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