@@ -31,6 +31,7 @@ interface EditTextDialogProps {
3131 buttonIdConfirm ?: string ;
3232 buttonTextIdCancel ?: string ;
3333 buttonTextIdConfirm ?: string ;
34+ multiline ?: boolean ;
3435 textFieldId ?: string ;
3536}
3637
@@ -70,6 +71,10 @@ export default function EditTextDialog(
7071
7172 function confirmIfEnter ( event : KeyboardEvent < any > ) : void {
7273 if ( event . key === Key . Enter ) {
74+ // Prevent newline in note. If we want to enable newlines (when multiline
75+ // is true), we'll need to manage Enter vs (e.g.) Shift+Enter and which
76+ // one confirms vs adds a newline.
77+ event . preventDefault ( ) ;
7378 onConfirm ( ) ;
7479 }
7580 }
@@ -101,28 +106,27 @@ export default function EditTextDialog(
101106 variant = "standard"
102107 autoFocus
103108 value = { text }
109+ multiline = { props . multiline }
104110 onChange = { ( event ) => setText ( event . target . value ) }
105- onKeyPress = { confirmIfEnter }
111+ onKeyDown = { confirmIfEnter }
106112 slotProps = { { input : { endAdornment } } }
107113 id = { props . textFieldId }
108114 />
109115 </ DialogContent >
110116 < DialogActions >
111117 < Button
112- onClick = { onCancel }
113- variant = "outlined"
114- color = "primary"
115118 data-testid = { props . buttonIdCancel }
116119 id = { props . buttonIdCancel }
120+ onClick = { onCancel }
121+ variant = "outlined"
117122 >
118123 { t ( props . buttonTextIdCancel ?? "buttons.cancel" ) }
119124 </ Button >
120125 < Button
121- onClick = { onConfirm }
122- variant = "outlined"
123- color = "primary"
124126 data-testid = { props . buttonIdConfirm }
125127 id = { props . buttonIdConfirm }
128+ onClick = { onConfirm }
129+ variant = "contained"
126130 >
127131 { t ( props . buttonTextIdConfirm ?? "buttons.confirm" ) }
128132 </ Button >
0 commit comments