From 6ef0e5e567fa1cd7a0f493e68bcf29d4eb585e84 Mon Sep 17 00:00:00 2001 From: lawvs <18554747+lawvs@users.noreply.github.com> Date: Wed, 27 Jul 2022 16:15:42 +0800 Subject: [PATCH] chore: clean code --- .../editor-core/src/recast-block/Context.tsx | 14 ++++++++++++++ .../editor-core/src/render-block/RenderBlock.tsx | 1 - 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/libs/components/editor-core/src/recast-block/Context.tsx b/libs/components/editor-core/src/recast-block/Context.tsx index b819d20f2a..55d334039b 100644 --- a/libs/components/editor-core/src/recast-block/Context.tsx +++ b/libs/components/editor-core/src/recast-block/Context.tsx @@ -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(null); export const RecastBlockProvider = ({ @@ -31,6 +43,8 @@ export const RecastBlockProvider = ({ ); } + normalizeRecastBlockData(block); + return ( {children} diff --git a/libs/components/editor-core/src/render-block/RenderBlock.tsx b/libs/components/editor-core/src/render-block/RenderBlock.tsx index 4fa6435bf7..46f068af2b 100644 --- a/libs/components/editor-core/src/render-block/RenderBlock.tsx +++ b/libs/components/editor-core/src/render-block/RenderBlock.tsx @@ -49,7 +49,6 @@ export const RenderBlock: FC = ({ block={block} columns={columns.columns} columnsFromId={columns.fromId} - scene="page" editorElement={editorElement} /> ) : null;