Merge pull request #253 from toeverything/fix/console-error

Fix/console error
This commit is contained in:
Chi Zhang 2022-08-15 14:04:20 +08:00 committed by GitHub
commit 1ce12aabfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 11 deletions

View File

@ -1,9 +1,9 @@
import {
BlockPendantProvider,
CreateView,
RenderBlock,
useCurrentView,
useOnSelect,
BlockPendantProvider,
} from '@toeverything/components/editor-core';
import { styled } from '@toeverything/components/ui';
import type {
@ -60,8 +60,8 @@ const ChildrenView = ({
{childrenIds.map((childId, idx) => {
if (isKanbanScene) {
return (
<StyledBorder>
<RenderBlock key={childId} blockId={childId} />
<StyledBorder key={childId}>
<RenderBlock blockId={childId} />
</StyledBorder>
);
}

View File

@ -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
);
}

View File

@ -171,7 +171,9 @@ const Container = styled('div')({
display: 'contents',
});
const BasicStyledPopper = styled(PopperUnstyled)<{
const BasicStyledPopper = styled(PopperUnstyled, {
shouldForwardProp: propName => !['zIndex'].some(name => name === propName),
})<{
zIndex?: number;
}>(({ zIndex, theme }) => {
return {