diff --git a/cypress/e2e/spec-scratch.cy.js b/cypress/e2e/spec-scratch.cy.js index b2bc8b403..35f833a8a 100644 --- a/cypress/e2e/spec-scratch.cy.js +++ b/cypress/e2e/spec-scratch.cy.js @@ -21,7 +21,7 @@ const getIframeBody = () => { describe("Scratch", () => { beforeEach(() => { cy.visit(origin); - cy.findByText("blank-scratch").click(); + cy.findByText("cool-scratch").click(); }); it("loads Scratch in an iframe", () => { diff --git a/public/api/assets/internalapi/asset/8a9dadf4eea61892ec6908b1c99e4961.svg/get b/public/api/scratch/assets/internalapi/asset/8a9dadf4eea61892ec6908b1c99e4961.svg/get similarity index 100% rename from public/api/assets/internalapi/asset/8a9dadf4eea61892ec6908b1c99e4961.svg/get rename to public/api/scratch/assets/internalapi/asset/8a9dadf4eea61892ec6908b1c99e4961.svg/get diff --git a/public/api/projects/cool-id.json b/public/api/scratch/projects/cool-scratch.json similarity index 100% rename from public/api/projects/cool-id.json rename to public/api/scratch/projects/cool-scratch.json diff --git a/public/index.html b/public/index.html index 1dbfdf1f4..af22667d6 100644 --- a/public/index.html +++ b/public/index.html @@ -1,4 +1,4 @@

You may be looking for...

diff --git a/src/components/Editor/Project/ScratchContainer.jsx b/src/components/Editor/Project/ScratchContainer.jsx index bf6f5f2d9..4b3f909ef 100644 --- a/src/components/Editor/Project/ScratchContainer.jsx +++ b/src/components/Editor/Project/ScratchContainer.jsx @@ -1,9 +1,25 @@ import React from "react"; +import { useSelector } from "react-redux"; export default function ScratchContainer() { + const projectIdentifier = useSelector( + (state) => state.editor.project.identifier, + ); + const scratchApiEndpoint = useSelector( + (state) => state.editor.scratchApiEndpoint, + ); + + const queryParams = new URLSearchParams(); + queryParams.set("project_id", projectIdentifier); + queryParams.set("api_url", scratchApiEndpoint); + + const iframeSrcUrl = `${ + process.env.ASSETS_URL + }/scratch.html?${queryParams.toString()}`; + return (