Skip to content

Commit

Permalink
Fix highlighting for words
Browse files Browse the repository at this point in the history
`includes()` is case sensitive
  • Loading branch information
beatrycze-volk committed Nov 21, 2024
1 parent f088772 commit 24d8a5f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Resources/Public/JavaScript/PageView/Utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,16 +646,18 @@ dlfUtils.scaleToImageSize = function (features, imageObj, width, height, optOffs
};

/**
* Search a feature collection for a feature with the given coordinates
* Search a feature collection for a feature with the given word in its fulltext.
* @param {Array.<ol.Feature>} featureCollection
* @param {string} coordinates
* @param {string} word for highlighting
* @returns {Array.<ol.Feature>|undefined}
*/
dlfUtils.searchFeatureCollectionForCoordinates = function (featureCollection, coordinates) {
dlfUtils.searchFeatureCollectionForCoordinates = function (featureCollection, word) {
var features = [];
console.log(word);
featureCollection.forEach(function (ft) {
if (ft.values_.fulltext !== undefined) {
if (ft.values_.fulltext.includes(coordinates)) {
console.log(ft.values_.fulltext);
if (ft.values_.fulltext.toLowerCase().includes(word.toLowerCase())) {
features.push(ft);
}
}
Expand Down

0 comments on commit 24d8a5f

Please sign in to comment.