Skip to content

Commit cbdbae2

Browse files
authored
Fix 'add code comment' button being invisible all the time (#13389) (#13402)
* Fix 'add code comment' button being invisible all the time * Fix off-center icon * Remove old JS hover hack * Show on full-line hover Co-authored-by: techknowlogick <techknowlogick@gitea.io> (cherry picked from commit 7f7e7f3)
1 parent 350c10f commit cbdbae2

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

web_src/js/index.js

-10
Original file line numberDiff line numberDiff line change
@@ -1236,16 +1236,6 @@ function initPullRequestReview() {
12361236
$(this).closest('.menu').toggle('visible');
12371237
});
12381238

1239-
$('.code-view .lines-code,.code-view .lines-num')
1240-
.on('mouseenter', function () {
1241-
const parent = $(this).closest('td');
1242-
$(this).closest('tr').addClass(
1243-
parent.hasClass('lines-num-old') || parent.hasClass('lines-code-old') ? 'focus-lines-old' : 'focus-lines-new'
1244-
);
1245-
})
1246-
.on('mouseleave', function () {
1247-
$(this).closest('tr').removeClass('focus-lines-new focus-lines-old');
1248-
});
12491239
$('.add-code-comment').on('click', function (e) {
12501240
if ($(e.target).hasClass('btn-add-single')) return; // https://github.com/go-gitea/gitea/issues/4745
12511241
e.preventDefault();

web_src/less/_review.less

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.ui.button.add-code-comment {
22
font-size: 14px;
33
height: 16px;
4-
line-height: 16px !important;
4+
line-height: 12px !important;
55
padding: 0;
66
position: relative;
77
width: 16px;
@@ -17,6 +17,10 @@
1717
}
1818
}
1919

20+
.diff-file-box .lines-code:hover .ui.button.add-code-comment {
21+
opacity: 1;
22+
}
23+
2024
.add-comment-left.add-comment-right .ui.attached.header {
2125
border: 1px solid #d4d4d5;
2226
margin-top: .5em;
@@ -32,11 +36,6 @@
3236
}
3337
}
3438

35-
.focus-lines-new .ui.button.add-code-comment.add-code-comment-right,
36-
.focus-lines-old .ui.button.add-code-comment.add-code-comment-left {
37-
opacity: 1;
38-
}
39-
4039
.comment-code-cloud {
4140
padding: 4px;
4241
position: relative;

0 commit comments

Comments
 (0)