fix: 修复在没有选中任何画布节点时, 添加模态框异常的 bug

This commit is contained in:
力皓 2021-04-13 14:47:46 +08:00
parent c02f0ec837
commit 34e8105c10

View File

@ -896,6 +896,11 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
* @deprecated
*/
getSuitablePlace(node: Node, ref: any): any {
// 如果节点是模态框,插入到根节点下
if (node?.componentMeta?.isModal) {
return { container: this.document.rootNode, ref };
}
if (this.isRoot() && this.children) {
const dropElement = this.children.filter((c: Node) => {
if (!c.isContainer()) {
@ -922,10 +927,6 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
return null;
}
if (node?.componentMeta?.getMetadata().configure.component?.isModal) {
return { container: this.document.rootNode, ref };
}
const canDropIn = this.componentMeta?.prototype?.options?.canDropIn;
if (this.isContainer()) {
if (canDropIn === undefined ||