Compare commits

..

3 commits

Author SHA1 Message Date
cbd4b2ae33
chore: add mx-uc.css 2024-01-18 08:03:28 +09:00
a396a8dca0
misc: update config.json and title for supnas 2024-01-18 08:03:28 +09:00
658185a39f
fix: auto scroll to bottom properly 2024-01-18 08:03:17 +09:00

View file

@ -666,13 +666,13 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
// Stay at bottom when room editor resize
useResizeObserver(
useMemo(() => {
let mounted = false;
// let mounted = false;
return (entries) => {
if (!mounted) {
// skip initial mounting call
mounted = true;
return;
}
// if (!mounted) {
// // skip initial mounting call
// mounted = true;
// return;
// }
if (!roomInputRef.current) return;
const editorBaseEntry = getResizeObserverEntry(roomInputRef.current, entries);
const scrollElement = getScrollElement();
@ -1100,13 +1100,17 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
if (typeof mxcUrl !== 'string') {
return null;
}
// const height = scaleYDimension(imgInfo?.w || 400, 400, imgInfo?.h || 400);
// FIXME
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 (
<Attachment>
<AttachmentBox
style={{
// height: toRem(height < 48 ? 48 : height),
height: toRem(Math.max(48, Math.min(480, height))),
}}
>
<ImageContent