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 to Clipboard Button #234

Merged
merged 3 commits into from
May 21, 2024

Conversation

adwait-godbole
Copy link
Contributor

Fixes #171

2024-05-20.22-34-58.mp4

Copy link
Member

@jviotti jviotti left a comment

Choose a reason for hiding this comment

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

Very cool. It works really well and looks good on both light and dark themes already. Just left a couple of comments. Mostly one, as the style of the schema code blocks got a bit messed up after introducing the relative positioning container

assets/main.js Outdated

document.addEventListener("DOMContentLoaded", function () {
const copyBtns = document.querySelectorAll(".copy-btn");
copyBtns.forEach((btn) => {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
copyBtns.forEach((btn) => {
document.querySelectorAll(".copy-btn").forEach((btn) => {

Pretty minor thing, but I guess we can loop directly here?

@@ -9,5 +9,10 @@
Schema</span>
</div>
{{ $code := trim .Inner "\n" }}
{{ transform.Highlight ($code) "json" }}
<div class="position-relative">
Copy link
Member

Choose a reason for hiding this comment

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

Screenshot 2024-05-21 081238

Works great, but I think this wrapper is messing things up a bit. Check the dark gray top and bottom borders compared to the ones in the live website:

Screenshot 2024-05-21 081334

I think its because of some CSS rules trying to match .hightlight directly under code. Can you please revise those rules a little bit?

@adwait-godbole
Copy link
Contributor Author

Screenshot (157)

Fixed it!

assets/main.scss Outdated Show resolved Hide resolved
@jviotti
Copy link
Member

jviotti commented May 21, 2024

Thanks a lot!

@jviotti jviotti merged commit c161ca2 into Intelligence-AI:main May 21, 2024
1 check passed
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.

Add a copy-to-clipboard button on code snippets
2 participants