chore: clean code

This commit is contained in:
lawvs
2022-08-15 11:52:40 +08:00
parent 4c4e98d885
commit 0c09bd2b8c
@@ -25,11 +25,11 @@ export function RenderBlock({
[block]
);
const blockView = useMemo(() => {
const BlockView = useMemo(() => {
if (block?.type) {
return editor.getView(block.type);
return editor.getView(block.type).View;
}
return null;
return () => null;
}, [editor, block?.type]);
if (!block) {
@@ -44,22 +44,22 @@ export function RenderBlock({
columns: block.columns ?? [],
};
const view = blockView?.View ? (
<blockView.View
const view = (
<BlockView
editor={editor}
block={block}
columns={columns.columns}
columnsFromId={columns.fromId}
editorElement={editorElement}
/>
) : null;
);
return hasContainer ? (
<BlockContainer block-id={blockId} ref={setRef} data-block-id={blockId}>
{view}
</BlockContainer>
) : (
<> {view}</>
view
);
}