From e4be1d5aaf50c4c2be2a78ad7ac27aef1b2bc91b Mon Sep 17 00:00:00 2001 From: Sj-Si Date: Wed, 29 May 2024 16:06:33 -0400 Subject: [PATCH] Added missing long press event for tree file items to enable the detail view. --- javascript/extraNetworks.js | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/javascript/extraNetworks.js b/javascript/extraNetworks.js index 814a55cb2..b40c334df 100644 --- a/javascript/extraNetworks.js +++ b/javascript/extraNetworks.js @@ -1477,16 +1477,18 @@ function extraNetworksCardOnLongPress(event) { tab.showDetsView(btn); } -function extraNetworksTreeFileOnClick(event) { - // Do not select the row if its child button-row is the target of the event. - if (event.target.closest(".tree-list-item-action")) { - return; - } - - const btn = event.target.closest(".tree-list-item"); +function extraNetworksTreeFileOnLongPress(event) { + const btn = event.target.closest(".tree-list-item--file"); const pane = btn.closest(".extra-network-pane"); const tab = extra_networks_tabs[pane.dataset.tabnameFull]; + tab.showDetsView(btn); +} + +function extraNetworksTreeFileOnClick(event) { + const btn = event.target.closest(".tree-list-item"); + const pane = btn.closest(".extra-network-pane"); + const tab = extra_networks_tabs[pane.dataset.tabnameFull]; let checkpoint_name; if ("isCheckpoint" in btn.dataset) { @@ -1752,7 +1754,6 @@ function extraNetworksSetupEventDelegators() { }, event_options); const click_event_map = { - ".tree-list-item--file": extraNetworksTreeFileOnClick, ".copy-path-button": extraNetworksBtnCopyPathOnClick, ".edit-button": extraNetworksBtnEditMetadataOnClick, ".metadata-button": extraNetworksBtnShowMetadataOnClick, @@ -1791,6 +1792,11 @@ function extraNetworksSetupEventDelegators() { negative: ".tree-list-item-action", handler: extraNetworksTreeDirectoryOnClick, }, + { + selector: ".tree-list-item--file", + negative: ".tree-list-item-action", + handler: extraNetworksTreeFileOnClick, + }, { selector: ".extra-network-dirs-view-button", handler: extraNetworksBtnDirsViewItemOnClick, @@ -1839,6 +1845,11 @@ function extraNetworksSetupEventDelegators() { negative: ".tree-list-item-action", handler: extraNetworksTreeDirectoryOnLongPress, }, + { + selector: ".tree-list-item--file", + negative: ".tree-list-item-action", + handler: extraNetworksTreeFileOnLongPress, + }, { selector: ".extra-network-dirs-view-button", handler: extraNetworksBtnDirsViewItemOnLongPress,