From 9a64f0887ee3d2b9bc4af41b426d9e214a612b06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Trzci=C5=84ski?= Date: Tue, 17 Dec 2024 15:26:36 +0100 Subject: [PATCH] [#70333] fix commit popup shift value --- src/comments/ycomments.js | 10 ++++++++-- src/components/Comment.jsx | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/comments/ycomments.js b/src/comments/ycomments.js index 52dd109..1325428 100644 --- a/src/comments/ycomments.js +++ b/src/comments/ycomments.js @@ -338,8 +338,14 @@ export class YComments { } parentLineHeight(commentId) { - let elem = this.mainCodeMirror.dom.querySelector("#" + commentId)?.previousSibling; - if (elem) return elem.clientHeight; + let elem; + if (this.display().isShown(commentId)) { + elem = this.mainCodeMirror.dom.querySelector("#" + commentId)?.previousSibling; + if (elem) return elem.clientHeight + 5; + } else { + elem = this.mainCodeMirror.dom.querySelector("#" + commentId)?.parentElement; + if (elem) return elem.clientHeight; + } let parentLineNumber = this.positionManager.get(commentId); return [...this.mainCodeMirror.dom.querySelectorAll(`.cm-gutterElement`)].find((e) => e.textContent == parentLineNumber)?.clientHeight; diff --git a/src/components/Comment.jsx b/src/components/Comment.jsx index 832e71c..9214233 100644 --- a/src/components/Comment.jsx +++ b/src/components/Comment.jsx @@ -82,7 +82,7 @@ const YComment = ({ ycomments, commentId }) => { [commentId], ); - const parentHeight = ycomments.parentLineHeight(commentId) + 3.8; + const parentHeight = ycomments.parentLineHeight(commentId) - 1; useEffect(() => { if (!cmref.current) {