TagSpaces is an offline, open source, document manager with tagging support
fix Revisions preview and optimize (#2112)
Stanimire50effe28720
diff --git a/src/renderer/components/dialogs/FilePreviewDialog.tsx b/src/renderer/components/dialogs/FilePreviewDialog.tsxindex a2b872290..cf3dbab31 100644--- a/src/renderer/components/dialogs/FilePreviewDialog.tsx+++ b/src/renderer/components/dialogs/FilePreviewDialog.tsx@@ -41,7 +41,7 @@ interface Props {function FilePreviewDialog(props: Props) {const { open = false, onClose, fsEntry } = props;- const { currentLocation } = useCurrentLocationContext();+ const { findLocation } = useCurrentLocationContext();const { openedEntry } = useOpenedEntryContext();// const supportedFileTypes = useSelector(getSupportedFileTypes);const currentTheme = useSelector(getCurrentTheme);@@ -100,9 +100,10 @@ function FilePreviewDialog(props: Props) {// @ts-ignore call setContent from iframefileViewer.current.contentWindow.setTheme(currentTheme);}*/+ const openLocation = findLocation(openedFile.locationID);- currentLocation- .loadTextFilePromise(+ openLocation+ ?.loadTextFilePromise(textFilePath,data.preview ? data.preview : false,)@@ -113,14 +114,14 @@ function FilePreviewDialog(props: Props) {}let fileDirectory = extractContainingDirectoryPath(textFilePath,- currentLocation?.getDirSeparator(),+ openLocation?.getDirSeparator(),);if (AppConfig.isWeb) {fileDirectory =extractContainingDirectoryPath(// eslint-disable-next-line no-restricted-globalslocation.href,- currentLocation?.getDirSeparator(),+ openLocation?.getDirSeparator(),) +'/' +fileDirectory;diff --git a/src/renderer/hooks/IOActionsContextProvider.tsx b/src/renderer/hooks/IOActionsContextProvider.tsxindex e7e794de0..2d6386ea1 100644--- a/src/renderer/hooks/IOActionsContextProvider.tsx+++ b/src/renderer/hooks/IOActionsContextProvider.tsx@@ -154,10 +154,6 @@ type IOActionsContextData = {id: string,location: CommonLocation,) => Promise<string>;- createFsEntryMeta: (- entry: TS.FileSystemEntry,- props?: any,- ) => Promise<string>;saveFsEntryMeta: (entry: TS.FileSystemEntry,meta: any,@@ -234,7 +230,6 @@ export const IOActionsContext = createContext<IOActionsContextData>({saveCurrentLocationMetaData: undefined,saveMetaDataPromise: undefined,getMetadataID: undefined,- createFsEntryMeta: undefined,saveFsEntryMeta: undefined,savePerspective: undefined,removeFolderCustomSettings: undefined,@@ -1498,10 +1493,10 @@ export const IOActionsContextProvider = ({if (fsEntryMeta.id) {return fsEntryMeta.id;} else {- return createFsEntryMeta(- location.toFsEntry(path, fsEntryMeta.isFile),- { ...fsEntryMeta, id: id },- );+ return saveFsEntryMeta(location.toFsEntry(path, fsEntryMeta.isFile), {+ ...fsEntryMeta,+ id: id,+ }).then((fsEntryMeta) => fsEntryMeta.id);}}).catch(() => {@@ -1515,11 +1510,10 @@ export const IOActionsContextProvider = ({content,true,).then(() => id);- //return createFsEntryMeta(path, { id: id });});}- function createFsEntryMeta(+ /*function createFsEntryMeta(entry: TS.FileSystemEntry,props: any = {},): Promise<string> {@@ -1536,7 +1530,7 @@ export const IOActionsContextProvider = ({);return newFsEntryMeta.id;});- }+ }*/function saveFsEntryMeta(entry: TS.FileSystemEntry,@@ -2011,7 +2005,6 @@ export const IOActionsContextProvider = ({saveCurrentLocationMetaData,saveMetaDataPromise,getMetadataID,- createFsEntryMeta,saveFsEntryMeta,savePerspective,removeFolderCustomSettings,