Skip to content

Commit f416649

Browse files
committed
Corrected myself, cdnLibraryUrl was already present, so we'll just use that instead of Github's p5.min.js. Passing it into code.scripts in index.jsx rather than frame.tsx resolve the issue with the Multiple Canvases example.
Signed-off-by: Bryan Hoffman <bryanhoffman1@gmail.com
1 parent 7dafe17 commit f416649

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/components/CodeEmbed/frame.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ ${code.css || ""}
4444
</style>
4545
<!-- If we need an addon script, load p5 the usual way with no caching to make sure
4646
the import order doesn't get messed up. -->
47-
${((code.scripts?.length ?? 0) > 0 ? [cdnLibraryUrl, ...(code.scripts ?? [])] : []).map((src) => `<script type="text/javascript" src="${src}"></script>`).join('\n')}
47+
${((code.scripts?.length ?? 0) > 0 ? [(code.scripts ?? [])] : []).map((src) => `<script type="text/javascript" src="${src}"></script>`).join('\n')}
4848
<body>${code.htmlBody || ""}</body>
4949
<script id="code" type="text/javascript">${wrapSketch(code.js) || ""}</script>
5050
${(code.scripts?.length ?? 0) > 0 ? '' : `

src/components/CodeEmbed/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useState, useEffect, useRef } from "preact/hooks";
22
import { useLiveRegion } from '../hooks/useLiveRegion';
33
import CodeMirror, { EditorView } from "@uiw/react-codemirror";
44
import { javascript } from "@codemirror/lang-javascript";
5-
import { minifiedLibraryDownloadUrl, cdnLibraryUrl, cdnSoundUrl } from "@/src/globals/globals";
5+
import { cdnLibraryUrl, cdnSoundUrl } from "@/src/globals/globals";
66

77
import { CodeFrame } from "./frame";
88
import { CopyCodeButton } from "../CopyCodeButton";
@@ -96,7 +96,7 @@ export const CodeEmbed = (props) => {
9696
base={props.base}
9797
frameRef={codeFrameRef}
9898
lazyLoad={props.lazyLoad}
99-
scripts={props.includeSound ? [minifiedLibraryDownloadUrl, cdnSoundUrl] :[minifiedLibraryDownloadUrl]}
99+
scripts={props.includeSound ? [cdnLibraryUrl, cdnSoundUrl] :[cdnLibraryUrl]}
100100
/>
101101
</div>
102102
<div className={`flex gap-2.5 ${largeSketch ? "flex-row" : "md:flex-row lg:flex-col"}`}>

0 commit comments

Comments
 (0)