mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-06 11:59:51 +08:00
refactor(editor): improve edgeless clipboard config (#11472)
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { EdgelessClipboardConfig } from '@blocksuite/affine-block-surface';
|
||||
import { type BlockSnapshot } from '@blocksuite/store';
|
||||
|
||||
export class EdgelessClipboardImageConfig extends EdgelessClipboardConfig {
|
||||
static override readonly key = 'affine:image';
|
||||
|
||||
override async createBlock(image: BlockSnapshot) {
|
||||
const { xywh, rotate, sourceId, size, width, height, caption } =
|
||||
image.props;
|
||||
|
||||
if (!this.surface) return null;
|
||||
|
||||
if (!(await this.std.workspace.blobSync.get(sourceId as string))) {
|
||||
return null;
|
||||
}
|
||||
return this.crud.addBlock(
|
||||
'affine:image',
|
||||
{
|
||||
caption,
|
||||
sourceId,
|
||||
xywh,
|
||||
rotate,
|
||||
size,
|
||||
width,
|
||||
height,
|
||||
},
|
||||
this.surface.model.id
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
export * from './adapters';
|
||||
export * from './commands';
|
||||
export * from './edgeless-clipboard-config';
|
||||
export * from './image-block';
|
||||
export * from './image-edgeless-block';
|
||||
export { ImageProxyService } from './image-proxy-service';
|
||||
|
||||
Reference in New Issue
Block a user