TagSpaces is an offline, open source, document manager with tagging support
save entryPropertiesHeight in settings reducer
sytolk9d3afaa0eed0
diff --git a/src/renderer/components/EntryContainer.tsx b/src/renderer/components/EntryContainer.tsxindex 617b3f020..a60119562 100644--- a/src/renderer/components/EntryContainer.tsx+++ b/src/renderer/components/EntryContainer.tsx@@ -37,7 +37,9 @@ import { useOpenedEntryContext } from '-/hooks/useOpenedEntryContext';import { usePerspectiveActionsContext } from '-/hooks/usePerspectiveActionsContext';import { Pro } from '-/pro';import {+ actions as SettingsActions,getEntryContainerTab,+ getEntryPropertiesHeight,getKeyBindingObject,isDesktopMode,isRevisionsEnabled,@@ -58,11 +60,13 @@ import React, {} from 'react';import { GlobalHotKeys } from 'react-hotkeys';import { useTranslation } from 'react-i18next';-import { useSelector } from 'react-redux';+import { useDispatch, useSelector } from 'react-redux';import { TabNames } from '-/hooks/EntryPropsTabsContextProvider';+import { AppDispatch } from '-/reducers/app';function EntryContainer() {const { t } = useTranslation();+ const dispatch: AppDispatch = useDispatch();const {openedEntry,closeAllFiles,@@ -83,6 +87,7 @@ function EntryContainer() {const { showNotification } = useNotificationContext();const tabIndex = useSelector(getEntryContainerTab);+ const entryPropertiesHeight = useSelector(getEntryPropertiesHeight);const keyBindings = useSelector(getKeyBindingObject);const desktopMode = useSelector(isDesktopMode);const revisionsEnabled = useSelector(isRevisionsEnabled);@@ -110,8 +115,6 @@ function EntryContainer() {setSaveBeforeReloadConfirmDialogOpened,] = useState<boolean>(false);const isSavingInProgress = useRef<boolean>(false);- const [entryPropertiesHeight, setEntryPropertiesHeight] =- useState<number>(100);const fileViewer: MutableRefObject<HTMLIFrameElement> =useRef<HTMLIFrameElement>(null);const fileViewerContainer: MutableRefObject<HTMLDivElement> =@@ -502,15 +505,15 @@ function EntryContainer() {const toggleEntryPropertiesHeight = () => {if (entryPropertiesHeight === 100) {- setEntryPropertiesHeight(200);+ dispatch(SettingsActions.setEntryPropertiesHeight(200));} else if (entryPropertiesHeight === 200) {- setEntryPropertiesHeight(350);+ dispatch(SettingsActions.setEntryPropertiesHeight(350));} else if (entryPropertiesHeight === 350) {- setEntryPropertiesHeight(50);+ dispatch(SettingsActions.setEntryPropertiesHeight(50));} else if (entryPropertiesHeight === 50) {- setEntryPropertiesHeight(100);+ dispatch(SettingsActions.setEntryPropertiesHeight(100));} else {- setEntryPropertiesHeight(200);+ dispatch(SettingsActions.setEntryPropertiesHeight(200));}};diff --git a/src/renderer/reducers/settings-default.ts b/src/renderer/reducers/settings-default.tsindex 9b092ace5..eb5e7fb8f 100644--- a/src/renderer/reducers/settings-default.ts+++ b/src/renderer/reducers/settings-default.ts@@ -65,6 +65,7 @@ export default {'<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body></body></html>',showUnixHiddenEntries: false,entryContainerTab: 0,+ entryPropertiesHeight: 100,checkForUpdates,reorderTags: false,coloredFileExtension: false,diff --git a/src/renderer/reducers/settings.ts b/src/renderer/reducers/settings.tsindex 0e7af784f..0bca9fd41 100644--- a/src/renderer/reducers/settings.ts+++ b/src/renderer/reducers/settings.ts@@ -40,7 +40,7 @@ export const types = {SET_LANGUAGE: 'SETTINGS/SET_LANGUAGE',TOGGLE_SHOWUNIXHIDDENENTRIES: 'SETTINGS/TOGGLE_SHOWUNIXHIDDENENTRIES',SET_ENTRY_CONTAINER_TAB: 'SETTINGS/SET_ENTRY_CONTAINER_TAB',- //SET_SHOW_DETAILS: 'SETTINGS/SET_SHOW_DETAILS',+ SET_ENTRY_PROPERTIES_HEIGHT: 'SETTINGS/SET_ENTRY_PROPERTIES_HEIGHT',SET_DESKTOPMODE: 'SETTINGS/SET_DESKTOPMODE',SET_USEONLYTAGSFROMTAGLIBRARY: 'SETTINGS/SET_USEONLYTAGSFROMTAGLIBRARY',SET_DEVMODE: 'SETTINGS/SET_DEVMODE',@@ -174,6 +174,9 @@ export default (state: any = defaultSettings, action: any) => {case types.SET_ENTRY_CONTAINER_TAB: {return { ...state, entryContainerTab: action.entryContainerTab };}+ case types.SET_ENTRY_PROPERTIES_HEIGHT: {+ return { ...state, entryPropertiesHeight: action.entryPropertiesHeight };+ }case types.SET_TAG_DELIMITER: {return { ...state, tagDelimiter: action.delimiter };}@@ -653,6 +656,10 @@ export const actions = {type: types.SET_ENTRY_CONTAINER_TAB,entryContainerTab: tabName,}),+ setEntryPropertiesHeight: (height: number) => ({+ type: types.SET_ENTRY_PROPERTIES_HEIGHT,+ entryPropertiesHeight: height,+ }),/* setShowDetails: (showDetails: boolean) => ({type: types.SET_SHOW_DETAILS,showDetails: showDetails,@@ -1010,6 +1017,8 @@ export const getShowUnixHiddenEntries = (state: any) =>state.settings.showUnixHiddenEntries;export const getEntryContainerTab = (state: any) =>state.settings.entryContainerTab;+export const getEntryPropertiesHeight = (state: any) =>+ state.settings.entryPropertiesHeight;export const getUseDefaultLocation = (state: any) =>state.settings.useDefaultLocation;export const getDefaultPerspective = (state: any) =>