Skip to content

Commit

Permalink
fix: Fix downloading screenshots on the playground. (#6025)
Browse files Browse the repository at this point in the history
* fix: Fix downloading screenshots on the playground.

* fix: Resolve lint warning about unused variable.
  • Loading branch information
gonfunko authored Mar 25, 2022
1 parent 2c15d00 commit ca6e590
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tests/playground.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<!-- This script loads uncompressed when on localhost and loads compressed when it is being hosted.
Please add any other dependencies to playgrounds/prepare.js.-->
<script src="playgrounds/prepare.js"></script>
<script src="playgrounds/screenshot.js"></script>
<script src="../node_modules/@blockly/dev-tools/dist/index.js"></script>
<script type=module>
import Blockly from './playgrounds/blockly.mjs';
Expand Down Expand Up @@ -242,7 +243,7 @@
text: 'Download Screenshot',
enabled: workspace.getTopBlocks().length,
callback: function() {
Blockly.downloadScreenshot(workspace);
downloadScreenshot(workspace);
}
};
menuOptions.push(screenshotOption);
Expand Down
2 changes: 1 addition & 1 deletion tests/playgrounds/advanced_playground.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
text: 'Download Screenshot',
enabled: workspace.getTopBlocks().length,
callback: function() {
Blockly.downloadScreenshot(workspace);
downloadScreenshot(workspace);
}
};
menuOptions.push(screenshotOption);
Expand Down
2 changes: 1 addition & 1 deletion tests/playgrounds/screenshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function workspaceToSvg_(workspace, callback, customCss) {
* Download a screenshot of the blocks on a Blockly workspace.
* @param {!Blockly.WorkspaceSvg} workspace The Blockly workspace.
*/
Blockly.downloadScreenshot = function(workspace) {
function downloadScreenshot(workspace) {
workspaceToSvg_(workspace, function(datauri) {
const a = document.createElement('a');
a.download = 'screenshot.png';
Expand Down

0 comments on commit ca6e590

Please sign in to comment.