Commit 1022b91a authored by yann300's avatar yann300

fix adding / removing content

parent c5aafbfa
......@@ -27,13 +27,13 @@ class SwapPanelComponent {
}
add (moduleName, content) {
this.contents[moduleName] = yo`<div id='${moduleName}Content' class=${css.plugItIn} >${content}</div>`
this.contents[moduleName] = yo`<div class=${css.plugItIn} >${content}</div>`
this.view.appendChild(this.contents[moduleName])
}
remove (moduleName) {
var el = this.view.querySelector(`div#${moduleName}Content`)
el.parentElement.removeChild(el)
let el = this.contents[moduleName]
if (el) el.parentElement.removeChild(el)
}
render () {
......
......@@ -12,16 +12,18 @@ class VerticalIconComponent {
constructor () {
this.event = new EventEmmitter()
this.icons = {}
}
addIcon (mod) {
let self = this
this.view.appendChild(yo`<div id="${mod.name}Icon" class="${css.icon}" onclick=${(e) => { self._iconClick(mod.name) }} title=${mod.name}><img src="${mod.icon}" alt="${mod.name}" /></div>`)
this.icons[mod.name] = yo`<div class="${css.icon}" onclick=${(e) => { self._iconClick(mod.name) }} title=${mod.name}><img src="${mod.icon}" alt="${mod.name}" /></div>`
this.view.appendChild(this.icons[mod.name])
}
removeIcon (mod) {
var el = this.view.querySelector(`#${mod.name}Icon`)
el.parentElement.removeChild(el)
let el = this.icons[mod.name]
if (el) el.parentElement.removeChild(el)
}
select (name) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment