TagSpaces is an offline, open source, document manager with tagging support
Issue with editing month tag (#2308)
Stanimir338e5dcf937e
diff --git a/package-lock.json b/package-lock.jsonindex 6474100a2..941a68b86 100644--- a/package-lock.json+++ b/package-lock.json@@ -206,7 +206,7 @@"yarn": "please-use-npm"},"optionalDependencies": {- "@tagspacespro/tagspacespro": "5.0.151"+ "@tagspacespro/tagspacespro": "5.0.152"}},"node_modules/@adobe/css-tools": {@@ -19925,9 +19925,9 @@}},"node_modules/@tagspacespro/tagspacespro": {- "version": "5.0.151",- "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.151/5a2520dae0aa7c68b5501f1e16ed6e30c7949667",- "integrity": "sha512-7GR5IcUm3MN1ZXkvDdGo8xNZ7n43CnKSZ1xQXtml5SWl29x3KYgAMXnQqD8YPsYYTmMMaGlcHnOr/VaxKbk6qg==",+ "version": "5.0.152",+ "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.152/7a62b22c3b8686dd7f26b8000cf89b72081958f7",+ "integrity": "sha512-azi30Xwv9crZyNJw0jT0KZ6BffnsSLsKyQa+vlQ14UOdUTGvvVX0J3hvvsKTGZNJT4kWdwxUNoMelqFSVtaeGQ==","license": "Proprietary","optional": true},diff --git a/src/renderer/components/dialogs/EditEntryTagDialog.tsx b/src/renderer/components/dialogs/EditEntryTagDialog.tsxindex 852688070..679914829 100644--- a/src/renderer/components/dialogs/EditEntryTagDialog.tsx+++ b/src/renderer/components/dialogs/EditEntryTagDialog.tsx@@ -15,22 +15,8 @@* along with this program. If not, see <https://www.gnu.org/licenses/>.**/-import React, {- ChangeEvent,- useMemo,- useReducer,- useRef,- useState,-} from 'react';-import { useTranslation } from 'react-i18next';-import { useTheme } from '@mui/material/styles';-import useMediaQuery from '@mui/material/useMediaQuery';-import Dialog from '@mui/material/Dialog';-import DialogContent from '@mui/material/DialogContent';-import FormControl from '@mui/material/FormControl';-import FormHelperText from '@mui/material/FormHelperText';-import EditIcon from '@mui/icons-material/Edit';import AppConfig from '-/AppConfig';+import DraggablePaper from '-/components/DraggablePaper';import TsButton from '-/components/TsButton';import TsTextField from '-/components/TsTextField';import TsDialogActions from '-/components/dialogs/components/TsDialogActions';@@ -39,9 +25,19 @@ import { useTaggingActionsContext } from '-/hooks/useTaggingActionsContext';import { Pro } from '-/pro';import { tagsValidation } from '-/services/utils-io';import { TS } from '-/tagspaces.namespace';-import { isDateTimeTag } from '-/utils/dates';+import { isDateTimeTag, isYear, isYearMonth } from '-/utils/dates';import { isGeoTag } from '-/utils/geo';import useValidation from '-/utils/useValidation';+import EditIcon from '@mui/icons-material/Edit';+import Dialog from '@mui/material/Dialog';+import DialogContent from '@mui/material/DialogContent';+import FormControl from '@mui/material/FormControl';+import FormHelperText from '@mui/material/FormHelperText';+import Paper from '@mui/material/Paper';+import { useTheme } from '@mui/material/styles';+import useMediaQuery from '@mui/material/useMediaQuery';+import React, { ChangeEvent, useMemo, useRef, useState } from 'react';+import { useTranslation } from 'react-i18next';interface Props {open: boolean;@@ -84,7 +80,11 @@ function EditEntryTagDialog({ open, entries, tag, onClose }: Props) {return parts.length === 2 && parts.every(isDateTimeTag);}- return isDateTimeTag(currentTitle);+ return (+ isDateTimeTag(currentTitle) &&+ !isYear(currentTitle) &&+ !isYearMonth(currentTitle)+ );}, [titleRef.current, tag?.title]);const handleValidation = (tagTitle: string): boolean => {@@ -116,7 +116,10 @@ function EditEntryTagDialog({ open, entries, tag, onClose }: Props) {const showGeoEditor = GeoTagEditor && isGeoTag(tag?.title);return (- <DialogContent data-tid="editEntryTagDialog" style={{ overflow: 'auto' }}>+ <DialogContent+ data-tid="editEntryTagDialog"+ sx={{ overflow: 'auto', minWidth: '545px', minHeight: '190px' }}+ ><FormControl fullWidth error={haveError('tag')}><TsTextFielderror={haveError('tag')}@@ -156,7 +159,10 @@ function EditEntryTagDialog({ open, entries, tag, onClose }: Props) {/>)}{isShowDatePeriodEditor && tag && (- <DateTagEditor datePeriodTag={tag?.title} onChange={setTitle} />+ <DateTagEditor+ datePeriodTag={titleRef.current || tag?.title}+ onChange={setTitle}+ />)}</DialogContent>);@@ -175,6 +181,9 @@ function EditEntryTagDialog({ open, entries, tag, onClose }: Props) {onConfirm();}}}+ scroll="paper"+ PaperComponent={smallScreen ? Paper : DraggablePaper}+ aria-labelledby="draggable-dialog-title"><TsDialogTitledialogTitle={t('core:tagProperties')}