mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-23 13:02:21 +08:00
feat: edgeless dnd (#9988)
### Changed - Support edgelss dnd - Simplify the drag-handle state
This commit is contained in:
@@ -92,9 +92,18 @@ export class SurfaceBlockTransformer extends BaseBlockTransformer<SurfaceBlockPr
|
||||
const snapshot = super.toSnapshot(payload);
|
||||
const elementsValue = payload.model.elements.getValue();
|
||||
const value: Record<string, unknown> = {};
|
||||
/**
|
||||
* When the selectedElements is defined, only the selected elements will be serialized.
|
||||
*/
|
||||
const selectedElements = this.transformerConfigs.get(
|
||||
'selectedElements'
|
||||
) as Set<string>;
|
||||
|
||||
if (elementsValue) {
|
||||
elementsValue.forEach((element, key) => {
|
||||
value[key] = this._elementToJSON(element as Y.Map<unknown>);
|
||||
if (selectedElements?.has(key) || !selectedElements) {
|
||||
value[key] = this._elementToJSON(element as Y.Map<unknown>);
|
||||
}
|
||||
});
|
||||
}
|
||||
snapshot.props = {
|
||||
|
||||
Reference in New Issue
Block a user