mirror of
https://github.com/outline/outline.git
synced 2026-12-01 09:22:14 +03:00
perf: Reduce rendering when editing title
This commit is contained in:
1 parent
5374784df6
commit
0a4d67d96f
2 files changed
+12
-8
No files matched your search
@@ -309,4 +309,4 @@ const StyledTabPanel = styled(TabPanel)`
|
||||
overflow-y: auto;
|
||||
`;
|
||||
|
||||
export default IconPicker;
|
||||
export default React.memo(IconPicker);
|
||||
@@ -178,6 +178,16 @@ function DocumentEditor(props: Props, ref: React.RefObject<any>) {
|
||||
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 (
|
||||
<Flex auto column>
|
||||
<DocumentTitle
|
||||
@@ -231,13 +241,7 @@ function DocumentEditor(props: Props, ref: React.RefObject<any>) {
|
||||
: undefined
|
||||
}
|
||||
extensions={extensions}
|
||||
editorStyle={{
|
||||
padding: "0 32px",
|
||||
margin: "0 -32px",
|
||||
paddingBottom: `calc(50vh - ${
|
||||
childRef.current?.offsetHeight || 0
|
||||
}px)`,
|
||||
}}
|
||||
editorStyle={editorStyle}
|
||||
{...rest}
|
||||
/>
|
||||
<div ref={childRef}>{children}</div>
|
||||
|
||||
Reference in new issue
Block a user