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

Is it possible to replace 'Copy' text in clipboard button with an icon. #2557

Closed
CodAffection opened this issue Sep 17, 2020 · 5 comments · Fixed by #2789
Closed

Is it possible to replace 'Copy' text in clipboard button with an icon. #2557

CodAffection opened this issue Sep 17, 2020 · 5 comments · Fixed by #2789

Comments

@CodAffection
Copy link

CodAffection commented Sep 17, 2020

Is it possible to replace 'Copy' text inside the toolbar button with an icon.

@CodAffection CodAffection changed the title Is it possible to replace 'Copy' to clipboard button with an icon. Is it possible to replace 'Copy' text in clipboard button with an icon. Sep 17, 2020
@mAAdhaTTah
Copy link
Member

Currently, no, but that might be a useful enhancement, esp for i18n, so we'd be open to a PR. We could use data attributes for this pretty easily.

@RunDevelopment
Copy link
Member

The plugin has 3 states it has to display ("Copy", "Copied!", "Press Ctrl+C to copy"). The easiest might be to give the button a data- attribute with the current state and wrap the text into a span element, so you can just hide the text via a little CSS. How does that sound?

@DraftProducts
Copy link

Hi!
Sorry for commenting on a closed issue, (I can open another one if it's needed).
I'm not sure that the request of @CodAffection was resolved with this PR.
You can't add an icon with the current code-base of copy-to-clipboard.
You can't put an SVG or HTML element into the textContent of a span.

@RunDevelopment
Copy link
Member

Hello @DraftProducts!

You can use an SVG and/or icon. You can either use the background property of the span or use an icon font and set the copy text. With a little CSS, this should be enough for most use cases.

@DraftProducts
Copy link

Hello!
Thank you for your quick reaction!
I thought it was a bit hacky but it should be enough 👍
Have a nice day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants