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