Skip to content

Commit

Permalink
Merge pull request #35523 from code-dot-org/jun26-readonly-minitoolbox
Browse files Browse the repository at this point in the history
Fixes for LB page and readonly blockspace
  • Loading branch information
ajpal committed Jun 29, 2020
2 parents 80417dd + 08ed2b6 commit b392912
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 26 deletions.
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
10 changes: 8 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,14 @@ exports.createJsWrapperBlockCreator = function(
});
}
});
if (appOptions.level.miniToolbox && !appOptions.readonlyWorkspace) {
// Use window.appOptions, not global appOptions, because the levelbuilder
// block page doesn't have appOptions, but we *do* want to show the mini-toolbox
// there
if (
!window.appOptions ||
(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

0 comments on commit b392912

Please sign in to comment.