mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-16 13:57:02 +08:00
fix(editor): paste surface-ref block to another doc as embed-linked-doc block (#10274)
[BS-2155](https://linear.app/affine-design/issue/BS-2155/复制-insert-frame-group-粘贴后,应当变为-block-ref-link)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
export * from './code';
|
||||
export * from './copy';
|
||||
export * from './paste';
|
||||
export * from './surface-ref-to-embed';
|
||||
|
||||
@@ -17,12 +17,16 @@ export const surfaceRefToEmbed =
|
||||
payload.snapshot.flavour === 'affine:surface-ref' &&
|
||||
!std.store.hasBlock(payload.snapshot.id)
|
||||
) {
|
||||
const id = payload.snapshot.id;
|
||||
// The blockId of the original surface-ref block
|
||||
const blockId = payload.snapshot.id;
|
||||
payload.snapshot.id = std.workspace.idGenerator();
|
||||
payload.snapshot.flavour = 'affine:embed-linked-doc';
|
||||
payload.snapshot.props = {
|
||||
blockId: id,
|
||||
pageId,
|
||||
params: {
|
||||
mode: 'page',
|
||||
blockIds: [blockId],
|
||||
},
|
||||
};
|
||||
}
|
||||
});
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
NoteBlockModel,
|
||||
RootBlockModel,
|
||||
} from '@blocksuite/affine-model';
|
||||
import { surfaceRefToEmbed } from '@blocksuite/affine-shared/adapters';
|
||||
import {
|
||||
BLOCK_CHILDREN_CONTAINER_PADDING_LEFT,
|
||||
EMBED_CARD_HEIGHT,
|
||||
@@ -68,7 +69,6 @@ import { PreviewHelper } from '../helpers/preview-helper.js';
|
||||
import { gfxBlocksFilter } from '../middleware/blocks-filter.js';
|
||||
import { newIdCrossDoc } from '../middleware/new-id-cross-doc.js';
|
||||
import { reorderList } from '../middleware/reorder-list';
|
||||
import { surfaceRefToEmbed } from '../middleware/surface-ref-to-embed.js';
|
||||
import {
|
||||
containBlock,
|
||||
extractIdsFromSnapshot,
|
||||
|
||||
Reference in New Issue
Block a user