TagSpaces is an offline, open source, document manager with tagging support
Assigning custom date and geo-location tags to multiple files (#2225)
Stanimird146b19dbdc3
diff --git a/package-lock.json b/package-lock.jsonindex 2b7e0b5f3..288d536fe 100644--- a/package-lock.json+++ b/package-lock.json@@ -19,9 +19,9 @@"@mui/lab": "6.0.0-beta.14","@mui/material": "^6.1.6","@mui/x-date-pickers": "^7.22.1",- "@tagspaces/tagspaces-common": "4.5.48",- "@tagspaces/tagspaces-common-aws3": "4.5.48",- "@tagspaces/tagspaces-common-cordova": "4.5.48",+ "@tagspaces/tagspaces-common": "4.5.49",+ "@tagspaces/tagspaces-common-aws3": "4.5.49",+ "@tagspaces/tagspaces-common-cordova": "4.5.49","@tagspaces/tagspaces-indexer": "4.5.48","@tagspaces/tagspaces-md": "4.5.38","aws-amplify": "^4.3.8",@@ -199,7 +199,7 @@"yarn": "please-use-npm"},"optionalDependencies": {- "@tagspacespro/tagspacespro": "5.0.94"+ "@tagspacespro/tagspacespro": "5.0.96-alpha.0"}},"node_modules/@adobe/css-tools": {@@ -15597,9 +15597,9 @@}},"node_modules/@tagspaces/tagspaces-common": {- "version": "4.5.48",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.48.tgz",- "integrity": "sha512-eLN5Irs325qwmEWCkA39FfpEk/8zGKpYxq/T4vwhFFkfG7pEKHeA4uRXa81NAqn0PgxZOCm79WZ9SU+0X09H3Q==",+ "version": "4.5.49",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.49.tgz",+ "integrity": "sha512-OQFTRa9yPt8YSWTyQFLCXB0qbMKBYAaLtgVHfR6yGHPgMlIMy6zPVPQYVPpYVDbds6rThGXBgqOScyBWQiCSsA==","license": "MIT","dependencies": {"dompurify": "^3.2.3",@@ -15611,25 +15611,25 @@}},"node_modules/@tagspaces/tagspaces-common-aws3": {- "version": "4.5.48",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-aws3/-/tagspaces-common-aws3-4.5.48.tgz",- "integrity": "sha512-8xcleU42i9lqTcKpd4/k8GiQ56F107oXSdIaqtfp5/hWIegLkWO+B6E2vqGBRSTSwH8YhWYk9RL55WPFruMRDg==",+ "version": "4.5.49",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-aws3/-/tagspaces-common-aws3-4.5.49.tgz",+ "integrity": "sha512-XmQ5GQbx3m8QBlXHf9C82RgyaG3OQGRVYUhT89dNPfrAY7ZuVkR69aqqipkid3rsv/M2lczxMjqgzIEhfAZo/w==","license": "MIT","dependencies": {"@aws-sdk/client-s3": "^3.665.0","@aws-sdk/lib-storage": "^3.665.0","@aws-sdk/s3-request-presigner": "^3.665.0",- "@tagspaces/tagspaces-common": "^4.5.48",+ "@tagspaces/tagspaces-common": "^4.5.49","crypto-js": "^4.2.0"}},"node_modules/@tagspaces/tagspaces-common-cordova": {- "version": "4.5.48",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-cordova/-/tagspaces-common-cordova-4.5.48.tgz",- "integrity": "sha512-VluNo0nHLl0NBSzLHeHb+Vqb27mxq31iEp0pkrOZFMlAz/nWCewMiG2O1T1AANHC57lxW7F4NyjklSAwD/OmDg==",+ "version": "4.5.49",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-cordova/-/tagspaces-common-cordova-4.5.49.tgz",+ "integrity": "sha512-/ESmfDOT60udr7fl75cUippLah6Ga9bDAF4uj86mR8UZOO6xt4WUnYZGkOfQuorwt/QgeCMA08Rtj77iqMPQnA==","license": "MIT","dependencies": {- "@tagspaces/tagspaces-common": "^4.5.48"+ "@tagspaces/tagspaces-common": "^4.5.49"}},"node_modules/@tagspaces/tagspaces-common/node_modules/agent-base": {@@ -15880,9 +15880,9 @@}},"node_modules/@tagspacespro/tagspacespro": {- "version": "5.0.94",- "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.94/9c8687edc434be5e7c477591ba8b4320bccccba7",- "integrity": "sha512-30X271icvBuriJZ+Ul7ogBlcnCY2WkBVAmxjacZXGaJIR5q2+bud6Qp+KMGuBpKM57RfDNMDqfWTMrG/JvJc6g==",+ "version": "5.0.96-alpha.0",+ "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.96-alpha.0/5c03f536f671bfc3b39d31f0274f0c71d98c6053",+ "integrity": "sha512-x4PRg8u5R3PmX82xUhaV2M86H7CFcAKJiVrA2U+beNiWHv/dbXQ4gamXTeF9FKeS6oVmZuT7KWwZ2SJ+6FcUQw==","license": "Proprietary","optional": true},diff --git a/package.json b/package.jsonindex 5a004df96..fd4cd767f 100644--- a/package.json+++ b/package.json@@ -236,7 +236,7 @@"uuid": "^9.0.0"},"optionalDependencies": {- "@tagspacespro/tagspacespro": "5.0.96"+ "@tagspacespro/tagspacespro": "5.0.96-alpha.0"},"devDependencies": {"@electron/notarize": "^2.3.2",diff --git a/src/renderer/components/EntryProperties.tsx b/src/renderer/components/EntryProperties.tsxindex 8e28c24db..5b30c74cf 100644--- a/src/renderer/components/EntryProperties.tsx+++ b/src/renderer/components/EntryProperties.tsx@@ -656,7 +656,7 @@ function EntryProperties(props: Props) {tags={getAllTags(openedEntry)}tagMode="default"handleChange={handleChange}- selectedEntryPath={openedEntry.path}+ selectedEntry={openedEntry}autoFocus={true}generateButton={true}/>diff --git a/src/renderer/components/TagContainer.tsx b/src/renderer/components/TagContainer.tsxindex 68b7a1ddd..bc71df8c7 100644--- a/src/renderer/components/TagContainer.tsx+++ b/src/renderer/components/TagContainer.tsx@@ -29,6 +29,7 @@ import PlaceIcon from '@mui/icons-material/Place';import { formatDateTime } from '@tagspaces/tagspaces-common/misc';import React, { useMemo } from 'react';import { useSelector } from 'react-redux';+import { useTaggingActionsContext } from '-/hooks/useTaggingActionsContext';interface Props {tag: TS.Tag;@@ -36,15 +37,14 @@ interface Props {handleTagMenu?: (event: Object,tag: TS.Tag,- tagGroup: TS.TagGroup | string,+ tagGroup: TS.TagGroup | TS.FileSystemEntry,haveSelectedEntries: boolean,) => void; // TODO refactorhandleRemoveTag?: (event: Object, tags: Array<TS.Tag>) => void;isDragging?: boolean;tagMode?: 'default' | 'display' | 'remove';- entryPath?: string;+ entry?: TS.FileSystemEntry;deleteIcon?: any;- addTags?: (paths: Array<string>, tags: Array<TS.Tag>, updateIndex?) => void;moveTag?: (tagTitle: string,fromTagGroupId: TS.Uuid,@@ -59,14 +59,14 @@ function TagContainer(props: Props) {deleteIcon,isDragging,tagGroup,- entryPath,+ entry,handleRemoveTag,handleTagMenu,- addTags,tagMode,} = props;let { title } = tag;+ const { addTags } = useTaggingActionsContext();const { selectedEntries } = useSelectedEntriesContext();const defaultBackgroundColor = useSelector(getTagColor);const defaultTextColor = useSelector(getTagTextColor);@@ -154,8 +154,8 @@ function TagContainer(props: Props) {onClick={(event) => {if (event.ctrlKey && addTags) {const selectedEntryPaths = [];- selectedEntries.map((entry) => selectedEntryPaths.push(entry.path));- addTags(selectedEntryPaths, [tag]);+ //selectedEntries.map((entry) => selectedEntryPaths.push(entry.path));+ addTags(selectedEntries, [tag]);// Removing tags doesn't seem to work correctly here, yet. Using sidecar tagging, but the removeTagsFromEntry function in tagging.actions.js// doesn't recignize it correctly, thinking it's a plain tag and thus tries to rename the files// } else if (event.shiftKey) {@@ -166,7 +166,7 @@ function TagContainer(props: Props) {handleTagMenu(event,tag,- entryPath || tagGroup,+ entry || tagGroup,selectedEntries && selectedEntries.length > 0,);}@@ -176,7 +176,7 @@ function TagContainer(props: Props) {handleTagMenu(event,tag,- entryPath || tagGroup,+ entry || tagGroup,selectedEntries && selectedEntries.length > 0,);}@@ -186,7 +186,7 @@ function TagContainer(props: Props) {handleTagMenu(event,tag,- entryPath || tagGroup,+ entry || tagGroup,selectedEntries && selectedEntries.length > 0,);}diff --git a/src/renderer/components/TagContainerDnd.tsx b/src/renderer/components/TagContainerDnd.tsxindex c07203b40..21501ab49 100644--- a/src/renderer/components/TagContainerDnd.tsx+++ b/src/renderer/components/TagContainerDnd.tsx@@ -26,6 +26,7 @@ import DragItemTypes from './DragItemTypes';import TagContainer from './TagContainer';import { TS } from '-/tagspaces.namespace';import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';+import { useTaggingActionsContext } from '-/hooks/useTaggingActionsContext';interface Props {tag: TS.Tag;@@ -39,8 +40,7 @@ interface Props {) => void;handleRemoveTag?: (event: Object, tag: TS.Tag) => void;tagMode?: 'default' | 'display' | 'remove';- entryPath?: string;- addTags?: (paths: Array<string>, tags: Array<TS.Tag>, updateIndex?) => void;+ entry?: TS.FileSystemEntry;addTag?: (tag: TS.Tag, parentTagGroupUuid: TS.Uuid) => void;moveTag?: (tagTitle: string,@@ -63,11 +63,10 @@ const TagContainerDnd = (props: Props) => {index,tag,tagGroup,- entryPath,+ entry,handleTagMenu,deleteIcon,addTag,- addTags,tagMode,reorderTags,changeTagOrder,@@ -76,6 +75,7 @@ const TagContainerDnd = (props: Props) => {selectedEntries,} = props;+ const { addTags } = useTaggingActionsContext();const { currentLocation } = useCurrentLocationContext();const tagContainerRef = useRef<HTMLSpanElement>(null);@@ -97,16 +97,19 @@ const TagContainerDnd = (props: Props) => {// add from file DnD to tagGroupaddTag(tag, dropResult.tagGroupId);}- } else if (dropResult && dropResult.entryPath && addTags) {+ } else if (dropResult && dropResult.entryPath) {// console.log(`Dropped item: ${item.tag.title} onto file: ${dropResult.entryPath}!`);if (selectedEntries.some((entry) => entry.path === dropResult.entryPath)) {- const selectedEntryPaths = [];- selectedEntries.map((entry) => selectedEntryPaths.push(entry.path));- addTags(selectedEntryPaths, [item.tag]);+ /*const selectedEntryPaths = [];+ selectedEntries.map((entry) => selectedEntryPaths.push(entry.path));*/+ addTags(selectedEntries, [item.tag]);} else {- addTags([dropResult.entryPath], [item.tag]);+ addTags(+ [currentLocation.toFsEntry(dropResult.entryPath, true)],+ [item.tag],+ );}}};@@ -170,7 +173,7 @@ const TagContainerDnd = (props: Props) => {// but it's good here for the sake of performance// to avoid expensive index searches.dragItem.index = hoverIndex;- } else if (reorderTags && entryPath) {+ } else if (reorderTags && entry) {// sort fileSystemEntries tagsconst dragIndex = dragItem.index;const hoverIndex = index;@@ -193,7 +196,7 @@ const TagContainerDnd = (props: Props) => {// Skip reorder on DnD Tag from an other fileif (dragItem.tag.type === 'plain') {const extractedTags = extractTags(- entryPath,+ entry.path,AppConfig.tagDelimiter,currentLocation?.getDirSeparator(),);@@ -208,7 +211,7 @@ const TagContainerDnd = (props: Props) => {}dragItem.tag.position = hoverIndex;- editTagForEntry(entryPath, dragItem.tag);+ editTagForEntry(entry.path, dragItem.tag);dragItem.index = hoverIndex;}@@ -240,9 +243,8 @@ const TagContainerDnd = (props: Props) => {tagGroup={tagGroup}handleTagMenu={handleTagMenu}deleteIcon={deleteIcon}- addTags={addTags}tagMode={tagMode}- entryPath={entryPath}+ entry={entry}isDragging={isDragging}reorderTags={reorderTags}/>diff --git a/src/renderer/components/TagLibrary.tsx b/src/renderer/components/TagLibrary.tsxindex 4cf1aa7a6..7a090d0e9 100644--- a/src/renderer/components/TagLibrary.tsx+++ b/src/renderer/components/TagLibrary.tsx@@ -66,7 +66,6 @@ interface Props {function TagLibrary(props: Props) {const { t } = useTranslation();const {- addTags,createTagGroup,removeTagGroup,deleteTag,@@ -253,7 +252,6 @@ function TagLibrary(props: Props) {tagGroup={tagGroup}tagMode={isSmartTag ? 'display' : 'default'}handleTagMenu={handleTagMenuCallback}- addTags={addTags}/>);}@@ -266,7 +264,6 @@ function TagLibrary(props: Props) {tagGroup={tagGroup}tagMode={isSmartTag ? 'display' : 'default'}handleTagMenu={handleTagMenuCallback}- addTags={addTags}moveTag={(tagTitle: string,fromTagGroupId: TS.Uuid,diff --git a/src/renderer/components/TagsSelect.tsx b/src/renderer/components/TagsSelect.tsxindex 1f8d2bce0..b9fefc00f 100644--- a/src/renderer/components/TagsSelect.tsx+++ b/src/renderer/components/TagsSelect.tsx@@ -46,7 +46,7 @@ interface Props {handleNewTags?: (newTags: TS.Tag[]) => void;tagMode?: 'default' | 'display' | 'remove';placeholderText?: string;- selectedEntryPath?: string;+ selectedEntry?: TS.FileSystemEntry;autoFocus?: boolean;generateButton?: boolean;}@@ -69,7 +69,7 @@ function TagsSelect(props: Props) {const {placeholderText = '',label,- selectedEntryPath,+ selectedEntry,autoFocus = false,tags = [],tagMode,@@ -189,7 +189,7 @@ function TagsSelect(props: Props) {renderTags={(value: readonly TS.Tag[], getTagProps) =>value.map((option: TS.Tag, index: number) => (<TagContainer- key={selectedEntryPath + option + index}+ key={selectedEntry?.path + option + index}tag={option}tagMode={tagMode}handleTagMenu={handleTagMenu}@@ -232,13 +232,13 @@ function TagsSelect(props: Props) {</>)}/>- {selectedEntryPath && (+ {selectedEntry && (<EntryTagMenuanchorEl={tagMenuAnchorEl}open={Boolean(tagMenuAnchorEl)}onClose={handleCloseTagMenu}selectedTag={selectedTag}- currentEntryPath={selectedEntryPath}+ currentEntry={selectedEntry}removeTags={handleRemoveTag}/>)}diff --git a/src/renderer/components/dialogs/EditEntryTagDialog.tsx b/src/renderer/components/dialogs/EditEntryTagDialog.tsxindex a3385eead..59a82a380 100644--- a/src/renderer/components/dialogs/EditEntryTagDialog.tsx+++ b/src/renderer/components/dialogs/EditEntryTagDialog.tsx@@ -46,6 +46,7 @@ import { useTranslation } from 'react-i18next';interface Props {open: boolean;+ entries: TS.FileSystemEntry[];tag: TS.Tag;onClose: () => void;}@@ -55,8 +56,8 @@ const DateTagEditor = Pro && Pro.UI ? Pro.UI.DateTagEditor : React.Fragment;function EditEntryTagDialog(props: Props) {const { t } = useTranslation();- const { onClose, open, tag } = props;- const { addTagsToEntry, editTagForEntry } = useTaggingActionsContext();+ const { onClose, open, tag, entries } = props;+ const { addTagsToFsEntries, editTagForEntry } = useTaggingActionsContext();const [showAdvancedMode, setShowAdvancedMode] = useState<boolean>(false);const [title, setTitle] = useState(tag && tag.title);const titleRef = useRef<HTMLInputElement>(null);@@ -103,11 +104,11 @@ function EditEntryTagDialog(props: Props) {if (!haveError()) {const isNew =tag.functionality === 'geoTagging' ||- tag.functionality === 'dateTagging'; //path.includes(props.selectedTag.title);+ tag.functionality === 'dateTagging';if (isNew) {- addTagsToEntry(tag.path, [{ ...tag, title }]);- } else {- editTagForEntry(tag.path, tag, title);+ addTagsToFsEntries(entries, [{ ...tag, title }]);+ } else if (entries.length === 1) {+ editTagForEntry(entries[0].path, tag, title);}props.onClose();}diff --git a/src/renderer/components/menus/EntryTagMenu.tsx b/src/renderer/components/menus/EntryTagMenu.tsxindex 6d010e49d..9f11a1f1b 100644--- a/src/renderer/components/menus/EntryTagMenu.tsx+++ b/src/renderer/components/menus/EntryTagMenu.tsx@@ -30,7 +30,6 @@ import ListItemIcon from '@mui/material/ListItemIcon';import ListItemText from '@mui/material/ListItemText';import Menu from '@mui/material/Menu';import MenuItem from '@mui/material/MenuItem';-import { useState } from 'react';import { useTranslation } from 'react-i18next';import { useSelector } from 'react-redux';@@ -39,7 +38,7 @@ interface Props {onClose: () => void;anchorEl: Element | null;selectedTag: TS.Tag | null;- currentEntryPath: string;+ currentEntry: TS.FileSystemEntry;removeTags?: (paths: Array<string>, tags: Array<TS.Tag>) => void;setIsAddTagDialogOpened?: (tag: TS.Tag) => void;}@@ -50,7 +49,7 @@ function EntryTagMenu(props: Props) {onClose,anchorEl,selectedTag,- currentEntryPath,+ currentEntry,setIsAddTagDialogOpened,} = props;const removeTagsProps = props.removeTags;@@ -59,19 +58,11 @@ function EntryTagMenu(props: Props) {const { setSearchQuery } = useDirectoryContentContext();const { removeTags, openEditEntryTagDialog } = useTaggingActionsContext();const { readOnlyMode } = useCurrentLocationContext();- const [isDeleteTagDialogOpened, setIsDeleteTagDialogOpened] = useState(false);const maxSearchResults: number = useSelector(getMaxSearchResults);function showEditTagDialog() {onClose();- const tag = selectedTag;- tag.path = currentEntryPath;- openEditEntryTagDialog(tag);- }-- function showDeleteTagDialog() {- onClose();- setIsDeleteTagDialogOpened(true);+ openEditEntryTagDialog([currentEntry], selectedTag);}function showAddTagDialog() {@@ -90,17 +81,11 @@ function EntryTagMenu(props: Props) {onClose();}- function handleCloseDialogs() {- setIsDeleteTagDialogOpened(false);- }-function confirmRemoveTag() {if (removeTagsProps) {- removeTagsProps([currentEntryPath], [selectedTag]);+ removeTagsProps([currentEntry.path], [selectedTag]);} else {- removeTags([currentEntryPath], [selectedTag]).then(() =>- handleCloseDialogs(),- );+ removeTags([currentEntry.path], [selectedTag]);}onClose();}diff --git a/src/renderer/components/menus/TagMenu.tsx b/src/renderer/components/menus/TagMenu.tsxindex c3cbe459d..3b87a7e32 100644--- a/src/renderer/components/menus/TagMenu.tsx+++ b/src/renderer/components/menus/TagMenu.tsx@@ -86,8 +86,8 @@ function TagMenu(props: Props) {}function applyTag() {- const selectedEntryPaths = selectedEntries.map((entry) => entry.path);- addTags(selectedEntryPaths, [selectedTag]);+ // const selectedEntryPaths = selectedEntries.map((entry) => entry.path);+ addTags(selectedEntries, [selectedTag]);onClose();}diff --git a/src/renderer/hooks/DirectoryContentContextProvider.tsx b/src/renderer/hooks/DirectoryContentContextProvider.tsxindex 9515815b5..9f137ed0e 100644--- a/src/renderer/hooks/DirectoryContentContextProvider.tsx+++ b/src/renderer/hooks/DirectoryContentContextProvider.tsx@@ -136,7 +136,8 @@ type DirectoryContentContextData = {setThumbnails: (fsEntries: TS.FileSystemEntry[],) => Promise<TS.FileSystemEntry[]>;- setThumbnail: (fsEntries: TS.FileSystemEntry) => Promise<TS.FileSystemEntry>;+ setThumbnail: (fsEntry: TS.FileSystemEntry) => Promise<TS.FileSystemEntry>;+ getMetaForEntry: (fsEntry: TS.FileSystemEntry) => Promise<TS.FileSystemEntry>;};export const DirectoryContentContext =@@ -183,6 +184,7 @@ export const DirectoryContentContext =closeIsTruncatedConfirmDialog: undefined,setThumbnails: undefined,setThumbnail: undefined,+ getMetaForEntry: undefined,});export type DirectoryContentContextProviderProps = {@@ -1473,6 +1475,7 @@ export const DirectoryContentContextProvider = ({closeIsTruncatedConfirmDialog,setThumbnails,setThumbnail,+ getMetaForEntry,};}, [currentLocation,diff --git a/src/renderer/hooks/TaggingActionsContextProvider.tsx b/src/renderer/hooks/TaggingActionsContextProvider.tsxindex f1812095e..5c4eb117f 100644--- a/src/renderer/hooks/TaggingActionsContextProvider.tsx+++ b/src/renderer/hooks/TaggingActionsContextProvider.tsx@@ -65,8 +65,10 @@ type TaggingActionsContextData = {files: TS.FileSystemEntry[],tags: TS.Tag[],) => Promise<boolean>;- addFilesTags: (files: { [filePath: string]: TS.Tag[] }) => Promise<boolean>;- addTags: (paths: Array<string>, tags: Array<TS.Tag>) => Promise<boolean>;+ addTags: (+ entries: TS.FileSystemEntry[],+ tags: Array<TS.Tag>,+ ) => Promise<boolean>;addTagsToEntry: (path: string,tags: Array<TS.Tag>,@@ -116,13 +118,12 @@ type TaggingActionsContextData = {replace?: boolean,location?: CommonLocation,) => void;- openEditEntryTagDialog: (tag: TS.Tag) => void;+ openEditEntryTagDialog: (entries: TS.FileSystemEntry[], tag: TS.Tag) => void;closeEditEntryTagDialog: () => void;};export const TaggingActionsContext = createContext<TaggingActionsContextData>({addTagsToFsEntries: undefined,- addFilesTags: undefined,addTags: undefined,addTagsToEntry: undefined,addTagsToFsEntry: undefined,@@ -174,7 +175,7 @@ export const TaggingActionsContextProvider = ({removeLocationTagGroup,mergeLocationTagGroup,} = useTagGroupsLocationContext();- const { currentDirectoryEntries, getAllPropertiesPromise } =+ const { currentDirectoryEntries, getAllPropertiesPromise, getMetaForEntry } =useDirectoryContentContext();const { getIndex } = useLocationIndexContext();const { renameFile, saveMetaDataPromise, saveCurrentLocationMetaData } =@@ -184,6 +185,7 @@ export const TaggingActionsContextProvider = ({const open = useRef<boolean>(false);const selectedTag = useRef<TS.Tag>(undefined);+ const selectedEntries = useRef<TS.FileSystemEntry[]>(undefined);const geoTaggingFormat = useSelector(getGeoTaggingFormat);const maxCollectedTag = useSelector(getMaxCollectedTag);@@ -233,51 +235,10 @@ export const TaggingActionsContextProvider = ({return path;}- /**- * @deprecated use addTagsToFsEntries instead- * @param files- */- function addFilesTags(files: {- [filePath: string]: TS.Tag[];- }): Promise<boolean> {- if (files) {- const promises = Object.entries(files).map(([filePath, tags]) =>- addTagsToEntry(filePath, tags, false).then((newEntry) => ({- filePath,- newEntry,- })),- );- return Promise.all(promises).then((editedPaths) => {- const reflects: TS.EditAction[] = [];- for (let i = 0; i < editedPaths.length; i++) {- const { filePath, newEntry } = editedPaths[i];- if (newEntry !== undefined) {- const currentAction: TS.EditAction = {- action: 'update',- entry: newEntry,- oldEntryPath: filePath,- };- reflects.push(currentAction);- }- }- setReflectActions(...reflects);- return true;- });- }- return Promise.resolve(true);- }-function addTags(- paths: Array<string>,- tags: Array<TS.Tag>,+ entries: TS.FileSystemEntry[],+ tags: TS.Tag[],): Promise<boolean> {- let defaultTagLocation;- if (geoTaggingFormat.toLowerCase() === 'mgrs') {- defaultTagLocation = mgrs.forward([0, 51.48]);- } else {- defaultTagLocation = OpenLocationCode.encode(51.48, 0, undefined);- }-const processedTags = [];tags.map((pTag) => {const tag = { ...pTag };@@ -292,9 +253,11 @@ export const TaggingActionsContextProvider = ({delete tag.description;if (tag.functionality === 'geoTagging') {if (Pro) {- tag.path = paths[0]; // todo rethink and remove this!- tag.title = defaultTagLocation;- openEditEntryTagDialog(tag);+ tag.title =+ geoTaggingFormat.toLowerCase() === 'mgrs'+ ? mgrs.forward([0, 51.48])+ : OpenLocationCode.encode(51.48, 0, undefined);+ openEditEntryTagDialog(entries, tag);} else {showNotification(t('core:thisFunctionalityIsAvailableInPro' as any) as string,@@ -302,10 +265,11 @@ export const TaggingActionsContextProvider = ({}} else if (tag.functionality === 'dateTagging') {if (Pro) {- tag.path = paths[0]; // todo rethink and remove this!// delete tag.functionality;- tag.title = formatDateTime4Tag(new Date(), true); // defaultTagDate;- openEditEntryTagDialog(tag);+ tag.title = formatDateTime4Tag(new Date(), false);+ tag.color = tagBackgroundColor;+ tag.textcolor = tagTextColor;+ openEditEntryTagDialog(entries, tag);} else {showNotification(t('core:thisFunctionalityIsAvailableInPro' as any) as string,@@ -325,11 +289,7 @@ export const TaggingActionsContextProvider = ({if (processedTags.length > 0) {collectTagsToLibrary(processedTags);- const files = {};- paths.map((path) => {- files[path] = processedTags;- });- return addFilesTags(files);+ return addTagsToFsEntries(entries, processedTags);}return Promise.resolve(false);}@@ -436,6 +396,12 @@ export const TaggingActionsContextProvider = ({if (!entry.isFile || persistTagsInSidecarFile) {// Handling adding tags in sidecar+ if (!entry.meta) {+ const entryMeta = await getMetaForEntry(entry);+ if (entryMeta) {+ entry.meta = entryMeta.meta;+ }+ }if (entry.meta) {const uniqueTags = getNonExistingTags(tags,@@ -648,7 +614,6 @@ export const TaggingActionsContextProvider = ({}delete tag.description;delete tag.functionality;- delete tag.path;delete tag.id;const extractedTags: string[] = extractTags(path,@@ -1472,8 +1437,9 @@ export const TaggingActionsContextProvider = ({saveTagLibrary(arr);}- function openEditEntryTagDialog(tag: TS.Tag) {+ function openEditEntryTagDialog(entries: TS.FileSystemEntry[], tag: TS.Tag) {open.current = true;+ selectedEntries.current = entries;selectedTag.current = tag;forceUpdate();}@@ -1494,7 +1460,6 @@ export const TaggingActionsContextProvider = ({const context = useMemo(() => {return {addTagsToFsEntries,- addFilesTags,addTags,addTagsToEntry,addTagsToFsEntry,@@ -1535,6 +1500,7 @@ export const TaggingActionsContextProvider = ({open={open.current}onClose={closeEditEntryTagDialog}tag={selectedTag.current}+ entries={selectedEntries.current}/>{children}</TaggingActionsContext.Provider>diff --git a/src/renderer/perspectives/grid/components/GridCell.tsx b/src/renderer/perspectives/grid/components/GridCell.tsxindex afd6c67b1..eaea2c10d 100644--- a/src/renderer/perspectives/grid/components/GridCell.tsx+++ b/src/renderer/perspectives/grid/components/GridCell.tsx@@ -109,7 +109,11 @@ interface Props {fsEntry: TS.FileSystemEntry;style?: any;selectionMode: boolean;- handleTagMenu: (event: Object, tag: TS.Tag, entryPath: string) => void;+ handleTagMenu: (+ event: Object,+ tag: TS.Tag,+ fsEntry: TS.FileSystemEntry,+ ) => void;handleGridContextMenu: (event: Object, fsEntry: TS.FileSystemEntry) => void;handleGridCellDblClick: (event: Object, fsEntry: TS.FileSystemEntry) => void;handleGridCellClick: (event: Object, fsEntry: TS.FileSystemEntry) => void;@@ -230,9 +234,6 @@ function GridCell(props: Props) {const handleEditTag = (path: string, tag: TS.Tag, newTagTitle?: string) => {editTagForEntry(path, tag, newTagTitle);};- const handleAddTags = (paths: Array<string>, tags: Array<TS.Tag>) => {- addTags(paths, tags);- };const handleAddTag = (tag: TS.Tag, parentTagGroupUuid: TS.Uuid) => {addTag([tag], parentTagGroupUuid);@@ -306,8 +307,7 @@ function GridCell(props: Props) {<TagContainertag={tag}key={entryPath + tag.title}- entryPath={entryPath}- addTags={handleAddTags}+ entry={fsEntry}handleTagMenu={handleTagMenu}/>) : (@@ -315,8 +315,7 @@ function GridCell(props: Props) {tag={tag}index={tag.type === 'sidecar' ? index : index - sideCarLength}key={entryPath + tag.title}- entryPath={entryPath}- addTags={handleAddTags}+ entry={fsEntry}addTag={handleAddTag}handleTagMenu={handleTagMenu}selectedEntries={selectedEntries}diff --git a/src/renderer/perspectives/grid/components/MainContainer.tsx b/src/renderer/perspectives/grid/components/MainContainer.tsxindex 805649606..cff578359 100644--- a/src/renderer/perspectives/grid/components/MainContainer.tsx+++ b/src/renderer/perspectives/grid/components/MainContainer.tsx@@ -87,8 +87,7 @@ function GridPerspective(props: Props) {const [mouseX, setMouseX] = useState<number>(undefined);const [mouseY, setMouseY] = useState<number>(undefined);- // const selectedEntry = useRef<FileSystemEntry>(undefined);- const selectedEntryPath = useRef<string>(undefined);+ const selectedEntry = useRef<TS.FileSystemEntry>(undefined);const selectedTag = useRef<TS.Tag | null>(null);const perspectiveMode = useRef<boolean>(true);const [fileContextMenuAnchorEl, setFileContextMenuAnchorEl] =@@ -151,7 +150,7 @@ function GridPerspective(props: Props) {const clearSelection = () => {setSelectedEntries([]);- selectedEntryPath.current = undefined;+ selectedEntry.current = undefined;};const toggleSelectAllFiles = () => {@@ -175,13 +174,13 @@ function GridPerspective(props: Props) {const handleTagMenu = (event: React.ChangeEvent<HTMLInputElement>,tag: TS.Tag,- entryPath: string,+ entry: TS.FileSystemEntry,) => {event.preventDefault();event.stopPropagation();selectedTag.current = tag;- selectedEntryPath.current = entryPath;+ selectedEntry.current = entry;setTagContextMenuAnchorEl(event.currentTarget);};@@ -459,7 +458,7 @@ function GridPerspective(props: Props) {onClose={() => setTagContextMenuAnchorEl(null)}setIsAddTagDialogOpened={setIsAddTagDialogOpened}selectedTag={selectedTag.current}- currentEntryPath={selectedEntryPath.current}+ currentEntry={selectedEntry.current}/>{Boolean(sortingContextMenuAnchorEl) && (<SortingMenudiff --git a/src/renderer/perspectives/list/components/MainContainer.tsx b/src/renderer/perspectives/list/components/MainContainer.tsxindex e69695fd2..0f0f2e030 100644--- a/src/renderer/perspectives/list/components/MainContainer.tsx+++ b/src/renderer/perspectives/list/components/MainContainer.tsx@@ -87,8 +87,7 @@ function ListPerspective(props: Props) {const [mouseX, setMouseX] = useState<number>(undefined);const [mouseY, setMouseY] = useState<number>(undefined);- // const selectedEntry = useRef<FileSystemEntry>(undefined);- const selectedEntryPath = useRef<string>(undefined);+ const selectedEntry = useRef<TS.FileSystemEntry>(undefined);const selectedTag = useRef<TS.Tag | null>(null);const perspectiveMode = useRef<boolean>(true);const [fileContextMenuAnchorEl, setFileContextMenuAnchorEl] =@@ -151,7 +150,7 @@ function ListPerspective(props: Props) {const clearSelection = () => {setSelectedEntries([]);- selectedEntryPath.current = undefined;+ selectedEntry.current = undefined;};const toggleSelectAllFiles = () => {@@ -175,13 +174,13 @@ function ListPerspective(props: Props) {const handleTagMenu = (event: React.ChangeEvent<HTMLInputElement>,tag: TS.Tag,- entryPath: string,+ entry: TS.FileSystemEntry,) => {event.preventDefault();event.stopPropagation();selectedTag.current = tag;- selectedEntryPath.current = entryPath;+ selectedEntry.current = entry;setTagContextMenuAnchorEl(event.currentTarget);};@@ -456,7 +455,7 @@ function ListPerspective(props: Props) {onClose={() => setTagContextMenuAnchorEl(null)}setIsAddTagDialogOpened={setIsAddTagDialogOpened}selectedTag={selectedTag.current}- currentEntryPath={selectedEntryPath.current}+ currentEntry={selectedEntry.current}/>{Boolean(sortingContextMenuAnchorEl) && (<SortingMenudiff --git a/src/renderer/perspectives/list/components/RowCell.tsx b/src/renderer/perspectives/list/components/RowCell.tsxindex 736fec3b6..c4fa74f02 100644--- a/src/renderer/perspectives/list/components/RowCell.tsx+++ b/src/renderer/perspectives/list/components/RowCell.tsx@@ -92,7 +92,11 @@ interface Props {fsEntry: TS.FileSystemEntry;style?: any;selectionMode: boolean;- handleTagMenu: (event: Object, tag: TS.Tag, entryPath: string) => void;+ handleTagMenu: (+ event: Object,+ tag: TS.Tag,+ entry: TS.FileSystemEntry,+ ) => void;handleGridContextMenu: (event: Object, fsEntry: TS.FileSystemEntry) => void;handleGridCellDblClick: (event: Object, fsEntry: TS.FileSystemEntry) => void;handleGridCellClick: (event: Object, fsEntry: TS.FileSystemEntry) => void;@@ -133,7 +137,7 @@ function RowCell(props: Props) {const { selectedEntries, selectEntry } = useSelectedEntriesContext();const { entrySize, showTags, thumbnailMode } =usePerspectiveSettingsContext();- const { addTags, addTag, editTagForEntry } = useTaggingActionsContext();+ const { addTag, editTagForEntry } = useTaggingActionsContext();const { findLocation, readOnlyMode } = useCurrentLocationContext();const supportedFileTypes = useSelector(getSupportedFileTypes);const reorderTags: boolean = useSelector(isReorderTags);@@ -143,9 +147,6 @@ function RowCell(props: Props) {const handleEditTag = (path: string, tag: TS.Tag, newTagTitle?: string) => {editTagForEntry(path, tag, newTagTitle);};- const handleAddTags = (paths: Array<string>, tags: Array<TS.Tag>) => {- addTags(paths, tags);- };const handleAddTag = (tag: TS.Tag, parentTagGroupUuid: TS.Uuid) => {addTag([tag], parentTagGroupUuid);@@ -230,8 +231,7 @@ function RowCell(props: Props) {<TagContainertag={tag}key={entryPath + tag.title}- entryPath={entryPath}- addTags={handleAddTags}+ entry={fsEntry}handleTagMenu={handleTagMenu}/>) : (@@ -239,8 +239,7 @@ function RowCell(props: Props) {tag={tag}index={tag.type === 'sidecar' ? index : index - sideCarLength}key={entryPath + tag.title}- entryPath={entryPath}- addTags={handleAddTags}+ entry={fsEntry}addTag={handleAddTag}handleTagMenu={handleTagMenu}selectedEntries={selectedEntries}diff --git a/src/renderer/tagspaces.namespace.d.ts b/src/renderer/tagspaces.namespace.d.tsindex f4e0dafd6..5d3eccbba 100644--- a/src/renderer/tagspaces.namespace.d.ts+++ b/src/renderer/tagspaces.namespace.d.ts@@ -156,7 +156,7 @@ export namespace TS {icon?: string;description?: string;style?: string;- path?: string; // needed for geo tagging should be removed+ //path?: string; // needed for geo tagging should be removedmodified_date?: number;functionality?: string;keyBinding?: string;diff --git a/tests/e2e/general.pw.e2e.js b/tests/e2e/general.pw.e2e.jsindex 1eeb3eedb..9e04d53e5 100644--- a/tests/e2e/general.pw.e2e.js+++ b/tests/e2e/general.pw.e2e.js@@ -304,7 +304,7 @@ test.describe('TST51 - Perspective Grid', () => {'[data-tid=tagContainer_' + tagName + ']',getGridFileSelector('sample.txt'),);- await clickOn('[data-tid=showTimeTID]');+ //await clickOn('[data-tid=showTimeTID]');await clickOn('[data-tid=confirmEditTagEntryDialog]');await expectElementExist(diff --git a/tests/e2e/tag.pw.e2e.js b/tests/e2e/tag.pw.e2e.jsindex f2fbebe49..7482d4e29 100644--- a/tests/e2e/tag.pw.e2e.js+++ b/tests/e2e/tag.pw.e2e.js@@ -347,7 +347,7 @@ test.describe('TST04 - Testing the tag library:', () => {'[data-tid=tagContainer_' + tagName + ']',getGridFileSelector('sample.txt'),);- await clickOn('[data-tid=showTimeTID]');+ //await clickOn('[data-tid=showTimeTID]');await clickOn('[data-tid=confirmEditTagEntryDialog]');await expectElementExist(