mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
fix: 修复 setDevice 的时机,从 currentDocument -> simualtor
fix: 根据 canDropIn 来支持选择 Page 节点时是否可添加组件
This commit is contained in:
parent
cb9bce87c9
commit
0f14884bf1
@ -910,6 +910,12 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
||||
if (dropElement) {
|
||||
return { container: dropElement, ref };
|
||||
}
|
||||
const rootCanDropIn = this.componentMeta?.prototype?.options?.canDropIn;
|
||||
if (rootCanDropIn === undefined
|
||||
|| rootCanDropIn === true
|
||||
|| (typeof rootCanDropIn === 'function' && rootCanDropIn(node))) {
|
||||
return { container: this, ref };
|
||||
}
|
||||
// 假如最后找不到合适位置,返回 undefined 阻止继续插入节点
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@ -248,6 +248,7 @@ export class Project {
|
||||
private mountSimulator(simulator: ISimulatorHost) {
|
||||
// TODO: 多设备 simulator 支持
|
||||
this._simulator = simulator;
|
||||
this.designer.editor.set('simulator', simulator);
|
||||
}
|
||||
|
||||
setRendererReady(renderer: any) {
|
||||
|
||||
@ -194,8 +194,8 @@ export class Viewport {
|
||||
async setDevice(device = 'pc') {
|
||||
if (this.getDevice() !== device) {
|
||||
this.device = device;
|
||||
const currentDocument = await editor.onceGot('currentDocument');
|
||||
currentDocument?.simulator?.set('device', device === 'mobile' ? 'mobile' : 'default');
|
||||
const simulator = await editor.onceGot('simulator');
|
||||
simulator?.set('device', device === 'mobile' ? 'mobile' : 'default');
|
||||
// Flags.setSimulator(device);
|
||||
// this.applyMediaCSS();
|
||||
this.emitter.emit('devicechange', device);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user