mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-09-09 11:29:14 -04:00
Add workaround for Firefox's broken resize observer
This commit is contained in:
@@ -214,6 +214,11 @@ class View {
|
|||||||
this.render(layout)
|
this.render(layout)
|
||||||
new ResizeObserver(() => this.expand()).observe(doc.body)
|
new ResizeObserver(() => this.expand()).observe(doc.body)
|
||||||
|
|
||||||
|
// the resize observer above doesn't work in Firefox
|
||||||
|
// (see https://bugzilla.mozilla.org/show_bug.cgi?id=1832939)
|
||||||
|
// until the bug is fixed we can at least account for font load
|
||||||
|
doc.fonts.ready.then(() => this.expand())
|
||||||
|
|
||||||
resolve()
|
resolve()
|
||||||
}, { once: true })
|
}, { once: true })
|
||||||
this.#iframe.src = src
|
this.#iframe.src = src
|
||||||
@@ -930,6 +935,9 @@ export class Paginator extends HTMLElement {
|
|||||||
$beforeStyle.textContent = beforeStyle
|
$beforeStyle.textContent = beforeStyle
|
||||||
$style.textContent = style
|
$style.textContent = style
|
||||||
} else $style.textContent = styles
|
} else $style.textContent = styles
|
||||||
|
|
||||||
|
// needed because the resize observer doesn't work in Firefox
|
||||||
|
this.#view?.document?.fonts?.ready?.then(() => this.#view.expand())
|
||||||
}
|
}
|
||||||
destroy() {
|
destroy() {
|
||||||
this.#observer.unobserve(this)
|
this.#observer.unobserve(this)
|
||||||
|
|||||||
Reference in New Issue
Block a user