mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
Use lodash to remove accents and ther diacritics
https://lodash.com/docs/4.17.15#deburr
This commit is contained in:
@@ -7,9 +7,10 @@
|
||||
* "lush" would only match the "L" in "Lavender".
|
||||
*/
|
||||
|
||||
import {localeCompare, nativeCompare, removeDiacritics, sortedIndex} from 'app/common/gutil';
|
||||
import {localeCompare, nativeCompare, sortedIndex} from 'app/common/gutil';
|
||||
import {DomContents} from 'grainjs';
|
||||
import escapeRegExp = require("lodash/escapeRegExp");
|
||||
import deburr = require("lodash/deburr");
|
||||
|
||||
export interface ACItem {
|
||||
// This should be a trimmed lowercase version of the item's text. It may be an accessor.
|
||||
@@ -17,10 +18,11 @@ export interface ACItem {
|
||||
cleanText: string;
|
||||
}
|
||||
|
||||
// Returns a normalized, trimmed, lowercase version of a string, so that autocomplete is case-
|
||||
// and accent-insensitive.
|
||||
// Returns a trimmed, lowercase version of a string,
|
||||
// from which accents and other diacritics have been removed,
|
||||
// so that autocomplete is case- and accent-insensitive.
|
||||
export function cleanText(text: string): string {
|
||||
return removeDiacritics(text).trim().toLowerCase();
|
||||
return deburr(text).trim().toLowerCase();
|
||||
}
|
||||
|
||||
// Regexp used to split text into words; includes nearly all punctuation. This means that
|
||||
|
||||
Reference in New Issue
Block a user