Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(page): snapshot export assets rename #6132

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/blocks/src/_common/adapters/attachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {

export type Attachment = File[];

type PngToSliceSnapshotPayload = {
type AttachmentToSliceSnapshotPayload = {
file: Attachment;
assets?: AssetsManager;
blockVersions: Record<string, number>;
Expand Down Expand Up @@ -70,7 +70,7 @@ export class AttachmentAdapter extends BaseAdapter<Attachment> {
throw new Error('Method not implemented.');
}
override async toSliceSnapshot(
payload: PngToSliceSnapshotPayload
payload: AttachmentToSliceSnapshotPayload
): Promise<SliceSnapshot | null> {
const content: SliceSnapshot['content'] = [];
for (const item of payload.file) {
Expand Down
4 changes: 2 additions & 2 deletions packages/blocks/src/_common/adapters/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {

export type Image = File[];

type PngToSliceSnapshotPayload = {
type ImageToSliceSnapshotPayload = {
file: Image;
assets?: AssetsManager;
blockVersions: Record<string, number>;
Expand Down Expand Up @@ -70,7 +70,7 @@ export class ImageAdapter extends BaseAdapter<Image> {
throw new Error('Method not implemented.');
}
override async toSliceSnapshot(
payload: PngToSliceSnapshotPayload
payload: ImageToSliceSnapshotPayload
): Promise<SliceSnapshot | null> {
const content: SliceSnapshot['content'] = [];
for (const item of payload.file) {
Expand Down
4 changes: 3 additions & 1 deletion packages/blocks/src/_common/transformers/zip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export async function exportPages(workspace: Workspace, pages: Page[]) {
const assetsMap = job.assets;

assetsMap.forEach((blob, id) => {
assets.file(getAssetName(assetsMap, id), blob);
const ext = getAssetName(assetsMap, id).split('.').at(-1);
const name = `${id}.${ext}`;
assets.file(name, blob);
});

return zip.generateAsync({ type: 'blob' });
Expand Down
Loading