Skip to content

Commit

Permalink
fix(edgeless): undo/redo on image dragging (#5750)
Browse files Browse the repository at this point in the history
  • Loading branch information
AyushAgrawal-A2 authored Dec 15, 2023
1 parent 915aeb9 commit f444352
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/blocks/src/image-block/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export async function uploadBlobForImage(
setImageLoading(blockId, true);
const storage = page.blob;
let sourceId = '';
let imageBlock: BaseBlockModel | null;
let imageBlock: BaseBlockModel | null = null;
try {
imageBlock = page.getBlockById(blockId);
if (!imageBlock) {
Expand Down Expand Up @@ -214,7 +214,7 @@ export function addSiblingImageBlock(
return blockIds;
}

export function addImageBlock(
export function addImageBlocks(
files: File[],
maxFileSize: number,
page: Page,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,10 @@ export class EdgelessBlockPortalContainer extends WithDisposable(
xywh: serializeXYWH(x, y, w, Math.round(newModelHeight)),
});
} else {
page.updateBlock(model, {
xywh: serializeXYWH(x, y, w, Math.round(newModelHeight)),
page.withoutTransact(() => {
page.updateBlock(model, {
xywh: serializeXYWH(x, y, w, Math.round(newModelHeight)),
});
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { getServiceOrRegister } from '../../../../_legacy/service/index.js';
import { toggleBookmarkCreateModal } from '../../../../bookmark-block/components/index.js';
import { ImageService } from '../../../../image-block/image-service.js';
import {
addImageBlock,
addImageBlocks,
addSiblingImageBlock,
} from '../../../../image-block/utils.js';
import { DocPageBlockComponent } from '../../../../page-block/doc/doc-page-block.js';
Expand Down Expand Up @@ -586,7 +586,7 @@ export class BlockHub extends WithDisposable(ShadowlessElement) {
assertInstanceOf(imageService, ImageService);
const maxFileSize = imageService.maxFileSize;

const blockIds = addImageBlock(
const blockIds = addImageBlocks(
imageFiles,
maxFileSize,
page,
Expand Down

4 comments on commit f444352

@vercel
Copy link

@vercel vercel bot commented on f444352 Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

blocksuite – ./packages/playground

try-blocksuite.vercel.app
blocksuite-git-master-toeverything.vercel.app
blocksuite-toeverything.vercel.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size Report

Bundles

Entry Size Gzip Brotli
examples/basic 14.1 MB (+336 kB) 2.75 MB (+43.4 kB) 1.73 MB (+33.3 kB)

Packages

Name Size Gzip Brotli
blocks 2.01 MB (+131 kB) 474 kB (+21.9 kB) 355 kB (+16.7 kB)
editor 84 B 89 B 63 B
store 63.5 kB (+247 B) 18.2 kB (+50 B) 16.3 kB (+38 B)
inline 31.6 kB (+113 B) 8.76 kB (+22 B) 7.85 kB (+15 B)

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size Report

Bundles

Entry Size Gzip Brotli
examples/basic 14.1 MB 2.75 MB 1.73 MB

Packages

Name Size Gzip Brotli
blocks 2.01 MB 474 kB 355 kB
editor 84 B 89 B 63 B
store 63.5 kB 18.2 kB 16.3 kB
inline 31.6 kB 8.76 kB 7.85 kB

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size Report

Bundles

Entry Size Gzip Brotli
examples/basic 14.1 MB 2.75 MB 1.73 MB

Packages

Name Size Gzip Brotli
blocks 2.01 MB 474 kB 355 kB
editor 84 B 89 B 63 B
store 63.5 kB 18.2 kB 16.3 kB
inline 31.6 kB 8.76 kB 7.85 kB

Please sign in to comment.