Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion appinventor/appengine/war/index.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
<script type="text/javascript" src="static/js/workspace-search-9.1.10.min.js"></script>
<script type="text/javascript" src="static/js/block-dynamic-connection-0.7.16.min.js"></script>
<script type="text/javascript" src="static/js/pickr.min.js"></script>
<script type="text/javascript" src="static/js/workspace-multiselect-pr126-e813d3a.min.js"></script>
<script type="text/javascript" src="static/js/workspace-multiselect-pr134-c630b72.min.js"></script>
<script type="text/javascript" src="static/js/keyboard-navigation-0.7.0.min.js"></script>
<script type="text/javascript" src="<%= odeBase %>ode/cdnok.js"></script>
<script type="text/javascript" src="static/js/jszip.min.js"></script>
Expand Down

This file was deleted.

Large diffs are not rendered by default.

17 changes: 14 additions & 3 deletions appinventor/blocklyeditor/src/backpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ AI.Blockly.Backpack = class extends Blockly.DragTarget {
}

onDragEnter(e) {
if (e instanceof Blockly.BlockSvg) {
if (e instanceof Blockly.BlockSvg || e.toFlyoutInfo !== undefined) {
// switch to open backpack icon
this.setOpen_(true);
}
Expand All @@ -312,6 +312,17 @@ AI.Blockly.Backpack = class extends Blockly.DragTarget {
try {
if (dragElement instanceof Blockly.BlockSvg) {
this.addToBackpack(/** @type {!Blockly.BlockSvg} */ (dragElement), true);
} else if (dragElement.toFlyoutInfo !== undefined) {
const headlessWorkspace = new Blockly.Workspace();
headlessWorkspace.targetWorkspace = this.workspace_;
try {
for (const blockInfo of dragElement.toFlyoutInfo()) {
const tempBlock = Blockly.serialization.blocks.append(blockInfo, headlessWorkspace);
this.addToBackpack(tempBlock, true);
}
} finally {
headlessWorkspace.dispose();
}
}
} finally {
this.setOpen_(false);
Expand Down Expand Up @@ -375,10 +386,10 @@ AI.Blockly.Backpack = class extends Blockly.DragTarget {
if (contents === undefined || contents.length === 0) {
return;
}
let headlessWorkspace = null;
let lastPastedBlock = null;
const headlessWorkspace = new Blockly.Workspace();
headlessWorkspace.targetWorkspace = this.workspace_;
try {
headlessWorkspace = new Blockly.Workspace();
Blockly.Events.setGroup(true);
for (let i = 0; i < contents.length; i++) {
const xml = Blockly.utils.xml.textToDom(contents[i]);
Expand Down
25 changes: 25 additions & 0 deletions appinventor/blocklyeditor/src/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,28 @@ Blockly.Block.prototype.domToMutation = null;
*/
Blockly.Block.prototype.mutationToDom = null;

/**
* Mark this block as bad.
*/
Blockly.Block.prototype.badBlock = function() {
this.isBad = true;
};

/**
* Unmark this block as bad.
*/
Blockly.Block.prototype.notBadBlock = function() {
this.isBad = false;
};

/**
* Get the top-most workspace. Typically this is the current workspace except for flyout/flydowns.
* @returns {!Blockly.Workspace}
*/
Blockly.Block.prototype.getTopWorkspace = function() {
var workspace = this.workspace;
while (workspace.targetWorkspace) {
workspace = workspace.targetWorkspace;
}
return workspace;
};
14 changes: 2 additions & 12 deletions appinventor/blocklyeditor/src/block_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Blockly.BlockSvg.prototype.isBadBlock = function() {
* Mark this block as Bad. Highlight it visually in Red.
*/
Blockly.BlockSvg.prototype.badBlock = function() {
this.isBad = true;
Object.getPrototypeOf(Blockly.BlockSvg.prototype).badBlock.call(this);
Comment thread
josmas marked this conversation as resolved.
if (this.workspace == Blockly.common.getMainWorkspace()) {
// mark a block bad only if it is on the main workspace
if (!((typeof this.getSvgRoot()) == 'object' && this.getSvgRoot() != null)) {
Expand All @@ -121,7 +121,7 @@ Blockly.BlockSvg.prototype.badBlock = function() {
* Unmark this block as Bad.
*/
Blockly.BlockSvg.prototype.notBadBlock = function() {
this.isBad = false;
Object.getPrototypeOf(Blockly.BlockSvg.prototype).notBadBlock.call(this);
if (this.workspace == Blockly.common.getMainWorkspace()) {
// mark a block not bad only if it is on the main workspace
if (!((typeof this.getSvgRoot()) == 'object' && this.getSvgRoot() != null)) {
Expand Down Expand Up @@ -154,16 +154,6 @@ Blockly.BlockSvg.prototype.dispose = (function(func) {
}
})(Blockly.BlockSvg.prototype.dispose);

/**
* Get the top-most workspace. Typically this is the current workspace except for flyout/flydowns.
* @returns {!Blockly.WorkspaceSvg}
*/
Blockly.BlockSvg.prototype.getTopWorkspace = function() {
var workspace = this.workspace;
while (workspace.targetWorkspace) workspace = workspace.targetWorkspace;
return workspace;
};

/**
* Load the block's help page in a new window. This version overrides the implementation in Blockly
* in order to include the locale query parameter that the documentation page will use to redirect
Expand Down
25 changes: 0 additions & 25 deletions appinventor/blocklyeditor/src/blocks/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,6 @@ Blockly.Blocks.component_event = {
// used here due to a previous call to mutationToDom. Reusing the dropdown is not
// allowed by Blockly, i.e. its sourceBlock is not allowed to be changed.
this.componentDropDown = Blockly.ComponentBlock.createComponentDropDown(this);
var oldRendered = this.rendered;
this.rendered = false;
var oldDo = null;
for (var i = 0, input; input = this.inputList[i]; i++) {
if (input.connection) {
Expand Down Expand Up @@ -347,16 +345,10 @@ Blockly.Blocks.component_event = {
this.getInput('DO').connection.connect(oldDo.previousConnection);
}

for (var i = 0, input; input = this.inputList[i]; i++) {
input.init();
}

// Set as badBlock if it doesn't exist.
this.verify();
// Disable it if it does exist and is deprecated.
Blockly.ComponentBlock.checkDeprecated(this, eventType);

this.rendered = oldRendered;
},

getTypeName: function() {
Expand Down Expand Up @@ -722,8 +714,6 @@ Blockly.Blocks.component_method = {
// used here due to a previous call to mutationToDom. Reusing the dropdown is not
// allowed by Blockly, i.e. its sourceBlock is not allowed to be changed.
this.componentDropDown = Blockly.ComponentBlock.createComponentDropDown(this);
var oldRendered = this.rendered;
this.rendered = false;
var oldInputValues = [];
for (var i = 0, input; input = this.inputList[i]; i++) {
if (input.connection) {
Expand Down Expand Up @@ -843,10 +833,6 @@ Blockly.Blocks.component_method = {
}
}

for (var i = 0, input; input = this.inputList[i]; i++) {
input.init();
}

if (!methodTypeObject) {
if (this.shape === 'statement') {
this.setPreviousStatement(true);
Expand Down Expand Up @@ -877,8 +863,6 @@ Blockly.Blocks.component_method = {
this.verify();
// Disable it if it does exist and is deprecated.
Blockly.ComponentBlock.checkDeprecated(this, this.getMethodTypeObject());

this.rendered = oldRendered;
},

getTypeName: function() {
Expand Down Expand Up @@ -1135,8 +1119,6 @@ Blockly.Blocks.component_set_get = {
},

domToMutation : function(xmlElement) {
var oldRendered = this.rendered;
this.rendered = false;
var oldInput = this.setOrGet == "set" && this.getInputTargetBlock('VALUE');
for (var i = 0, input; input = this.inputList[i]; i++) {
if (input.connection) {
Expand Down Expand Up @@ -1255,7 +1237,6 @@ Blockly.Blocks.component_set_get = {
}

if (oldInput) {
this.getInput('VALUE').init();
oldInput.outputConnection.reconnect(this, 'VALUE');
}

Expand All @@ -1279,12 +1260,6 @@ Blockly.Blocks.component_set_get = {
this.verify();
// Disable it if it does exist and is deprecated.
Blockly.ComponentBlock.checkDeprecated(this, this.propertyObject);

for (var i = 0, input; input = this.inputList[i]; i++) {
input.init();
}

this.rendered = oldRendered;
},

getTypeName: function() {
Expand Down
8 changes: 0 additions & 8 deletions appinventor/blocklyeditor/src/blocks/lexical-variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,13 +515,6 @@ Blockly.Blocks['local_declaration_statement'] = {
this.updateDeclarationInputs_(newLocalNames, initializers);
}
},
dispose: function() {
// *** [lyn, 11/07/12] Dunno if anything needs to be done here.
// Call parent's destructor.
Blockly.BlockSvg.prototype.dispose.apply(this, arguments);
// [lyn, 11/07/12] In above line, don't know where "arguments" param comes from,
// but if it's remove, there's no clicking sound upon deleting the block!
},
saveConnections: function(containerBlock) {
// Store child initializer blocks for local name declarations with name blocks in mutator editor
var nameBlock = containerBlock.getInputTargetBlock('STACK');
Expand Down Expand Up @@ -706,7 +699,6 @@ Blockly.Blocks['local_declaration_expression'] = {
blocksInScope: Blockly.Blocks.local_declaration_statement.blocksInScope,
decompose: Blockly.Blocks.local_declaration_statement.decompose,
compose: Blockly.Blocks.local_declaration_statement.compose,
dispose: Blockly.Blocks.local_declaration_statement.dispose,
saveConnections: Blockly.Blocks.local_declaration_statement.saveConnections,
getVars: Blockly.Blocks.local_declaration_statement.getVars,
declaredNames: Blockly.Blocks.local_declaration_statement.declaredNames,
Expand Down
4 changes: 2 additions & 2 deletions appinventor/blocklyeditor/src/blocks/procedures.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ Blockly.Blocks['procedures_defnoreturn'] = {
}

// Call parent's destructor.
Blockly.BlockSvg.prototype.dispose.apply(this, arguments);
Object.getPrototypeOf(this).dispose.apply(this, arguments);
Comment thread
josmas marked this conversation as resolved.

var procDb = workspace.getProcedureDatabase();
if (editable && procDb && workspace == Blockly.common.getMainWorkspace()) {
Expand Down Expand Up @@ -784,7 +784,7 @@ Blockly.Blocks['procedures_defanonnoreturn'] = {
}
},
dispose: function() {
Blockly.BlockSvg.prototype.dispose.apply(this, arguments);
Object.getPrototypeOf(this).dispose.apply(this, arguments);
},
getVars: Blockly.Blocks.procedures_defnoreturn.getVars,
declaredNames: Blockly.Blocks.procedures_defnoreturn.declaredNames,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<script src="../../../../../../appengine/war/static/js/workspace-search-9.1.10.min.js"></script>
<script src="../../../../../../appengine/war/static/js/block-dynamic-connection-0.7.16.min.js"></script>
<script src="../../../../../../appengine/war/static/js/blockly-field-colour-5.0.19.min.js"></script>
<script src="../../../../../../appengine/war/static/js/workspace-multiselect-pr126-e813d3a.min.js"></script>
<script src="../../../../../../appengine/war/static/js/workspace-multiselect-pr134-c630b72.min.js"></script>
<script src="../../../../../../blocklyeditor/tests/testCommon.js"></script>
<!--<script src="../../../../../../blocklyeditor/src/msg/en/_messages.js"></script>-->
</head>
Expand Down
2 changes: 1 addition & 1 deletion appinventor/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = function(config) {
'appengine/war/static/js/workspace-search-9.1.10.min.js',
'appengine/war/static/js/block-dynamic-connection-0.7.16.min.js',
'appengine/war/static/js/blockly-field-colour-5.0.19.min.js',
'appengine/war/static/js/workspace-multiselect-pr126-e813d3a.min.js',
'appengine/war/static/js/workspace-multiselect-pr134-c630b72.min.js',
'blocklyeditor/tests/testCommon.js',
'blocklyeditor/tests/com/google/appinventor/mocha/*.js',
'blocklyeditor/build/javascript/*.js',
Expand Down