Skip to content

Commit

Permalink
fix: 清除css错误转成key的属性 (baidu#9025)
Browse files Browse the repository at this point in the history
Co-authored-by: qinhaoyan <30946345+qinhaoyan@users.noreply.github.com>
  • Loading branch information
qkiroc and qkiroc committed Jan 16, 2024
1 parent 293e6f6 commit f5804b8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/amis-editor-core/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ export function JSONPipeIn(
if (obj.type) {
// 处理下历史style数据,整理到themeCss
obj = style2ThemeCss(obj);
// 处理下旧数据css被错误转成属性的问题
obj = clearDirtyCssKey(obj);

// 重新生成组件ID
if (reGenerateId) {
Expand Down Expand Up @@ -1237,6 +1239,19 @@ export function style2ThemeCss(data: any) {
};
}

export function clearDirtyCssKey(data: any) {
if (!data?.type) {
return data;
}
const temp = {...data};
Object.keys(temp).forEach(key => {
if (key.startsWith('.') || key.startsWith('#')) {
delete temp[key];
}
});
return temp;
}

/**
* 从amis数据域中取变量数据
* @param node
Expand Down

0 comments on commit f5804b8

Please sign in to comment.