Skip to content

Commit

Permalink
[#70333] fix commit popup shift value
Browse files Browse the repository at this point in the history
  • Loading branch information
Trzcin committed Dec 19, 2024
1 parent d3cfe63 commit 9a64f08
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/comments/ycomments.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Comment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 9a64f08

Please sign in to comment.