1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-09-16 20:05:31 -04:00

use react-innertext

This commit is contained in:
2022-01-04 18:44:49 -05:00
parent 20d8b13bb1
commit c890a8aae0
5 changed files with 11 additions and 28 deletions

View File

@@ -1,6 +1,5 @@
import { useState, useEffect } from "react";
import copy from "copy-to-clipboard";
import trimNewlines from "trim-newlines";
import { CopyOcticon, CheckOcticon } from "../icons/octicons";
import styles from "./CopyButton.module.scss";
@@ -19,8 +18,8 @@ const CopyButton = ({ content, timeout = 2000 }: Props) => {
// prevent unintentional double-clicks by unfocusing button
e.target.blur();
// trim any surrounding whitespace from target block's content and send it to the clipboard
const didCopy = copy(trimNewlines(content));
// send plaintext to the clipboard
const didCopy = copy(content);
// indicate success
setCopied(didCopy);