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

feat(Plugin): CopyFileContents #2790

Merged
merged 12 commits into from
Sep 1, 2024

Conversation

Obsidianninja11
Copy link
Contributor

@Obsidianninja11 Obsidianninja11 commented Aug 18, 2024

Adds a button to copy the contents of a text file (even if the text isn't in the tiny preview).
After clicking, the copy icon will turn into a checkmark (like in large codeblocks), and the text will be copied to your clipboard.
For files over 50kb (50 thousand characters) that don't fully show in the "View whole file" preview, it shows "File too large to copy". I made a version that fetches files that are large, but I don't think that's necessary for 99% of users, and it could lead to problems if a user tries to copy a huge file.
This pr also updates the copy icon in components\icons.tsx (because the icon is used in this plugin), as the icon that was in there is long outdated.

Images

image
image

A file containing 51kb that is unable to be copied (the first 683 numbers in the fibonacci sequence in this example).
image

Copy link
Contributor

@Scyye Scyye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im tired and youre asking for a review, so i gave it to ya lol
just verify everything is accurate before changing stuff.

src/plugins/CopyFileContents/index.tsx Outdated Show resolved Hide resolved
src/plugins/CopyFileContents/index.tsx Outdated Show resolved Hide resolved
src/plugins/CopyFileContents/index.tsx Show resolved Hide resolved
src/plugins/CopyFileContents/index.tsx Outdated Show resolved Hide resolved
@Nuckyz
Copy link
Collaborator

Nuckyz commented Aug 30, 2024

You never change setRecentlyCopied back to false, is that intended?

@Obsidianninja11
Copy link
Contributor Author

You never change setRecentlyCopied back to false, is that intended?

Yes. That's how it works in code blocks, so I recreated it here.

@Scyye
Copy link
Contributor

Scyye commented Aug 30, 2024

I still feel like it should

@Obsidianninja11
Copy link
Contributor Author

Obsidianninja11 commented Aug 31, 2024

I added a toast when copying. It's currently stay as a checkmark with a toast (the first video).
I don't think the checkmark changing back (second video) is necessary because it can create some buggy behaviour, and I don't think it looks as good.

Videos
cfc_stay_toast.mp4
cfc_change_back_toast.mp4

@Nuckyz
Copy link
Collaborator

Nuckyz commented Sep 1, 2024

I fixed the buggy behavior and made the checkmark change back, it makes way more sense

@Nuckyz Nuckyz changed the base branch from main to dev September 1, 2024 01:59
@Nuckyz Nuckyz merged commit ec267ab into Vendicated:dev Sep 1, 2024
1 check passed
@Nuckyz
Copy link
Collaborator

Nuckyz commented Sep 1, 2024

Thank you for the new plugin!

@Obsidianninja11 Obsidianninja11 deleted the copy-file-contents branch September 1, 2024 06:21
josiauh pushed a commit to josiauh/Vencord that referenced this pull request Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants