@nextui-org/use-clipboard
Advanced tools
Comparing version 0.0.0-canary-20241206144245 to 0.0.0-canary-20241228030715
@@ -27,2 +27,5 @@ "use strict"; | ||
var import_react = require("react"); | ||
var transformValue = (text) => { | ||
return text.replace(/[\u00A0]/g, " "); | ||
}; | ||
function useClipboard({ timeout = 2e3 } = {}) { | ||
@@ -48,3 +51,4 @@ const [error, setError] = (0, import_react.useState)(null); | ||
if ("clipboard" in navigator) { | ||
navigator.clipboard.writeText(valueToCopy).then(() => handleCopyResult(true)).catch((err) => setError(err)); | ||
const transformedValue = typeof valueToCopy === "string" ? transformValue(valueToCopy) : valueToCopy; | ||
navigator.clipboard.writeText(transformedValue).then(() => handleCopyResult(true)).catch((err) => setError(err)); | ||
} else { | ||
@@ -51,0 +55,0 @@ setError(new Error("useClipboard: navigator.clipboard is not supported")); |
{ | ||
"name": "@nextui-org/use-clipboard", | ||
"version": "0.0.0-canary-20241206144245", | ||
"version": "0.0.0-canary-20241228030715", | ||
"description": "Wrapper around navigator.clipboard with feedback timeout", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
7355
130