Skip to content

Commit e9418ed

Browse files
committed
🐛 增加版本转换函数
1 parent 67f0a82 commit e9418ed

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

app/src/core/stage/StageLoader.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export namespace StageLoader {
2626
data = convertV12toV13(data);
2727
data = convertV13toV14(data);
2828
data = convertV14toV15(data);
29+
data = convertV15toV16(data);
2930
return data as Serialized.File;
3031
}
3132

@@ -286,4 +287,23 @@ export namespace StageLoader {
286287
}
287288
return data;
288289
}
290+
291+
/**
292+
* 文本节点增加自动转换大小/手动转换大小功能
293+
* @param data
294+
*/
295+
function convertV15toV16(data: Record<string, any>): Record<string, any> {
296+
if (data.version >= 16) {
297+
return data;
298+
}
299+
data.version = 16;
300+
for (const node of data.entities) {
301+
if (node.type === "core:text_node") {
302+
if (typeof node.sizeAdjust === "undefined") {
303+
node.sizeAdjust = "auto";
304+
}
305+
}
306+
}
307+
return data;
308+
}
289309
}

0 commit comments

Comments
 (0)