mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
fix(editor): add childElementIds to ai generated frame (#9537)
Close [BS-1354](https://linear.app/affine-design/issue/BS-1354/更新-ai-slide-template-到新的-frame) This PR add `childElementIds` to frame block in ai presentation templates
This commit is contained in:
@@ -110,6 +110,16 @@ export const replaceIdMiddleware = (job: TemplateJob) => {
|
||||
|
||||
blockJson.props.elements = elements;
|
||||
}
|
||||
|
||||
// remap childElementIds of frame
|
||||
if (blockJson.flavour === 'affine:frame') {
|
||||
assertType<Record<string, boolean>>(blockJson.props.childElementIds);
|
||||
const newChildElementIds: Record<string, boolean> = {};
|
||||
Object.entries(blockJson.props.childElementIds).forEach(([key, val]) => {
|
||||
newChildElementIds[regeneratedIdMap.get(key) ?? key] = val;
|
||||
});
|
||||
blockJson.props.childElementIds = newChildElementIds;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -23,7 +23,11 @@ import type * as Y from 'yjs';
|
||||
* Those block contains other block's id
|
||||
* should defer the loading
|
||||
*/
|
||||
const DEFERED_BLOCK = ['affine:surface', 'affine:surface-ref'] as const;
|
||||
const DEFERED_BLOCK = [
|
||||
'affine:surface',
|
||||
'affine:surface-ref',
|
||||
'affine:frame',
|
||||
] as const;
|
||||
|
||||
/**
|
||||
* Those block should not be inserted directly
|
||||
|
||||
Reference in New Issue
Block a user