diff --git a/src/btn.ts b/src/btn.ts index 16f89f8..5b82ff7 100644 --- a/src/btn.ts +++ b/src/btn.ts @@ -30,6 +30,8 @@ export const getDownloadBtn = (): BtnElement => { interface BtnOptions { readonly name: string; readonly action: BtnAction; + readonly disabled?: boolean; + readonly tooltip?: string; } export class BtnList { @@ -57,6 +59,14 @@ export class BtnList { this.list.push(btn) + if (options.disabled) { + btn.disabled = options.disabled + } + + if (options.tooltip) { + btn.title = options.tooltip + } + return btn } diff --git a/src/main.ts b/src/main.ts index 7c0d6c3..364c6d3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -49,6 +49,7 @@ const main = (): void => { btnList.add({ name: 'Individual Parts', + tooltip: 'Download individual parts (BETA)', action: BtnAction.mscoreWindow(async (w, score, txt) => { const metadata = await score.metadata() console.log('score metadata loaded by webmscore', metadata) @@ -99,7 +100,7 @@ const main = (): void => { saveAs(data, `${filename} - ${partName}.pdf`) } }), - }).title = 'Download individual parts (BETA)' + }) btnList.commit() }