DulLabs / bhai-lang

A toy programming language written in Typescript
https://bhailang.js.org/
MIT License
3.97k stars 499 forks source link

Added a copy button in playground editor #176

Closed shubh0107 closed 2 years ago

shubh0107 commented 2 years ago

This PR closes issue #84.

The playground code editor now has a button which copies the current code written in the editor to clipboard.

Screenshot 2022-03-16 at 1 27 13 AM
ankitchouhan1020 commented 2 years ago

Please add copy icon in rest of the documentation code too.

Screenshot 2022-03-18 at 4 00 41 PM
shubh0107 commented 2 years ago

Please add copy icon in rest of the documentation code too.

Screenshot 2022-03-18 at 4 00 41 PM

This is also done.

Screenshot 2022-03-18 at 4 30 18 PM
shubh0107 commented 2 years ago

hi @aniketsingh0104, Have made the changes are per your suggestions.

Screenshot 2022-03-20 at 3 00 44 PM Screenshot 2022-03-20 at 3 01 04 PM

Let me know if this looks fine. Thanks 👍🏻

ankitchouhan1020 commented 2 years ago

Please check in mobile browser once. Copied text to being remove too fast.

shubh0107 commented 2 years ago

Please check in mobile browser once. Copied text to being remove too fast.

As the show and hide logic of the Copy button is based on hover over the editor/snippet block, it doesn't work as expected on a touch interface or the mobile browser. I've handled this by tweaking it a bit that only on viewports md and above, the copy button will be hidden by default. On sm it will always be visible.