diff --git a/package.json b/package.json index da6d8fa6..74e057ff 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/plugin/nodeMenu.ts b/src/plugin/nodeMenu.ts index 896be9f8..b56cb96d 100644 --- a/src/plugin/nodeMenu.ts +++ b/src/plugin/nodeMenu.ts @@ -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' diff --git a/src/utils/dom.ts b/src/utils/dom.ts index b27a4763..3fe0c2d0 100644 --- a/src/utils/dom.ts +++ b/src/utils/dom.ts @@ -45,7 +45,7 @@ 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 @@ -53,7 +53,7 @@ export const shapeTpc = function(tpc: Topic, nodeObj: NodeObj) { .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