chore: fix playground context menu (#8139)

This commit is contained in:
Maribeth Bottorff
2024-05-17 09:48:41 -07:00
committed by GitHub
parent 80cacdcad7
commit 53cc12da77

View File

@@ -26,7 +26,6 @@
function createWorkspace(blocklyDiv, options) {
var workspace = Blockly.inject(blocklyDiv, options);
workspace.configureContextMenu = configureContextMenu.bind(workspace);
return workspace;
}
@@ -101,6 +100,8 @@
},
};
Blockly.ContextMenuItems.registerCommentOptions();
createPlayground(
document.getElementById('root'),
createWorkspace,
@@ -125,23 +126,6 @@
document.body.style.backgroundColor = '#d6d6ff'; // Familliar lilac.
}
}
function configureContextMenu(menuOptions, e) {
var workspace = this;
var screenshotOption = {
text: 'Download Screenshot',
enabled: workspace.getTopBlocks().length,
callback: function () {
downloadScreenshot(workspace);
},
};
menuOptions.push(screenshotOption);
// Adds a default-sized workspace comment to the workspace.
menuOptions.push(
Blockly.ContextMenu.workspaceCommentOption(workspace, e),
);
}
start();
</script>