mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-23 17:54:03 +03:00
chore: clean code
This commit is contained in:
parent
3deabad74c
commit
6ef0e5e567
@ -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}
|
||||
|
@ -49,7 +49,6 @@ export const RenderBlock: FC<RenderBlockProps> = ({
|
||||
block={block}
|
||||
columns={columns.columns}
|
||||
columnsFromId={columns.fromId}
|
||||
scene="page"
|
||||
editorElement={editorElement}
|
||||
/>
|
||||
) : null;
|
||||
|
Loading…
Reference in New Issue
Block a user