Skip to content

Commit

Permalink
Fix: renderAboveSlate/Editable calls component as function
Browse files Browse the repository at this point in the history
  • Loading branch information
12joan committed Dec 5, 2023
1 parent d172a5e commit c698bb5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
10 changes: 5 additions & 5 deletions packages/core/src/components/PlateContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ const PlateContent = React.forwardRef(
);

editor.plugins.forEach((plugin) => {
const { renderAboveEditable } = plugin;
const { renderAboveEditable: RenderAboveEditable } = plugin;

if (renderAboveEditable)
aboveEditable = renderAboveEditable({
children: aboveEditable,
}) as any;
if (RenderAboveEditable)
aboveEditable = (
<RenderAboveEditable>{aboveEditable}</RenderAboveEditable>
);
});

return <PlateSlate id={id}>{aboveEditable}</PlateSlate>;
Expand Down
8 changes: 3 additions & 5 deletions packages/core/src/components/PlateSlate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ export function PlateSlate({
);

editor.plugins?.forEach((plugin) => {
const { renderAboveSlate } = plugin;
const { renderAboveSlate: RenderAboveSlate } = plugin;

if (renderAboveSlate)
aboveSlate = renderAboveSlate({
children: aboveSlate,
}) as any;
if (RenderAboveSlate)
aboveSlate = <RenderAboveSlate>{aboveSlate}</RenderAboveSlate>;
});

return aboveSlate;
Expand Down

0 comments on commit c698bb5

Please sign in to comment.