Skip to content

Commit

Permalink
🔀 Merge branch #1656 into deploy/rinkeby
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Jun 25, 2024
2 parents ac9be1b + 3d73a49 commit 95c998b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@
<div
class="desktop:grid grid-cols-5 items-stretch gap-[20px] flex-grow"
>
<div class="col-span-2">
<div v-if="stickyBookstoreItem" class="col-span-2">
<NFTBookItemCardV2
:class="[bookstoreSectionStickyClass, 'w-full']"
class-cover-frame-aspect-ratio="min-h-[360px] desktop:min-h-[0] desktop:aspect-[4/5]"
Expand Down
33 changes: 18 additions & 15 deletions src/pages/reader/pdf.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default {
return {
isLoading: false,
isIframeReady: false,
base64FileData: null,
fileData: null,
};
},
computed: {
Expand Down Expand Up @@ -60,38 +60,41 @@ export default {
if (event.origin !== this.iframeOrigin) return;
if (event.data === 'ready') {
this.isIframeReady = true;
if (this.base64FileData) {
if (this.fileData) {
const buffer = this.fileData;
this.$refs.pdfIframe?.contentWindow?.postMessage(
JSON.stringify({
action: 'openBase64File',
{
action: 'openArrayBufferFile',
data: {
data: this.base64FileData,
data: buffer,
name: this.nftName,
},
}),
this.iframeOrigin
},
this.iframeOrigin,
[buffer]
);
this.base64FileData = null;
this.fileData = null;
}
}
},
async initRendition() {
try {
this.isLoading = true;
const buffer = await this.getFileBuffer('reader-pdf');
this.base64FileData = Buffer.from(buffer).toString('base64');
if (this.isIframeReady) {
this.$refs.pdfIframe?.contentWindow?.postMessage(
JSON.stringify({
action: 'openBase64File',
{
action: 'openArrayBufferFile',
data: {
data: this.base64FileData,
data: buffer,
name: this.nftName,
},
}),
this.iframeOrigin
},
this.iframeOrigin,
[buffer]
);
this.base64FileData = null;
} else {
this.fileData = buffer;
}
this.isLoading = false;
} catch (err) {
Expand Down

0 comments on commit 95c998b

Please sign in to comment.