fix thread quote refs

This commit is contained in:
plebeius.eth
2023-06-14 10:08:46 +02:00
parent 7e5ac0b7c7
commit bebaa81dd5
+4 -4
View File
@@ -1268,14 +1268,14 @@ const Thread = () => {
<blockquote key={`pm-${index}`} className="post-message"> <blockquote key={`pm-${index}`} className="post-message">
<Link to={() => {}} key={`r-pm-${index}`} className="quotelink" <Link to={() => {}} key={`r-pm-${index}`} className="quotelink"
ref={el => { ref={el => {
quoteRefs.current[shortParentCid] = el; quoteRefs.current[reply.cid] = el;
}} }}
onClick={(event) => handleQuoteClick(reply, shortParentCid, event)} onClick={(event) => handleQuoteClick(reply, shortParentCid, event)}
onMouseOver={(event) => { onMouseOver={(event) => {
event.stopPropagation(); event.stopPropagation();
handleQuoteHover(reply, shortParentCid, () => { handleQuoteHover(reply, shortParentCid, () => {
setOutOfViewCid(reply.parentCid); setOutOfViewCid(reply.parentCid);
const rect = quoteRefs.current[shortParentCid].getBoundingClientRect(); const rect = quoteRefs.current[reply.cid].getBoundingClientRect();
const distanceToRight = window.innerWidth - rect.right; const distanceToRight = window.innerWidth - rect.right;
const distanceToTop = rect.top; const distanceToTop = rect.top;
const distanceToBottom = window.innerHeight - rect.bottom; const distanceToBottom = window.innerHeight - rect.bottom;
@@ -1551,14 +1551,14 @@ const Thread = () => {
<blockquote key={`mob-pm-${index}`} className="post-message-mobile"> <blockquote key={`mob-pm-${index}`} className="post-message-mobile">
<span style={{cursor: 'pointer'}} key={`mob-ql-${index}`} className="quotelink-mobile" <span style={{cursor: 'pointer'}} key={`mob-ql-${index}`} className="quotelink-mobile"
ref={el => { ref={el => {
quoteRefsMobile.current[shortParentCid] = el; quoteRefsMobile.current[reply.cid] = el;
}} }}
onClick={(event) => handleQuoteClick(reply, shortParentCid, event)} onClick={(event) => handleQuoteClick(reply, shortParentCid, event)}
onMouseOver={(event) => { onMouseOver={(event) => {
event.stopPropagation(); event.stopPropagation();
handleQuoteHover(reply, shortParentCid, () => { handleQuoteHover(reply, shortParentCid, () => {
setOutOfViewCid(reply.parentCid); setOutOfViewCid(reply.parentCid);
const rect = quoteRefsMobile.current[shortParentCid].getBoundingClientRect(); const rect = quoteRefsMobile.current[reply.cid].getBoundingClientRect();
const distanceToRight = window.innerWidth - rect.right; const distanceToRight = window.innerWidth - rect.right;
const distanceToTop = rect.top; const distanceToTop = rect.top;
const distanceToBottom = window.innerHeight - rect.bottom; const distanceToBottom = window.innerHeight - rect.bottom;