Browse Source

Update keymap docs

pull/540/head
Artur Arseniev 9 years ago
parent
commit
079fa4c5ed
  1. 2
      src/editor/index.js
  2. 7
      src/keymaps/index.js

2
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

7
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;

Loading…
Cancel
Save