Skip to content

Commit e109e39

Browse files
authored
fix: wrong oneline key output copy (#13)
This PR addresses issue where the oneline toggle is enabled, and a user clicks on the `Copy` button yet Multi-line output key is copied regardless. ### Related Issue Fixes #10 🔑
1 parent 97ecf85 commit e109e39

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/page.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,11 @@ export default function Home() {
174174
type="button"
175175
className="relative inline-flex items-center px-4 py-2 -ml-px space-x-2 text-sm font-medium duration-150 border rounded text-zinc-700 border-zinc-300 bg-zinc-50 hover focus:border-zinc-500 focus:outline-none hover:text-zinc-50 hover:bg-zinc-900"
176176
onClick={() => {
177-
navigator.clipboard.writeText(outputKey);
177+
navigator.clipboard.writeText(
178+
oneline
179+
? outputKey?.replace(/\n/g, "\\n")
180+
: outputKey
181+
);
178182
setCopied(true);
179183
}}
180184
>

0 commit comments

Comments
 (0)