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 RecastBlockContext = createContext<RecastBlock | null>(null);
|
||||||
|
|
||||||
export const RecastBlockProvider = ({
|
export const RecastBlockProvider = ({
|
||||||
@ -31,6 +43,8 @@ export const RecastBlockProvider = ({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
normalizeRecastBlockData(block);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RecastBlockContext.Provider value={block}>
|
<RecastBlockContext.Provider value={block}>
|
||||||
{children}
|
{children}
|
||||||
|
@ -49,7 +49,6 @@ export const RenderBlock: FC<RenderBlockProps> = ({
|
|||||||
block={block}
|
block={block}
|
||||||
columns={columns.columns}
|
columns={columns.columns}
|
||||||
columnsFromId={columns.fromId}
|
columnsFromId={columns.fromId}
|
||||||
scene="page"
|
|
||||||
editorElement={editorElement}
|
editorElement={editorElement}
|
||||||
/>
|
/>
|
||||||
) : null;
|
) : null;
|
||||||
|
Loading…
Reference in New Issue
Block a user