mirror of
https://github.com/sasjs/server.git
synced 2025-12-10 11:24:35 +00:00
fix(web): show original name as default name in rename file/folder modal
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react'
|
||||
import React, { useState, useEffect } from 'react'
|
||||
|
||||
import { Button, DialogActions, DialogContent, TextField } from '@mui/material'
|
||||
|
||||
@@ -12,6 +12,7 @@ type NameInputModalProps = {
|
||||
isFolder: boolean
|
||||
actionLabel: string
|
||||
action: (name: string) => void
|
||||
defaultName?: string
|
||||
}
|
||||
|
||||
const NameInputModal = ({
|
||||
@@ -20,12 +21,17 @@ const NameInputModal = ({
|
||||
title,
|
||||
isFolder,
|
||||
actionLabel,
|
||||
action
|
||||
action,
|
||||
defaultName
|
||||
}: NameInputModalProps) => {
|
||||
const [name, setName] = useState('')
|
||||
const [hasError, setHasError] = useState(false)
|
||||
const [errorText, setErrorText] = useState('')
|
||||
|
||||
useEffect(() => {
|
||||
if (defaultName) setName(defaultName)
|
||||
}, [defaultName])
|
||||
|
||||
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const value = event.target.value
|
||||
|
||||
|
||||
@@ -208,6 +208,7 @@ const TreeViewNode = ({
|
||||
action={
|
||||
nameInputModalActionLabel === 'Add' ? addFileFolder : renameFileFolder
|
||||
}
|
||||
defaultName={node.relativePath.split('/').pop()}
|
||||
/>
|
||||
<Menu
|
||||
open={contextMenu !== null}
|
||||
|
||||
Reference in New Issue
Block a user