mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-24 05:07:06 +08:00
1f45cc5dec
**Directory Structure Changes** - Renamed multiple block-related directories by removing the "block-" prefix: - `block-attachment` → `attachment` - `block-bookmark` → `bookmark` - `block-callout` → `callout` - `block-code` → `code` - `block-data-view` → `data-view` - `block-database` → `database` - `block-divider` → `divider` - `block-edgeless-text` → `edgeless-text` - `block-embed` → `embed`
34 lines
919 B
TypeScript
34 lines
919 B
TypeScript
import { EdgelessClipboardConfig } from '@blocksuite/affine-block-surface';
|
|
import { type BlockSnapshot } from '@blocksuite/store';
|
|
|
|
export class EdgelessClipboardEdgelessTextConfig extends EdgelessClipboardConfig {
|
|
static override readonly key = 'affine:edgeless-text';
|
|
|
|
override async createBlock(
|
|
edgelessText: BlockSnapshot
|
|
): Promise<string | null> {
|
|
const oldId = edgelessText.id;
|
|
delete edgelessText.props.index;
|
|
if (!edgelessText.props.xywh) {
|
|
console.error(
|
|
`EdgelessText block(id: ${oldId}) does not have xywh property`
|
|
);
|
|
return null;
|
|
}
|
|
if (!this.surface) {
|
|
return null;
|
|
}
|
|
const newId = await this.onBlockSnapshotPaste(
|
|
edgelessText,
|
|
this.std.store,
|
|
this.surface.model.id
|
|
);
|
|
if (!newId) {
|
|
console.error(`Failed to paste EdgelessText block(id: ${oldId})`);
|
|
return null;
|
|
}
|
|
|
|
return newId;
|
|
}
|
|
}
|