diff --git a/app/components/ClickablePadding.ts b/app/components/ClickablePadding.ts index 4d5274f61..f6d681b2a 100644 --- a/app/components/ClickablePadding.ts +++ b/app/components/ClickablePadding.ts @@ -1,9 +1,9 @@ import styled from "styled-components"; -const ClickablePadding = styled.div<{ grow?: boolean }>` - min-height: 50vh; - cursor: ${({ onClick }) => (onClick ? "text" : "default")}; - ${({ grow }) => grow && `flex-grow: 100;`}; +const ClickablePadding = styled.div<{ grow?: boolean; minHeight?: string }>` + min-height: ${(props) => props.minHeight || "50vh"}; + flex-grow: 100; + cursor: text; `; export default ClickablePadding; diff --git a/app/components/Editor.tsx b/app/components/Editor.tsx index 565e6f233..cd85e1933 100644 --- a/app/components/Editor.tsx +++ b/app/components/Editor.tsx @@ -50,10 +50,10 @@ export type Props = Optional< > & { shareId?: string | undefined; embedsDisabled?: boolean; - grow?: boolean; onHeadingsChange?: (headings: Heading[]) => void; onSynced?: () => Promise; onPublish?: (event: React.MouseEvent) => any; + bottomPadding?: string; }; function Editor(props: Props, ref: React.RefObject | null) { @@ -301,12 +301,12 @@ function Editor(props: Props, ref: React.RefObject | null) { placeholder={props.placeholder || ""} defaultValue={props.defaultValue || ""} /> - {props.grow && !props.readOnly && ( + {props.bottomPadding && !props.readOnly && ( )} {activeLinkEvent && !shareId && ( diff --git a/app/scenes/Document/components/Editor.tsx b/app/scenes/Document/components/Editor.tsx index f0cf9c5d7..34f68146a 100644 --- a/app/scenes/Document/components/Editor.tsx +++ b/app/scenes/Document/components/Editor.tsx @@ -51,6 +51,7 @@ function DocumentEditor(props: Props, ref: React.RefObject) { ...rest } = props; + const childRef = React.useRef(null); const focusAtStart = React.useCallback(() => { if (ref.current) { ref.current.focusAtStart(); @@ -115,10 +116,10 @@ function DocumentEditor(props: Props, ref: React.RefObject) { readOnly={readOnly} shareId={shareId} extensions={fullPackage} - grow + bottomPadding={`calc(50vh - ${childRef.current?.offsetHeight || 0}px)`} {...rest} /> - {children} +
{children}
); }