holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.8k stars 519 forks source link

Add pointer cursor when hovering over copybtn #7490

Closed MarcSkovMadsen closed 1 week ago

MarcSkovMadsen commented 1 week ago

When starting to use the new copy code button I felt that it was lacking the pointer cursor compared to ChatGPT.

https://github.com/user-attachments/assets/f48f74e4-fd39-4438-a450-ecad250f1447

This PR adds the pointer.

I have not tested this as I don't know how to trigger Panel to use the updated css file.

Workaround

Until this PR is released you can work around the problem as below:

import panel as pn
from panel.chat import ChatInterface

pn.extension("perspective")

CSS = """
.codehilite:hover .copybtn {
  cursor: pointer;
}
"""

if not CSS in pn.pane.Markdown._stylesheets:
    pn.pane.Markdown._stylesheets.append(CSS)

code = """
Some code

```python
a=1
b=a+1
print(a, b)

"""

pn.template.FastListTemplate( title="Copy Button", sidebar=[code], main=[code], ).servable()

MarcSkovMadsen commented 1 week ago

The failing tests has nothing to do with this PR.

hoxbro commented 1 week ago

The failing tests has nothing to do with this PR.

Opened #7491

I have not tested this as I don't know how to trigger Panel to use the updated css file.

Can you try running panel bundle --all with the environment variable BOKEH_RESOURCES=server set?