Skip to content

Commit

Permalink
Merge pull request #162 from ssshooter/v1.1.5
Browse files Browse the repository at this point in the history
V1.1.5
  • Loading branch information
SSShooter authored Mar 16, 2023
2 parents d68c681 + 6b6ab79 commit 555c5de
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 20 deletions.
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mind-elixir",
"version": "1.1.4",
"version": "1.1.5",
"description": "Mind elixir is a free open source mind map core.",
"main": "dist/MindElixir.js",
"scripts": {
Expand All @@ -16,8 +16,11 @@
"beta": "npm run build && npm publish --tag beta"
},
"lint-staged": {
"src/**/*.{ts,js,json}": [
"src/**/*.{ts,js}": [
"eslint --cache --fix"
],
"src/**/*.{json,less}": [
"prettier --write"
]
},
"files": [
Expand Down
10 changes: 8 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,15 @@ Mind elixir is a free open source mind map core.

- [Doc](#doc)
- [Try now](#try-now)
- [Playground](#playground)
- [Playground](#playground)
- [Vanilla JS](#vanilla-js)
- [Use with React](#use-with-react)
- [Use with Vue](#use-with-vue)
- [Use with Vue3](#use-with-vue3)
- [Usage](#usage)
- [Install](#install)
- [NPM](#npm)
- [Script tag](#script-tag)
- [HTML structure](#html-structure)
- [Init](#init)
- [Data Structure](#data-structure)
Expand Down Expand Up @@ -110,7 +116,7 @@ import MindElixir, { E } from 'mind-elixir'

```javascript
import MindElixir, { E } from 'mind-elixir'
import example from '../dist/example1'
import example from 'mind-elixir/dist/example1'

let options = {
el: '#map', // or HTMLDivElement
Expand Down
1 change: 1 addition & 0 deletions src/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const options = {
},
],
},
mobileMenu: true,
toolBar: true,
nodeMenu: true,
keypress: true,
Expand Down
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ export interface MindElixirInstance {
inputDiv: HTMLElement | null
scaleVal: number
tempDirection: number | null
bus: object // wip
bus: {
addListener: (type, handler) => void
} // wip

// wip
history: operation[]
Expand Down Expand Up @@ -253,7 +255,7 @@ function MindElixir(
this.primaryNodeVerticalGap = primaryNodeVerticalGap

this.bus = new Bus()
;(this.bus as any).addListener('operation', (operation: operation) => {
this.bus.addListener('operation', (operation: operation) => {
if (this.isUndo) {
this.isUndo = false
return
Expand Down
2 changes: 1 addition & 1 deletion src/plugin/contextMenu.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmenu {
.mind-elixir .context-menu {
position: fixed;
top: 0;
left: 0;
Expand Down
21 changes: 11 additions & 10 deletions src/plugin/contextMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export default function (mind, option) {
}
}
}
const menuContainer = document.createElement('cmenu')
const menuContainer = document.createElement('div')
menuContainer.className = 'context-menu'
menuContainer.appendChild(menuUl)
menuContainer.hidden = true

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

add_child.onclick = e => {
add_child.onclick = () => {
mind.addChild()
menuContainer.hidden = true
}
add_parent.onclick = e => {
add_parent.onclick = () => {
mind.insertParent()
menuContainer.hidden = true
}
add_sibling.onclick = e => {
add_sibling.onclick = () => {
if (isRoot) return
mind.insertSibling()
menuContainer.hidden = true
}
remove_child.onclick = e => {
remove_child.onclick = () => {
if (isRoot) return
mind.removeNode()
menuContainer.hidden = true
}
focus.onclick = e => {
focus.onclick = () => {
if (isRoot) return
mind.focusNode(mind.currentNode)
menuContainer.hidden = true
}
unfocus.onclick = e => {
unfocus.onclick = () => {
mind.cancelFocus()
menuContainer.hidden = true
}
up.onclick = e => {
up.onclick = () => {
if (isRoot) return
mind.moveUpNode()
menuContainer.hidden = true
}
down.onclick = e => {
down.onclick = () => {
if (isRoot) return
mind.moveDownNode()
menuContainer.hidden = true
}
link.onclick = e => {
link.onclick = () => {
menuContainer.hidden = true
const from = mind.currentNode
const tips = createTips(i18n[locale].clickTips)
Expand Down
2 changes: 1 addition & 1 deletion src/plugin/mobileMenu.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mmenu {
.mind-elixir .mobile-menu {
position: absolute;
left: 20px;
bottom: 70px;
Expand Down
1 change: 1 addition & 0 deletions src/plugin/mobileMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default function (mind, option?) {
}
}
const menuContainer = document.createElement('mmenu')
menuContainer.className = 'mobile-menu'
menuContainer.appendChild(add_child)
menuContainer.appendChild(add_sibling)
menuContainer.appendChild(remove_child)
Expand Down
2 changes: 1 addition & 1 deletion src/plugin/nodeMenu.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
nmenu {
.mind-elixir .node-menu {
position: absolute;
right: 20px;
top: 20px;
Expand Down
3 changes: 2 additions & 1 deletion src/plugin/nodeMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export default function (mind) {
const memoDiv = createDiv('nm-memo', `${i18n[locale].memo || 'Memo'}<textarea class="nm-memo" rows="5" tabindex="-1" />`)

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

0 comments on commit 555c5de

Please sign in to comment.