diff --git a/src/renderer/src/components/Popups/TextEditPopup.tsx b/src/renderer/src/components/Popups/TextEditPopup.tsx index 1aa414fc..dfdd52ac 100644 --- a/src/renderer/src/components/Popups/TextEditPopup.tsx +++ b/src/renderer/src/components/Popups/TextEditPopup.tsx @@ -51,6 +51,17 @@ const PopupContainer: React.FC = ({ text, textareaProps, modalProps, reso setTimeout(resizeTextArea, 0) }, []) + const handleAfterOpenChange = (visible: boolean) => { + if (visible) { + const textArea = textareaRef.current?.resizableTextArea?.textArea + if (textArea) { + textArea.focus() + const length = textArea.value.length + textArea.setSelectionRange(length, length) + } + } + } + TextEditPopup.hide = onCancel return ( @@ -65,6 +76,7 @@ const PopupContainer: React.FC = ({ text, textareaProps, modalProps, reso onOk={onOk} onCancel={onCancel} afterClose={onClose} + afterOpenChange={handleAfterOpenChange} centered>