Fix broken tag selector with colored tags that differ with normalization

https://forums.zotero.org/discussion/96138/lost-content-in-tag-selector

An entered character from the CJK_COMPATIBILITY_IDEOGRAPHS block (char
code 63834, or similar) was normalized to the CJK_UNIFIED_IDEOGRAPHS
block (char code 35712), which then caused an expected key not to exist.

To fix, normalize colored tag values coming from the DB.
This commit is contained in:
Dan Stillman 2022-04-09 06:20:47 -04:00
parent 2112aa7271
commit 0df8b7670d

View file

@ -591,6 +591,8 @@ Zotero.Tags = new function() {
}
var tagColors = Zotero.SyncedSettings.get(libraryID, 'tagColors') || [];
// Normalize tags from DB, which might not have been normalized properly previously
tagColors.forEach(x => x.name = x.name.normalize());
_libraryColors[libraryID] = tagColors;
_libraryColorsByName[libraryID] = new Map;
@ -619,7 +621,7 @@ Zotero.Tags = new function() {
this.getColors(libraryID);
var tagColors = _libraryColors[libraryID];
name = name.trim();
name = name.trim().normalize();
// Unset
if (!color) {