Skip to content

Commit 5f18de1

Browse files
authored
Merge pull request #124 from code-hike/fix-firefox-copypasting
Fix firefox copypasting
2 parents 099ea14 + 5b2426a commit 5f18de1

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

packages/smooth-code/src/code-spring.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import {
1010
type SpringConfig = Parameters<typeof useSpring>[1]
1111

1212
type HTMLProps = React.DetailedHTMLProps<
13-
React.HTMLAttributes<HTMLPreElement>,
14-
HTMLPreElement
13+
React.HTMLAttributes<HTMLDivElement>,
14+
HTMLDivElement
1515
>
1616

1717
const defaultSpring = {

packages/smooth-code/src/code-tween.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import {
1616
import { SmoothLines } from "./smooth-lines"
1717

1818
type HTMLProps = React.DetailedHTMLProps<
19-
React.HTMLAttributes<HTMLPreElement>,
20-
HTMLPreElement
19+
React.HTMLAttributes<HTMLDivElement>,
20+
HTMLDivElement
2121
>
2222

2323
export type CodeTweenProps = {
@@ -166,11 +166,13 @@ function Wrapper({
166166
children: React.ReactNode
167167
}) {
168168
return (
169-
<pre
169+
<div
170170
{...htmlProps}
171171
style={{
172172
margin: 0,
173173
padding: 0,
174+
// using this instead of <pre> because https://github.com/code-hike/codehike/issues/120
175+
whiteSpace: "pre",
174176
...style,
175177
...htmlProps?.style,
176178
}}

0 commit comments

Comments
 (0)