TagSpaces is an offline, open source, document manager with tagging support
fix last edited and search
sytolkb8e28bbf9053
diff --git a/src/renderer/components/EntryContainer.tsx b/src/renderer/components/EntryContainer.tsxindex 00bb6af65..273f82762 100644--- a/src/renderer/components/EntryContainer.tsx+++ b/src/renderer/components/EntryContainer.tsx@@ -71,6 +71,7 @@ import { usePlatformFacadeContext } from '-/hooks/usePlatformFacadeContext';import { SaveIcon, EditIcon } from '-/components/CommonIcons';import { useIOActionsContext } from '-/hooks/useIOActionsContext';import { usePerspectiveActionsContext } from '-/hooks/usePerspectiveActionsContext';+import { useEditedEntryContext } from '-/hooks/useEditedEntryContext';const historyKeys = Pro ? Pro.keys.historyKeys : {};@@ -86,6 +87,7 @@ function EntryContainer() {reflectUpdateOpenedFileContent,addToEntryContainer,} = useOpenedEntryContext();+ const { setReflectActions } = useEditedEntryContext();const { setActions } = usePerspectiveActionsContext();const { saveDescription, description } = useDescriptionContext();const { setAutoSave, getMetadataID } = useIOActionsContext();@@ -95,13 +97,7 @@ function EntryContainer() {const { copyFilePromiseOverwrite, copyFilePromise, saveTextFilePromise } =usePlatformFacadeContext();const { showNotification } = useNotificationContext();- const historyContext = Pro?.contextProviders?.HistoryContext- ? useContext<TS.HistoryContextData>(Pro.contextProviders.HistoryContext)- : undefined;const tabIndex = useSelector(getEntryContainerTab);- const fileEditHistoryKey = useSelector(- (state: any) => state.settings[historyKeys.fileEditKey],- );const keyBindings = useSelector(getKeyBindingObject);const desktopMode = useSelector(isDesktopMode);const revisionsEnabled = useSelector(isRevisionsEnabled);@@ -526,7 +522,13 @@ function EntryContainer() {).then((entry) => {reflectUpdateOpenedFileContent(entry);- if (Pro) {+ // send action to save in history+ const action: TS.EditAction = {+ action: 'edit',+ entry: entry,+ };+ setReflectActions(action);+ /*if (Pro) {const relativePath = getRelativeEntryPath(currentLocationPath,fileOpen.path,@@ -541,7 +543,7 @@ function EntryContainer() {},fileEditHistoryKey,);- }+ }*/return true;/*return updateOpenedFile(fileOpen.path, {id: '',diff --git a/src/renderer/hooks/DirectoryContentContextProvider.tsx b/src/renderer/hooks/DirectoryContentContextProvider.tsxindex 3c60e214d..a613d21b9 100644--- a/src/renderer/hooks/DirectoryContentContextProvider.tsx+++ b/src/renderer/hooks/DirectoryContentContextProvider.tsx@@ -18,14 +18,12 @@import React, {createContext,- useContext,useEffect,useMemo,useReducer,useRef,} from 'react';import { useDispatch, useSelector } from 'react-redux';-import { locationType } from '@tagspaces/tagspaces-common/misc';import { actions as AppActions, AppDispatch } from '-/reducers/app';import { TS } from '-/tagspaces.namespace';import { useTranslation } from 'react-i18next';@@ -55,7 +53,6 @@ import { useNotificationContext } from '-/hooks/useNotificationContext';import { useSelectedEntriesContext } from '-/hooks/useSelectedEntriesContext';import { getSearches } from '-/reducers/searches';import { getTagColors } from '-/services/taglibrary-utils';-import { defaultTitle } from '-/services/search';import { Pro } from '-/pro';import { defaultSettings as defaultGridSettings } from '-/perspectives/grid';import { defaultSettings as defaultListSettings } from '-/perspectives/list';@@ -201,9 +198,6 @@ export const DirectoryContentContextProvider = ({const { kanbanActions } = useEditedKanBanMetaContext();const { showNotification, hideNotifications } = useNotificationContext();const { selectedEntries, setSelectedEntries } = useSelectedEntriesContext();- const historyContext = Pro?.contextProviders?.HistoryContext- ? useContext<TS.HistoryContextData>(Pro.contextProviders.HistoryContext)- : undefined;const currentLocationPath = useRef<string>('');//const useGenerateThumbnails = useSelector(getUseGenerateThumbnails);@@ -213,9 +207,6 @@ export const DirectoryContentContextProvider = ({const searches = useSelector(getSearches);const defaultBackgroundColor = useSelector(getTagColor);const defaultTextColor = useSelector(getTagTextColor);- const searchHistoryKey = useSelector((state: any) =>- Pro ? state.settings[Pro.keys.historyKeys.searchHistoryKey] : undefined,- );//const enableWS = useSelector(getEnableWS);@@ -981,28 +972,6 @@ export const DirectoryContentContextProvider = ({} else {isSearchMode.current = true;searchQuery.current = sQuery;- const searchTitle = defaultTitle(sQuery);- if (searchTitle.length > 0 && Pro) {- const historyKeys = Pro.keys.historyKeys;- if (currentLocation) {- historyContext.saveHistory(- historyKeys.searchHistoryKey,- {- creationTimeStamp: new Date().getTime(),- path:- searchTitle +- ' ' +- (currentLocation.path- ? currentLocation.path- : currentLocation.name),- url: '/',- lid: currentLocation.uuid,- searchQuery: sQuery,- },- searchHistoryKey,- );- }- }forceUpdate();}}diff --git a/src/renderer/hooks/OpenedEntryContextProvider.tsx b/src/renderer/hooks/OpenedEntryContextProvider.tsxindex 074551215..10031342d 100644--- a/src/renderer/hooks/OpenedEntryContextProvider.tsx+++ b/src/renderer/hooks/OpenedEntryContextProvider.tsx@@ -148,7 +148,7 @@ export const OpenedEntryContextProvider = ({const { selectedEntries, setSelectedEntries } = useSelectedEntriesContext();const { showNotification } = useNotificationContext();- const { actions, setReflectActions } = useEditedEntryContext();+ const { actions } = useEditedEntryContext();const { metaActions } = useEditedEntryMetaContext();const { saveFilePromise } = usePlatformFacadeContext();@@ -592,13 +592,6 @@ export const OpenedEntryContextProvider = ({);addToEntryContainer(entryForOpening);-- // send action to save in history- const action: TS.EditAction = {- action: 'open',- entry: fsEntry,- };- setReflectActions(action);return Promise.resolve(true);}diff --git a/src/renderer/tagspaces.namespace.d.ts b/src/renderer/tagspaces.namespace.d.tsindex 2ebf43e21..a1f4481b6 100644--- a/src/renderer/tagspaces.namespace.d.ts+++ b/src/renderer/tagspaces.namespace.d.ts@@ -115,7 +115,7 @@ export namespace TS {export type ActionSource = 'local' | 'upload' | 'thumbgen' | 'fsWatcher';interface EditAction {- action: 'add' | 'delete' | 'update' | 'move' | 'open' | 'edit';+ action: 'add' | 'delete' | 'update' | 'move' | 'edit';entry: TS.FileSystemEntry;oldEntryPath?: string;open?: boolean;