mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 13:06:31 +00:00
fix(client): blocks are deleted when they are dragged below the current block
This commit is contained in:
parent
057e1d0039
commit
20ab8c1501
@ -460,22 +460,6 @@ export class Designable {
|
|||||||
}
|
}
|
||||||
const opts = { onSuccess: options?.onSuccess };
|
const opts = { onSuccess: options?.onSuccess };
|
||||||
const { wrap = defaultWrap, breakRemoveOn, removeParentsIfNoChildren } = options;
|
const { wrap = defaultWrap, breakRemoveOn, removeParentsIfNoChildren } = options;
|
||||||
if (Schema.isSchemaInstance(schema)) {
|
|
||||||
if (this.parentsIn(schema)) {
|
|
||||||
this.emit('error', {
|
|
||||||
code: 'parent_is_not_allowed',
|
|
||||||
schema,
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
schema.parent.removeProperty(schema.name);
|
|
||||||
if (removeParentsIfNoChildren) {
|
|
||||||
opts['removed'] = this.recursiveRemoveIfNoChildren(schema.parent, { breakRemoveOn });
|
|
||||||
}
|
|
||||||
schema.parent = null;
|
|
||||||
} else if (schema) {
|
|
||||||
schema = cloneDeep(schema);
|
|
||||||
}
|
|
||||||
|
|
||||||
let order = 0;
|
let order = 0;
|
||||||
let newOrder = 0;
|
let newOrder = 0;
|
||||||
@ -496,6 +480,23 @@ export class Designable {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (Schema.isSchemaInstance(schema)) {
|
||||||
|
if (this.parentsIn(schema)) {
|
||||||
|
this.emit('error', {
|
||||||
|
code: 'parent_is_not_allowed',
|
||||||
|
schema,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
schema.parent.removeProperty(schema.name);
|
||||||
|
if (removeParentsIfNoChildren) {
|
||||||
|
opts['removed'] = this.recursiveRemoveIfNoChildren(schema.parent, { breakRemoveOn });
|
||||||
|
}
|
||||||
|
schema.parent = null;
|
||||||
|
} else if (schema) {
|
||||||
|
schema = cloneDeep(schema);
|
||||||
|
}
|
||||||
|
|
||||||
this.prepareProperty(schema);
|
this.prepareProperty(schema);
|
||||||
const wrapped = wrap(schema);
|
const wrapped = wrap(schema);
|
||||||
const s = this.current.parent.addProperty(wrapped.name || uid(), wrapped);
|
const s = this.current.parent.addProperty(wrapped.name || uid(), wrapped);
|
||||||
|
Loading…
Reference in New Issue
Block a user