mirror of
https://github.com/google/blockly.git
synced 2026-01-07 00:50:27 +01:00
Honour option for collapse in context menu
Currently the ‘collapse’ option is always present, even if flagged off in the inject options.
This commit is contained in:
@@ -397,14 +397,12 @@ Blockly.ContextMenuItems.registerCollapseExpandBlock = function() {
|
||||
/** @type {!Blockly.ContextMenuRegistry.RegistryItem} */
|
||||
var collapseExpandOption = {
|
||||
displayText: function(/** @type {!Blockly.ContextMenuRegistry.Scope} */ scope) {
|
||||
if (scope.block.isCollapsed()) {
|
||||
return Blockly.Msg['EXPAND_BLOCK'];
|
||||
}
|
||||
return Blockly.Msg['COLLAPSE_BLOCK'];
|
||||
return scope.block.isCollapsed() ?
|
||||
Blockly.Msg['EXPAND_BLOCK'] : Blockly.Msg['COLLAPSE_BLOCK'];
|
||||
},
|
||||
preconditionFn: function(/** @type {!Blockly.ContextMenuRegistry.Scope} */ scope) {
|
||||
var block = scope.block;
|
||||
if (!block.isInFlyout && block.isMovable()) {
|
||||
if (!block.isInFlyout && block.isMovable() && block.workspace.options.collapse) {
|
||||
return 'enabled';
|
||||
}
|
||||
return 'hidden';
|
||||
|
||||
Reference in New Issue
Block a user