Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
fix: #32 iframe loading bug with BBT
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyu committed Oct 17, 2022
1 parent e2ca919 commit 2357604
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,10 @@ class AddonEvents extends AddonModule {
const tabIndex = tabbox.selectedIndex;
tabbox.selectedIndex =
tabIndex === tabbox.childNodes.length - 1 ? 1 : tabIndex + 1;
setTimeout(() => {
setTimeout(async () => {
tabbox.selectedIndex = tabIndex;
this.initPreview(PreviewType.info);
await this.initPreview(PreviewType.info);
this.doPreview(true);
}, 1);
}

Expand Down Expand Up @@ -378,8 +379,10 @@ class AddonEvents extends AddonModule {
if (!container) {
return;
}
const iframeId = this._Addon.preview.getPreviewIds(type).iframeId;
document.getElementById(iframeId)?.remove();
const iframe = document.createElement("iframe");
iframe.setAttribute("id", this._Addon.preview.getPreviewIds(type).iframeId);
iframe.setAttribute("id", iframeId);
iframe.setAttribute("src", "chrome://PDFPreview/content/previewPDF.html");
container.appendChild(iframe);
await this._Addon.preview._initPromise;
Expand Down

0 comments on commit 2357604

Please sign in to comment.