diff --git a/biz/webui/htdocs/src/js/index.js b/biz/webui/htdocs/src/js/index.js index c98e05d7c..5b12124b5 100644 --- a/biz/webui/htdocs/src/js/index.js +++ b/biz/webui/htdocs/src/js/index.js @@ -749,6 +749,17 @@ var Index = React.createClass({ self.importSessions(e); e.preventDefault(); } + + if ( + (util.IS_MACOS && e.key === 'Backspace' && e.metaKey === true) || + (!util.IS_MACOS && e.key === 'Delete') + ) { + if (self.state.name === 'rules') { + self.removeRules(); + } else if (self.state.name === 'values') { + self.removeValues(); + } + } }); function getKey(url) { diff --git a/biz/webui/htdocs/src/js/util.js b/biz/webui/htdocs/src/js/util.js index 658a6fc0a..4b1af4493 100644 --- a/biz/webui/htdocs/src/js/util.js +++ b/biz/webui/htdocs/src/js/util.js @@ -17,6 +17,10 @@ var dragTarget, dragOffset, dragCallback; var logTempId = 0; var LEVELS = ['fatal', 'error', 'warn', 'info', 'debug']; +var IS_MACOS = navigator.userAgent.indexOf('Macintosh') >= 0; + +exports.IS_MACOS = IS_MACOS; + function noop(_) { return _; } @@ -277,7 +281,7 @@ exports.getExtension = function(headers) { } type = type || getRawType(headers); type = type.substring(type.indexOf('/') + 1).toLowerCase(); - return /\w+/.test(type) ? '.' + RegExp['$&'] : ''; + return /\w+/.test(type) ? '.' + RegExp['$&'] : ''; }; function getContentType(type) {