Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
Thomas Weber committed 2020-06-26 00:45:18 -05:00
commit 1714ebf5f6
9 files changed
+762 -235

No files matched your search

+18 -2
View File
@@ -1375,13 +1375,28 @@ class Runtime extends EventEmitter {
/**
* @returns {Array.<object>} scratch-blocks XML for each category of extension blocks, in category order.
* @param {?Target} [target] - the active editing target (optional)
* @property {string} id - the category / extension ID
* @property {string} xml - the XML text for this category, starting with `<category>` and ending with `</category>`
*/
getBlocksXML () {
getBlocksXML (target) {
return this._blockInfo.map(categoryInfo => {
const {name, color1, color2} = categoryInfo;
const paletteBlocks = categoryInfo.blocks.filter(block => !block.info.hideFromPalette);
// Filter out blocks that aren't supposed to be shown on this target, as determined by the block info's
// `hideFromPalette` and `filter` properties.
const paletteBlocks = categoryInfo.blocks.filter(block => {
let blockFilterIncludesTarget = true;
// If an editing target is not passed, include all blocks
// If the block info doesn't include a `filter` property, always include it
if (target && block.info.filter) {
blockFilterIncludesTarget = block.info.filter.includes(
target.isStage ? TargetType.STAGE : TargetType.SPRITE
);
}
// If the block info's `hideFromPalette` is true, then filter out this block
return blockFilterIncludesTarget && !block.info.hideFromPalette;
});
const colorXML = `colour="${color1}" secondaryColour="${color2}"`;
// Use a menu icon if there is one. Otherwise, use the block icon. If there's no icon,
@@ -1858,6 +1873,7 @@ class Runtime extends EventEmitter {
this.targets.map(this.disposeTarget, this);
this._monitorState = OrderedMap({});
this.emit(Runtime.RUNTIME_DISPOSED);
this.ioDevices.clock.resetProjectTimer();
// @todo clear out extensions? turboMode? etc.
// *********** Cloud *******************