Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
*/
Blockly.FieldVariable.prototype.setValue = function(newValue) {
if (newValue != this.value_) {
var that = this;
this.fieldHasChanged(this.value_, newValue, function() {
that.value_ = newValue;
that.setText(newValue);
});
}
};
/**
* Set whether this block is a shadow block or not.
* @param {boolean} shadow True if a shadow.
*/
Blockly.Block.prototype.setShadow = function(shadow) {
if (this.isShadow_ != shadow) {
Blockly.Events.fire(new Blockly.Events.Change(
this, 'shadow', null, this.isShadow_, shadow));
this.isShadow_ = shadow;
}
};
/**
* Run a change event.
* @param {boolean} forward True if run forward, false if run backward (undo).
*/
Blockly.Events.Change.prototype.run = function(forward) {
var workspace = Blockly.Workspace.getById(this.workspaceId);
var block = workspace.getBlockById(this.blockId);
if (!block) {
console.warn("Can't change non-existant block: " + this.blockId);
decompose: function(workspace) {
var containerBlock = Blockly.Block.obtain(workspace,
'sparql_text_create_join_container');
containerBlock.initSvg();
var connection = containerBlock.getInput('STACK').connection;
for (var i = 0; i < this.itemCount_; i++) {
var itemBlock = workspace.newBlock('sparql_text_create_join_item');
itemBlock.initSvg();
connection.connect(itemBlock.previousConnection);
connection = itemBlock.nextConnection;
}
return containerBlock;
},
/**
var morphShadowRec = function(block) {
var parentBlock = block.getParent();
if (parentBlock) {
morphShadowRec(parentBlock);
}
block.setShadow(false);
};
/**
* When a field changes, generate event and manage shadow state.
* @param {Object} oldValue The old field value
* @param {Object} newValue The new field value
* @protected
*/
Blockly.Block.prototype.blockIsTargetOfConnection = function(childBlock, manageEvent) {
var noGroup = false;
if (Blockly.Events.recordUndo) {
if (Blockly.Events.isEnabled()) {
noGroup = true; //!Blockly.Events.getGroup();
Blockly.Events.setGroup(true);
}
morphShadowRec(this);
}
manageEvent();
if (noGroup) {
Blockly.Events.setGroup(false);
}
};
/**
* When a field changes, generate event and manage shadow state.