mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-04 17:27:09 +00:00
fix: 粘贴时判断 canDropIn
This commit is contained in:
parent
d48e6ae0c8
commit
07dab6db8e
@ -277,13 +277,21 @@ export class ComponentMeta {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkNestingDown(my: Node, target: Node | NodeSchema) {
|
checkNestingDown(my: Node, target: Node | NodeSchema | NodeSchema[]) {
|
||||||
// 检查父子关系,直接约束型,在画布中拖拽直接掠过目标容器
|
// 检查父子关系,直接约束型,在画布中拖拽直接掠过目标容器
|
||||||
if (this.childWhitelist) {
|
if (this.childWhitelist) {
|
||||||
if (!isNode(target)) {
|
let _target: any = target;
|
||||||
target = new Node(my.document, target);
|
if (!Array.isArray(_target)) {
|
||||||
|
_target = [_target];
|
||||||
}
|
}
|
||||||
return this.childWhitelist(target, my);
|
|
||||||
|
return !_target.some((item: Node | NodeSchema) => {
|
||||||
|
let _item = item;
|
||||||
|
if (!isNode(_item)) {
|
||||||
|
_item = new Node(my.document, _item);
|
||||||
|
}
|
||||||
|
return this.childWhitelist && !this.childWhitelist(_item, my);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -151,7 +151,7 @@ hotkey.bind(['command+v', 'ctrl+v'], (e) => {
|
|||||||
}
|
}
|
||||||
clipboard.waitPasteData(e, ({ componentsTree }) => {
|
clipboard.waitPasteData(e, ({ componentsTree }) => {
|
||||||
if (componentsTree) {
|
if (componentsTree) {
|
||||||
const { target, index } = designer.getSuitableInsertion() || {};
|
const { target, index } = designer.getSuitableInsertion(componentsTree) || {};
|
||||||
if (!target) {
|
if (!target) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -295,7 +295,7 @@ export class Designer {
|
|||||||
/**
|
/**
|
||||||
* 获得合适的插入位置
|
* 获得合适的插入位置
|
||||||
*/
|
*/
|
||||||
getSuitableInsertion(insertNode?: Node | NodeSchema): { target: ParentalNode; index?: number } | null {
|
getSuitableInsertion(insertNode?: Node | NodeSchema | NodeSchema[]): { target: ParentalNode; index?: number } | null {
|
||||||
const activedDoc = this.project.currentDocument;
|
const activedDoc = this.project.currentDocument;
|
||||||
if (!activedDoc) {
|
if (!activedDoc) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user