diff --git a/.eslintrc.js b/.eslintrc.js index 9cb0b100714d4..b5af773920cf9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -85,6 +85,7 @@ module.exports = { 'compact', 'concat', 'countBy', + 'deburr', 'defaults', 'defaultTo', 'delay', diff --git a/package-lock.json b/package-lock.json index 6d7947ac5abc5..958eedcd119f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16658,6 +16658,7 @@ "lodash": "^4.17.21", "memize": "^1.1.0", "rememo": "^4.0.0", + "remove-accents": "^0.4.2", "showdown": "^1.9.1", "simple-html-tokenizer": "^0.5.7", "uuid": "^8.3.0" diff --git a/packages/blocks/package.json b/packages/blocks/package.json index b756451e81990..eb3c8d4a35976 100644 --- a/packages/blocks/package.json +++ b/packages/blocks/package.json @@ -47,6 +47,7 @@ "lodash": "^4.17.21", "memize": "^1.1.0", "rememo": "^4.0.0", + "remove-accents": "^0.4.2", "showdown": "^1.9.1", "simple-html-tokenizer": "^0.5.7", "uuid": "^8.3.0" diff --git a/packages/blocks/src/store/selectors.js b/packages/blocks/src/store/selectors.js index c4cd747719a46..04c87a439fd59 100644 --- a/packages/blocks/src/store/selectors.js +++ b/packages/blocks/src/store/selectors.js @@ -2,7 +2,8 @@ * External dependencies */ import createSelector from 'rememo'; -import { deburr, filter, flow, get, includes, map, some } from 'lodash'; +import removeAccents from 'remove-accents'; +import { filter, flow, get, includes, map, some } from 'lodash'; /** @typedef {import('../api/registration').WPBlockVariation} WPBlockVariation */ /** @typedef {import('../api/registration').WPBlockVariationScope} WPBlockVariationScope */ @@ -688,7 +689,7 @@ export function isMatchingSearchTerm( state, nameOrType, searchTerm ) { const getNormalizedSearchTerm = flow( [ // Disregard diacritics. // Input: "média" - deburr, + ( term ) => removeAccents( term ?? '' ), // Lowercase. // Input: "MEDIA"