Skip to content

Commit aab11aa

Browse files
author
Ke, Mingze
committed
Bumped blockly source
ec4ab879168829fa20bea0b9e440350d20df47f4
1 parent 9c7a907 commit aab11aa

213 files changed

Lines changed: 8551 additions & 4009 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "webduino-blockly",
33
"dependencies": {
4-
"blockly-src": "google/blockly#217c7d7c8a37b2897409198cd05f99da85951d4b",
4+
"blockly-src": "google/blockly#ec4ab879168829fa20bea0b9e440350d20df47f4",
55
"webcomponentsjs": "0.x"
66
}
77
}

code.js

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ Code.loadBlocks = function(defaultXml) {
119119
// Language switching stores the blocks during the reload.
120120
delete window.sessionStorage.loadOnceBlocks;
121121
var xml = Blockly.Xml.textToDom(loadOnce);
122-
Blockly.Xml.domToWorkspace(Code.workspace, xml);
122+
Blockly.Xml.domToWorkspace(xml, Code.workspace);
123123
} else if (defaultXml) {
124124
// Load the editor with default starting blocks.
125125
var xml = Blockly.Xml.textToDom(defaultXml);
126-
Blockly.Xml.domToWorkspace(Code.workspace, xml);
126+
Blockly.Xml.domToWorkspace(xml, Code.workspace);
127127
} else if ('BlocklyStorage' in window) {
128128
// Restore saved blocks in a separate thread so that subsequent
129129
// initialization is not affected from a failed load.
@@ -438,7 +438,7 @@ Code.tabClick = function(clickedName) {
438438
}
439439
if (xmlDom) {
440440
Code.workspace.clear();
441-
Blockly.Xml.domToWorkspace(Code.workspace, xmlDom);
441+
Blockly.Xml.domToWorkspace(xmlDom, Code.workspace);
442442
}
443443
}
444444

@@ -941,13 +941,30 @@ Blockly.WorkspaceSvg.prototype.showContextMenu_ = function(e) {
941941
}
942942
var menuOptions = [];
943943
var topBlocks = this.getTopBlocks(true);
944+
var eventGroup = Blockly.genUid();
945+
946+
// Options to undo/redo previous action.
947+
var undoOption = {};
948+
undoOption.text = Blockly.Msg.UNDO;
949+
undoOption.enabled = this.undoStack_.length > 0;
950+
undoOption.callback = this.undo.bind(this, false);
951+
menuOptions.push(undoOption);
952+
var redoOption = {};
953+
redoOption.text = Blockly.Msg.REDO;
954+
redoOption.enabled = this.redoStack_.length > 0;
955+
redoOption.callback = this.undo.bind(this, true);
956+
menuOptions.push(redoOption);
957+
944958
// Option to clean up blocks.
945-
var cleanOption = {};
946-
cleanOption.text = MSG.cleanUpBlocks;
947-
cleanOption.enabled = topBlocks.length > 1;
948-
cleanOption.callback = this.cleanUp_.bind(this);
949-
menuOptions.push(cleanOption);
959+
if (this.scrollbar) {
960+
var cleanOption = {};
961+
cleanOption.text = Blockly.Msg.CLEAN_UP;
962+
cleanOption.enabled = topBlocks.length > 1;
963+
cleanOption.callback = this.cleanUp_.bind(this);
964+
menuOptions.push(cleanOption);
965+
}
950966

967+
// Add download img option
951968
var imgOption = {};
952969
imgOption.text = MSG.exportImage;
953970
imgOption.enabled = topBlocks.length > 0;
@@ -1022,7 +1039,7 @@ Blockly.WorkspaceSvg.prototype.showContextMenu_ = function(e) {
10221039
addDeletableBlocks(topBlocks[i]);
10231040
}
10241041
var deleteOption = {
1025-
text: deleteList.length <= 1 ? Blockly.Msg.DELETE_BLOCK :
1042+
text: deleteList.length == 1 ? Blockly.Msg.DELETE_BLOCK :
10261043
Blockly.Msg.DELETE_X_BLOCKS.replace('%1', String(deleteList.length)),
10271044
enabled: deleteList.length > 0,
10281045
callback: function() {
@@ -1034,6 +1051,7 @@ Blockly.WorkspaceSvg.prototype.showContextMenu_ = function(e) {
10341051
}
10351052
};
10361053
function deleteNext() {
1054+
Blockly.Events.setGroup(eventGroup);
10371055
var block = deleteList.shift();
10381056
if (block) {
10391057
if (block.workspace) {
@@ -1043,6 +1061,7 @@ Blockly.WorkspaceSvg.prototype.showContextMenu_ = function(e) {
10431061
deleteNext();
10441062
}
10451063
}
1064+
Blockly.Events.setGroup(false);
10461065
}
10471066
menuOptions.push(deleteOption);
10481067

components/blockly-src/.bower.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "blockly-src",
33
"homepage": "https://github.com/google/blockly",
4-
"_release": "217c7d7c8a",
4+
"_release": "ec4ab87916",
55
"_resolution": {
66
"type": "commit",
7-
"commit": "217c7d7c8a37b2897409198cd05f99da85951d4b"
7+
"commit": "ec4ab879168829fa20bea0b9e440350d20df47f4"
88
},
99
"_source": "git://github.com/google/blockly.git",
10-
"_target": "217c7d7c8a37b2897409198cd05f99da85951d4b",
10+
"_target": "ec4ab879168829fa20bea0b9e440350d20df47f4",
1111
"_originalSource": "google/blockly"
1212
}

components/blockly-src/appengine/README.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ blockly/
3030
|- blocks_compressed.js
3131
|- dart_compressed.js
3232
|- javascript_compressed.js
33+
|- lua_compressed.js
3334
|- php_compressed.js
3435
`- python_compressed.js
3536

components/blockly-src/appengine/storage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ BlocklyStorage.restoreBlocks = function(opt_workspace) {
6060
if ('localStorage' in window && window.localStorage[url]) {
6161
var workspace = opt_workspace || Blockly.getMainWorkspace();
6262
var xml = Blockly.Xml.textToDom(window.localStorage[url]);
63-
Blockly.Xml.domToWorkspace(workspace, xml);
63+
Blockly.Xml.domToWorkspace(xml, workspace);
6464
}
6565
};
6666

@@ -181,7 +181,7 @@ BlocklyStorage.loadXml_ = function(xml, workspace) {
181181
}
182182
// Clear the workspace to avoid merge.
183183
workspace.clear();
184-
Blockly.Xml.domToWorkspace(workspace, xml);
184+
Blockly.Xml.domToWorkspace(xml, workspace);
185185
};
186186

187187
/**

components/blockly-src/blockly_compressed.js

Lines changed: 323 additions & 275 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)