ChatGPT_Chatbot icon indicating copy to clipboard operation
ChatGPT_Chatbot copied to clipboard

Copy/Paste

Open DaveenJay opened this issue 3 years ago • 1 comments

Currently, it is not possible to copy text bubbles within the app. It would be helpful to have the ability to copy both specific pieces of text within ChatGPT's replies and the entire chat bubbles themselves.

Edit (Jan 13, 2022):

I found a solution to this. Add ".textSelection(.enabled)" under Text(message.text)

struct MessageRow: View {
    var message: Message
    var body: some View {
        HStack {
            if message.isFromUser {
                Spacer()
                Text(message.text)
                
                    .textSelection(.enabled)
                    .padding(10)
                    .background(Color("AccentColor"))
                    .foregroundColor(.white)
                    .clipShape(RoundedRectangle(cornerRadius: 10))
                    .padding(.horizontal, 10)
                    .padding(.vertical, 5)
                
            } else {
                ScrollView {
                    Text(message.text).italic(message.isResponding)
                    
                        .textSelection(.enabled)
                        .lineLimit(1...)
                        .padding(10)
                        .background(Color(.systemGray6))
                        .clipShape(RoundedRectangle(cornerRadius: 10))
                        .padding(.horizontal, 10)
                        .padding(.vertical, 5)
                }
                Spacer()
            }
        }
    }
}

DaveenJay avatar Jan 08 '23 21:01 DaveenJay

Would you like to submit a pull request? You can fork the repository, create a new branch to address the issue, and then make a pull request to merge your changes back into the main repository.

motianjun4 avatar Jan 13 '23 22:01 motianjun4