mirror of
https://github.com/vladmandic/automatic
synced 2026-09-10 06:48:43 +02:00
extraNetworks.js fix for networks menu with process caption gallery tabs
More robust code by adding a simple check to ensure that searchTextarea is not null, added a check for debugging if it ever fails again Fixed getENActiveTab, expression tabName in ['process', 'caption', 'gallery'] will always solve as false, making network menus inoperable when in either of these tabs.
This commit is contained in:
committed by
GitHub
parent
a073c63e09
commit
84df9f7b4d
@@ -14,7 +14,7 @@ const getENActiveTab = () => {
|
||||
else if (gradioApp().getElementById('extras_image')?.checkVisibility()) tabName = 'process';
|
||||
else if (gradioApp().getElementById('interrogate_image')?.checkVisibility()) tabName = 'caption';
|
||||
else if (gradioApp().getElementById('tab-gallery-search')?.checkVisibility()) tabName = 'gallery';
|
||||
if (tabName in ['process', 'caption', 'gallery']) tabName = lastTab;
|
||||
if (['process', 'caption', 'gallery'].includes(tabName)) tabName = lastTab;
|
||||
else lastTab = tabName;
|
||||
if (tabName !== '') return tabName;
|
||||
// legacy method
|
||||
@@ -277,8 +277,12 @@ function extraNetworksSearchButton(event) {
|
||||
const tabName = getENActiveTab();
|
||||
const searchTextarea = gradioApp().querySelector(`#${tabName}_extra_search textarea`);
|
||||
const button = event.target;
|
||||
searchTextarea.value = `${button.textContent.trim()}/`;
|
||||
updateInput(searchTextarea);
|
||||
if (searchTextarea) {
|
||||
searchTextarea.value = `${button.textContent.trim()}/`;
|
||||
updateInput(searchTextarea);
|
||||
} else {
|
||||
console.error(`Could not find the search textarea for the tab: ${tabName}`);
|
||||
}
|
||||
}
|
||||
|
||||
let desiredStyle = '';
|
||||
|
||||
Reference in New Issue
Block a user