mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-21 16:48:18 +00:00
Merge branch 'fix/render-error-style' into 'release/0.9.3'
Fix/render error style See merge request !931751
This commit is contained in:
commit
c245f49274
@ -77,7 +77,9 @@ hotkey.bind(['backspace', 'del'], (e: KeyboardEvent) => {
|
|||||||
const topItems = sel.getTopNodes();
|
const topItems = sel.getTopNodes();
|
||||||
// TODO: check can remove
|
// TODO: check can remove
|
||||||
topItems.forEach((node) => {
|
topItems.forEach((node) => {
|
||||||
|
if (node.canPerformAction('remove')) {
|
||||||
doc.removeNode(node);
|
doc.removeNode(node);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
sel.clear();
|
sel.clear();
|
||||||
});
|
});
|
||||||
@ -102,8 +104,13 @@ hotkey.bind(['command+c', 'ctrl+c', 'command+x', 'ctrl+x'], (e, action) => {
|
|||||||
}
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const selected = doc.selection.getTopNodes(true);
|
let selected = doc.selection.getTopNodes(true);
|
||||||
if (!selected || selected.length < 1) return;
|
selected = selected.filter((node) => {
|
||||||
|
return node.canPerformAction('copy');
|
||||||
|
})
|
||||||
|
if (!selected || selected.length < 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const componentsMap = {};
|
const componentsMap = {};
|
||||||
const componentsTree = selected.map((item) => item.export(TransformStage.Clone));
|
const componentsTree = selected.map((item) => item.export(TransformStage.Clone));
|
||||||
|
|||||||
@ -703,6 +703,14 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
|||||||
this.document.destroyNode(this);
|
this.document.destroyNode(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否可执行某action
|
||||||
|
*/
|
||||||
|
canPerformAction(action: string): boolean {
|
||||||
|
const availableActions = this.componentMeta?.availableActions?.map((action) => action.name) || [];
|
||||||
|
return availableActions.indexOf(action) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
// ======= compatible apis ====
|
// ======= compatible apis ====
|
||||||
isEmpty(): boolean {
|
isEmpty(): boolean {
|
||||||
return this.children ? this.children.isEmpty() : true;
|
return this.children ? this.children.isEmpty() : true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user