mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-26 03:05:41 +03:00
Possible fix for weird truncation bug
This commit is contained in:
parent
bc4dfaf62f
commit
16c52ad3ea
1 changed files with 16 additions and 8 deletions
|
@ -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 →';
|
||||
|
|
Loading…
Reference in a new issue