TagSpaces is an offline, open source, document manager with tagging support
fix thumbPath in meta (#2065)
Stanimirf8500fb7f987
diff --git a/package-lock.json b/package-lock.jsonindex 0d49ddd14..2de9f0fc8 100644--- a/package-lock.json+++ b/package-lock.json@@ -196,7 +196,7 @@"yarn": "please-use-npm"},"optionalDependencies": {- "@tagspacespro/tagspacespro": "5.0.18"+ "@tagspacespro/tagspacespro": "5.0.19-alpha.0"}},"node_modules/@aashutoshrathi/word-wrap": {@@ -13571,9 +13571,9 @@}},"node_modules/@tagspacespro/tagspacespro": {- "version": "5.0.18",- "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.18/4154c247c3738445e0763b1cdfbb8cda46a843ca",- "integrity": "sha512-3+7S+f8VRk9twTLE50icZanVayskc6XjYD9vORaethIfc/kVZJstSnVrkntssVdFyJkaG9INQMB5CYAeGaHoVg==",+ "version": "5.0.19-alpha.0",+ "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.19-alpha.0/b93747c73646ceba47d760ddf3a576d6830a589b",+ "integrity": "sha512-9tSJ6oZUd9M5VEx4D5oBBf/Dj9VxGGMPJONN/pyYCVnF7w4KzMWBTmdmMBaE2MdkVS8pYMZrjXZfXbuD3z9jiA==","license": "Proprietary","optional": true},@@ -54692,9 +54692,9 @@}},"@tagspacespro/tagspacespro": {- "version": "5.0.18",- "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.18/4154c247c3738445e0763b1cdfbb8cda46a843ca",- "integrity": "sha512-3+7S+f8VRk9twTLE50icZanVayskc6XjYD9vORaethIfc/kVZJstSnVrkntssVdFyJkaG9INQMB5CYAeGaHoVg==",+ "version": "5.0.19-alpha.0",+ "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.19-alpha.0/b93747c73646ceba47d760ddf3a576d6830a589b",+ "integrity": "sha512-9tSJ6oZUd9M5VEx4D5oBBf/Dj9VxGGMPJONN/pyYCVnF7w4KzMWBTmdmMBaE2MdkVS8pYMZrjXZfXbuD3z9jiA==","optional": true},"@teamsupercell/typings-for-css-modules-loader": {diff --git a/package.json b/package.jsonindex 97c113a6f..cecb4d2a0 100644--- a/package.json+++ b/package.json@@ -225,7 +225,7 @@"uuid": "^9.0.0"},"optionalDependencies": {- "@tagspacespro/tagspacespro": "5.0.18"+ "@tagspacespro/tagspacespro": "5.0.19"},"devDependencies": {"@electron/notarize": "^2.2.0",diff --git a/src/renderer/components/EntryContainerTitle.tsx b/src/renderer/components/EntryContainerTitle.tsxindex b27bd44d8..af261e163 100644--- a/src/renderer/components/EntryContainerTitle.tsx+++ b/src/renderer/components/EntryContainerTitle.tsx@@ -42,6 +42,7 @@ import { Pro } from '-/pro';import { useTranslation } from 'react-i18next';import { useOpenedEntryContext } from '-/hooks/useOpenedEntryContext';import { useNotificationContext } from '-/hooks/useNotificationContext';+import { getAllTags } from '-/services/utils-io';const FileBadge = styled('span')(({ theme }) => ({color: 'white',@@ -260,7 +261,7 @@ function EntryContainerTitle(props: Props) {)}</IconButton></ProTooltip>- <TagsPreview tags={openedEntry.tags} />+ <TagsPreview tags={getAllTags(openedEntry)} /><EntryContainerMenuanchorEl={anchorEl}startClosingEntry={startClosingEntry}diff --git a/src/renderer/components/EntryProperties.tsx b/src/renderer/components/EntryProperties.tsxindex 4ca13f341..fb2cfe289 100644--- a/src/renderer/components/EntryProperties.tsx+++ b/src/renderer/components/EntryProperties.tsx@@ -63,6 +63,7 @@ import {dirNameValidation,getFolderBgndPath,getThumbPath,+ getAllTags,} from '-/services/utils-io';import { getUuid } from '@tagspaces/tagspaces-common/utils-io';import { parseGeoLocation } from '-/utils/geo';@@ -559,7 +560,7 @@ function EntryProperties(props: Props) {openedEntry.current.editMode ||editName !== undefined}*/- tags={openedEntry.tags}+ tags={getAllTags(openedEntry)}tagMode="default"handleChange={handleChange}selectedEntryPath={openedEntry.path}diff --git a/src/renderer/components/FileView.tsx b/src/renderer/components/FileView.tsxindex 6a23a52e2..f58d64cbc 100644--- a/src/renderer/components/FileView.tsx+++ b/src/renderer/components/FileView.tsx@@ -115,8 +115,8 @@ function FileView(props: Props) {theming +extQuery +event +- '&edit=true&t=' +- openedEntry.lmdt+ '&edit=true'+ // '&t=' + openedEntry.lmdt);} else {return (diff --git a/src/renderer/components/TagContainerMenu.tsx b/src/renderer/components/TagContainerMenu.tsxindex ace2a9d42..940ba154e 100644--- a/src/renderer/components/TagContainerMenu.tsx+++ b/src/renderer/components/TagContainerMenu.tsx@@ -36,6 +36,9 @@ function TagContainerMenu(props: Props) {if (readOnlyMode) {return <div style={{ width: 10 }} />;}+ if (tagMode === 'display') {+ return <div style={{ width: 10 }} />;+ }return tagMode === 'remove' ? (deleteIcon || (<RemoveTagIcondiff --git a/src/renderer/components/menus/FileMenu.tsx b/src/renderer/components/menus/FileMenu.tsxindex 62a011053..2d5b57f9f 100644--- a/src/renderer/components/menus/FileMenu.tsx+++ b/src/renderer/components/menus/FileMenu.tsx@@ -67,6 +67,7 @@ import { useIOActionsContext } from '-/hooks/useIOActionsContext';import MenuKeyBinding from '-/components/menus/MenuKeyBinding';import { useEditedEntryMetaContext } from '-/hooks/useEditedEntryMetaContext';import PlatformFacade from '-/services/platform-facade';+import { TS } from '-/tagspaces.namespace';interface Props {anchorEl: Element;@@ -167,16 +168,17 @@ function FileMenu(props: Props) {onClose();setFolderThumbnailPromise(selectedEntries[0].path) //selectedFilePath).then((thumbPath: string) => {- setThumbnailImageChange(- toFsEntry(- extractContainingDirectoryPath(- selectedEntries[0].path,- PlatformFacade.getDirSeparator(),- ),- false,+ const entry: TS.FileSystemEntry = toFsEntry(+ extractContainingDirectoryPath(+ selectedEntries[0].path,+ PlatformFacade.getDirSeparator(),),- thumbPath,+ false,);+ setThumbnailImageChange({+ ...entry,+ meta: { id: entry.uuid, thumbPath },+ });showNotification('Thumbnail created: ' + thumbPath);return true;})diff --git a/src/renderer/hooks/DirectoryContentContextProvider.tsx b/src/renderer/hooks/DirectoryContentContextProvider.tsxindex d202869e7..6c4b437bd 100644--- a/src/renderer/hooks/DirectoryContentContextProvider.tsx+++ b/src/renderer/hooks/DirectoryContentContextProvider.tsx@@ -34,15 +34,10 @@ import {extractContainingDirectoryPath,extractFileName,extractParentDirectoryPath,- getMetaFileLocationForDir,- getMetaDirectoryPath,} from '@tagspaces/tagspaces-common/paths';import PlatformIO from '-/services/platform-facade';import {getAllPropertiesPromise,- getFolderBgndPath,- loadJSONFile,- merge,toFsEntry,updateFsEntries,} from '-/services/utils-io';@@ -66,7 +61,7 @@ import { Pro } from '-/pro';import { defaultSettings as defaultGridSettings } from '-/perspectives/grid';import { defaultSettings as defaultListSettings } from '-/perspectives/list';import { useEditedEntryContext } from '-/hooks/useEditedEntryContext';-import { loadCurrentDirMeta } from '-/services/meta-loader';+import { getDirMeta, loadCurrentDirMeta } from '-/services/meta-loader';import { useEditedEntryMetaContext } from '-/hooks/useEditedEntryMetaContext';type DirectoryContentContextData = {@@ -431,7 +426,16 @@ export const DirectoryContentContextProvider = ({}function setSearchResults(searchResults: TS.FileSystemEntry[]) {- setCurrentDirectoryEntries(searchResults);+ setCurrentDirectoryEntries(+ searchResults.map((sr) => ({+ ...sr,+ // @ts-ignore temp fix model in common+ ...(sr.thumbPath && {+ // @ts-ignore+ meta: { ...(sr.meta && sr.meta), thumbPath: sr.thumbPath },+ }),+ })),+ );}function appendSearchResults(searchResults: TS.FileSystemEntry[]) {@@ -574,7 +578,15 @@ export const DirectoryContentContextProvider = ({setSelectedEntries([]);}if (loadDirMeta) {- const metaDirectory = getMetaDirectoryPath(directoryPath);+ return getDirMeta(directoryPath).then((meta) => {+ if (meta) {+ directoryMeta.current = meta;+ } else {+ directoryMeta.current = getDefaultDirMeta();+ }+ return loadDirectoryContentInt(directoryPath, showHiddenEntries);+ });+ /*const metaDirectory = getMetaDirectoryPath(directoryPath);return PlatformIO.checkDirExist(metaDirectory).then((exist) => {if (exist) {//isMetaFolderExist.current = true;@@ -595,7 +607,7 @@ export const DirectoryContentContextProvider = ({directoryMeta.current = getDefaultDirMeta();return loadDirectoryContentInt(directoryPath, showHiddenEntries);}- });+ });*/} else {isMetaLoaded.current = false;directoryMeta.current = getDefaultDirMeta();@@ -813,7 +825,7 @@ export const DirectoryContentContextProvider = ({action: 'perspectiveChange',entry: {...entry,- meta: { ...(entry.meta && { ...entry.meta }), perspective },+ meta: { ...(entry.meta && entry.meta), perspective },},};setReflectMetaActions(action);diff --git a/src/renderer/hooks/EditedEntryMetaContextProvider.tsx b/src/renderer/hooks/EditedEntryMetaContextProvider.tsxindex 9ff8687b7..b3e5f30e0 100644--- a/src/renderer/hooks/EditedEntryMetaContextProvider.tsx+++ b/src/renderer/hooks/EditedEntryMetaContextProvider.tsx@@ -50,11 +50,7 @@ type EditedEntryMetaContextData = {color: string,locationId?,) => Promise<boolean>;- setThumbnailImageChange: (- entry: TS.FileSystemEntry,- thumbPath: string,- locationId?,- ) => Promise<boolean>;+ setThumbnailImageChange: (entry: TS.FileSystemEntry) => void;};export const EditedEntryMetaContext = createContext<EditedEntryMetaContextData>(@@ -99,7 +95,7 @@ export const EditedEntryMetaContextProvider = ({action: 'autoSaveChange',entry: {...entry,- meta: meta,+ meta: { ...(entry.meta && entry.meta), ...meta },},};setReflectMetaActions(action);@@ -121,7 +117,7 @@ export const EditedEntryMetaContextProvider = ({action: 'perspectiveChange',entry: {...entry,- meta: meta,+ meta: { ...(entry.meta && entry.meta), ...meta },},};setReflectMetaActions(action);@@ -144,7 +140,7 @@ export const EditedEntryMetaContextProvider = ({action: 'descriptionChange',entry: {...entry,- meta: meta,+ meta: { ...(entry.meta && entry.meta), ...meta },},};setReflectMetaActions(action);@@ -168,7 +164,10 @@ export const EditedEntryMetaContextProvider = ({action: 'bgdImgChange',entry: {...entry,- meta: { ...entry.meta, lastUpdated: new Date().getTime() },+ meta: {+ ...(entry.meta && entry.meta),+ lastUpdated: new Date().getTime(),+ },},};setReflectMetaActions(action);@@ -185,7 +184,7 @@ export const EditedEntryMetaContextProvider = ({action: 'bgdColorChange',entry: {...entry,- meta: meta,+ meta: { ...(entry.meta && entry.meta), ...meta },},};setReflectMetaActions(action);@@ -195,36 +194,23 @@ export const EditedEntryMetaContextProvider = ({});}- function setThumbnailImageChange(- entry: TS.FileSystemEntry,- thumbPath: string,- locationId = undefined,- ): Promise<boolean> {- return saveMetaData(entry.path, { thumbPath }, locationId).then((meta) => {- if (meta) {- if (- PlatformIO.haveObjectStoreSupport() ||- PlatformIO.haveWebDavSupport()- ) {- // reload cache- const folderThumbPath = getThumbFileLocationForDirectory(- entry.path,- PlatformIO.getDirSeparator(),- );- PlatformIO.generateURLforPath(folderThumbPath, 604800);- }- const action: TS.EditMetaAction = {- action: 'thumbChange',- entry: {- ...entry,- meta: meta,- },- };- setReflectMetaActions(action);- return true;- }- return false;- });+ function setThumbnailImageChange(entry: TS.FileSystemEntry) {+ if (PlatformIO.haveObjectStoreSupport() || PlatformIO.haveWebDavSupport()) {+ // reload cache+ const folderThumbPath = getThumbFileLocationForDirectory(+ entry.path,+ PlatformIO.getDirSeparator(),+ );+ PlatformIO.generateURLforPath(folderThumbPath, 604800);+ }+ const action: TS.EditMetaAction = {+ action: 'thumbChange',+ entry: {+ ...entry,+ meta: { ...entry.meta, lastUpdated: new Date().getTime() },+ },+ };+ setReflectMetaActions(action);}function saveMetaData(diff --git a/src/renderer/hooks/OpenedEntryContextProvider.tsx b/src/renderer/hooks/OpenedEntryContextProvider.tsxindex a3c86559b..176facebd 100644--- a/src/renderer/hooks/OpenedEntryContextProvider.tsx+++ b/src/renderer/hooks/OpenedEntryContextProvider.tsx@@ -186,7 +186,8 @@ export const OpenedEntryContextProvider = ({if (actions && actions.length > 0) {for (const action of actions) {if (action.action === 'add') {- if (action.open && action.entry.isFile && action.entry.isNewFile) {+ if (action.open && action.entry.isFile) {+ //&& action.entry.isNewFile) {openFsEntry(action.entry, true);}} else if (action.action === 'delete') {@@ -217,22 +218,12 @@ export const OpenedEntryContextProvider = ({currentEntry.current &¤tEntry.current.path === action.entry.path) {- if (action.action === 'thumbChange') {- if (action.entry.meta.thumbPath) {- currentEntry.current = {- ...currentEntry.current,- meta: { ...currentEntry.current.meta, ...action.entry.meta },- };- } else {- const { thumbPath, ...meta } = currentEntry.current.meta;- currentEntry.current = { ...currentEntry.current, meta };- }- isChanged = true;- } else if (+ if (action.action === 'bgdColorChange' ||- //action.action === 'thumbChange' ||+ action.action === 'thumbChange' ||action.action === 'bgdImgChange' ||- action.action === 'descriptionChange'+ action.action === 'descriptionChange' ||+ action.action === 'autoSaveChange') {currentEntry.current = {...currentEntry.current,@@ -387,100 +378,12 @@ export const OpenedEntryContextProvider = ({function reloadOpenedFile(): Promise<boolean> {if (currentEntry.current) {currentEntry.current.editMode = false;- return openEntry(currentEntry.current.path, true);- /*//openedEntries && openedEntries.length > 0) {- const openedFile = currentEntry.current; //openedEntries[0];- const metaFilePath = openedFile.isFile- ? getMetaFileLocationForFile(- openedFile.path,- PlatformIO.getDirSeparator(),- )- : getMetaFileLocationForDir(- openedFile.path,- PlatformIO.getDirSeparator(),- );- try {- return loadJSONFile(metaFilePath).then((fsEntryMeta) => {- if (fsEntryMeta) {- return updateOpenedFile(openedFile.path, {- ...fsEntryMeta,- editMode: false,- shouldReload: !openedFile.shouldReload,- });- }- // @ts-ignore- const entryMeta: TS.FileSystemEntryMeta = {- ...openedFile,- editMode: false,- shouldReload: !openedFile.shouldReload,- };- return updateOpenedFile(openedFile.path, entryMeta);- });- } catch (e) {- // @ts-ignore- const entryMeta: TS.FileSystemEntryMeta = {- ...openedFile,- editMode: false,- shouldReload: !openedFile.shouldReload,- };- return updateOpenedFile(openedFile.path, entryMeta);- }*/+ return openEntry(currentEntry.current.path); //true);}return Promise.resolve(false);}- /*function updateOpenedFile(- entryPath: string,- fsEntryMeta: TS.FileSystemEntryMeta,- ): Promise<boolean> {- if (currentEntry.current && currentEntry.current.path === entryPath) {- return PlatformIO.getPropertiesPromise(entryPath)- .then((entryProps) => {- if (entryProps) {- let entryForOpening: TS.OpenedEntry;-- entryForOpening = { ...currentEntry.current }; //entryExist };-- if (fsEntryMeta.editMode !== undefined) {- entryForOpening.editMode = fsEntryMeta.editMode;- }- //entryForOpening.shouldReload = fsEntryMeta.shouldReload;- if (fsEntryMeta.color) {- if (fsEntryMeta.color === 'transparent') {- entryForOpening.color = undefined;- } else {- entryForOpening.color = fsEntryMeta.color;- }- }- if (fsEntryMeta.description !== undefined) {- entryForOpening.description = fsEntryMeta.description;- }- if (fsEntryMeta.perspective) {- entryForOpening.perspective = fsEntryMeta.perspective;- } else {- entryForOpening.perspective = 'unspecified';- }- if (fsEntryMeta.tags) {- entryForOpening.tags = fsEntryMeta.tags;- }- if (fsEntryMeta.autoSave !== undefined) {- entryForOpening.isAutoSaveEnabled = fsEntryMeta.autoSave;- }- entryForOpening.lmdt = entryProps.lmdt;- entryForOpening.size = entryProps.size;- addToEntryContainer(entryForOpening);- }- return true;- })- .catch((err) => {- console.log('updateOpenedFile ' + entryPath + ' not exist ' + err);- return Promise.resolve(false);- });- }- return Promise.resolve(false);- }*/-- function openEntry(path?: string, showDetails = false): Promise<boolean> {+ function openEntry(path?: string, showDetails = undefined): Promise<boolean> {if (path === undefined) {return openFsEntry(undefined, showDetails);}@@ -496,9 +399,11 @@ export const OpenedEntryContextProvider = ({function openFsEntry(fsEntry?: TS.FileSystemEntry,- showDetails = false,+ showDetails = undefined,): Promise<boolean> {- dispatch(SettingsActions.setShowDetails(showDetails));+ if (showDetails !== undefined) {+ dispatch(SettingsActions.setShowDetails(showDetails));+ }if (fsEntry === undefined) {if (selectedEntries && selectedEntries.length > 0) {const lastSelectedEntry = selectedEntries[selectedEntries.length - 1];diff --git a/src/renderer/perspectives/grid/components/GridCell.tsx b/src/renderer/perspectives/grid/components/GridCell.tsxindex 49e6e747c..65a645285 100644--- a/src/renderer/perspectives/grid/components/GridCell.tsx+++ b/src/renderer/perspectives/grid/components/GridCell.tsx@@ -141,16 +141,16 @@ function GridCell(props: Props) {const dispatch: AppDispatch = useDispatch();const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);- const fileSystemEntryBgColor = useRef<string>(+ /*const fileSystemEntryBgColor = useRef<string>(findBackgroundColorForFolder(fsEntry),- );- const thumbUrl = useRef<string>(undefined);+ );*/+ //const thumbUrl = useRef<string>(undefined);useEffect(() => {if (metaActions && metaActions.length > 0) {for (const action of metaActions) {if (fsEntry.path === action.entry.path) {- if (action.action === 'thumbChange') {+ /*if (action.action === 'thumbChange') {if (action.entry.meta.thumbPath) {thumbUrl.current = getThumbPath(action.entry.meta.thumbPath,@@ -165,12 +165,18 @@ function GridCell(props: Props) {}}forceUpdate();- } else if (action.action === 'bgdColorChange') {+ } else*/+ /*if (action.action === 'bgdColorChange') {fileSystemEntryBgColor.current = findBackgroundColorForFolder(action.entry,);forceUpdate();- } else if (action.action === 'descriptionChange') {+ } else*/+ if (+ action.action === 'thumbChange' ||+ action.action === 'bgdColorChange' ||+ action.action === 'descriptionChange'+ ) {fsEntry.meta = { ...action.entry.meta };forceUpdate();}@@ -403,7 +409,7 @@ function GridCell(props: Props) {style={{height: maxHeight - 70,position: 'relative',- backgroundColor: fileSystemEntryBgColor.current || 'transparent',+ backgroundColor: findBackgroundColorForFolder(fsEntry),}}><Box style={{ position: 'absolute' }}>@@ -413,7 +419,7 @@ function GridCell(props: Props) {<TagsPreview tags={entryTags} />)}</Box>- {(fsEntry.meta && fsEntry.meta.thumbPath) || thumbUrl.current ? (+ {fsEntry.meta && fsEntry.meta.thumbPath ? (<CardMediacomponent="img"loading="lazy"@@ -421,14 +427,10 @@ function GridCell(props: Props) {onError={(i) => (i.target.style.display = 'none')}alt="thumbnail image"height="auto"- src={- thumbUrl.current- ? thumbUrl.current- : getThumbPath(- fsEntry.meta.thumbPath,- fsEntry.meta?.lastUpdated,- )- }+ src={getThumbPath(+ fsEntry.meta.thumbPath,+ fsEntry.meta?.lastUpdated,+ )}style={{height: maxHeight - 70,objectFit: thumbnailMode,diff --git a/src/renderer/services/meta-loader.ts b/src/renderer/services/meta-loader.tsindex 9f7d99dac..87b6d6726 100644--- a/src/renderer/services/meta-loader.ts+++ b/src/renderer/services/meta-loader.ts@@ -1,6 +1,10 @@import { TS } from '-/tagspaces.namespace';import PlatformIO from '-/services/platform-facade';-import { executePromisesInBatches, getMetaForEntry } from '-/services/utils-io';+import {+ executePromisesInBatches,+ getMetaForEntry,+ loadMetaForDir,+} from '-/services/utils-io';import {getMetaFileLocationForDir,getMetaFileLocationForFile,@@ -125,7 +129,12 @@ export function getEnhancedDir(if (entry.name === AppConfig.metaFolder) {return Promise.resolve(undefined);}- return PlatformIO.listMetaDirectoryPromise(entry.path).then((meta) => {+ return getDirMeta(entry.path).then((meta) => ({+ ...entry,+ meta,+ }));++ /*return PlatformIO.listMetaDirectoryPromise(entry.path).then((meta) => {const metaFilePath = getMetaFileLocationForDir(entry.path,PlatformIO.getDirSeparator(),@@ -140,7 +149,7 @@ export function getEnhancedDir(PlatformIO.haveObjectStoreSupport() || PlatformIO.haveWebDavSupport()? PlatformIO.getURLforPath(thumbDirPath): thumbDirPath;- enhancedEntry = { ...entry, thumbPath };+ enhancedEntry = { ...entry, meta: { thumbPath } };}if (meta.some((metaFile) => metaFilePath.endsWith(metaFile.path)) &&@@ -151,5 +160,36 @@ export function getEnhancedDir(return getMetaForEntry(enhancedEntry || entry, metaFilePath);}return enhancedEntry;+ });*/+}++export function getDirMeta(dirPath: string): Promise<TS.FileSystemEntryMeta> {+ return PlatformIO.listMetaDirectoryPromise(dirPath).then((meta) => {+ const metaFilePath = getMetaFileLocationForDir(+ dirPath,+ PlatformIO.getDirSeparator(),+ );+ const thumbDirPath = getThumbFileLocationForDirectory(+ dirPath,+ PlatformIO.getDirSeparator(),+ );+ let thumbPath;+ if (meta.some((metaFile) => thumbDirPath.endsWith(metaFile.path))) {+ thumbPath =+ PlatformIO.haveObjectStoreSupport() || PlatformIO.haveWebDavSupport()+ ? PlatformIO.getURLforPath(thumbDirPath)+ : thumbDirPath;+ }+ if (+ meta.some((metaFile) => metaFilePath.endsWith(metaFile.path)) &&+ dirPath.indexOf(AppConfig.metaFolder + PlatformIO.getDirSeparator()) ===+ -1+ ) {+ return loadMetaForDir(dirPath, { thumbPath });+ }+ if (thumbPath) {+ return { id: '', thumbPath, lastUpdated: new Date().getTime() };+ }+ return undefined;});}diff --git a/src/renderer/services/taglibrary-utils.ts b/src/renderer/services/taglibrary-utils.tsindex 2f703dce3..59eb276a2 100644--- a/src/renderer/services/taglibrary-utils.ts+++ b/src/renderer/services/taglibrary-utils.ts@@ -1,7 +1,6 @@import { TS } from '-/tagspaces.namespace';import { Pro } from '-/pro';import {- extend,formatDateTime4Tag,immutablySwapItems,prepareTagGroupForExport,diff --git a/src/renderer/services/utils-io.ts b/src/renderer/services/utils-io.tsindex ef9aa8a03..c2330c88f 100644--- a/src/renderer/services/utils-io.ts+++ b/src/renderer/services/utils-io.ts@@ -57,7 +57,31 @@ import { generateImageThumbnail } from '-/services/thumbsgenerator';import { base64ToArrayBuffer } from '-/utils/dom';import { Pro } from '-/pro';import { supportedFileTypes } from '-/extension-config';+import { getEnhancedDir } from '-/services/meta-loader';+export function getAllTags(entry: TS.FileSystemEntry): Array<TS.Tag> {+ const tags = [];+ if (entry.meta && entry.meta.tags && entry.meta.tags.length > 0) {+ tags.push(...entry.meta.tags);+ }+ if (entry.tags && entry.tags.length > 0) {+ if (tags.length > 0) {+ const filteredTags = entry.tags.filter(+ (tag) => !tags.some((t) => t.title === tag.title),+ );+ tags.push(...filteredTags);+ } else {+ tags.push(...entry.tags);+ }+ }+ return tags;+}++/**+ * @deprecated use loadMetaForDir+ * @param entry+ * @param metaFilePath+ */export function getMetaForEntry(entry: TS.FileSystemEntry,metaFilePath?: string,@@ -86,8 +110,9 @@ export function getMetaForEntry({...entry,meta: {+ ...(entry.meta && entry.meta),...meta,- description: getDescriptionPreview(meta.description, 200),+ // description: getDescriptionPreview(meta.description, 200),},},AppConfig.tagDelimiter,@@ -98,6 +123,24 @@ export function getMetaForEntry(});}+export function loadMetaForDir(+ dirPath: string,+ metaAdd?,+): Promise<TS.FileSystemEntryMeta> {+ return loadJSONFile(+ getMetaFileLocationForDir(dirPath, PlatformIO.getDirSeparator()),+ ).then((meta: TS.FileSystemEntryMeta) => {+ if (meta) {+ return {+ ...(metaAdd && metaAdd),+ ...meta,+ // description: getDescriptionPreview(meta.description, 200),+ };+ }+ return undefined;+ });+}+export function enhanceOpenedEntry(entry: TS.OpenedEntry,tagDelimiter,@@ -573,11 +616,15 @@ export function getAllPropertiesPromise(return PlatformIO.getPropertiesPromise(entryPath).then((entryProps: TS.FileSystemEntry) => {if (entryProps) {- const metaFilePath = entryProps.isFile- ? getMetaFileLocationForFile(entryPath, PlatformIO.getDirSeparator())- : getMetaFileLocationForDir(entryPath, PlatformIO.getDirSeparator());- //const metaFileProps = await PlatformIO.getPropertiesPromise(metaFilePath);- //if (metaFileProps.isFile) {+ if (!entryProps.isFile) {+ return getEnhancedDir(entryProps);+ }++ const metaFilePath = getMetaFileLocationForFile(+ entryPath,+ PlatformIO.getDirSeparator(),+ );+try {return loadJSONFile(metaFilePath).then((meta: TS.FileSystemEntryMeta) => {@@ -984,9 +1031,6 @@ export function cleanMetaData(if (metaData.autoSave) {cleanedMeta.autoSave = metaData.autoSave;}- if (metaData.thumbPath) {- cleanedMeta.thumbPath = metaData.thumbPath;- }/*if (metaData.perspectiveSettings) { // clean perspectiveSettings !== defaultSettingsObject.keys(metaData.perspectiveSettings).forEach(perspective => {if (!cleanedMeta.perspectiveSettings) {