瀏覽代碼

Frontend: only look at top-level tabs, not nested tabs

Refs https://github.com/adieyal/sd-dynamic-prompts/issues/459#issuecomment-1568543926
Aarni Koskela 2 年之前
父節點
當前提交
f81931c591
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      script.js

+ 8 - 2
script.js

@@ -10,12 +10,18 @@ function gradioApp() {
     return elem.shadowRoot ? elem.shadowRoot : elem;
 }
 
+/**
+ * Get the currently selected top-level UI tab button (e.g. the button that says "Extras").
+ */
 function get_uiCurrentTab() {
-    return gradioApp().querySelector('#tabs button.selected');
+    return gradioApp().querySelector('#tabs > .tab-nav > button.selected');
 }
 
+/**
+ * Get the first currently visible top-level UI tab content (e.g. the div hosting the "txt2img" UI).
+ */
 function get_uiCurrentTabContent() {
-    return gradioApp().querySelector('.tabitem[id^=tab_]:not([style*="display: none"])');
+    return gradioApp().querySelector('#tabs > .tabitem[id^=tab_]:not([style*="display: none"])');
 }
 
 var uiUpdateCallbacks = [];