File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
packages/mdx/src/mini-editor Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 22
22
font-size : 1rem ;
23
23
line-height : 1.2rem ;
24
24
letter-spacing : 0px ;
25
+ position : relative ;
25
26
}
26
27
27
28
.ch-code-browser-content ::selection {
42
43
background-color : var (--ch-hover-background );
43
44
color : var (--ch-hover-foreground );
44
45
}
46
+
47
+ .ch-code-browser-button {
48
+ width : 1.5em ;
49
+ height : 1.5em ;
50
+ cursor : pointer ;
51
+ min-width : 1.5em ;
52
+ min-height : 1.5em ;
53
+ position : absolute ;
54
+ right : 0.8em ;
55
+ top : 0.8em ;
56
+ }
Original file line number Diff line number Diff line change 1
1
import { CodeFile } from "./editor-shift"
2
2
import { IRawTheme } from "vscode-textmate"
3
- import { ColorName , getColor , getColorScheme } from "utils"
3
+ import {
4
+ codeToText ,
5
+ ColorName ,
6
+ getColor ,
7
+ getColorScheme ,
8
+ } from "utils"
4
9
import React from "react"
10
+ import { CopyButton } from "smooth-code/copy-button"
5
11
6
12
export function CodeBrowser ( {
7
13
files,
@@ -192,6 +198,10 @@ function Content({
192
198
colorScheme : getColorScheme ( theme ) ,
193
199
} }
194
200
>
201
+ < CopyButton
202
+ className = "ch-code-browser-button"
203
+ content = { codeToText ( file . code ) }
204
+ />
195
205
{ file . code . lines . map ( ( line , i ) => (
196
206
< div key = { i } >
197
207
{ line . tokens . length === 0 ? (
You can’t perform that action at this time.
0 commit comments