TagSpaces is an offline, open source, document manager with tagging support
fix https://github.com/tagspaces/tagspaces/issues/2335 (#2365)
Stanimir24eaa2df1858
diff --git a/src/renderer/components/TagContainer.tsx b/src/renderer/components/TagContainer.tsxindex 3fa642e5d..ecd47a2bc 100644--- a/src/renderer/components/TagContainer.tsx+++ b/src/renderer/components/TagContainer.tsx@@ -69,7 +69,6 @@ function TagContainer(props: Props) {const { addTags } = useTaggingActionsContext();const { selectedEntries } = useSelectedEntriesContext();- const { tagGroups } = useEditedTagLibraryContext();const defaultBackgroundColor = useSelector(getTagColor);const defaultTextColor = useSelector(getTagTextColor);@@ -86,14 +85,19 @@ function TagContainer(props: Props) {[isTagGeo, title, tagGroup],);- const tagColors = getTagColors(- title,- tagGroups,- tag.textcolor || defaultTextColor,- tag.color || defaultBackgroundColor,- );- textColor = tagColors.textcolor;- backgroundColor = tagColors.color;+ if (tag.color && tag.textcolor) {+ textColor = tag.textcolor;+ backgroundColor = tag.color;+ } else {+ const tagColors = getTagColors(+ title,+ tagGroup ? [tagGroup] : undefined,+ defaultTextColor,+ defaultBackgroundColor,+ );+ textColor = tagColors.textcolor;+ backgroundColor = tagColors.color;+ }let tid = 'tagContainer_';if (title && title.length > 0) {diff --git a/src/renderer/services/taglibrary-utils.ts b/src/renderer/services/taglibrary-utils.tsindex 504273fa4..1543757cb 100644--- a/src/renderer/services/taglibrary-utils.ts+++ b/src/renderer/services/taglibrary-utils.ts@@ -41,7 +41,7 @@ export function getAllTags(tagGroups?: Array<TS.TagGroup>) {}const uniqueTags: TS.Tag[] = [];tagGroups.forEach((tagGroup) => {- tagGroup.children.forEach((tag) => {+ tagGroup?.children.forEach((tag) => {const found = uniqueTags.find((uTag) => uTag.title === tag.title);if (!found) {uniqueTags.push(tag);