fix: Fix downloading screenshots on the playground. (#6025)

* fix: Fix downloading screenshots on the playground.

* fix: Resolve lint warning about unused variable.
This commit is contained in:
Aaron Dodson
2022-03-25 08:27:08 -07:00
committed by GitHub
parent 2c15d002ab
commit ca6e590101
3 changed files with 4 additions and 3 deletions

View File

@@ -121,7 +121,7 @@ function configureContextMenu(menuOptions, e) {
text: 'Download Screenshot',
enabled: workspace.getTopBlocks().length,
callback: function() {
Blockly.downloadScreenshot(workspace);
downloadScreenshot(workspace);
}
};
menuOptions.push(screenshotOption);

View File

@@ -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';