mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-22 12:36:24 +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`
29 lines
776 B
TypeScript
29 lines
776 B
TypeScript
import { EdgelessClipboardConfig } from '@blocksuite/affine-block-surface';
|
|
import { type BlockSnapshot } from '@blocksuite/store';
|
|
|
|
export class EdgelessClipboardNoteConfig extends EdgelessClipboardConfig {
|
|
static override readonly key = 'affine:note';
|
|
|
|
override async createBlock(note: BlockSnapshot): Promise<null | string> {
|
|
const oldId = note.id;
|
|
|
|
delete note.props.index;
|
|
if (!note.props.xywh) {
|
|
console.error(`Note block(id: ${oldId}) does not have xywh property`);
|
|
return null;
|
|
}
|
|
|
|
const newId = await this.onBlockSnapshotPaste(
|
|
note,
|
|
this.std.store,
|
|
this.std.store.root!.id
|
|
);
|
|
if (!newId) {
|
|
console.error(`Failed to paste note block(id: ${oldId})`);
|
|
return null;
|
|
}
|
|
|
|
return newId;
|
|
}
|
|
}
|