-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5167bb7
commit 3851f96
Showing
8 changed files
with
62 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
const MAC_COMPAT_KEY = Symbol('macCompat') | ||
export const MAC_COMPAT = { [MAC_COMPAT_KEY]: true } | ||
|
||
export function applyCompat(code, window, overrides, dir = 'forward') { | ||
if ( | ||
overrides[MAC_COMPAT_KEY] && | ||
window.navigator.platform.indexOf('Mac') === 0 && | ||
code.indexOf('meta+ctrl') === -1 | ||
) { | ||
return code.replace( | ||
...(dir === 'reverse' ? ['ctrl', 'meta'] : ['meta', 'ctrl']) | ||
) | ||
export function macCompat() { | ||
return (code, window, dir) => { | ||
if ( | ||
window.navigator.platform.indexOf('Mac') === 0 && | ||
code.indexOf('meta+ctrl') === -1 | ||
) { | ||
return code.replace(...(dir ? ['ctrl', 'meta'] : ['meta', 'ctrl'])) | ||
} | ||
return code | ||
} | ||
return code | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters