mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
Update Thread.jsx
This commit is contained in:
@@ -1661,7 +1661,55 @@ const Thread = () => {
|
|||||||
}}>
|
}}>
|
||||||
{`c/${shortParentCid}`}{shortParentCid === comment.shortCid ? " (OP)" : null}
|
{`c/${shortParentCid}`}{shortParentCid === comment.shortCid ? " (OP)" : null}
|
||||||
</span>
|
</span>
|
||||||
<Post content={reply.content} comment={reply} key={`post-mobile-${index}`} />
|
<Post key={`post-mobile-${index}`}
|
||||||
|
content={reply.content}
|
||||||
|
postQuoteRef={(quoteShortParentCid, ref) => {
|
||||||
|
postRefs.current[quoteShortParentCid] = ref;
|
||||||
|
}}
|
||||||
|
postQuoteOnClick={(quoteShortParentCid) => {
|
||||||
|
handleQuoteClick(reply, quoteShortParentCid, null)
|
||||||
|
}}
|
||||||
|
postQuoteOnOver={(quoteShortParentCid) => {
|
||||||
|
const quoteParentCid = cidTracker[quoteShortParentCid];
|
||||||
|
if (outOfViewCid !== quoteParentCid) {
|
||||||
|
handleQuoteHover(reply, quoteShortParentCid, () => {
|
||||||
|
setOutOfViewCid(quoteParentCid);
|
||||||
|
|
||||||
|
const rect = postRefs.current[quoteShortParentCid].getBoundingClientRect();
|
||||||
|
const distanceToRight = window.innerWidth - rect.right;
|
||||||
|
const distanceToTop = rect.top;
|
||||||
|
const distanceToBottom = window.innerHeight - rect.bottom;
|
||||||
|
let top;
|
||||||
|
|
||||||
|
if (distanceToTop < postOnHoverHeight / 2) {
|
||||||
|
top = window.scrollY - 5;
|
||||||
|
} else if (distanceToBottom < postOnHoverHeight / 2) {
|
||||||
|
top = window.scrollY - postOnHoverHeight + window.innerHeight - 10;
|
||||||
|
} else {
|
||||||
|
top = rect.top + window.scrollY - postOnHoverHeight / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (distanceToRight < 200) {
|
||||||
|
setOutOfViewPosition({
|
||||||
|
top,
|
||||||
|
right: window.innerWidth - rect.left - 10,
|
||||||
|
maxWidth: rect.left - 5
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setOutOfViewPosition({
|
||||||
|
top,
|
||||||
|
left: rect.left + rect.width + 5,
|
||||||
|
maxWidth: window.innerWidth - rect.left - rect.width - 5
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
postQuoteOnLeave={() => {
|
||||||
|
removeHighlight();
|
||||||
|
setOutOfViewCid(null);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
<EditLabel key={`edit-label-reply-mob-${index}`}
|
<EditLabel key={`edit-label-reply-mob-${index}`}
|
||||||
commentCid={reply.cid}
|
commentCid={reply.cid}
|
||||||
className="ttl"/>
|
className="ttl"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user