mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-07 02:47:12 +00:00
fix: 去掉将 JSSlot 降级到 JSBlock 的功能, 以便解决预览和出码时无法处理 JSBlock 的问题
This commit is contained in:
parent
45a2c21ab0
commit
024db057ac
@ -12,7 +12,7 @@ import { Skeleton, SettingsPrimaryPane, registerDefaults } from '@ali/lowcode-ed
|
||||
import { deepValueParser } from './deep-value-parser';
|
||||
import { liveEditingRule, liveEditingSaveHander } from './vc-live-editing';
|
||||
import {
|
||||
compatibleReducer,
|
||||
// compatibleReducer,
|
||||
upgradePageLifeCyclesReducer,
|
||||
stylePropsReducer,
|
||||
upgradePropsReducer,
|
||||
@ -55,7 +55,8 @@ designer.addPropsReducer(filterReducer, TransformStage.Save);
|
||||
designer.addPropsReducer(filterReducer, TransformStage.Render);
|
||||
|
||||
// FIXME: Dirty fix, will remove this reducer
|
||||
designer.addPropsReducer(compatibleReducer, TransformStage.Save);
|
||||
// designer.addPropsReducer(compatibleReducer, TransformStage.Save);
|
||||
|
||||
// 兼容历史版本的 Page 组件
|
||||
designer.addPropsReducer(upgradePageLifeCyclesReducer, TransformStage.Save);
|
||||
|
||||
|
||||
@ -1,26 +1,26 @@
|
||||
import {
|
||||
isPlainObject,
|
||||
} from '@ali/lowcode-utils';
|
||||
import { isJSExpression, isJSSlot } from '@ali/lowcode-types';
|
||||
// import { isPlainObject } from '@ali/lowcode-utils';
|
||||
// import { isJSExpression, isJSSlot } from '@ali/lowcode-types';
|
||||
|
||||
export function compatibleReducer(props: any) {
|
||||
if (!props || !isPlainObject(props)) {
|
||||
return props;
|
||||
}
|
||||
// 为了能降级到老版本,建议在后期版本去掉以下代码
|
||||
if (isJSSlot(props)) {
|
||||
return {
|
||||
type: 'JSBlock',
|
||||
value: {
|
||||
componentName: 'Slot',
|
||||
children: props.value,
|
||||
props: {
|
||||
slotTitle: props.title,
|
||||
slotName: props.name,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
return props;
|
||||
// if (!props || !isPlainObject(props)) {
|
||||
// return props;
|
||||
// }
|
||||
|
||||
// // 为了能降级到老版本,建议在后期版本去掉以下代码
|
||||
// if (isJSSlot(props)) {
|
||||
// return {
|
||||
// type: 'JSBlock',
|
||||
// value: {
|
||||
// componentName: 'Slot',
|
||||
// children: props.value,
|
||||
// props: {
|
||||
// slotTitle: props.title,
|
||||
// slotName: props.name,
|
||||
// },
|
||||
// },
|
||||
// };
|
||||
// }
|
||||
// if (isJSExpression(props) && !props.events) {
|
||||
// return {
|
||||
// type: 'variable',
|
||||
@ -28,9 +28,9 @@ export function compatibleReducer(props: any) {
|
||||
// variable: props.value,
|
||||
// };
|
||||
// }
|
||||
const newProps: any = {};
|
||||
Object.entries<any>(props).forEach(([key, val]) => {
|
||||
newProps[key] = compatibleReducer(val);
|
||||
});
|
||||
return newProps;
|
||||
// const newProps: any = {};
|
||||
// Object.entries<any>(props).forEach(([key, val]) => {
|
||||
// newProps[key] = compatibleReducer(val);
|
||||
// });
|
||||
// return newProps;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user