@@ -719,11 +719,19 @@ define(function (require, exports, module) {
719719 normalized ,
720720 normalizedDisplay ,
721721 explicitPlatform = keyBinding . platform || platform ,
722+ explicitBrowserOnly = keyBinding . browserOnly ,
723+ explicitNativeOnly = keyBinding . nativeOnly ,
722724 targetPlatform ,
723725 command ,
724726 bindingsToDelete = [ ] ,
725727 existing ;
726728
729+ if ( Phoenix . isNativeApp && explicitBrowserOnly ) {
730+ return null ;
731+ }
732+ if ( ! Phoenix . isNativeApp && explicitNativeOnly ) {
733+ return null ;
734+ }
727735 // For platform: "all", use explicit current platform
728736 if ( explicitPlatform && explicitPlatform !== "all" ) {
729737 targetPlatform = explicitPlatform ;
@@ -983,12 +991,13 @@ define(function (require, exports, module) {
983991 * Returns record(s) for valid key binding(s).
984992 *
985993 * @param {!string | Command } command - A command ID or command object
986- * @param {{key: string, displayKey:string, platform: string} } keyBindings
994+ * @param {{key: string, displayKey:string, platform: string, browserOnly: boolean, nativeOnly:boolean } } keyBindings
987995 * A single key binding or an array of keybindings.
988996 * In an array of keybinding `platform` property is also available. Example:
989997 * "Shift-Cmd-F". Mac and Win key equivalents are automatically
990998 * mapped to each other. Use displayKey property to display a different
991- * string (e.g. "CMD+" instead of "CMD=").
999+ * string (e.g. "CMD+" instead of "CMD="). if browserOnly is true, then the shortcut will only apply in browser
1000+ * if nativeOnly is set, the shortcut will only apply in native apps
9921001 * @param {?string } platform The target OS of the keyBindings either
9931002 * "mac", "win" or "linux". If undefined, all platforms not explicitly
9941003 * defined will use the key binding.
@@ -1022,7 +1031,7 @@ define(function (require, exports, module) {
10221031 // process platform-specific bindings first
10231032 keyBindings . sort ( _sortByPlatform ) ;
10241033
1025- keyBindings . forEach ( function addSingleBinding ( keyBindingRequest ) {
1034+ keyBindings . forEach ( function ( keyBindingRequest ) {
10261035 // attempt to add keybinding
10271036 keyBinding = _addBinding ( commandID , keyBindingRequest , {
10281037 platform : keyBindingRequest . platform ,
0 commit comments