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,10 +211,14 @@ function Status({
onResize: () => { onResize: () => {
if (spoilerContentRef.current) { if (spoilerContentRef.current) {
const { scrollHeight, clientHeight } = spoilerContentRef.current; const { scrollHeight, clientHeight } = spoilerContentRef.current;
spoilerContentRef.current.classList.toggle( if (scrollHeight < window.innerHeight * 0.4) {
'truncated', spoilerContentRef.current.classList.remove('truncated');
scrollHeight > clientHeight, } else {
); spoilerContentRef.current.classList.toggle(
'truncated',
scrollHeight > clientHeight,
);
}
} }
}, },
}); });
@ -224,10 +228,14 @@ function Status({
onResize: () => { onResize: () => {
if (contentRef.current) { if (contentRef.current) {
const { scrollHeight, clientHeight } = contentRef.current; const { scrollHeight, clientHeight } = contentRef.current;
contentRef.current.classList.toggle( if (scrollHeight < window.innerHeight * 0.4) {
'truncated', contentRef.current.classList.remove('truncated');
scrollHeight > clientHeight, } else {
); contentRef.current.classList.toggle(
'truncated',
scrollHeight > clientHeight,
);
}
} }
}, },
}); });