Show extension status button via XML attr not button (#1270)

This commit is contained in:
Eric Rosenbaum 2018-06-27 15:53:18 -04:00 committed by GitHub
parent 326c41875e
commit aa400ea15b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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>');
}