@@ -473,7 +473,6 @@ export const UnifiedDataUploadDialog: React.FC<UnifiedDataUploadDialogProps> = (
473473
474474 // Paste tab state
475475 const [ pasteContent , setPasteContent ] = useState < string > ( "" ) ;
476- const [ displayContent , setDisplayContent ] = useState < string > ( "" ) ;
477476 const [ isLargeContent , setIsLargeContent ] = useState < boolean > ( false ) ;
478477 const [ showFullContent , setShowFullContent ] = useState < boolean > ( false ) ;
479478 const [ isOverSizeLimit , setIsOverSizeLimit ] = useState < boolean > ( false ) ;
@@ -595,7 +594,6 @@ export const UnifiedDataUploadDialog: React.FC<UnifiedDataUploadDialogProps> = (
595594 const handleClose = useCallback ( ( ) => {
596595 // Reset state when closing
597596 setPasteContent ( "" ) ;
598- setDisplayContent ( "" ) ;
599597 setIsLargeContent ( false ) ;
600598 setIsOverSizeLimit ( false ) ;
601599 setShowFullContent ( false ) ;
@@ -753,27 +751,15 @@ export const UnifiedDataUploadDialog: React.FC<UnifiedDataUploadDialogProps> = (
753751 const isLarge = newContent . length > LARGE_CONTENT_THRESHOLD ;
754752 setIsLargeContent ( isLarge ) ;
755753
756- if ( isLarge && ! showFullContent ) {
757- const lines = newContent . split ( '\n' ) ;
758- const previewLines = lines . slice ( 0 , MAX_DISPLAY_LINES ) ;
759- const preview = previewLines . join ( '\n' ) + ( lines . length > MAX_DISPLAY_LINES ? '\n... (truncated for performance)' : '' ) ;
760- setDisplayContent ( preview ) ;
761- } else {
762- setDisplayContent ( newContent ) ;
754+ // If switching from large to small content, ensure full content is shown
755+ if ( ! isLarge ) {
756+ setShowFullContent ( true ) ;
763757 }
764- } , [ showFullContent , MAX_CONTENT_SIZE ] ) ;
758+ } , [ ] ) ;
765759
766760 const toggleFullContent = useCallback ( ( ) => {
767761 setShowFullContent ( ! showFullContent ) ;
768- if ( ! showFullContent ) {
769- setDisplayContent ( pasteContent ) ;
770- } else {
771- const lines = pasteContent . split ( '\n' ) ;
772- const previewLines = lines . slice ( 0 , MAX_DISPLAY_LINES ) ;
773- const preview = previewLines . join ( '\n' ) + ( lines . length > MAX_DISPLAY_LINES ? '\n... (truncated for performance)' : '' ) ;
774- setDisplayContent ( preview ) ;
775- }
776- } , [ showFullContent , pasteContent ] ) ;
762+ } , [ showFullContent ] ) ;
777763
778764 const handlePasteSubmit = ( ) : void => {
779765 let table : undefined | DictTable = undefined ;
@@ -1401,9 +1387,12 @@ export const UnifiedDataUploadDialog: React.FC<UnifiedDataUploadDialogProps> = (
14011387 autoFocus
14021388 multiline
14031389 fullWidth
1404- value = { displayContent }
1390+ value = { pasteContent }
14051391 onChange = { handleContentChange }
14061392 placeholder = "Paste your data here (CSV, TSV, or JSON format)"
1393+ InputProps = { {
1394+ readOnly : isLargeContent && ! showFullContent ,
1395+ } }
14071396 sx = { {
14081397 flex : hasPasteContent ? 1 : 'none' ,
14091398 '& .MuiInputBase-root' : {
@@ -1415,9 +1404,27 @@ export const UnifiedDataUploadDialog: React.FC<UnifiedDataUploadDialogProps> = (
14151404 fontFamily : 'monospace' ,
14161405 height : hasPasteContent ? '100% !important' : 'auto !important' ,
14171406 overflow : 'auto !important' ,
1407+ } ,
1408+ '& .MuiInputBase-input[readonly]' : {
1409+ cursor : 'not-allowed' ,
14181410 }
14191411 } }
14201412 />
1413+ { /* Show preview indicator when in preview mode */ }
1414+ { isLargeContent && ! showFullContent && (
1415+ < Box sx = { {
1416+ mt : 0.5 ,
1417+ px : 1 ,
1418+ py : 0.5 ,
1419+ backgroundColor : alpha ( theme . palette . info . main , 0.08 ) ,
1420+ borderRadius : 0.5 ,
1421+ border : `1px solid ${ alpha ( theme . palette . info . main , 0.2 ) } `
1422+ } } >
1423+ < Typography variant = "caption" color = "text.secondary" sx = { { fontSize : '0.7rem' } } >
1424+ Preview mode: Editing disabled. Click "Show Full" to enable editing.
1425+ </ Typography >
1426+ </ Box >
1427+ ) }
14211428 </ Box >
14221429
14231430 < Box sx = { { display : 'flex' , justifyContent : 'flex-end' , mt : 2 , gap : 1 } } >
0 commit comments