mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 13:25:12 +00:00
fix: drag block issue (#9902)
### Changed - Added support for changing the preview offset during dragging. - Fixed the preview rendering for embed block and surface-ref block - Resolved an issue where the host element might be reused in certain cases, which could cause unexpected behavior - Moved viewport-related constants and methods to a more appropriate location
This commit is contained in:
@@ -255,13 +255,13 @@ export class Transformer {
|
||||
this._flattenSnapshot(tmpRootSnapshot, flatSnapshots, parent, index);
|
||||
|
||||
const blockTree = await this._convertFlatSnapshots(flatSnapshots);
|
||||
|
||||
const first = content[0];
|
||||
|
||||
// check if the slice is already in the doc
|
||||
if (first && doc.hasBlock(first.id)) {
|
||||
// if the slice is already in the doc, we need to move the blocks instead of adding them
|
||||
const models = flatSnapshots
|
||||
.map(flat => doc.getBlock(flat.snapshot.id)?.model)
|
||||
const models = content
|
||||
.map(block => doc.getBlock(block.id)?.model)
|
||||
.filter(Boolean) as BlockModel[];
|
||||
const parentModel = parent ? doc.getBlock(parent)?.model : undefined;
|
||||
if (!parentModel) {
|
||||
|
||||
Reference in New Issue
Block a user