diff --git a/html/extra-networks-pane-dirs.html b/html/extra-networks-pane-dirs.html
new file mode 100644
index 000000000..5ce04289a
--- /dev/null
+++ b/html/extra-networks-pane-dirs.html
@@ -0,0 +1,8 @@
+
+
+ {dirs_html}
+
+
+ {items_html}
+
+
diff --git a/html/extra-networks-pane-tree.html b/html/extra-networks-pane-tree.html
new file mode 100644
index 000000000..88561fcdc
--- /dev/null
+++ b/html/extra-networks-pane-tree.html
@@ -0,0 +1,8 @@
+
+
+ {tree_html}
+
+
+ {items_html}
+
+
\ No newline at end of file
diff --git a/html/extra-networks-pane.html b/html/extra-networks-pane.html
index 02a871086..ff8a73ad2 100644
--- a/html/extra-networks-pane.html
+++ b/html/extra-networks-pane.html
@@ -1,4 +1,4 @@
-
+
-
-
- {tree_html}
-
-
- {items_html}
-
-
-
\ No newline at end of file
+ {pane_content}
+
diff --git a/javascript/extraNetworks.js b/javascript/extraNetworks.js
index 584fd6c75..6adf9ec0d 100644
--- a/javascript/extraNetworks.js
+++ b/javascript/extraNetworks.js
@@ -272,6 +272,15 @@ function saveCardPreview(event, tabname, filename) {
event.preventDefault();
}
+function extraNetworksSearchButton(tabname, extra_networks_tabname, event) {
+ var searchTextarea = gradioApp().querySelector("#" + tabname + "_" + extra_networks_tabname + "_extra_search");
+ var button = event.target;
+ var text = button.classList.contains("search-all") ? "" : button.textContent.trim();
+
+ searchTextarea.value = text;
+ updateInput(searchTextarea);
+}
+
function extraNetworksTreeProcessFileClick(event, btn, tabname, extra_networks_tabname) {
/**
* Processes `onclick` events when user clicks on files in tree.
@@ -447,27 +456,12 @@ function extraNetworksControlTreeViewOnClick(event, tabname, extra_networks_tabn
* @param tabname The name of the active tab in the sd webui. Ex: txt2img, img2img, etc.
* @param extra_networks_tabname The id of the active extraNetworks tab. Ex: lora, checkpoints, etc.
*/
- const tree = gradioApp().getElementById(tabname + "_" + extra_networks_tabname + "_tree");
- const parent = tree.parentElement;
- let resizeHandle = parent.querySelector('.resize-handle');
- tree.classList.toggle("hidden");
+ var button = event.currentTarget;
+ button.classList.toggle("extra-network-control--enabled");
+ var show = ! button.classList.contains("extra-network-control--enabled");
- if (tree.classList.contains("hidden")) {
- tree.style.display = 'none';
- parent.style.display = 'flex';
- if (resizeHandle) {
- resizeHandle.style.display = 'none';
- }
- } else {
- tree.style.display = 'block';
- parent.style.display = 'grid';
- if (!resizeHandle) {
- setupResizeHandle(parent);
- resizeHandle = parent.querySelector('.resize-handle');
- }
- resizeHandle.style.display = 'block';
- }
- event.currentTarget.classList.toggle("extra-network-control--enabled");
+ var pane = gradioApp().getElementById(tabname + "_" + extra_networks_tabname + "_pane");
+ pane.classList.toggle("extra-network-dirs-hidden", show);
}
function extraNetworksControlRefreshOnClick(event, tabname, extra_networks_tabname) {
diff --git a/modules/shared_options.py b/modules/shared_options.py
index 536766dbe..21643afe0 100644
--- a/modules/shared_options.py
+++ b/modules/shared_options.py
@@ -258,7 +258,8 @@ options_templates.update(options_section(('extra_networks', "Extra Networks", "s
"extra_networks_card_description_is_html": OptionInfo(False, "Treat card description as HTML"),
"extra_networks_card_order_field": OptionInfo("Path", "Default order field for Extra Networks cards", gr.Dropdown, {"choices": ['Path', 'Name', 'Date Created', 'Date Modified']}).needs_reload_ui(),
"extra_networks_card_order": OptionInfo("Ascending", "Default order for Extra Networks cards", gr.Dropdown, {"choices": ['Ascending', 'Descending']}).needs_reload_ui(),
- "extra_networks_tree_view_default_enabled": OptionInfo(False, "Enables the Extra Networks directory tree view by default").needs_reload_ui(),
+ "extra_networks_tree_view_style": OptionInfo("Dirs", "Extra Networks directory view style", gr.Radio, {"choices": ["Tree", "Dirs"]}).needs_reload_ui(),
+ "extra_networks_tree_view_default_enabled": OptionInfo(True, "Show the Extra Networks directory view by default").needs_reload_ui(),
"extra_networks_tree_view_default_width": OptionInfo(180, "Default width for the Extra Networks directory tree view", gr.Number).needs_reload_ui(),
"extra_networks_add_text_separator": OptionInfo(" ", "Extra networks separator").info("extra text to add before <...> when adding extra network to prompt"),
"ui_extra_networks_tab_reorder": OptionInfo("", "Extra networks tab order").needs_reload_ui(),
diff --git a/modules/ui_extra_networks.py b/modules/ui_extra_networks.py
index 2cf91d36b..9a1cf913f 100644
--- a/modules/ui_extra_networks.py
+++ b/modules/ui_extra_networks.py
@@ -164,6 +164,8 @@ class ExtraNetworksPage:
self.lister = util.MassFileLister()
# HTML Templates
self.pane_tpl = shared.html("extra-networks-pane.html")
+ self.pane_content_tree_tpl = shared.html("extra-networks-pane-tree.html")
+ self.pane_content_dirs_tpl = shared.html("extra-networks-pane-dirs.html")
self.card_tpl = shared.html("extra-networks-card.html")
self.btn_tree_tpl = shared.html("extra-networks-tree-button.html")
self.btn_copy_path_tpl = shared.html("extra-networks-copy-path-button.html")
@@ -476,6 +478,47 @@ class ExtraNetworksPage:
return f"