diff options
author | crupest <crupest@outlook.com> | 2020-06-16 17:05:37 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-06-16 17:05:37 +0800 |
commit | 74032c5b506b69a4b2799e9373ab10ce2e86092b (patch) | |
tree | 545f12232c87abdd1b08ab6de40014a18910a597 /Timeline/ClientApp/src/app/timeline/TimelinePostEdit.tsx | |
parent | eea8d50ba92467f91e76928776491fad879fe30b (diff) | |
download | timeline-74032c5b506b69a4b2799e9373ab10ce2e86092b.tar.gz timeline-74032c5b506b69a4b2799e9373ab10ce2e86092b.tar.bz2 timeline-74032c5b506b69a4b2799e9373ab10ce2e86092b.zip |
fix(front): Truly fix the layout bug when last post is short.
Diffstat (limited to 'Timeline/ClientApp/src/app/timeline/TimelinePostEdit.tsx')
-rw-r--r-- | Timeline/ClientApp/src/app/timeline/TimelinePostEdit.tsx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Timeline/ClientApp/src/app/timeline/TimelinePostEdit.tsx b/Timeline/ClientApp/src/app/timeline/TimelinePostEdit.tsx index 6501e349..d1c09036 100644 --- a/Timeline/ClientApp/src/app/timeline/TimelinePostEdit.tsx +++ b/Timeline/ClientApp/src/app/timeline/TimelinePostEdit.tsx @@ -110,6 +110,12 @@ const TimelinePostEdit: React.FC<TimelinePostEditProps> = (props) => { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const containerRef = React.useRef<HTMLDivElement>(null!); + const notifyHeightChange = (): void => { + if (props.onHeightChange) { + props.onHeightChange(containerRef.current.clientHeight); + } + }; + React.useEffect(() => { if (props.onHeightChange) { props.onHeightChange(containerRef.current.clientHeight); @@ -204,6 +210,7 @@ const TimelinePostEdit: React.FC<TimelinePostEditProps> = (props) => { <> <div className="d-block text-center mt-1 mb-2"> <Svg + onLoad={notifyHeightChange} src={kind === 'text' ? imageIcon : textIcon} className="icon-button" onClick={toggleKind} |