Skip to content

Commit 555c5de

Browse files
authored
Merge pull request #162 from ssshooter/v1.1.5
V1.1.5
2 parents d68c681 + 6b6ab79 commit 555c5de

File tree

10 files changed

+35
-20
lines changed

10 files changed

+35
-20
lines changed

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mind-elixir",
3-
"version": "1.1.4",
3+
"version": "1.1.5",
44
"description": "Mind elixir is a free open source mind map core.",
55
"main": "dist/MindElixir.js",
66
"scripts": {
@@ -16,8 +16,11 @@
1616
"beta": "npm run build && npm publish --tag beta"
1717
},
1818
"lint-staged": {
19-
"src/**/*.{ts,js,json}": [
19+
"src/**/*.{ts,js}": [
2020
"eslint --cache --fix"
21+
],
22+
"src/**/*.{json,less}": [
23+
"prettier --write"
2124
]
2225
},
2326
"files": [

readme.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,15 @@ Mind elixir is a free open source mind map core.
3131

3232
- [Doc](#doc)
3333
- [Try now](#try-now)
34-
- [Playground](#playground)
34+
- [Playground](#playground)
35+
- [Vanilla JS](#vanilla-js)
36+
- [Use with React](#use-with-react)
37+
- [Use with Vue](#use-with-vue)
38+
- [Use with Vue3](#use-with-vue3)
3539
- [Usage](#usage)
3640
- [Install](#install)
41+
- [NPM](#npm)
42+
- [Script tag](#script-tag)
3743
- [HTML structure](#html-structure)
3844
- [Init](#init)
3945
- [Data Structure](#data-structure)
@@ -110,7 +116,7 @@ import MindElixir, { E } from 'mind-elixir'
110116

111117
```javascript
112118
import MindElixir, { E } from 'mind-elixir'
113-
import example from '../dist/example1'
119+
import example from 'mind-elixir/dist/example1'
114120

115121
let options = {
116122
el: '#map', // or HTMLDivElement

src/dev.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const options = {
3636
},
3737
],
3838
},
39+
mobileMenu: true,
3940
toolBar: true,
4041
nodeMenu: true,
4142
keypress: true,

src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ export interface MindElixirInstance {
118118
inputDiv: HTMLElement | null
119119
scaleVal: number
120120
tempDirection: number | null
121-
bus: object // wip
121+
bus: {
122+
addListener: (type, handler) => void
123+
} // wip
122124

123125
// wip
124126
history: operation[]
@@ -253,7 +255,7 @@ function MindElixir(
253255
this.primaryNodeVerticalGap = primaryNodeVerticalGap
254256

255257
this.bus = new Bus()
256-
;(this.bus as any).addListener('operation', (operation: operation) => {
258+
this.bus.addListener('operation', (operation: operation) => {
257259
if (this.isUndo) {
258260
this.isUndo = false
259261
return

src/plugin/contextMenu.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmenu {
1+
.mind-elixir .context-menu {
22
position: fixed;
33
top: 0;
44
left: 0;

src/plugin/contextMenu.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ export default function (mind, option) {
5252
}
5353
}
5454
}
55-
const menuContainer = document.createElement('cmenu')
55+
const menuContainer = document.createElement('div')
56+
menuContainer.className = 'context-menu'
5657
menuContainer.appendChild(menuUl)
5758
menuContainer.hidden = true
5859

@@ -107,44 +108,44 @@ export default function (mind, option) {
107108
if (e.target === menuContainer) menuContainer.hidden = true
108109
}
109110

110-
add_child.onclick = e => {
111+
add_child.onclick = () => {
111112
mind.addChild()
112113
menuContainer.hidden = true
113114
}
114-
add_parent.onclick = e => {
115+
add_parent.onclick = () => {
115116
mind.insertParent()
116117
menuContainer.hidden = true
117118
}
118-
add_sibling.onclick = e => {
119+
add_sibling.onclick = () => {
119120
if (isRoot) return
120121
mind.insertSibling()
121122
menuContainer.hidden = true
122123
}
123-
remove_child.onclick = e => {
124+
remove_child.onclick = () => {
124125
if (isRoot) return
125126
mind.removeNode()
126127
menuContainer.hidden = true
127128
}
128-
focus.onclick = e => {
129+
focus.onclick = () => {
129130
if (isRoot) return
130131
mind.focusNode(mind.currentNode)
131132
menuContainer.hidden = true
132133
}
133-
unfocus.onclick = e => {
134+
unfocus.onclick = () => {
134135
mind.cancelFocus()
135136
menuContainer.hidden = true
136137
}
137-
up.onclick = e => {
138+
up.onclick = () => {
138139
if (isRoot) return
139140
mind.moveUpNode()
140141
menuContainer.hidden = true
141142
}
142-
down.onclick = e => {
143+
down.onclick = () => {
143144
if (isRoot) return
144145
mind.moveDownNode()
145146
menuContainer.hidden = true
146147
}
147-
link.onclick = e => {
148+
link.onclick = () => {
148149
menuContainer.hidden = true
149150
const from = mind.currentNode
150151
const tips = createTips(i18n[locale].clickTips)

src/plugin/mobileMenu.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
mmenu {
1+
.mind-elixir .mobile-menu {
22
position: absolute;
33
left: 20px;
44
bottom: 70px;

src/plugin/mobileMenu.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export default function (mind, option?) {
3636
}
3737
}
3838
const menuContainer = document.createElement('mmenu')
39+
menuContainer.className = 'mobile-menu'
3940
menuContainer.appendChild(add_child)
4041
menuContainer.appendChild(add_sibling)
4142
menuContainer.appendChild(remove_child)

src/plugin/nodeMenu.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
nmenu {
1+
.mind-elixir .node-menu {
22
position: absolute;
33
right: 20px;
44
top: 20px;

src/plugin/nodeMenu.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ export default function (mind) {
7272
const memoDiv = createDiv('nm-memo', `${i18n[locale].memo || 'Memo'}<textarea class="nm-memo" rows="5" tabindex="-1" />`)
7373

7474
// create container
75-
const menuContainer = document.createElement('nmenu')
75+
const menuContainer = document.createElement('div')
76+
menuContainer.className = 'node-menu'
7677
menuContainer.innerHTML = `
7778
<div class="button-container"><svg class="icon" aria-hidden="true">
7879
<use xlink:href="#icon-close"></use>

0 commit comments

Comments
 (0)