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 2222 font-size : 1rem ;
2323 line-height : 1.2rem ;
2424 letter-spacing : 0px ;
25+ position : relative ;
2526}
2627
2728.ch-code-browser-content ::selection {
4243 background-color : var (--ch-hover-background );
4344 color : var (--ch-hover-foreground );
4445}
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 11import { CodeFile } from "./editor-shift"
22import { IRawTheme } from "vscode-textmate"
3- import { ColorName , getColor , getColorScheme } from "utils"
3+ import {
4+ codeToText ,
5+ ColorName ,
6+ getColor ,
7+ getColorScheme ,
8+ } from "utils"
49import React from "react"
10+ import { CopyButton } from "smooth-code/copy-button"
511
612export function CodeBrowser ( {
713 files,
@@ -192,6 +198,10 @@ function Content({
192198 colorScheme : getColorScheme ( theme ) ,
193199 } }
194200 >
201+ < CopyButton
202+ className = "ch-code-browser-button"
203+ content = { codeToText ( file . code ) }
204+ />
195205 { file . code . lines . map ( ( line , i ) => (
196206 < div key = { i } >
197207 { line . tokens . length === 0 ? (
You can’t perform that action at this time.
0 commit comments