From f4c6816ea74b56a502db3d2ff7cf72e9cf99d5de Mon Sep 17 00:00:00 2001 From: Guilherme Affonso Date: Wed, 26 Dec 2018 19:26:59 +0900 Subject: [PATCH] Fix dynamic menus for string arrays --- src/extension-support/extension-manager.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/extension-support/extension-manager.js b/src/extension-support/extension-manager.js index 86a335989..2898aa042 100644 --- a/src/extension-support/extension-manager.js +++ b/src/extension-support/extension-manager.js @@ -316,13 +316,17 @@ class ExtensionManager { const menuItems = menuFunc.call(extensionObject, editingTargetID).map( item => { item = maybeFormatMessage(item, extensionMessageContext); - if (typeof item === 'object') { + switch (typeof item) { + case 'object': return [ maybeFormatMessage(item.text, extensionMessageContext), item.value ]; + case 'string': + return [item, item]; + default: + return item; } - return item; }); if (!menuItems || menuItems.length < 1) {