Possible fix for weird truncation bug

This commit is contained in:
Lim Chee Aun 2023-03-16 16:16:15 +08:00
parent bc4dfaf62f
commit 16c52ad3ea

View file

@ -211,11 +211,15 @@ function Status({
onResize: () => {
if (spoilerContentRef.current) {
const { scrollHeight, clientHeight } = spoilerContentRef.current;
if (scrollHeight < window.innerHeight * 0.4) {
spoilerContentRef.current.classList.remove('truncated');
} else {
spoilerContentRef.current.classList.toggle(
'truncated',
scrollHeight > clientHeight,
);
}
}
},
});
const contentRef = useRef(null);
@ -224,11 +228,15 @@ function Status({
onResize: () => {
if (contentRef.current) {
const { scrollHeight, clientHeight } = contentRef.current;
if (scrollHeight < window.innerHeight * 0.4) {
contentRef.current.classList.remove('truncated');
} else {
contentRef.current.classList.toggle(
'truncated',
scrollHeight > clientHeight,
);
}
}
},
});
const readMoreText = 'Read more →';