fix: 修复 canDropIn / canDropTo 转成 nestingRule 异常

fix: 修复部分场景下 bem-tools 选择框位置不对
chore: 命名 iframe 为 SimulatorRenderer, 方便调试
This commit is contained in:
力皓 2021-02-19 16:45:16 +08:00
parent a409348cb7
commit 6406417e73
4 changed files with 5 additions and 6 deletions

View File

@ -73,7 +73,7 @@ class Toolbar extends Component<{ observed: OffsetObserver }> {
const MARGIN = 1;
const BORDER = 2;
const SPACE_HEIGHT = BAR_HEIGHT + MARGIN + BORDER;
const SPACE_MINIMUM_WIDTH = 140; // magic number
const SPACE_MINIMUM_WIDTH = 160; // magic number大致是 toolbar 的宽度
let style: any;
// 计算 toolbar 的上/下位置
if (observed.top > SPACE_HEIGHT) {

View File

@ -85,6 +85,7 @@ class Content extends Component<{ host: BuiltinSimulatorHost }> {
return (
<div className="lc-simulator-content">
<iframe
name="SimulatorRenderer"
className="lc-simulator-content-frame"
style={frameStyle}
ref={(frame) => sim.mountContentFrame(frame)}

View File

@ -124,7 +124,7 @@ export class SettingTopEntry implements SettingEntry {
*
*/
@computed getValue(): any {
this.first.propsData;
return this.first?.propsData;
}
/**

View File

@ -688,16 +688,14 @@ export function upgradeMetadata(oldConfig: OldPrototypeConfig) {
if (canDropTo != null || canDropto != null) {
if (canDropTo === false || canDropto === false) {
nestingRule.parentWhitelist = () => false;
}
if (canDropTo !== true && canDropto !== true) {
} else if (canDropTo !== true && canDropto !== true) {
nestingRule.parentWhitelist = canDropTo || canDropto;
}
}
if (canDropIn != null || canDroping != null) {
if (canDropIn === false || canDroping === false) {
nestingRule.childWhitelist = () => false;
}
if (canDropIn !== true && canDroping !== true) {
} else if (canDropIn !== true && canDroping !== true) {
nestingRule.childWhitelist = canDropIn || canDroping;
}
}