mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 22:42:27 -05:00
Show extension status button via XML attr not button (#1270)
This commit is contained in:
parent
326c41875e
commit
aa400ea15b
1 changed files with 8 additions and 10 deletions
|
@ -497,6 +497,7 @@ class Runtime extends EventEmitter {
|
|||
const categoryInfo = {
|
||||
id: extensionInfo.id,
|
||||
name: maybeFormatMessage(extensionInfo.name),
|
||||
showStatusButton: extensionInfo.showStatusButton,
|
||||
blockIconURI: extensionInfo.blockIconURI,
|
||||
menuIconURI: extensionInfo.menuIconURI,
|
||||
color1: extensionInfo.colour || '#FF6680',
|
||||
|
@ -547,15 +548,6 @@ class Runtime extends EventEmitter {
|
|||
}
|
||||
}
|
||||
|
||||
// Add extension status button
|
||||
if (extensionInfo.showStatusButton) {
|
||||
categoryInfo.blocks.push({
|
||||
info: {},
|
||||
json: null,
|
||||
xml: `<button type="status" extensionId="${categoryInfo.id}"></button>`
|
||||
});
|
||||
}
|
||||
|
||||
for (const blockInfo of extensionInfo.blocks) {
|
||||
if (blockInfo === '---') {
|
||||
categoryInfo.blocks.push(ConvertedSeparator);
|
||||
|
@ -854,7 +846,13 @@ class Runtime extends EventEmitter {
|
|||
const menuIconXML = menuIconURI ?
|
||||
`iconURI="${menuIconURI}"` : '';
|
||||
|
||||
xmlParts.push(`<category name="${name}" id="${categoryInfo.id}" ${colorXML} ${menuIconXML}>`);
|
||||
let statusButtonXML = '';
|
||||
if (categoryInfo.showStatusButton) {
|
||||
statusButtonXML = 'showStatusButton="true"';
|
||||
}
|
||||
|
||||
xmlParts.push(`<category name="${name}" id="${categoryInfo.id}"
|
||||
${statusButtonXML} ${colorXML} ${menuIconXML}>`);
|
||||
xmlParts.push.apply(xmlParts, paletteBlocks.map(block => block.xml));
|
||||
xmlParts.push('</category>');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue