From 036051b82de87c84ae59a0bce94fa7349e7370b8 Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Tue, 3 Dec 2024 04:43:20 +0000 Subject: [PATCH 1/3] fix --- templates/repo/find/files.tmpl | 2 +- web_src/js/features/repo-findfile.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/repo/find/files.tmpl b/templates/repo/find/files.tmpl index 548ce2f0e8018..ce242796bec80 100644 --- a/templates/repo/find/files.tmpl +++ b/templates/repo/find/files.tmpl @@ -9,7 +9,7 @@ - +
diff --git a/web_src/js/features/repo-findfile.ts b/web_src/js/features/repo-findfile.ts index 1f151d7056cba..5f0ebc5609999 100644 --- a/web_src/js/features/repo-findfile.ts +++ b/web_src/js/features/repo-findfile.ts @@ -90,6 +90,7 @@ function filterRepoFiles(filter) { const span = document.createElement('span'); // safely escape by using textContent span.textContent = part; + span.setAttribute('data-tooltip-content', span.textContent); // if the target file path is "abc/xyz", to search "bx", then the matchResult is ['a', 'b', 'c/', 'x', 'yz'] // the matchResult[odd] is matched and highlighted to red. if (index % 2 === 1) span.classList.add('ui', 'text', 'red'); From ce36ce65d02845f27ec10388c8d4e6457b042b43 Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Tue, 3 Dec 2024 04:49:12 +0000 Subject: [PATCH 2/3] adjust tooltip location --- web_src/js/features/repo-findfile.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/web_src/js/features/repo-findfile.ts b/web_src/js/features/repo-findfile.ts index 5f0ebc5609999..617d3549ebdf9 100644 --- a/web_src/js/features/repo-findfile.ts +++ b/web_src/js/features/repo-findfile.ts @@ -91,6 +91,7 @@ function filterRepoFiles(filter) { // safely escape by using textContent span.textContent = part; span.setAttribute('data-tooltip-content', span.textContent); + span.setAttribute('data-tooltip-placement', 'top'); // if the target file path is "abc/xyz", to search "bx", then the matchResult is ['a', 'b', 'c/', 'x', 'yz'] // the matchResult[odd] is matched and highlighted to red. if (index % 2 === 1) span.classList.add('ui', 'text', 'red'); From bc714af14c33e512d09b609d37ac5d5c2366ca95 Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Tue, 3 Dec 2024 06:04:02 +0000 Subject: [PATCH 3/3] use title instead of tooltip --- web_src/js/features/repo-findfile.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/web_src/js/features/repo-findfile.ts b/web_src/js/features/repo-findfile.ts index 617d3549ebdf9..6500978bc8189 100644 --- a/web_src/js/features/repo-findfile.ts +++ b/web_src/js/features/repo-findfile.ts @@ -90,8 +90,7 @@ function filterRepoFiles(filter) { const span = document.createElement('span'); // safely escape by using textContent span.textContent = part; - span.setAttribute('data-tooltip-content', span.textContent); - span.setAttribute('data-tooltip-placement', 'top'); + span.title = span.textContent; // if the target file path is "abc/xyz", to search "bx", then the matchResult is ['a', 'b', 'c/', 'x', 'yz'] // the matchResult[odd] is matched and highlighted to red. if (index % 2 === 1) span.classList.add('ui', 'text', 'red');