fix(core): some dnd perf issues (#9661)
1. page list item are bound two draggables. adding `draggable` prop to WorkbenchLink to mitigate the issue. 2. DndService may not resolve datatransfer when dragging.
This commit is contained in:
@@ -81,7 +81,7 @@ export class DndService extends Service {
|
||||
isDropEvent?: boolean
|
||||
) => {
|
||||
if (!isDropEvent) {
|
||||
return this.resolveBlocksuiteExternalData(args.source) || {};
|
||||
return {};
|
||||
}
|
||||
|
||||
let resolved: AffineDNDData['draggable'] | null = null;
|
||||
@@ -168,30 +168,24 @@ export class DndService extends Service {
|
||||
if (!dndAPI) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (source.types.includes(dndAPI.mimeType)) {
|
||||
const from = {
|
||||
at: 'blocksuite-editor',
|
||||
} as const;
|
||||
|
||||
let entity: Entity | null = null;
|
||||
|
||||
const encoded = source.getStringData(dndAPI.mimeType);
|
||||
const snapshot = encoded ? dndAPI.decodeSnapshot(encoded) : null;
|
||||
entity = snapshot ? this.resolveBlockSnapshot(snapshot) : null;
|
||||
|
||||
if (!entity) {
|
||||
return {
|
||||
from,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
entity,
|
||||
from,
|
||||
};
|
||||
}
|
||||
const encoded = source.getStringData(dndAPI.mimeType);
|
||||
if (!encoded) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
const snapshot = dndAPI.decodeSnapshot(encoded);
|
||||
if (!snapshot) {
|
||||
return null;
|
||||
}
|
||||
const entity = this.resolveBlockSnapshot(snapshot);
|
||||
if (!entity) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
entity,
|
||||
from: {
|
||||
at: 'blocksuite-editor',
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
private readonly resolveHTML: EntityResolver = html => {
|
||||
|
||||
Reference in New Issue
Block a user