TagSpaces is an offline, open source, document manager with tagging support
Kanban - fix saving order of the folder and files in the folders
sytolk09d45f39e51d
diff --git a/app/components/FolderContainer.tsx b/app/components/FolderContainer.tsxindex 5f4108972..2c712a978 100644--- a/app/components/FolderContainer.tsx+++ b/app/components/FolderContainer.tsx@@ -49,7 +49,8 @@ import {getCurrentDirectoryPerspective,OpenedEntry,getSelectedEntries,- getProgress+ getProgress,+ getCurrentDirectoryFiles} from '../reducers/app';import TaggingActions from '../reducers/tagging-actions';import LoadingLazy from '../components/LoadingLazy';@@ -183,6 +184,7 @@ interface Props {windowHeight: number;windowWidth: number;directoryContent: Array<Object>;+ currentDirectoryFiles: Array<any>;currentDirectoryPath: string | null;searchResultCount: number;addTags: () => void;@@ -323,6 +325,7 @@ const FolderContainer = (props: Props) => {return (<KanBanPerspectiveAsyncdirectoryContent={props.directoryContent}+ currentDirectoryFiles={props.currentDirectoryFiles}loadDirectoryContent={props.loadDirectoryContent}openFsEntry={props.openFsEntry}openRenameEntryDialog={() => setIsRenameEntryDialogOpened(true)}@@ -725,6 +728,7 @@ function mapStateToProps(state) {settings: state.settings,selectedEntries: getSelectedEntries(state),directoryContent: getDirectoryContent(state),+ currentDirectoryFiles: getCurrentDirectoryFiles(state),currentDirectoryPerspective: getCurrentDirectoryPerspective(state),searchResultCount: getSearchResultCount(state),currentLocationPath: getCurrentLocationPath(state),diff --git a/app/reducers/app.ts b/app/reducers/app.tsindex 28fe707fc..dcc570951 100644--- a/app/reducers/app.ts+++ b/app/reducers/app.ts@@ -284,6 +284,10 @@ export default (state: any = initialState, action: any) => {? action.directoryMeta.perspective: state.currentDirectoryPerspective,currentDirectoryPath: directoryPath,+ // used for reorder files in KanBan+ currentDirectoryFiles: action.directoryMeta+ ? action.directoryMeta.files+ : [],isLoading: action.showIsLoading || false};}@@ -2172,6 +2176,8 @@ export const actions = {export const currentUser = (state: any) => state.app.user;export const getDirectoryContent = (state: any) =>state.app.currentDirectoryEntries;+export const getCurrentDirectoryFiles = (state: any) =>+ state.app.currentDirectoryFiles;export const getCurrentDirectoryColor = (state: any) =>state.app.currentDirectoryColor;export const getCurrentDirectoryDescription = (state: any) =>diff --git a/app/services/utils-io.ts b/app/services/utils-io.tsindex 3c9904382..51e2853c2 100644--- a/app/services/utils-io.ts+++ b/app/services/utils-io.ts@@ -335,6 +335,26 @@ export function prepareDirectoryContent();}+export function orderByMetaArray(arr, metaArray) {+ const arrLength = arr.length;+ return arr.sort((a, b) => {+ let indexA = metaArray.findIndex(+ metaFiles => metaFiles.name === a.name+ );+ let indexB = metaArray.findIndex(+ metaFiles => metaFiles.name === b.name+ );+ // set new files last; dirs first+ if (indexA === -1) {+ indexA = !a.isFile ? arrLength * -1 : arrLength;+ }+ if (indexB === -1) {+ indexB = !b.isFile ? arrLength * -1 : arrLength;+ }+ return indexA - indexB;+ });+}+export function findExtensionPathForId(extensionId: string): string {const extensionPath = 'node_modules/' + extensionId;return extensionPath;