Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
668199e219
2 changed files with 26 additions and 12 deletions
|
@ -30,6 +30,7 @@ var RoomNotifs = require('matrix-react-sdk/lib/RoomNotifs');
|
||||||
var FormattingUtils = require('matrix-react-sdk/lib/utils/FormattingUtils');
|
var FormattingUtils = require('matrix-react-sdk/lib/utils/FormattingUtils');
|
||||||
var AccessibleButton = require('matrix-react-sdk/lib/components/views/elements/AccessibleButton');
|
var AccessibleButton = require('matrix-react-sdk/lib/components/views/elements/AccessibleButton');
|
||||||
import Modal from 'matrix-react-sdk/lib/Modal';
|
import Modal from 'matrix-react-sdk/lib/Modal';
|
||||||
|
import KeyCode from 'matrix-react-sdk/lib/KeyCode';
|
||||||
|
|
||||||
// turn this on for drop & drag console debugging galore
|
// turn this on for drop & drag console debugging galore
|
||||||
var debug = false;
|
var debug = false;
|
||||||
|
@ -151,10 +152,11 @@ var RoomSubList = React.createClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onRoomTileClick(roomId) {
|
onRoomTileClick(roomId, ev) {
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'view_room',
|
action: 'view_room',
|
||||||
room_id: roomId,
|
room_id: roomId,
|
||||||
|
clear_search: (ev && (ev.keyCode == KeyCode.ENTER || ev.keyCode == KeyCode.SPACE)),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,13 @@ limitations under the License.
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var React = require('react');
|
import React from 'react';
|
||||||
import { _t } from 'matrix-react-sdk/lib/languageHandler';
|
import { _t } from 'matrix-react-sdk/lib/languageHandler';
|
||||||
var sdk = require('matrix-react-sdk')
|
import KeyCode from 'matrix-react-sdk/lib/KeyCode';
|
||||||
var dis = require('matrix-react-sdk/lib/dispatcher');
|
import sdk from 'matrix-react-sdk';
|
||||||
var rate_limited_func = require('matrix-react-sdk/lib/ratelimitedfunc');
|
import dis from 'matrix-react-sdk/lib/dispatcher';
|
||||||
var AccessibleButton = require('matrix-react-sdk/lib/components/views/elements/AccessibleButton');
|
import rate_limited_func from 'matrix-react-sdk/lib/ratelimitedfunc';
|
||||||
|
import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton';
|
||||||
|
|
||||||
module.exports = React.createClass({
|
module.exports = React.createClass({
|
||||||
displayName: 'SearchBox',
|
displayName: 'SearchBox',
|
||||||
|
@ -46,18 +47,19 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
onAction: function(payload) {
|
onAction: function(payload) {
|
||||||
// Disabling this as I find it really really annoying, and was used to the
|
|
||||||
// previous behaviour - see https://github.com/vector-im/riot-web/issues/3348
|
|
||||||
/*
|
|
||||||
switch (payload.action) {
|
switch (payload.action) {
|
||||||
// Clear up the text field when a room is selected.
|
|
||||||
case 'view_room':
|
case 'view_room':
|
||||||
if (this.refs.search) {
|
if (this.refs.search && payload.clear_search) {
|
||||||
this._clearSearch();
|
this._clearSearch();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'focus_room_filter':
|
||||||
|
if (this.refs.search) {
|
||||||
|
this.refs.search.focus();
|
||||||
|
this.refs.search.select();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onChange: function() {
|
onChange: function() {
|
||||||
|
@ -86,6 +88,15 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onKeyDown: function(ev) {
|
||||||
|
switch (ev.keyCode) {
|
||||||
|
case KeyCode.ESCAPE:
|
||||||
|
this._clearSearch();
|
||||||
|
dis.dispatch({action: 'focus_composer'});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
_clearSearch: function() {
|
_clearSearch: function() {
|
||||||
this.refs.search.value = "";
|
this.refs.search.value = "";
|
||||||
this.onChange();
|
this.onChange();
|
||||||
|
@ -135,6 +146,7 @@ module.exports = React.createClass({
|
||||||
className="mx_SearchBox_search"
|
className="mx_SearchBox_search"
|
||||||
value={ this.state.searchTerm }
|
value={ this.state.searchTerm }
|
||||||
onChange={ this.onChange }
|
onChange={ this.onChange }
|
||||||
|
onKeyDown={ this._onKeyDown }
|
||||||
placeholder={ _t('Filter room names') }
|
placeholder={ _t('Filter room names') }
|
||||||
/>
|
/>
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue