fix: 关闭低代码组件在页面引用时的原地编辑功能

This commit is contained in:
力皓 2021-06-18 16:45:34 +08:00
parent 8b0c9189e2
commit 3c07142f71
2 changed files with 6 additions and 2 deletions

View File

@ -17,7 +17,7 @@ import {
} from '../simulator'; } from '../simulator';
import Viewport from './viewport'; import Viewport from './viewport';
import { createSimulator } from './create-simulator'; import { createSimulator } from './create-simulator';
import { Node, ParentalNode, contains, isRootNode } from '../document'; import { Node, ParentalNode, contains, isRootNode, isLowCodeComponent } from '../document';
import ResourceConsumer from './resource-consumer'; import ResourceConsumer from './resource-consumer';
import { import {
AssetLevel, AssetLevel,
@ -792,7 +792,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
return; return;
} }
const node = nodeInst.node || this.project.currentDocument?.rootNode; const node = nodeInst.node || this.project.currentDocument?.rootNode;
if (!node) { if (!node || isLowCodeComponent(node)) {
return; return;
} }

View File

@ -1091,6 +1091,10 @@ export function isRootNode(node: Node): node is RootNode {
return node && node.isRoot(); return node && node.isRoot();
} }
export function isLowCodeComponent(node: Node): boolean {
return node.componentMeta.getMetadata().devMode === 'lowcode';
}
export function getZLevelTop(child: Node, zLevel: number): Node | null { export function getZLevelTop(child: Node, zLevel: number): Node | null {
let l = child.zLevel; let l = child.zLevel;
if (l < zLevel || zLevel < 0) { if (l < zLevel || zLevel < 0) {