Skip to content

Commit

Permalink
feat: add shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
SSShooter committed Oct 8, 2023
1 parent c51b400 commit bef7a2a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mind-elixir",
"version": "3.2.2",
"version": "3.2.3",
"type": "module",
"description": "Mind elixir is a free open source mind map core.",
"keywords": [
Expand Down
16 changes: 8 additions & 8 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,14 @@ Be aware that Mind Elixir will not observe the change of `prefers-color-scheme`.
| Tab | Insert Child Node |
| F1 | Center the Map |
| F2 | Begin Editing the Current Node |
| Up Arrow | Select the Previous Sibling Node |
| Down Arrow | Select the Next Sibling Node |
| Left/Right Arrow | Select Parent or First Child |
| PageUp | Move Up Node |
| PageDown | Move Down Node |
| Ctrl + Up Arrow | Change Layout Pattern to Side |
| Ctrl + Left Arrow | Change Layout Pattern to Left |
| Ctrl + Right Arrow | Change Layout Pattern to Right |
| | Select the Previous Sibling Node |
| | Select the Next Sibling Node |
| ← / → | Select Parent or First Child |
| PageUp / Alt + ↑ | Move Up Node |
| PageDown / Alt + ↓ | Move Down Node |
| Ctrl + | Change Layout Pattern to Side |
| Ctrl + | Change Layout Pattern to Left |
| Ctrl + | Change Layout Pattern to Right |
| Ctrl + C | Copy the Current Node |
| Ctrl + V | Paste the Copied Node |
| Ctrl + "+" | Zoom In Mind Map |
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ MindElixir.DARK_THEME = DARK_THEME
* @memberof MindElixir
* @static
*/
MindElixir.version = '3.2.2'
MindElixir.version = '3.2.3'
/**
* @function
* @memberof MindElixir
Expand Down
23 changes: 17 additions & 6 deletions src/plugin/keypress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ const selectRoot = (mei: MindElixirInstance) => {

export default function (mind: MindElixirInstance) {
const key2func: Record<string, (e: KeyboardEvent) => void> = {
13: () => {
13: e => {
// enter
mind.insertSibling()
if (e.shiftKey) {
mind.insertBefore()
} else {
mind.insertSibling()
}
},
9: () => {
// tab
Expand All @@ -33,14 +37,21 @@ export default function (mind: MindElixirInstance) {
},
38: e => {
// up
if (e.metaKey || e.ctrlKey) {
if (e.altKey) {
mind.moveUpNode()
} else if (e.metaKey || e.ctrlKey) {
return mind.initSide()
} else {
mind.selectPrevSibling()
}
mind.selectPrevSibling()
},
40: () => {
40: e => {
// down
mind.selectNextSibling()
if (e.altKey) {
mind.moveDownNode()
} else {
mind.selectNextSibling()
}
},
37: e => {
// left
Expand Down

0 comments on commit bef7a2a

Please sign in to comment.