Skip to content

Commit dc5f6e7

Browse files
fix: Disallow toolbox/insert during a keyboard-driven move (#425)
* fix: Disallow toolbox/insert during a keyboard-driven move * Review feedback
1 parent 9c6e622 commit dc5f6e7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/actions/insert.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ export class InsertAction {
101101
* @returns True iff `insertCallback` function should be called.
102102
*/
103103
private insertPrecondition(workspace: WorkspaceSvg): boolean {
104-
return this.navigation.canCurrentlyEdit(workspace);
104+
return (
105+
!workspace.isDragging() && this.navigation.canCurrentlyEdit(workspace)
106+
);
105107
}
106108

107109
/**

src/navigation_controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export class NavigationController {
244244
focusToolbox: {
245245
name: Constants.SHORTCUT_NAMES.TOOLBOX,
246246
preconditionFn: (workspace) =>
247-
this.navigation.canCurrentlyEdit(workspace),
247+
!workspace.isDragging() && this.navigation.canCurrentlyEdit(workspace),
248248
callback: (workspace) => {
249249
switch (this.navigation.getState(workspace)) {
250250
case Constants.STATE.WORKSPACE:

0 commit comments

Comments
 (0)