mirror of
https://github.com/google/blockly.git
synced 2026-01-06 16:40:07 +01:00
chore: fix playground context menu (#8139)
This commit is contained in:
committed by
GitHub
parent
80cacdcad7
commit
53cc12da77
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user