diff --git a/app/components/IconPicker/index.tsx b/app/components/IconPicker/index.tsx index d314c99108..2aa0946ec0 100644 --- a/app/components/IconPicker/index.tsx +++ b/app/components/IconPicker/index.tsx @@ -309,4 +309,4 @@ const StyledTabPanel = styled(TabPanel)` overflow-y: auto; `; -export default IconPicker; +export default React.memo(IconPicker); diff --git a/app/scenes/Document/components/Editor.tsx b/app/scenes/Document/components/Editor.tsx index 8b314e5caf..608b84fc32 100644 --- a/app/scenes/Document/components/Editor.tsx +++ b/app/scenes/Document/components/Editor.tsx @@ -178,6 +178,16 @@ function DocumentEditor(props: Props, ref: React.RefObject) { const handleRefChanged = React.useCallback(setEditor, [setEditor]); const EditorComponent = multiplayer ? MultiplayerEditor : Editor; + const childOffsetHeight = childRef.current?.offsetHeight || 0; + const editorStyle = React.useMemo( + () => ({ + padding: "0 32px", + margin: "0 -32px", + paddingBottom: `calc(50vh - ${childOffsetHeight}px)`, + }), + [childOffsetHeight] + ); + return ( ) { : undefined } extensions={extensions} - editorStyle={{ - padding: "0 32px", - margin: "0 -32px", - paddingBottom: `calc(50vh - ${ - childRef.current?.offsetHeight || 0 - }px)`, - }} + editorStyle={editorStyle} {...rest} />
{children}