From 6e7b0794ea80c9eae1a6bc4f89590e3d657febea Mon Sep 17 00:00:00 2001 From: somebody Date: Fri, 21 Jul 2023 15:40:07 -0500 Subject: [PATCH] Context Menu: Fix for elements with a context-menu attribute but... ...without an entry in `context_menu_items`. --- static/koboldai.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/static/koboldai.js b/static/koboldai.js index d7560f54..b25bef31 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -6153,6 +6153,10 @@ process_cookies(); // Show only applicable actions in the context menu let contextMenuType = target.getAttribute("context-menu"); + + // If context menu is not present, return + if (!context_menu_actions[contextMenuType]) return; + for (const contextMenuItem of contextMenu.childNodes) { let shouldShow = contextMenuItem.classList.contains(`context-menu-${contextMenuType}`);