1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-03-07 06:20:07 +01:00

Fix missing isAltKey ()

This commit is contained in:
Leon Koole 2017-05-30 22:15:11 +02:00 committed by Ian Storm Taylor
parent 890d790d42
commit b6541854fa

@ -69,7 +69,7 @@ In this case our plugin object will have one property: a `onKeyDown` handler, wi
```js
function MarkHotkey(options) {
const { type, code } = options
const { type, code, isAltKey = false } = options
// Return our "plugin" object, containing the `onKeyDown` handler.
return {
@ -212,12 +212,12 @@ import keycode from `keycode`
function MarkHotkey(options) {
// Change the options to take a `key`.
const { type, key } = options
const { type, key, isAltKey = false } = options
return {
onKeyDown(event, data, state) {
// Change the comparison to use the key name.
if (!event.metaKey || keycode(event.which) != key) return
if (!event.metaKey || keycode(event.which) != key || event.altKey != isAltKey) return
event.preventDefault()
return state
.transform()