重命名对话框改用源条目口径显示,提交不带扩展名由服务端保留原格式
This commit is contained in:
parent
e9902f9d9d
commit
d9377b550e
@ -989,15 +989,16 @@ export default function SharePage() {
|
||||
|
||||
const openTaskDetailRenameDialog = (asset: { id: string; fileName?: string }) => {
|
||||
const currentName = asset.fileName || ''
|
||||
const dotIndex = currentName.lastIndexOf('.')
|
||||
const baseName = dotIndex > 0 ? currentName.slice(0, dotIndex) : currentName
|
||||
const extension = dotIndex > 0 ? currentName.slice(dotIndex) : ''
|
||||
// 预览行文件名不是包内条目名:剥掉 .webp 与历史「源名-preview」尾巴,
|
||||
// 扩展名由服务端按包内条目自动保留,前端不预设(预设 .webp 会误触扩展名校验)。
|
||||
let displayBase = currentName.replace(/\.webp$/i, '')
|
||||
displayBase = displayBase.replace(/-preview$/i, '')
|
||||
setRenameDialogState({
|
||||
assetId: asset.id,
|
||||
currentName,
|
||||
baseName,
|
||||
extension,
|
||||
value: baseName,
|
||||
baseName: displayBase,
|
||||
extension: '',
|
||||
value: displayBase,
|
||||
error: null,
|
||||
saving: false,
|
||||
})
|
||||
@ -1023,7 +1024,7 @@ export default function SharePage() {
|
||||
assetId: renameDialogState.assetId,
|
||||
kind: 'rename',
|
||||
label: `重命名为 ${nextBaseName}${renameDialogState.extension}`,
|
||||
newFileName: nextBaseName + renameDialogState.extension,
|
||||
newFileName: nextBaseName,
|
||||
})
|
||||
showToast('重命名已加入待应用清单', { variant: 'success' })
|
||||
setRenameDialogState(null)
|
||||
@ -1853,7 +1854,7 @@ export default function SharePage() {
|
||||
aria-label="新文件名"
|
||||
/>
|
||||
<span className="flex min-h-10 items-center rounded-r-[8px] border border-[#e7e8ea] bg-[#fafafa] px-2.5 text-[13px] text-[#86898e]">
|
||||
{renameDialogState.extension || '(无扩展名)'}
|
||||
保存后自动沿用原扩展名
|
||||
</span>
|
||||
</div>
|
||||
{renameDialogState.error && (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user