Skip to content

Commit bef7a2a

Browse files
committed
feat: add shortcuts
1 parent c51b400 commit bef7a2a

File tree

4 files changed

+27
-16
lines changed

4 files changed

+27
-16
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mind-elixir",
3-
"version": "3.2.2",
3+
"version": "3.2.3",
44
"type": "module",
55
"description": "Mind elixir is a free open source mind map core.",
66
"keywords": [

readme.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -325,14 +325,14 @@ Be aware that Mind Elixir will not observe the change of `prefers-color-scheme`.
325325
| Tab | Insert Child Node |
326326
| F1 | Center the Map |
327327
| F2 | Begin Editing the Current Node |
328-
| Up Arrow | Select the Previous Sibling Node |
329-
| Down Arrow | Select the Next Sibling Node |
330-
| Left/Right Arrow | Select Parent or First Child |
331-
| PageUp | Move Up Node |
332-
| PageDown | Move Down Node |
333-
| Ctrl + Up Arrow | Change Layout Pattern to Side |
334-
| Ctrl + Left Arrow | Change Layout Pattern to Left |
335-
| Ctrl + Right Arrow | Change Layout Pattern to Right |
328+
| | Select the Previous Sibling Node |
329+
| | Select the Next Sibling Node |
330+
| ← / → | Select Parent or First Child |
331+
| PageUp / Alt + ↑ | Move Up Node |
332+
| PageDown / Alt + ↓ | Move Down Node |
333+
| Ctrl + | Change Layout Pattern to Side |
334+
| Ctrl + | Change Layout Pattern to Left |
335+
| Ctrl + | Change Layout Pattern to Right |
336336
| Ctrl + C | Copy the Current Node |
337337
| Ctrl + V | Paste the Copied Node |
338338
| Ctrl + "+" | Zoom In Mind Map |

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ MindElixir.DARK_THEME = DARK_THEME
126126
* @memberof MindElixir
127127
* @static
128128
*/
129-
MindElixir.version = '3.2.2'
129+
MindElixir.version = '3.2.3'
130130
/**
131131
* @function
132132
* @memberof MindElixir

src/plugin/keypress.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@ const selectRoot = (mei: MindElixirInstance) => {
1515

1616
export default function (mind: MindElixirInstance) {
1717
const key2func: Record<string, (e: KeyboardEvent) => void> = {
18-
13: () => {
18+
13: e => {
1919
// enter
20-
mind.insertSibling()
20+
if (e.shiftKey) {
21+
mind.insertBefore()
22+
} else {
23+
mind.insertSibling()
24+
}
2125
},
2226
9: () => {
2327
// tab
@@ -33,14 +37,21 @@ export default function (mind: MindElixirInstance) {
3337
},
3438
38: e => {
3539
// up
36-
if (e.metaKey || e.ctrlKey) {
40+
if (e.altKey) {
41+
mind.moveUpNode()
42+
} else if (e.metaKey || e.ctrlKey) {
3743
return mind.initSide()
44+
} else {
45+
mind.selectPrevSibling()
3846
}
39-
mind.selectPrevSibling()
4047
},
41-
40: () => {
48+
40: e => {
4249
// down
43-
mind.selectNextSibling()
50+
if (e.altKey) {
51+
mind.moveDownNode()
52+
} else {
53+
mind.selectNextSibling()
54+
}
4455
},
4556
37: e => {
4657
// left

0 commit comments

Comments
 (0)