Skip to content

Commit b78b3b0

Browse files
committed
Merge pull request code-dot-org#865 from code-dot-org/webapp_changes
Webapp changes
2 parents a41c493 + db84d17 commit b78b3b0

File tree

11 files changed

+39
-32
lines changed

11 files changed

+39
-32
lines changed

blockly/i18n/common/en_us.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@
7676
"saveToGallery": "Save to gallery",
7777
"savedToGallery": "Saved in gallery!",
7878
"shareFailure": "Sorry, we can't share this program.",
79-
"typeFuncs": "Available functions:%1",
80-
"typeHint": "Note that the parentheses and semicolons are required.",
8179
"workspaceHeader": "Assemble your blocks here: ",
8280
"workspaceHeaderJavaScript": "Type your JavaScript code here",
8381
"infinity": "Infinity",

blockly/lib/droplet/droplet-full.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9957,10 +9957,10 @@ if(i=this.variable instanceof Z){if(this.variable.isArray()||this.variable.isObj
99579957

99589958
Editor.prototype.resizeBlockMode = function() {
99599959
this.resizeTextMode();
9960-
this.resizeGutter();
99619960
this.dropletElement.style.left = "" + this.paletteElement.offsetWidth + "px";
99629961
this.dropletElement.style.height = "" + this.wrapperElement.offsetHeight + "px";
99639962
this.dropletElement.style.width = "" + (this.wrapperElement.offsetWidth - this.paletteWrapper.offsetWidth) + "px";
9963+
this.resizeGutter();
99649964
this.mainCanvas.height = this.dropletElement.offsetHeight;
99659965
this.mainCanvas.width = this.dropletElement.offsetWidth - this.gutter.offsetWidth;
99669966
this.mainCanvas.style.height = "" + this.mainCanvas.height + "px";

blockly/lib/droplet/droplet-full.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

blockly/lib/droplet/droplet-full.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

blockly/lib/droplet/droplet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8294,10 +8294,10 @@ if(i=this.variable instanceof Z){if(this.variable.isArray()||this.variable.isObj
82948294

82958295
Editor.prototype.resizeBlockMode = function() {
82968296
this.resizeTextMode();
8297-
this.resizeGutter();
82988297
this.dropletElement.style.left = "" + this.paletteElement.offsetWidth + "px";
82998298
this.dropletElement.style.height = "" + this.wrapperElement.offsetHeight + "px";
83008299
this.dropletElement.style.width = "" + (this.wrapperElement.offsetWidth - this.paletteWrapper.offsetWidth) + "px";
8300+
this.resizeGutter();
83018301
this.mainCanvas.height = this.dropletElement.offsetHeight;
83028302
this.mainCanvas.width = this.dropletElement.offsetWidth - this.gutter.offsetWidth;
83038303
this.mainCanvas.style.height = "" + this.mainCanvas.height + "px";

blockly/src/base.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -453,18 +453,6 @@ BlocklyApps.init = function(config) {
453453

454454
if (config.level.startBlocks) {
455455
BlocklyApps.editor.setValue(config.level.startBlocks);
456-
} else {
457-
var startText = '// ' + msg.typeHint() + '\n';
458-
var codeFunctions = config.level.codeFunctions;
459-
// Insert hint text from level codeFunctions into editCode area
460-
if (codeFunctions) {
461-
var hintText = '';
462-
for (var i = 0; i < codeFunctions.length; i++) {
463-
hintText += " " + codeFunctions[i].func + "();";
464-
}
465-
startText += '// ' + msg.typeFuncs().replace('%1', hintText) + '\n';
466-
}
467-
BlocklyApps.editor.setValue(startText);
468456
}
469457
});
470458
}

blockly/src/codegen.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ exports.workspaceCode = function(blockly) {
5454
exports.marshalNativeToInterpreter = function (interpreter, nativeVar, nativeParentObj, maxDepth) {
5555
var retVal;
5656
if (typeof maxDepth === "undefined") {
57-
maxDepth = 4; // default to 4 levels of depth
57+
maxDepth = Infinity; // default to inifinite levels of depth
5858
}
5959
if (maxDepth === 0) {
6060
return interpreter.createPrimitive(undefined);
@@ -102,11 +102,11 @@ exports.marshalNativeToInterpreter = function (interpreter, nativeVar, nativePar
102102
/**
103103
* Generate a native function wrapper for use with the JS interpreter.
104104
*/
105-
exports.makeNativeMemberFunction = function (interpreter, nativeFunc, nativeParentObj) {
105+
exports.makeNativeMemberFunction = function (interpreter, nativeFunc, nativeParentObj, maxDepth) {
106106
return function() {
107107
// Call the native function:
108108
var nativeRetVal = nativeFunc.apply(nativeParentObj, arguments);
109-
return exports.marshalNativeToInterpreter(interpreter, nativeRetVal, null);
109+
return exports.marshalNativeToInterpreter(interpreter, nativeRetVal, null, maxDepth);
110110
};
111111
};
112112

blockly/src/templates/page.html.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ var helpArea = function(html) { -%>
8989
<div id="show-code-header" class="blockly-header"><span><%= msg.showCodeHeader() %></span></div>
9090
</div>
9191
<% if (data.editCode) { %>
92-
<div id="codeTextbox" contenteditable spellcheck=false></div>
92+
<div id="codeTextbox"></div>
9393
<% } %>
9494
</div>
9595

blockly/src/webapp/webapp.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -819,13 +819,16 @@ Webapp.execute = function() {
819819
Webapp: api,
820820
console: consoleApi,
821821
JSON: JSONApi,
822-
Globals: Webapp.Globals } );
823-
822+
Globals: Webapp.Globals });
824823

825824
var getCallbackObj = interpreter.createObject(interpreter.FUNCTION);
825+
// Only allow four levels of depth when marshalling the return value
826+
// since we will occasionally return DOM Event objects which contain
827+
// properties that recurse over and over...
826828
var wrapper = codegen.makeNativeMemberFunction(interpreter,
827829
nativeGetCallback,
828-
null);
830+
null,
831+
4);
829832
interpreter.setProperty(scope,
830833
'getCallback',
831834
interpreter.createNativeFunction(wrapper));

blockly/style/common.scss

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,31 @@ html[dir="RTL"] .farSide {
6666
margin-left: 415px;
6767
}
6868

69+
div.droplet-palette-group-header {
70+
@include font;
71+
}
72+
73+
div.droplet-palette-group-header:active {
74+
color: #000;
75+
}
76+
77+
div.droplet-palette-group-header-selected {
78+
font-weight: 400;
79+
color: #000;
80+
}
81+
82+
.droplet-palette-group-header.yellow {
83+
border-left:10px solid #e0e053;
84+
}
85+
86+
.droplet-palette-group-header-selected.yellow {
87+
background-color: #e0e053;
88+
}
89+
90+
.droplet-wrapper-div {
91+
outline-style: none;
92+
}
93+
6994
#show-code-button {
7095
@media screen and (max-device-width: 540px) {
7196
display: none;

blockly/style/webapp/style.scss

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
$root: '/blockly/media/webapp/'; //TODO: Parameterize for asset pipeline
22

3-
.droplet-palette-group-header.yellow {
4-
border-left:10px solid #e0e053;
5-
}
6-
.droplet-palette-group-header-selected.yellow {
7-
background-color: #e0e053;
8-
}
9-
103
#divWebapp {
114
overflow: hidden;
125
position: relative;

0 commit comments

Comments
 (0)