* docs: process docs to include UX Stories requirement * docs: include note regarding different environments * Services init * Remove unused canny logos * docs: add ModalService diagram * docs: GIF of notification * docs: add ui-services page * docs: simplify ui services call out in the general services docs * docs: tips and tricks for UI services * docs: moar pages * docs: dialog gif * docs: services in summary/sidebar * docs: gif examples at top of dialog and notification pages * docs: add UIModal gif * docs: details for Dialog Service * docs: include usage information for ui modal service * docs: detailed information about our UI Notification Service * docs: services diagram * docs: remove unused links * docs: services example and image * docs: stubbing extension pages * docs: UX Stories --> User Cases * chore: eslint fix * docs: extensions overview + diagram * docs: update extensions in sidebar * docs: extension skeleton and registration info * docs: copy of maintained extensions table partial in the extensions folder * docs: swap out old extensions structure for new
35 lines
1.1 KiB
Markdown
35 lines
1.1 KiB
Markdown
# Module: Commands
|
|
|
|
The Commands Module allows us to register one or more commands scoped to
|
|
specific contexts. Commands can be run by [hotkeys][#], [toolbar buttons][#],
|
|
and any registered custom react component (like a [viewport][#] or [panel][#]).
|
|
Here is a simple example commands module:
|
|
|
|
```js
|
|
{
|
|
getCommandsModule() {
|
|
return {
|
|
actions: {
|
|
speak: ({ viewports, words }) => {
|
|
console.log(viewports, words);
|
|
},
|
|
},
|
|
definitions: {
|
|
rotateViewportCW: {
|
|
commandFn: actions.rotateViewport,
|
|
storeContexts: ['viewports'],
|
|
options: { rotation: 90 }
|
|
},
|
|
rotateViewportCCW: {
|
|
commandFn: actions.rotateViewport,
|
|
storeContexts: ['viewports'],
|
|
options: { rotation: -90 },
|
|
context: 'ACTIVE_VIEWER::CORNERSTONE'
|
|
},
|
|
},
|
|
defaultContext: 'VIEWER'
|
|
}
|
|
}
|
|
}
|
|
```
|