fix file manager dropdown

*fix the way to select and display dropdown actions for file manager to avoid error with folders that have same names attributs
This commit is contained in:
BlasenhauerJ 2023-01-18 18:18:12 +01:00
parent efbcfd0e2c
commit d7ee3ad667
1 changed files with 4 additions and 7 deletions

View File

@ -185,12 +185,9 @@ class FolderDropdown {
if (
e.target.closest("div").hasAttribute(`${this.prefix}-action-button`)
) {
const att = e.target
.closest("div")
.getAttribute(`${this.prefix}-action-button`);
const dropEl = document.querySelector(
`[${this.prefix}-action-dropdown="${att}"]`
);
const dropEl = e.target
.closest(`div[${this.prefix}-element]`)
.querySelector(`[${this.prefix}-action-dropdown]`);
//avoid multiple dropdown
if (prevActionBtn === "") prevActionBtn = dropEl;
if (prevActionBtn !== dropEl) this.hideDropEls();
@ -557,7 +554,7 @@ class FolderModal {
getInfoFromActionBtn(btnEl) {
const action = btnEl.getAttribute("value");
const name = btnEl.getAttribute(`${this.prefix}-action-dropdown-btn`);
const folder = document.querySelector(`[${this.prefix}-element='${name}']`);
const folder = btnEl.closest(`[${this.prefix}-element]`);
const level = folder.getAttribute("level");
const path = folder.getAttribute("path");
const type = folder.getAttribute("_type");