mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-27 17:09:53 +02:00
add isModAlt
This commit is contained in:
@@ -141,12 +141,15 @@ The `data` object contains the `key` which is a string name of the key that was
|
|||||||
isLine: Boolean,
|
isLine: Boolean,
|
||||||
isMeta: Boolean,
|
isMeta: Boolean,
|
||||||
isMod: Boolean,
|
isMod: Boolean,
|
||||||
|
isModAlt: Boolean,
|
||||||
isShift: Boolean,
|
isShift: Boolean,
|
||||||
isWord: Boolean
|
isWord: Boolean
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The `isMod` boolean is true if the <kbd>control</kbd> key was pressed on Windows or the <kbd>command</kbd> key was pressed on Mac.
|
The `isMod` boolean is `true` if the <kbd>control</kbd> key was pressed on Windows or the <kbd>command</kbd> key was pressed on Mac _without_ the <kbd>alt/option<kbd> key was also being pressed. This is a convenience for adding hotkeys like <kbd>command+b</kbd>.
|
||||||
|
|
||||||
|
The `isModAlt` boolean is `true` if the <kbd>control</kbd> key was pressed on Windows or the <kbd>command</kbd> key was pressed on Mac _and_ the <kbd>alt/option<kbd> key was also being pressed. This is a convenience for secondary hotkeys like <kbd>command+option+1</kbd>.
|
||||||
|
|
||||||
The `isLine` and `isWord` booleans represent whether the "line modifier" or "word modifier" hotkeys are pressed when deleteing or moving the cursor. For example, on a Mac <kbd>option + right</kbd> moves the cursor to the right one word at a time.
|
The `isLine` and `isWord` booleans represent whether the "line modifier" or "word modifier" hotkeys are pressed when deleteing or moving the cursor. For example, on a Mac <kbd>option + right</kbd> moves the cursor to the right one word at a time.
|
||||||
|
|
||||||
|
@@ -508,6 +508,7 @@ class Content extends React.Component {
|
|||||||
data.isLine = IS_MAC ? e.metaKey : false
|
data.isLine = IS_MAC ? e.metaKey : false
|
||||||
data.isMeta = e.metaKey
|
data.isMeta = e.metaKey
|
||||||
data.isMod = IS_MAC ? e.metaKey && !e.altKey : e.ctrlKey && !e.altKey
|
data.isMod = IS_MAC ? e.metaKey && !e.altKey : e.ctrlKey && !e.altKey
|
||||||
|
data.isModAlt = IS_MAC ? e.metaKey && e.altKey : e.ctrlKey && e.altKey
|
||||||
data.isShift = e.shiftKey
|
data.isShift = e.shiftKey
|
||||||
data.isWord = IS_MAC ? e.altKey : e.ctrlKey
|
data.isWord = IS_MAC ? e.altKey : e.ctrlKey
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user