diff --git a/docs/reference/plugins/plugins.md b/docs/reference/plugins/plugins.md index ac8bdf95b..e7b32141f 100644 --- a/docs/reference/plugins/plugins.md +++ b/docs/reference/plugins/plugins.md @@ -141,12 +141,15 @@ The `data` object contains the `key` which is a string name of the key that was isLine: Boolean, isMeta: Boolean, isMod: Boolean, + isModAlt: Boolean, isShift: Boolean, isWord: Boolean } ``` -The `isMod` boolean is true if the control key was pressed on Windows or the command key was pressed on Mac. +The `isMod` boolean is `true` if the control key was pressed on Windows or the command key was pressed on Mac _without_ the alt/option key was also being pressed. This is a convenience for adding hotkeys like command+b. + +The `isModAlt` boolean is `true` if the control key was pressed on Windows or the command key was pressed on Mac _and_ the alt/option key was also being pressed. This is a convenience for secondary hotkeys like command+option+1. 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 option + right moves the cursor to the right one word at a time. diff --git a/lib/components/content.js b/lib/components/content.js index 5163e17c9..4e2db718e 100644 --- a/lib/components/content.js +++ b/lib/components/content.js @@ -508,6 +508,7 @@ class Content extends React.Component { data.isLine = IS_MAC ? e.metaKey : false data.isMeta = e.metaKey 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.isWord = IS_MAC ? e.altKey : e.ctrlKey