Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for LB page and readonly blockspace #35523

Merged
merged 6 commits into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@babel/preset-react": "^7.0.0",
"@cdo/interpreted": "link:../dashboard/config/libraries",
"@code-dot-org/artist": "0.2.1",
"@code-dot-org/blockly": "3.5.24",
"@code-dot-org/blockly": "3.5.25",
"@code-dot-org/bramble": "0.1.26",
"@code-dot-org/craft": "0.2.2",
"@code-dot-org/dance-party": "1.0.1",
Expand Down
7 changes: 5 additions & 2 deletions apps/src/block_utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* global appOptions */
import _ from 'lodash';
import xml from './xml';
import experiments from '@cdo/apps/util/experiments';
Expand Down Expand Up @@ -1040,7 +1039,11 @@ exports.createJsWrapperBlockCreator = function(
});
}
});
if (appOptions.level.miniToolbox && !appOptions.readonlyWorkspace) {
if (
!window.appOptions ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't understand the addition of !window.appOptions here -- why do we init mini-toolbox if we don't have appOptions?

(out of curiosity) are we moving away from using /* global appOptions */ in favor of window.appOptions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for the levelbuilder block page which doesn't have appOptions but we do want to render the mini toolbox blocks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, right, that makes sense!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(added a comment to the code for clarity)

(window.appOptions.level.miniToolbox &&
!window.appOptions.readonlyWorkspace)
) {
this.appendDummyInput()
.appendTitle(toggle)
.appendTitle(' ');
Expand Down
44 changes: 25 additions & 19 deletions apps/src/p5lab/spritelab/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,29 +195,35 @@ const customInputTypes = {
},
spritePointer: {
addInput(blockly, block, inputConfig, currentInputRow) {
switch (block.type) {
case 'gamelab_clickedSpritePointer':
block.shortString = spritelabMsg.clicked();
block.longString = spritelabMsg.clickedSprite();
break;
case 'gamelab_subjectSpritePointer':
block.shortString = spritelabMsg.subject();
block.longString = spritelabMsg.subjectSprite();
break;
case 'gamelab_objectSpritePointer':
block.shortString = spritelabMsg.object();
block.longString = spritelabMsg.objectSprite();
break;
default:
// unsupported block for spritePointer, leave the block text blank
block.shortString = '';
block.longString = '';
if (Object.keys(spritelabMsg).length === 0) {
// spritelab i18n is not available on Levelbuilder
block.shortString = ' ';
block.longString = ' ';
} else {
switch (block.type) {
case 'gamelab_clickedSpritePointer':
block.shortString = spritelabMsg.clicked();
block.longString = spritelabMsg.clickedSprite();
break;
case 'gamelab_subjectSpritePointer':
block.shortString = spritelabMsg.subject();
block.longString = spritelabMsg.subjectSprite();
break;
case 'gamelab_objectSpritePointer':
block.shortString = spritelabMsg.object();
block.longString = spritelabMsg.objectSprite();
break;
default:
// unsupported block for spritePointer, leave the block text blank
block.shortString = '';
block.longString = '';
}
}
block.thumbnailSize = 32;
currentInputRow
.appendTitle(block.shortString)
.appendTitle(block.longString)
.appendTitle(
new Blockly.FieldImage('', block.thumbnailSize, block.thumbnailSize),
new Blockly.FieldImage('', 1, block.thumbnailSize),
inputConfig.name
);
},
Expand Down
8 changes: 4 additions & 4 deletions apps/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1526,10 +1526,10 @@
version "0.2.1"
resolved "https://registry.yarnpkg.com/@code-dot-org/artist/-/artist-0.2.1.tgz#fcfe7ea5cfb3f19ddb6b912e70e922ba4b7ef0b1"

"@code-dot-org/blockly@3.5.24":
version "3.5.24"
resolved "https://registry.yarnpkg.com/@code-dot-org/blockly/-/blockly-3.5.24.tgz#6527c1a778e566b08371a8f8ffa5b1babae4a52f"
integrity sha512-mNmVVbfkyEzpXNOzX5+gMFn2St9ikHZbTDlYaWYF8KgUsaHy2AZ8pV1t1ocey0pIW7cpZtB9of/VPrbrjxhFkQ==
"@code-dot-org/blockly@3.5.25":
version "3.5.25"
resolved "https://registry.yarnpkg.com/@code-dot-org/blockly/-/blockly-3.5.25.tgz#ddd478e549dcc4db21189d56301b5247f4f0e19c"
integrity sha512-ahBxuPndJsbPHJWuenEbdo4b5/YRbtgqtTUIhajBSxgk0Bf51xNiOuLLPrboZfJ2etrI8dZDYujP60/ZMIjEMw==

"@code-dot-org/bramble@0.1.26":
version "0.1.26"
Expand Down