Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/actions/insert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export class InsertAction {
private registerShortcut() {
const insertShortcut: ShortcutRegistry.KeyboardShortcut = {
name: this.insertShortcutName,
preconditionFn: this.insertPrecondition.bind(this),
preconditionFn: (workspace: WorkspaceSvg) =>
!workspace.isDragging() && this.insertPrecondition(workspace),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should go inside the insertPrecondition function instead of splitting up the logic here and in that named function. otherwise lgtm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that makes sense. Updated here 833e67b

callback: this.insertCallback.bind(this),
keyCodes: [KeyCodes.I],
};
Expand Down
2 changes: 1 addition & 1 deletion src/navigation_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export class NavigationController {
focusToolbox: {
name: Constants.SHORTCUT_NAMES.TOOLBOX,
preconditionFn: (workspace) =>
this.navigation.canCurrentlyEdit(workspace),
!workspace.isDragging() && this.navigation.canCurrentlyEdit(workspace),
callback: (workspace) => {
switch (this.navigation.getState(workspace)) {
case Constants.STATE.WORKSPACE:
Expand Down