Skip to content

Commit 801c591

Browse files
authored
Fix bug where the turtle canvas couldn't be found (#1082)
closes RaspberryPiFoundation/editor-standalone#388
1 parent fbbcea6 commit 801c591

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## Unreleased
8+
9+
### Fixed
10+
11+
- Enabling web component to find the `turtle` canvas
12+
713
## [0.27.0] - 2024-09-26
814

915
### Added

src/components/Editor/Runners/PythonRunner/VisualOutputPane.jsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ const VisualOutputPane = () => {
1818
const projectImages = useSelector((state) => state.editor.project.image_list);
1919
const error = useSelector((state) => state.editor.error);
2020

21-
const outputCanvas = useRef();
21+
const turtleOutput = useRef();
2222
const pygalOutput = useRef();
2323
const p5Output = useRef();
2424
const dispatch = useDispatch();
2525
const { t } = useTranslation();
2626

2727
useEffect(() => {
2828
if (codeRunTriggered) {
29-
outputCanvas.current.innerHTML = "";
29+
turtleOutput.current.innerHTML = "";
3030
pygalOutput.current.innerHTML = "";
3131
p5Output.current.innerHTML = "";
3232

@@ -43,7 +43,8 @@ const VisualOutputPane = () => {
4343

4444
(Sk.pygal || (Sk.pygal = {})).outputCanvas = pygalOutput.current;
4545

46-
(Sk.TurtleGraphics || (Sk.TurtleGraphics = {})).target = "outputCanvas";
46+
(Sk.TurtleGraphics || (Sk.TurtleGraphics = {})).target =
47+
turtleOutput.current;
4748
Sk.TurtleGraphics.assets = Object.assign(
4849
{},
4950
...projectImages.map((image) => ({
@@ -78,8 +79,8 @@ const VisualOutputPane = () => {
7879
<div id="pygalOutput" ref={pygalOutput} />
7980
<div className="pythonrunner-canvas-container">
8081
<div
81-
id="outputCanvas"
82-
ref={outputCanvas}
82+
id="turtleOutput"
83+
ref={turtleOutput}
8384
className="pythonrunner-graphic"
8485
/>
8586
</div>

0 commit comments

Comments
 (0)