feat(ui): hover copy button on markdown code blocks
Nightly Build / build (push) Successful in 7m53s
Nightly Build / build (push) Successful in 7m53s
This commit is contained in:
@@ -440,6 +440,45 @@
|
||||
|
||||
.copilot-markdown pre code { background: none; padding: 0; font-size: inherit; }
|
||||
|
||||
/* Fenced code blocks carry a copy button that appears on hover (renderMarkdown
|
||||
wraps every <pre> in .md-code-wrap). */
|
||||
.md-code-wrap { position: relative; }
|
||||
|
||||
.md-code-copy {
|
||||
position: absolute;
|
||||
top: 0.4rem;
|
||||
right: 0.4rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 1.6rem;
|
||||
height: 1.6rem;
|
||||
padding: 0;
|
||||
border: none;
|
||||
border-radius: 0.35rem;
|
||||
background: rgba(0, 0, 0, 0.12);
|
||||
color: inherit;
|
||||
font-size: 0.8rem;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s ease;
|
||||
}
|
||||
|
||||
.md-code-wrap:hover .md-code-copy,
|
||||
.md-code-copy:focus-visible { opacity: 1; }
|
||||
|
||||
.md-code-copy.copied { opacity: 1; color: #16a34a; }
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.md-code-copy { background: rgba(255, 255, 255, 0.14); }
|
||||
}
|
||||
|
||||
/* No hover on touch: keep the button dimly visible so it stays reachable. */
|
||||
@media (hover: none) {
|
||||
.md-code-copy { opacity: 0.55; }
|
||||
}
|
||||
|
||||
.copilot-markdown blockquote {
|
||||
border-left: 3px solid var(--accent);
|
||||
margin: 0.5rem 0;
|
||||
|
||||
Reference in New Issue
Block a user