Merge branch 'fix/paste' into 'release/1.0.24'

fix: 粘贴时判断 canDropIn



See merge request !1079467
This commit is contained in:
力皓 2020-12-11 15:31:52 +08:00
commit 487bb9d953
4 changed files with 9 additions and 8 deletions

View File

@ -277,13 +277,14 @@ 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)) { const _target: any = !Array.isArray(target) ? [target] : target;
target = new Node(my.document, target); return _target.every((item: Node | NodeSchema) => {
} const _item = !isNode(item) ? new Node(my.document, item) : item;
return this.childWhitelist(target, my); return this.childWhitelist && this.childWhitelist(_item, my);
});
} }
return true; return true;
} }

View File

@ -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;
} }

View File

@ -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;

View File

@ -18,7 +18,7 @@ export interface IconProps {
export function SVGIcon({ export function SVGIcon({
fill, fill,
size = 'medium', size = 'large',
viewBox, viewBox,
style, style,
children, children,