Merge pull request #1871 from Affonso-Gui/fix_dynamic_menu_string

Fix dynamic menus for string arrays
This commit is contained in:
Chris Willis-Ford 2019-02-13 10:41:36 -08:00 committed by GitHub
commit a02fb3877b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -320,13 +320,17 @@ class ExtensionManager {
const menuItems = menuFunc.call(extensionObject, editingTargetID).map( const menuItems = menuFunc.call(extensionObject, editingTargetID).map(
item => { item => {
item = maybeFormatMessage(item, extensionMessageContext); item = maybeFormatMessage(item, extensionMessageContext);
if (typeof item === 'object') { switch (typeof item) {
case 'object':
return [ return [
maybeFormatMessage(item.text, extensionMessageContext), maybeFormatMessage(item.text, extensionMessageContext),
item.value item.value
]; ];
case 'string':
return [item, item];
default:
return item;
} }
return item;
}); });
if (!menuItems || menuItems.length < 1) { if (!menuItems || menuItems.length < 1) {