File tree Expand file tree Collapse file tree 5 files changed +17
-2
lines changed
Expand file tree Collapse file tree 5 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ export interface DialFileManagerItemIconProps
1818 loading ?: boolean ;
1919 sharedIndicatorClassName ?: string ;
2020 sharedIndicatorTooltip ?: ReactNode ;
21+ fileExtension ?: string ;
2122}
2223
2324/**
@@ -65,6 +66,7 @@ export const DialFileManagerItemIcon: FC<DialFileManagerItemIconProps> = ({
6566 loading = false ,
6667 sharedIndicatorClassName,
6768 sharedIndicatorTooltip,
69+ fileExtension,
6870 ...restProps
6971} ) => {
7072 const wrapIcon = ( icon : ReactNode ) => (
@@ -86,7 +88,9 @@ export const DialFileManagerItemIcon: FC<DialFileManagerItemIconProps> = ({
8688 }
8789
8890 if ( type === DialItemType . File ) {
89- const extension = name . includes ( '.' ) ? name . split ( '.' ) . pop ( ) : undefined ;
91+ const extension = name . includes ( '.' )
92+ ? name . split ( '.' ) . pop ( )
93+ : fileExtension || void 0 ;
9094
9195 return (
9296 < DialFileIcon
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ export interface DialFileManagerItemNameProps
1919 shared ?: boolean ;
2020 details ?: ReactNode ;
2121 sharedIndicatorTooltip ?: ReactNode ;
22+ fileExtension ?: string ;
2223 validate ?: ( value : string ) => string | null ;
2324 onSave ?: ( value : string ) => void ;
2425 onCancel ?: ( ) => void ;
@@ -67,6 +68,7 @@ export const DialFileManagerItemName: FC<DialFileManagerItemNameProps> = ({
6768 iconSize = BASE_ICON_SIZE ,
6869 validate,
6970 onSave,
71+ fileExtension,
7072 onCancel,
7173 inputContainerClassName,
7274 sharedIndicatorClassName,
@@ -117,6 +119,7 @@ export const DialFileManagerItemName: FC<DialFileManagerItemNameProps> = ({
117119 inputRef = { inputRef }
118120 onChange = { onChange }
119121 iconSize = { iconSize }
122+ fileExtension = { fileExtension }
120123 inputContainerClassName = { inputContainerClassName }
121124 sharedIndicatorTooltip = { sharedIndicatorTooltip }
122125 sharedIndicatorClassName = { sharedIndicatorClassName }
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ export interface DialFileManagerItemNameInputProps {
2626 onChange ?: ( value ?: string ) => void ;
2727 sharedIndicatorClassName ?: string ;
2828 sharedIndicatorTooltip ?: ReactNode ;
29+ fileExtension ?: string ;
2930}
3031
3132/**
@@ -96,6 +97,7 @@ export const DialFileManagerItemNameInput: FC<
9697 onChange,
9798 sharedIndicatorClassName,
9899 sharedIndicatorTooltip,
100+ fileExtension,
99101} ) => {
100102 const getInputIconAfter = ( ) => {
101103 if ( ! inputInvalid ) return null ;
@@ -125,6 +127,7 @@ export const DialFileManagerItemNameInput: FC<
125127 stroke = { iconStroke }
126128 loading = { loading }
127129 shared = { shared }
130+ fileExtension = { fileExtension }
128131 sharedIndicatorClassName = { sharedIndicatorClassName }
129132 sharedIndicatorTooltip = { sharedIndicatorTooltip }
130133 />
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import classNames from 'classnames';
88
99export interface DialFileNameProps {
1010 name : string ;
11+ fileExtension ?: string ;
1112 className ?: string ;
1213 shared ?: boolean ;
1314 iconSize ?: number ;
@@ -51,8 +52,11 @@ export const DialFileName: FC<DialFileNameProps> = ({
5152 details,
5253 sharedIndicatorClassName,
5354 sharedIndicatorTooltip,
55+ fileExtension,
5456} ) => {
55- const extension = name . includes ( '.' ) ? name . split ( '.' ) . pop ( ) : undefined ;
57+ const extension = name . includes ( '.' )
58+ ? name . split ( '.' ) . pop ( )
59+ : fileExtension || void 0 ;
5660
5761 return (
5862 < div className = { mergeClasses ( 'flex items-center gap-2 w-full' , className ) } >
Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ export const NAME_COLUMN =
101101 ? DialItemType . Folder
102102 : DialItemType . File
103103 }
104+ fileExtension = { renamedItem . name . split ( '.' ) . pop ( ) }
104105 elementId = { `rename-${ params . data . id } ` }
105106 editing = { true }
106107 shared = { isSharedByMe }
You can’t perform that action at this time.
0 commit comments