From cbdbae292531832fcaf7a35e369394dfe3e0eb6e Mon Sep 17 00:00:00 2001 From: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com> Date: Tue, 3 Nov 2020 00:09:29 +0100 Subject: [PATCH] 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 (cherry picked from commit 7f7e7f3ca432fa80f9f5a8a71c9c10a89ac43c4f) --- web_src/js/index.js | 10 ---------- web_src/less/_review.less | 11 +++++------ 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/web_src/js/index.js b/web_src/js/index.js index 6aedd8b54..1c479d0e7 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -1236,16 +1236,6 @@ function initPullRequestReview() { $(this).closest('.menu').toggle('visible'); }); - $('.code-view .lines-code,.code-view .lines-num') - .on('mouseenter', function () { - const parent = $(this).closest('td'); - $(this).closest('tr').addClass( - parent.hasClass('lines-num-old') || parent.hasClass('lines-code-old') ? 'focus-lines-old' : 'focus-lines-new' - ); - }) - .on('mouseleave', function () { - $(this).closest('tr').removeClass('focus-lines-new focus-lines-old'); - }); $('.add-code-comment').on('click', function (e) { if ($(e.target).hasClass('btn-add-single')) return; // https://github.com/go-gitea/gitea/issues/4745 e.preventDefault(); diff --git a/web_src/less/_review.less b/web_src/less/_review.less index 73506f5f0..5ba4525a2 100644 --- a/web_src/less/_review.less +++ b/web_src/less/_review.less @@ -1,7 +1,7 @@ .ui.button.add-code-comment { font-size: 14px; height: 16px; - line-height: 16px !important; + line-height: 12px !important; padding: 0; position: relative; width: 16px; @@ -17,6 +17,10 @@ } } +.diff-file-box .lines-code:hover .ui.button.add-code-comment { + opacity: 1; +} + .add-comment-left.add-comment-right .ui.attached.header { border: 1px solid #d4d4d5; margin-top: .5em; @@ -32,11 +36,6 @@ } } -.focus-lines-new .ui.button.add-code-comment.add-code-comment-right, -.focus-lines-old .ui.button.add-code-comment.add-code-comment-left { - opacity: 1; -} - .comment-code-cloud { padding: 4px; position: relative;