Skip to content

Commit af92edb

Browse files
committed
fix(nodeMenu): clear tags and icons while it's empty
v.0.19.7 fixed #85
1 parent f43f8a2 commit af92edb

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
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": "0.19.6",
3+
"version": "0.19.7",
44
"description": "Mind elixir is a free open source mind map core.",
55
"main": "dist/MindElixir.js",
66
"scripts": {

src/plugin/nodeMenu.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,16 @@ export default function(mind) {
150150
}
151151
tagInput.onchange = (e:InputEvent & { target: HTMLInputElement}) => {
152152
if (!mind.currentNode) return
153-
if (e.target.value) {
153+
if (typeof e.target.value === 'string') {
154154
const newTags = e.target.value.split(',')
155-
mind.updateNodeTags(mind.currentNode.nodeObj, newTags)
155+
mind.updateNodeTags(mind.currentNode.nodeObj, newTags.filter(tag => tag))
156156
}
157157
}
158158
iconInput.onchange = (e:InputEvent & { target: HTMLInputElement}) => {
159159
if (!mind.currentNode) return
160-
if (e.target.value) {
160+
if (typeof e.target.value === 'string') {
161161
const newIcons = e.target.value.split(',')
162-
mind.updateNodeIcons(mind.currentNode.nodeObj, newIcons)
162+
mind.updateNodeIcons(mind.currentNode.nodeObj, newIcons.filter(icon => icon))
163163
}
164164
}
165165
let state = 'open'

src/utils/dom.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ export const shapeTpc = function(tpc: Topic, nodeObj: NodeObj) {
4545
linkContainer.href = nodeObj.hyperLink
4646
tpc.appendChild(linkContainer)
4747
}
48-
if (nodeObj.icons) {
48+
if (nodeObj.icons && nodeObj.icons.length) {
4949
const iconsContainer = $d.createElement('span')
5050
iconsContainer.className = 'icons'
5151
iconsContainer.innerHTML = nodeObj.icons
5252
.map(icon => `<span>${encodeHTML(icon)}</span>`)
5353
.join('')
5454
tpc.appendChild(iconsContainer)
5555
}
56-
if (nodeObj.tags) {
56+
if (nodeObj.tags && nodeObj.tags.length) {
5757
const tagsContainer = $d.createElement('div')
5858
tagsContainer.className = 'tags'
5959
tagsContainer.innerHTML = nodeObj.tags

0 commit comments

Comments
 (0)