Compare commits
2 commits
cbd4b2ae33
...
44b61a34ee
Author | SHA1 | Date | |
---|---|---|---|
44b61a34ee | |||
63096305b6 |
1 changed files with 8 additions and 12 deletions
|
@ -666,13 +666,13 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
||||||
// Stay at bottom when room editor resize
|
// Stay at bottom when room editor resize
|
||||||
useResizeObserver(
|
useResizeObserver(
|
||||||
useMemo(() => {
|
useMemo(() => {
|
||||||
// let mounted = false;
|
let mounted = false;
|
||||||
return (entries) => {
|
return (entries) => {
|
||||||
// if (!mounted) {
|
if (!mounted) {
|
||||||
// // skip initial mounting call
|
// skip initial mounting call
|
||||||
// mounted = true;
|
mounted = true;
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
if (!roomInputRef.current) return;
|
if (!roomInputRef.current) return;
|
||||||
const editorBaseEntry = getResizeObserverEntry(roomInputRef.current, entries);
|
const editorBaseEntry = getResizeObserverEntry(roomInputRef.current, entries);
|
||||||
const scrollElement = getScrollElement();
|
const scrollElement = getScrollElement();
|
||||||
|
@ -1100,17 +1100,13 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
||||||
if (typeof mxcUrl !== 'string') {
|
if (typeof mxcUrl !== 'string') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// FIXME
|
// const height = scaleYDimension(imgInfo?.w || 400, 400, imgInfo?.h || 400);
|
||||||
const imgW = imgInfo?.w ?? 400;
|
|
||||||
const imgH = imgInfo?.h ?? 400;
|
|
||||||
const maxW = scrollRef.current?.querySelector(`[data-message-id]>div>div:nth-child(2)`)?.clientWidth ?? 400;
|
|
||||||
const height = imgW <= maxW ? imgH : scaleYDimension(imgW, maxW, imgH);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Attachment>
|
<Attachment>
|
||||||
<AttachmentBox
|
<AttachmentBox
|
||||||
style={{
|
style={{
|
||||||
height: toRem(Math.max(48, Math.min(480, height))),
|
// height: toRem(height < 48 ? 48 : height),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ImageContent
|
<ImageContent
|
||||||
|
|
Loading…
Reference in a new issue