feat: 提供画布 lock 的开关

This commit is contained in:
lihao.ylh 2021-07-19 15:46:41 +08:00
parent 3994b18877
commit 57a6d8c375
3 changed files with 7 additions and 4 deletions

View File

@ -13,7 +13,7 @@ import {
LiveTextEditingConfig,
FieldConfig,
} from '@ali/lowcode-types';
import { computed } from '@ali/lowcode-editor-core';
import { computed, engineConfig } from '@ali/lowcode-editor-core';
import EventEmitter from 'events';
import { isNode, Node, ParentalNode } from './document';
@ -479,7 +479,7 @@ const builtinComponentActions: ComponentAction[] = [
},
condition: (node: Node) => {
const isLocked = node.getExtraProp('isLocked')?.getValue();
return (node.isContainer() && isLocked !== true);
return (engineConfig.get('enableCanvasLock', false) && node.isContainer() && isLocked !== true);
},
important: true,
},
@ -494,7 +494,7 @@ const builtinComponentActions: ComponentAction[] = [
},
condition: (node: Node) => {
const isLocked = node.getExtraProp('isLocked')?.getValue();
return (node.isContainer() && isLocked === true);
return (engineConfig.get('enableCanvasLock', false) && node.isContainer() && isLocked === true);
},
important: true,
},

View File

@ -51,6 +51,10 @@ export interface EngineOptions {
* false
*/
disableDefaultSetters: boolean;
/**
* false
*/
enableCanvasLock: boolean;
/**
* Vision-polyfill settings
*/

View File

@ -178,7 +178,6 @@ export async function init(container?: Element, options?: EngineOptions) {
}
}
engineContainer.id = 'engine';
engineConfig.setConfig(engineOptions as any);
await plugins.init();