TagSpaces is an offline, open source, document manager with tagging support
chore: added option for showing first tag in the tagpreview component
Ilian Sapundshiev453f4b34bafe
diff --git a/src/renderer/components/AiPropertiesTab.tsx b/src/renderer/components/AiPropertiesTab.tsxindex a888353dc..393cac29e 100644--- a/src/renderer/components/AiPropertiesTab.tsx+++ b/src/renderer/components/AiPropertiesTab.tsx@@ -35,6 +35,23 @@ function AiPropertiesTab(props: Props) {return <ChatView />;}+ // const iframe = document.getElementsByTagName('iframe')[0];++ // function getIframeSelection() {+ // const iframeWindow = iframe.contentWindow;+ // const selection = iframeWindow.getSelection();+ // const selectionText = selection.toString();+ // if (selectionText) {+ // return selectionText;+ // } else {+ // const childIframe =+ // iframeWindow.document.getElementsByTagName('iframe')[0];+ // const subselection = childIframe.contentWindow.getSelection();+ // return subselection.toString();+ // }+ // }+ // alert(getIframeSelection());+return (<Box position="relative" display="inline-flex"><AiGenDescButton />diff --git a/src/renderer/components/EntryContainerTitle.tsx b/src/renderer/components/EntryContainerTitle.tsxindex 0a9c1895a..f9b9c8ab7 100644--- a/src/renderer/components/EntryContainerTitle.tsx+++ b/src/renderer/components/EntryContainerTitle.tsx@@ -226,7 +226,7 @@ function EntryContainerTitle(props: Props) {{fileTitle}</Box></Tooltip>- <TagsPreview tags={getAllTags(openedEntry, tagDelimiter)} />+ <TagsPreview showFirstTag tags={getAllTags(openedEntry, tagDelimiter)} />{openedEntry.isEncrypted && (<Tooltip title={t('core:encryptedTooltip')}><EncryptedIcondiff --git a/src/renderer/components/TagsPreview.tsx b/src/renderer/components/TagsPreview.tsxindex 2e3caef03..238ab9abf 100644--- a/src/renderer/components/TagsPreview.tsx+++ b/src/renderer/components/TagsPreview.tsx@@ -27,6 +27,7 @@ import { Box } from '@mui/material';import { useTranslation } from 'react-i18next';interface Props {+ showFirstTag?: boolean;tags: Array<TS.Tag>;}@@ -36,14 +37,14 @@ function TagsPreview(props: Props) {const defaultBackgroundColor = useSelector(getTagColor);const defaultTextColor = useSelector(getTagTextColor);- const { tags } = props;+ const { tags, showFirstTag = false } = props;if (!tags || tags.length < 1) {return <></>;}- let tagNames = t('core:searchTags') + ': ';- tags.forEach((tag) => {- tagNames = tagNames + tag.title + ' ';+ let tagNames = t('core:tags') + ': ';+ tags.forEach((tag, index) => {+ tagNames = tagNames + (index > 0 ? ', ' : '') + tag.title;});let firstTagColor: string;@@ -85,10 +86,11 @@ function TagsPreview(props: Props) {{display: 'inline-block',minWidth: 15,- width: 18,height: 15,marginLeft: '4px',marginRight: '4px',+ paddingLeft: showFirstTag ? '4px' : '0',+ paddingRight: showFirstTag ? '4px' : '0',borderRadius: '7px',borderRight: moreThanOne ? 'white 1px solid' : 'initial',boxShadow: moreThanOne@@ -103,7 +105,7 @@ function TagsPreview(props: Props) {} as React.CSSProperties}>- {moreThanOne ? tags.length : '1'}+ {showFirstTag ? tags[0].title : moreThanOne ? tags.length : '1'}</Box></Tooltip>);diff --git a/src/renderer/perspectives/grid/components/GridPagination.tsx b/src/renderer/perspectives/grid/components/GridPagination.tsxindex d02027d70..384f7c6d9 100644--- a/src/renderer/perspectives/grid/components/GridPagination.tsx+++ b/src/renderer/perspectives/grid/components/GridPagination.tsx@@ -251,7 +251,7 @@ function GridPagination(props: Props) {))}</Box>) : (- <TagsPreview tags={directoryMeta?.tags} />+ <TagsPreview showFirstTag tags={directoryMeta?.tags} />)}</Box><Box