InfoPanel: handle missing Clipboard API silently
This commit is contained in:
@@ -60,8 +60,8 @@ const InfoPanel: React.FC<InfoPanelProps> = (props) => {
|
|||||||
event.currentTarget.blur();
|
event.currentTarget.blur();
|
||||||
setCopied(type);
|
setCopied(type);
|
||||||
const data = snippets[type];
|
const data = snippets[type];
|
||||||
if (!navigator.clipboard) throw new Error("no clipboard!");
|
// if (!navigator.clipboard) throw new Error("no clipboard!");
|
||||||
data && navigator.clipboard.writeText(data);
|
data && void(navigator.clipboard?.writeText(data));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDownloadSVG = (
|
const handleDownloadSVG = (
|
||||||
@@ -78,7 +78,7 @@ const InfoPanel: React.FC<InfoPanelProps> = (props) => {
|
|||||||
) => {
|
) => {
|
||||||
event.currentTarget.blur();
|
event.currentTarget.blur();
|
||||||
setCopied("svg");
|
setCopied("svg");
|
||||||
ref.current && navigator.clipboard.writeText(ref.current.outerHTML);
|
ref.current && void(navigator.clipboard?.writeText(ref.current.outerHTML));
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user