Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy button #19011

Closed
buzzard10 opened this issue Mar 5, 2022 · 15 comments · Fixed by #21629
Closed

Copy button #19011

buzzard10 opened this issue Mar 5, 2022 · 15 comments · Fixed by #21629
Labels
topic/ui Change the appearance of the Gitea UI type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@buzzard10
Copy link

Feature Description

It would be great if you could add copy button like there is in gitlab for example. It would help me very much.
I think it's small thing but it would help.

Screenshots

image

@lunny lunny added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Mar 6, 2022
@lunny
Copy link
Member

lunny commented Mar 6, 2022

But then so much buttons there.

@buzzard10
Copy link
Author

@lunny i want only one button - for copying. If that's a problem, then they can also add this as option, so user could decide in his preferences does he want this additional button, or not.

@lunny
Copy link
Member

lunny commented Mar 8, 2022

Just found Github also has that button.

@buzzard10
Copy link
Author

Just found Github also has that button.

So you're also down for this feature?

@noerw noerw added the topic/ui Change the appearance of the Gitea UI label Mar 12, 2022
@lunny
Copy link
Member

lunny commented Mar 12, 2022

Just found Github also has that button.

So you're also down for this feature?

Yes, I think we can follow that if no better idea.

@r4tze
Copy link

r4tze commented May 17, 2022

I'm missing such a "Copy Content" Button as well. This would be a nice feature.

@yardenshoham
Copy link
Member

Does #21629 close this?

@buzzard10
Copy link
Author

It's work in the same way as button on github? If so, then yes :)

@yardenshoham
Copy link
Member

It's not exactly the same, in #21629 you can only copy the text if a file is displayed in source mode. The maintainers preferred to avoid an HTTP call to get raw contents on click. If you want to try it out,

https://try.gitea.io/alchemist/stem-ui/src/branch/main/README.md (disabled as it's not raw text)
https://try.gitea.io/alchemist/stem-ui/src/branch/main/README.md?display=source (enabled)
https://try.gitea.io/alchemist/stem-ui/src/branch/main/sass/main.sass (enabled)

@buzzard10
Copy link
Author

Can you make it work for all views? Not only raw content?

@yardenshoham
Copy link
Member

That would require a call to the raw content endpoint, which the maintainers preferred not to have, see quotes:

    The button could only be displayed when the file type is `TEXT`.

Originally posted by @lunny in #21629 (comment)

    3. Button needs to conditionally be disabled (I prefer to disable over hide) or hidden if content can not be copied like binary files. This can be determined during template rendering.
    4. Can we do without the fetch and just read data from DOM? Will be faster as well.

Originally posted by @silverwind in #21629 (comment)

@buzzard10
Copy link
Author

I love copying feature in Github, but this is better then nothing :)

@yardenshoham
Copy link
Member

If you'd like the extended functionality to copy files while in rendered view please open a new issue

@silverwind
Copy link
Member

Where does GitHub have this button?

We can extend later to allow image copy which is a bit tricky but possible. What other file types do you want to copy?

@silverwind
Copy link
Member

Apparently GitHub hides the button depending on User-Agent. Firefox UA will not show it. Switching Firefox to Chrome UA shows it and it also works. Way to go to discriminate browsers...

@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/ui Change the appearance of the Gitea UI type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants