Skip to content

Commit 3ff07da

Browse files
cdedarm4b
authored andcommitted
fix hotkey actions running twice
(cherry picked from commit b423602)
1 parent fee4f85 commit 3ff07da

File tree

2 files changed

+11
-25
lines changed

2 files changed

+11
-25
lines changed

apps/st2-workflows/workflows.component.js

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import React, { Component } from 'react';
1717
// import ReactDOM from 'react-dom';
1818
import { Provider, connect } from 'react-redux';
1919
import { PropTypes } from 'prop-types';
20-
import { HotKeys } from 'react-hotkeys';
2120
import { mapValues, get } from 'lodash';
2221
import cx from 'classnames';
2322
import url from 'url';
@@ -283,17 +282,6 @@ export default class Workflows extends Component {
283282

284283
style = style
285284

286-
keyMap = {
287-
copy: [ 'ctrl+c', 'command+c', 'meta+c' ],
288-
cut: [ 'ctrl+x', 'command+x', 'meta+x' ],
289-
paste: [ 'ctrl+v', 'command+v', 'meta+v' ],
290-
open: [ 'ctrl+o', 'command+o', 'meta+o' ],
291-
undo: [ 'ctrl+z', 'command+z', 'meta+z' ],
292-
redo: [ 'ctrl+shift+z', 'command+shift+z', 'meta+shift+z' ],
293-
save: [ 'ctrl+s', 'command+s', 'meta+s' ],
294-
handleTaskDelete: [ 'del', 'backspace' ],
295-
}
296-
297285
keyHandlers = {
298286
undo: () => {
299287
store.dispatch({ type: 'FLOW_UNDO' });
@@ -349,10 +337,8 @@ export default class Workflows extends Component {
349337
<Menu location={location} routes={this.props.routes} />
350338
<div className="component-row-content">
351339
{ !isCollapsed.palette && <Palette className="palette" actions={actions} /> }
352-
<HotKeys
340+
<div
353341
style={{ flex: 1}}
354-
keyMap={this.keyMap}
355-
handlers={this.keyHandlers}
356342
>
357343
<Canvas className="canvas" location={location} match={match} fetchActionscalled={e => this.props.fetchActions()} save={this.keyHandlers.save} dirtyflag={this.props.dirty} undo={this.keyHandlers.undo} redo={this.keyHandlers.redo}>
358344
<Toolbar>
@@ -404,7 +390,7 @@ export default class Workflows extends Component {
404390
</ToolbarDropdown>
405391
</Toolbar>
406392
</Canvas>
407-
</HotKeys>
393+
</div>
408394
{ !isCollapsed.details && <Details className="details" actions={actions} /> }
409395
</div>
410396
</div>

modules/st2flow-canvas/index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -719,13 +719,13 @@ export default class Canvas extends Component {
719719
focused={true}
720720
attach={document.body}
721721
keyMap={{
722-
copy: [ 'ctrl+c', 'command+c', 'meta+c' ],
723-
cut: [ 'ctrl+x', 'command+x', 'meta+x' ],
724-
paste: [ 'ctrl+v', 'command+v', 'meta+v' ],
725-
open: [ 'ctrl+o', 'command+o', 'meta+o' ],
726-
undo: [ 'ctrl+z', 'command+z', 'meta+z' ],
727-
redo: [ 'ctrl+shift+z', 'command+shift+z', 'meta+shift+z' ],
728-
save: [ 'ctrl+s', 'command+s', 'meta+s' ],
722+
copy: [ 'ctrl+c', 'command+c' ],
723+
cut: [ 'ctrl+x', 'command+x' ],
724+
paste: [ 'ctrl+v', 'command+v' ],
725+
open: [ 'ctrl+o', 'command+o' ],
726+
undo: [ 'ctrl+z', 'command+z' ],
727+
redo: [ 'ctrl+shift+z', 'command+shift+z' ],
728+
save: [ 'ctrl+s', 'command+s' ],
729729
}}
730730
handlers={{
731731
copy: () => {
@@ -752,7 +752,7 @@ export default class Canvas extends Component {
752752

753753
const newCoords = {
754754
x: taskCoords.x,
755-
y: taskCoords.y + taskHeight + 10
755+
y: taskCoords.y + taskHeight + 10,
756756
};
757757

758758
const lastIndex = tasks
@@ -781,7 +781,7 @@ export default class Canvas extends Component {
781781
e.preventDefault();
782782
e.stopPropagation();
783783
this.props.save();
784-
}
784+
},
785785
}}
786786
>
787787
<div

0 commit comments

Comments
 (0)