Skip to content

Commit

Permalink
fix(nodeMenu): clear tags and icons while it's empty
Browse files Browse the repository at this point in the history
v.0.19.7 fixed #85
  • Loading branch information
SSShooter committed Jul 1, 2022
1 parent f43f8a2 commit af92edb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 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": "0.19.6",
"version": "0.19.7",
"description": "Mind elixir is a free open source mind map core.",
"main": "dist/MindElixir.js",
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions src/plugin/nodeMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,16 @@ export default function(mind) {
}
tagInput.onchange = (e:InputEvent & { target: HTMLInputElement}) => {
if (!mind.currentNode) return
if (e.target.value) {
if (typeof e.target.value === 'string') {
const newTags = e.target.value.split(',')
mind.updateNodeTags(mind.currentNode.nodeObj, newTags)
mind.updateNodeTags(mind.currentNode.nodeObj, newTags.filter(tag => tag))
}
}
iconInput.onchange = (e:InputEvent & { target: HTMLInputElement}) => {
if (!mind.currentNode) return
if (e.target.value) {
if (typeof e.target.value === 'string') {
const newIcons = e.target.value.split(',')
mind.updateNodeIcons(mind.currentNode.nodeObj, newIcons)
mind.updateNodeIcons(mind.currentNode.nodeObj, newIcons.filter(icon => icon))
}
}
let state = 'open'
Expand Down
4 changes: 2 additions & 2 deletions src/utils/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ export const shapeTpc = function(tpc: Topic, nodeObj: NodeObj) {
linkContainer.href = nodeObj.hyperLink
tpc.appendChild(linkContainer)
}
if (nodeObj.icons) {
if (nodeObj.icons && nodeObj.icons.length) {
const iconsContainer = $d.createElement('span')
iconsContainer.className = 'icons'
iconsContainer.innerHTML = nodeObj.icons
.map(icon => `<span>${encodeHTML(icon)}</span>`)
.join('')
tpc.appendChild(iconsContainer)
}
if (nodeObj.tags) {
if (nodeObj.tags && nodeObj.tags.length) {
const tagsContainer = $d.createElement('div')
tagsContainer.className = 'tags'
tagsContainer.innerHTML = nodeObj.tags
Expand Down

0 comments on commit af92edb

Please sign in to comment.