File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
frontend/src/components/metadata/widgets Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,23 @@ export const MetadataTextField = (props) => {
4444 return "null" ;
4545 } ;
4646
47+ // Get the value for the text field
48+ const getValue = ( ) => {
49+ if ( readOnly ) {
50+ // Read-only mode: show content or "null"
51+ if ( content && content [ fieldName ] !== undefined && content [ fieldName ] !== null ) {
52+ return content [ fieldName ] ;
53+ }
54+ if ( localContent && localContent [ fieldName ] !== undefined && localContent [ fieldName ] !== null ) {
55+ return localContent [ fieldName ] ;
56+ }
57+ return "null" ;
58+ } else {
59+ // Edit mode: show localContent value (what user is typing)
60+ return localContent [ fieldName ] || "" ;
61+ }
62+ } ;
63+
4764
4865 return (
4966 < Grid container spacing = { 2 } sx = { { alignItems : "center" } } >
@@ -55,7 +72,7 @@ export const MetadataTextField = (props) => {
5572 fullWidth
5673 name = { widgetName }
5774 required = { isRequired }
58- value = { getDisplayValue ( ) || "" }
75+ value = { getValue ( ) }
5976 onChange = { ( event : React . ChangeEvent < HTMLInputElement > ) => {
6077 setInputChanged ( true ) ;
6178 const tempContents : { [ key : string ] : string | number } = { } ;
You can’t perform that action at this time.
0 commit comments