Skip to content

Commit 7f2b8ff

Browse files
committed
fix: corretta evidenziazione risultati ricerca
1 parent 3a9de9a commit 7f2b8ff

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

assets/src/css/style.css

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,13 @@ input[type=file] {
207207
padding: 5px;
208208
}
209209

210-
.highlight {
211-
background: #FFFF66;
210+
.highlight, .search-highlight {
211+
background: #ffc107;
212+
color: #212529;
213+
font-weight: bold;
214+
padding: 2px 4px;
215+
border-radius: 3px;
216+
box-shadow: 0 1px 3px rgba(255, 193, 7, 0.3);
212217
}
213218

214219
/* Disabilita il widget sidebar-search di AdminLTE */

assets/src/js/base/supersearch.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,20 @@ $(document).ready(function () {
261261
results.forEach(result => {
262262
const title = result.title;
263263
const labels = result.labels ? result.labels.join('').split('<br/>,').join(' • ') : '';
264+
265+
// Preserva l'evidenziazione esistente e applica quella per search-highlight
266+
let processedLabels = labels;
267+
// Sostituisci la classe highlight con search-highlight per coerenza
268+
processedLabels = processedLabels.replace(/class=['"]highlight['"]/g, 'class="search-highlight"');
269+
264270
const cleanLabels = labels.replace(/<[^>]*>/g, ''); // Rimuovi HTML per il tooltip
265271

266272
// Evidenzia il termine di ricerca nel titolo
267273
const highlightedTitle = highlightSearchTerm(title, searchTerm);
268-
// Mantieni le labels complete per permettere il wrap
269-
const simplifiedLabels = cleanLabels.replace(/:/g, '');
274+
275+
// Applica evidenziazione anche alle labels processate
276+
const highlightedLabels = highlightSearchTerm(processedLabels, searchTerm);
277+
const simplifiedLabels = highlightedLabels.replace(/:/g, '');
270278

271279
categoryList.append(`
272280
<li class="nav-item">

0 commit comments

Comments
 (0)