-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
Hi,
In the previous version, I can simply override the method from the package (to better handle text in Vietnamese)
function convertVietnamese(str) {
return str
.normalize("NFD")
.replace(/[\u0300-\u036f]/g, "")
.replace(/đ/g, "d")
.replace(/Đ/g, "D");
};
NiceSelect.prototype._onSearchChanged = function(e) {
var open = hasClass(this.dropdown, "open");
var text = e.target.value;
text = convertVietnamese(text.toLowerCase());
if (text == "") {
this.options.forEach(function(item) {
item.element.style.display = "";
});
} else if (open) {
var matchReg = new RegExp(text);
this.options.forEach(function(item) {
var optionText = convertVietnamese(item.data.text.toLowerCase());
var matched = matchReg.test(optionText);
item.element.style.display = matched ? "" : "none";
});
}
this.dropdown.querySelectorAll(".focus").forEach(function(item) {
removeClass(item, "focus");
});
var firstEl = this._findNext(null);
addClass(firstEl, "focus");
};
Now the method has been changed into private aka #onSearchChanged
Is that possible switch back to old method instead using private one?
Thanks
Metadata
Metadata
Assignees
Labels
No labels