Skip to content

Commit

Permalink
feat: support space to start editing
Browse files Browse the repository at this point in the history
  • Loading branch information
Quorafind committed Jan 18, 2024
1 parent 2cc999f commit 5cd1572
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/canvasMindMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,6 @@ export default class CanvasMindMap extends Plugin {
});

this.scope.register([], "Enter", async () => {


const node = await createSiblingNode(this.canvas);
if (!node) return;

Expand All @@ -354,6 +352,19 @@ export default class CanvasMindMap extends Plugin {
this.canvas.zoomToSelection();
}, 0);
});

this.scope.register([], 'Space', async (ev: KeyboardEvent) => {
const selection = this.canvas.selection;
if (selection.size !== 1) return;
const node = selection.entries().next().value[1];

if (node?.label || node?.url) return;

if (node.isEditing) return;
node.startEditing();

});

return next.call(this);
}
});
Expand Down

0 comments on commit 5cd1572

Please sign in to comment.