chore: clean code

This commit is contained in:
lawvs 2022-07-27 16:15:42 +08:00
parent 3deabad74c
commit 6ef0e5e567
2 changed files with 14 additions and 1 deletions

View File

@ -16,6 +16,18 @@ export const isRecastBlock = (block: unknown): block is RecastBlock => {
);
};
/**
* Remove legacy properties
*/
const normalizeRecastBlockData = (block: RecastBlock) => {
if (block.getProperty('scene')) {
block.removeProperty('scene');
}
if (block.getProperty('kanbanProps')) {
block.removeProperty('kanbanProps');
}
};
export const RecastBlockContext = createContext<RecastBlock | null>(null);
export const RecastBlockProvider = ({
@ -31,6 +43,8 @@ export const RecastBlockProvider = ({
);
}
normalizeRecastBlockData(block);
return (
<RecastBlockContext.Provider value={block}>
{children}

View File

@ -49,7 +49,6 @@ export const RenderBlock: FC<RenderBlockProps> = ({
block={block}
columns={columns.columns}
columnsFromId={columns.fromId}
scene="page"
editorElement={editorElement}
/>
) : null;