fix: PDF download when the piano keyboard is open
This commit is contained in:
parent
e9ed0812b9
commit
eda8342a3d
|
@ -105,9 +105,12 @@ export abstract class SheetInfo {
|
||||||
export class SheetInfoInPage extends SheetInfo {
|
export class SheetInfoInPage extends SheetInfo {
|
||||||
constructor (private document: Document) { super() }
|
constructor (private document: Document) { super() }
|
||||||
|
|
||||||
|
private get sheet0Img (): HTMLImageElement | null {
|
||||||
|
return this.document.querySelector('img[src*=score_]')
|
||||||
|
}
|
||||||
|
|
||||||
get pageCount (): number {
|
get pageCount (): number {
|
||||||
const sheet0Img = this.document.querySelector('img[src*=score_]')
|
const sheet0Div = this.sheet0Img?.parentElement
|
||||||
const sheet0Div = sheet0Img?.parentElement
|
|
||||||
if (!sheet0Div) {
|
if (!sheet0Div) {
|
||||||
throw new Error('no sheet images found')
|
throw new Error('no sheet images found')
|
||||||
}
|
}
|
||||||
|
@ -116,8 +119,8 @@ export class SheetInfoInPage extends SheetInfo {
|
||||||
|
|
||||||
get thumbnailUrl (): string {
|
get thumbnailUrl (): string {
|
||||||
// url to the image of the first page
|
// url to the image of the first page
|
||||||
const el = this.document.querySelector('link[as=image]') as HTMLLinkElement
|
const el = this.document.querySelector<HTMLLinkElement>('link[as=image]')
|
||||||
const url = el.href
|
const url = (el?.href || this.sheet0Img?.src) as string
|
||||||
return url.split('@')[0]
|
return url.split('@')[0]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue