diff --git a/src/editor/index.js b/src/editor/index.js index fbd03eee2..ae7c90166 100644 --- a/src/editor/index.js +++ b/src/editor/index.js @@ -51,9 +51,9 @@ * * `asset:upload:response` - On upload response, passes the result as an argument * ## Keymaps * * `keymap:add` - New keymap added. The new keyamp object is passed as an argument + * * `keymap:remove` - Keymap removed. The removed keyamp object is passed as an argument * * `keymap:emit` - Some keymap emitted, in arguments you get keymapId, shortcutUsed, Event * * `keymap:emit:{keymapId}` - `keymapId` emitted, in arguments you get keymapId, shortcutUsed, Event - * * `keymap:remove` - Keymap removed. The removed keyamp object is passed as an argument * ## Style Manager * * `styleManager:change` - Triggered on style property change from new selected component, the view of the property is passed as an argument to the callback * * `styleManager:change:{propertyName}` - As above but for a specific style property diff --git a/src/keymaps/index.js b/src/keymaps/index.js index 52ba223df..292884201 100644 --- a/src/keymaps/index.js +++ b/src/keymaps/index.js @@ -53,11 +53,16 @@ module.exports = () => { * or just a command id as a string * @example * // 'ns' is just a custom namespace - * keymaps.add('ns:my-keymap', '⌘+s, ctrl+s', editor => { + * keymaps.add('ns:my-keymap', '⌘+j, ⌘+u, ctrl+j, alt+u', editor => { * console.log('do stuff'); * }); * // or * keymaps.add('ns:my-keymap', '⌘+s, ctrl+s', 'some-gjs-command'); + * + * // listen to events + * editor.on('keymap:emit', (id, shortcut, e) => { + * // ... + * }) */ add(id, keys, handler) { const em = this.em;