This repository was archived by the owner on Feb 6, 2023. It is now read-only.
Commit 98e7730
KeyBindingUtil: add usesMacOSHeuristics method (#869)
Summary:
**Summary**
Add a public method, `usesMacOSHeuristics`, to the `KeyBindingUtil` module. This makes it possible to determine how draft-js will interpret certain keyboard events and thus alter the UI accordingly, e.g.;
<img width="499" alt="screenshot 2016-12-13 at 17 58 33" src="https://cloud.githubusercontent.com/assets/6705160/21150013/dee64566-c15d-11e6-9639-75a39d21d079.png">
I currently achieve this by doing (🙈);
```js
const COMMAND_MODIFIER_CHAR = (navigator && navigator.userAgent.indexOf('Mac') >= 0)
? '\u2318' // Mac command key character
: 'Ctrl'
```
Pull Request resolved: #869
Differential Revision: D9734962
fbshipit-source-id: ed3f3d0a87df51c708fd666fe85bc6acba1ecfee1 parent c6ff39d commit 98e7730
File tree
2 files changed
+13
-0
lines changed- docs
- src/component/utils
2 files changed
+13
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
31 | 40 | | |
32 | 41 | | |
33 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
| |||
0 commit comments