fix: buttons do appear but they do nothing

This commit is contained in:
Xmader 2020-11-23 12:02:41 -05:00
parent f014ede1f0
commit 89763ee762
No known key found for this signature in database
GPG Key ID: A20B97FB9EB730E4
1 changed files with 7 additions and 1 deletions

View File

@ -39,6 +39,12 @@ const buildDownloadBtn = () => {
}
}
const cloneBtn = (btn: HTMLButtonElement) => {
const n = btn.cloneNode(true) as HTMLButtonElement
n.onclick = btn.onclick
return n
}
interface BtnOptions {
readonly name: string;
readonly action: BtnAction;
@ -97,7 +103,7 @@ export class BtnList {
// hide buttons using the shadow DOM
const newParent = btnParent.cloneNode(false) as HTMLDivElement
newParent.append(...this.list.map(e => e.cloneNode(true)))
newParent.append(...this.list.map(e => cloneBtn(e)))
shadow.append(newParent)
const slot = document.createElement('slot')
shadow.append(slot)