fix: block hub not working in the editor
This commit is contained in:
@@ -143,13 +143,7 @@ export const PageDetailEditor: FC<PageDetailEditorProps> = props => {
|
||||
|
||||
const [layout, setLayout] = useAtom(contentLayoutAtom);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>{title}</title>
|
||||
</Head>
|
||||
<Mosaic
|
||||
onChange={useCallback(
|
||||
const onChange = useCallback(
|
||||
(_: MosaicNode<string | number> | null) => {
|
||||
// type cast
|
||||
const node = _ as MosaicNode<string> | null;
|
||||
@@ -167,12 +161,25 @@ export const PageDetailEditor: FC<PageDetailEditorProps> = props => {
|
||||
}
|
||||
},
|
||||
[setLayout]
|
||||
)}
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>{title}</title>
|
||||
</Head>
|
||||
{layout === 'editor' ? (
|
||||
<EditorWrapper {...props} />
|
||||
) : (
|
||||
<Mosaic
|
||||
onChange={onChange}
|
||||
renderTile={id => {
|
||||
if (id === 'editor') {
|
||||
return <EditorWrapper {...props} />;
|
||||
} else {
|
||||
const plugin = plugins.find(plugin => plugin.definition.id === id);
|
||||
const plugin = plugins.find(
|
||||
plugin => plugin.definition.id === id
|
||||
);
|
||||
if (plugin && plugin.uiAdapter.detailContent) {
|
||||
return (
|
||||
<Suspense>
|
||||
@@ -187,6 +194,7 @@ export const PageDetailEditor: FC<PageDetailEditorProps> = props => {
|
||||
}}
|
||||
value={layout}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user