diff --git a/resources/scripts/components/server/files/FileEditContainer.tsx b/resources/scripts/components/server/files/FileEditContainer.tsx index 8c9b192b5..2d0de6576 100644 --- a/resources/scripts/components/server/files/FileEditContainer.tsx +++ b/resources/scripts/components/server/files/FileEditContainer.tsx @@ -46,7 +46,7 @@ export default () => { }) .then(() => { if (name) { - history.push(`/server/${id}/files/edit#${hash.replace(/^#/, '')}/${name}`); + history.push(`/server/${id}/files/edit#/${name}`); return; } diff --git a/resources/scripts/components/server/files/FileNameModal.tsx b/resources/scripts/components/server/files/FileNameModal.tsx index 16aafc0d0..98cdd49fa 100644 --- a/resources/scripts/components/server/files/FileNameModal.tsx +++ b/resources/scripts/components/server/files/FileNameModal.tsx @@ -3,6 +3,8 @@ import Modal, { RequiredModalProps } from '@/components/elements/Modal'; import { Form, Formik, FormikActions } from 'formik'; import { object, string } from 'yup'; import Field from '@/components/elements/Field'; +import { ServerContext } from '@/state/server'; +import { join } from 'path'; type Props = RequiredModalProps & { onFileNamed: (name: string) => void; @@ -13,8 +15,10 @@ interface Values { } export default ({ onFileNamed, onDismissed, ...props }: Props) => { + const directory = ServerContext.useStoreState(state => state.files.directory); + const submit = (values: Values, { setSubmitting }: FormikActions) => { - onFileNamed(values.fileName); + onFileNamed(join(directory, values.fileName)); setSubmitting(false); }; @@ -40,6 +44,7 @@ export default ({ onFileNamed, onDismissed, ...props }: Props) => { name={'fileName'} label={'File Name'} description={'Enter the name that this file should be saved as.'} + autoFocus={true} />