h2oai / wave

Realtime Web Apps and Dashboards for Python and R
https://wave.h2o.ai
Apache License 2.0
3.98k stars 327 forks source link

feat: Add copy to clipboard button to markdown code block #2025 #2120

Closed marek-mihok closed 1 year ago

marek-mihok commented 1 year ago

The PR fulfills these requirements: (check all the apply)


This PR reuses the button from ui.copyable_text also for markdown code block.

https://github.com/h2oai/wave/assets/23740173/5153862d-e10c-4b7f-8cec-07cbd544fbb6

Closes #2025

marek-mihok commented 1 year ago

Using portals seems like overkill. Can we do without?

We can, please check the updated solution. I've reused the original approach we used for copyable_text and applied the same principle also for markdown code block.

The button on dark md syntax highlight blends into background and is barely visible. Can this be improved?

Improved by adding the outline.

The tests that check if button is rendered are unnecessary, we have visual regression tests for that. Hover ones are ok.

Good point. Removed ✅