Merge pull request #778 from mattermost/plt-43

PLT-43 Fixes backspace navigating back a page.
Этот коммит содержится в:
Corey Hulen
2015-09-24 08:58:32 -07:00
родитель d5343f997d 21a1eaa189
Коммит a7d75d3bce
2 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@@ -109,6 +109,13 @@ export default class ChannelLoader extends React.Component {
$('.modal-body').css('overflow-y', 'auto');
$('.modal-body').css('max-height', $(window).height() * 0.7);
});
/* Prevent backspace from navigating back a page */
$(window).on('keydown.preventBackspace', (e) => {
if (e.which === 8 && !$(e.target).is('input, textarea')) {
e.preventDefault();
}
});
}
componentWillUnmount() {
clearInterval(this.intervalId);
@@ -123,6 +130,8 @@ export default class ChannelLoader extends React.Component {
$('body').off('mouseenter mouseleave', '.post.post--comment.same--root');
$('.modal').off('show.bs.modal');
$(window).off('keydown.preventBackspace');
}
onSocketChange(msg) {
if (msg && msg.user_id && msg.user_id !== UserStore.getCurrentId()) {

Просмотреть файл

@@ -7,7 +7,8 @@ export default class SettingsSidebar extends React.Component {
this.handleClick = this.handleClick.bind(this);
}
handleClick(tab) {
handleClick(tab, e) {
e.preventDefault();
this.props.updateTab(tab.name);
$('.settings-modal').addClass('display--content');
}