allow save folder with command

This commit is contained in:
Filip Gala 2024-09-26 19:34:43 +02:00
parent 421ed54f92
commit 4f97e0c887
2 changed files with 12 additions and 3 deletions

View File

@ -12,9 +12,9 @@ import StyledWrapper from './StyledWrapper';
const Documentation = ({ collection, folder }) => { const Documentation = ({ collection, folder }) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const { displayedTheme } = useTheme(); const { displayedTheme } = useTheme();
const preferences = useSelector((state) => state.app.preferences);
const [isEditing, setIsEditing] = useState(false); const [isEditing, setIsEditing] = useState(false);
const docs = get(folder, 'root.docs', ''); const docs = get(folder, 'root.docs', '');
const preferences = useSelector((state) => state.app.preferences);
const toggleViewMode = () => { const toggleViewMode = () => {
setIsEditing((prev) => !prev); setIsEditing((prev) => !prev);

View File

@ -6,7 +6,12 @@ import { useSelector, useDispatch } from 'react-redux';
import EnvironmentSettings from 'components/Environments/EnvironmentSettings'; import EnvironmentSettings from 'components/Environments/EnvironmentSettings';
import NetworkError from 'components/ResponsePane/NetworkError'; import NetworkError from 'components/ResponsePane/NetworkError';
import NewRequest from 'components/Sidebar/NewRequest'; import NewRequest from 'components/Sidebar/NewRequest';
import { sendRequest, saveRequest, saveCollectionRoot } from 'providers/ReduxStore/slices/collections/actions'; import {
sendRequest,
saveRequest,
saveCollectionRoot,
saveFolderRoot
} from 'providers/ReduxStore/slices/collections/actions';
import { findCollectionByUid, findItemInCollection } from 'utils/collections'; import { findCollectionByUid, findItemInCollection } from 'utils/collections';
import { closeTabs, switchTab } from 'providers/ReduxStore/slices/tabs'; import { closeTabs, switchTab } from 'providers/ReduxStore/slices/tabs';
import { getKeyBindingsForActionAllOS } from './keyMappings'; import { getKeyBindingsForActionAllOS } from './keyMappings';
@ -43,7 +48,11 @@ export const HotkeysProvider = (props) => {
if (collection) { if (collection) {
const item = findItemInCollection(collection, activeTab.uid); const item = findItemInCollection(collection, activeTab.uid);
if (item && item.uid) { if (item && item.uid) {
dispatch(saveRequest(activeTab.uid, activeTab.collectionUid)); if (activeTab.type === 'folder-settings') {
dispatch(saveFolderRoot(collection.uid, item.uid));
} else {
dispatch(saveRequest(activeTab.uid, activeTab.collectionUid));
}
} else if (activeTab.type === 'collection-settings') { } else if (activeTab.type === 'collection-settings') {
dispatch(saveCollectionRoot(collection.uid)); dispatch(saveCollectionRoot(collection.uid));
} }