mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-10 18:06:02 +00:00
feat: 1. reportModified when insert 2. handle canDropTo in hotkey
This commit is contained in:
parent
547d85e4eb
commit
9124aaceb9
@ -3,6 +3,7 @@ import { isFormEvent } from '@ali/lowcode-utils';
|
|||||||
import { focusing } from './focusing';
|
import { focusing } from './focusing';
|
||||||
import { insertChildren, TransformStage } from '../document';
|
import { insertChildren, TransformStage } from '../document';
|
||||||
import clipboard from './clipboard';
|
import clipboard from './clipboard';
|
||||||
|
import { NodeSchema } from '@ali/lowcode-types';
|
||||||
|
|
||||||
function isInLiveEditing() {
|
function isInLiveEditing() {
|
||||||
if (globalContext.has(Editor)) {
|
if (globalContext.has(Editor)) {
|
||||||
@ -155,7 +156,11 @@ hotkey.bind(['command+v', 'ctrl+v'], (e) => {
|
|||||||
if (!target) {
|
if (!target) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const nodes = insertChildren(target, componentsTree, index);
|
let canAddComponentsTree = componentsTree.filter((i) => {
|
||||||
|
return doc.checkNestingUp(target, i);
|
||||||
|
})
|
||||||
|
if (canAddComponentsTree.length === 0) return;
|
||||||
|
const nodes = insertChildren(target, canAddComponentsTree, index);
|
||||||
if (nodes) {
|
if (nodes) {
|
||||||
doc.selection.selectAll(nodes.map((o) => o.id));
|
doc.selection.selectAll(nodes.map((o) => o.id));
|
||||||
setTimeout(() => designer.activeTracker.track(nodes[0]), 10);
|
setTimeout(() => designer.activeTracker.track(nodes[0]), 10);
|
||||||
|
|||||||
@ -157,7 +157,7 @@ export class NodeChildren {
|
|||||||
/**
|
/**
|
||||||
* 插入一个节点,返回新长度
|
* 插入一个节点,返回新长度
|
||||||
*/
|
*/
|
||||||
insert(node: Node, at?: number | null, useMutator = true): void {
|
insert(node: Node, at?: number | null, useMutator = true, copy?: boolean): void {
|
||||||
const { children } = this;
|
const { children } = this;
|
||||||
let index = at == null || at === -1 ? children.length : at;
|
let index = at == null || at === -1 ? children.length : at;
|
||||||
|
|
||||||
@ -185,7 +185,11 @@ export class NodeChildren {
|
|||||||
|
|
||||||
this.emitter.emit('change');
|
this.emitter.emit('change');
|
||||||
this.emitter.emit('insert', node);
|
this.emitter.emit('insert', node);
|
||||||
// this.reportModified(node, this.owner, { type: 'insert' });
|
// if (useMutator && copy) {
|
||||||
|
// this.reportModified(node, this.owner, {type: 'copy', copyIndex: index, copyNode: node })
|
||||||
|
// }
|
||||||
|
// this.reportModified(node, this.owner,)
|
||||||
|
this.reportModified(node, this.owner, { type: 'insert' });
|
||||||
|
|
||||||
// check condition group
|
// check condition group
|
||||||
if (node.conditionGroup) {
|
if (node.conditionGroup) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user