mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 20:38:52 +00:00
chore: clean code
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user