We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7e49ac0 commit 6581613Copy full SHA for 6581613
1 file changed
src/components/OpenWithButton.js
@@ -8,7 +8,7 @@ import * as css from './CopyButton.module.css';
8
const OpenWithButton = ({ text }) => {
9
return (
10
<a
11
- href={`pde://sketch/base64/${Buffer.from(text).toString('base64')}`}
+ href={`pde://sketch/base64/${stringToBase64(text)}`}
12
type="button"
13
className={classnames(css.root)}
14
>
@@ -17,4 +17,11 @@ const OpenWithButton = ({ text }) => {
17
)
18
}
19
20
-export default OpenWithButton;
+export default OpenWithButton;
21
+
22
+function stringToBase64(str) {
23
+ if (typeof Buffer !== 'undefined') {
24
+ return Buffer.from(str).toString('base64');
25
+ }
26
+ return btoa(str);
27
+}
0 commit comments