mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-10 21:50:14 -07:00
InlineTextArea: auto-select all on edit
Except for the Fusion instructions, and the Compact
This commit is contained in:
@@ -17,6 +17,7 @@ export function InlineTextarea(props: {
|
||||
centerText?: boolean,
|
||||
minRows?: number,
|
||||
syncWithInitialText?: boolean, // optional. if set, the text will be reset to initialText when the prop changes
|
||||
selectAllOnFocus?: boolean, // optional. if set to false, text won't be selected on focus (default: true)
|
||||
onEdit: (text: string) => void,
|
||||
onCancel?: () => void,
|
||||
sx?: SxProps,
|
||||
@@ -72,6 +73,11 @@ export function InlineTextarea(props: {
|
||||
...(props.centerText && {
|
||||
sx: { textAlign: 'center' },
|
||||
}),
|
||||
onFocus: (props.selectAllOnFocus === false) ? undefined : (e) => {
|
||||
// Select all text when the textarea receives focus
|
||||
// This is a great default behavior for all the inline text edits
|
||||
e.target?.select();
|
||||
},
|
||||
},
|
||||
}}
|
||||
sx={props.sx}
|
||||
|
||||
@@ -208,7 +208,7 @@ export function FlattenerModal(props: {
|
||||
)}
|
||||
|
||||
{/* Review or Edit Text */}
|
||||
{isSuccess && <InlineTextarea initialText={flattenedText} onEdit={setText} />}
|
||||
{isSuccess && <InlineTextarea initialText={flattenedText} selectAllOnFocus={false} onEdit={setText} />}
|
||||
|
||||
</Box>}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ function EditableChatInstructionPrompt(props: {
|
||||
decolor
|
||||
initialText={props.itemValue}
|
||||
minRows={3}
|
||||
selectAllOnFocus={false}
|
||||
onCancel={handleEditCancel}
|
||||
onEdit={handleEdit}
|
||||
sx={{
|
||||
|
||||
Reference in New Issue
Block a user