Spaces:
Sleeping
Sleeping
Commit ·
73ae9fa
1
Parent(s): af270a2
Fix file menu action clicks and star icon rendering
Browse files170 unmodified lines1711721731741751761775 unmodified lines1831841851861871881896 unmodified lines1961971981992002012022032042052062072082092102112122139 unmodified lines223224225226227228170 unmodified lines<div class="quick-actions"><button class="quick-btn" data-action="preview" title="Preview"><i class="ph-fill ph-eye"></i></button><button class="quick-btn" data-action="download" title="Download"><i class="ph-fill ph-download-simple"></i></button><button class="quick-btn" data-action="star" title="${starred ? 'Unstar' : 'Star'}"><i class="ph-fill ph-star${starred ? '' : '-bold'}"></i></button><button class="quick-btn" data-action="rename" title="Rename"><i class="ph-fill ph-pencil-simple"></i></button><button class="quick-btn" data-action="history" title="History"><i class="ph-fill ph-clock-counter-clockwise"></i></button></div>`;5 unmodified lines<span class="list-meta">${size} • ${ext}</span></div><div class="list-actions"><button class="icon-btn" data-action="star" title="${starred ? 'Unstar' : 'Star'}"><i class="ph-fill ph-star${starred ? '' : '-bold'}"></i></button><button class="icon-btn" data-action="rename" title="Rename"><i class="ph-fill ph-pencil-simple"></i></button><button class="icon-btn" data-action="history" title="History"><i class="ph-fill ph-clock-counter-clockwise"></i></button><button class="icon-btn" data-action="download" title="Download"><i class="ph-fill ph-download-simple"></i></button>6 unmodified linesactions.onPreview(file);};card.addEventListener('click', (e) => {const btn = e.target.closest('[data-action]');if (!btn) return;e.stopPropagation();card.querySelectorAll('.dropdown-menu.open').forEach(m => m.classList.remove('open'));const action = btn.dataset.action;if (action === 'preview') actions.onPreview(file);else if (action === 'download') actions.onDownload(url, file.name);else if (action === 'rename') actions.onRename(file.path, file.name);else if (action === 'star') actions.onStar(file.path);else if (action === 'delete') actions.onDelete(file.path, file.name);else if (action === 'history') actions.onHistory(file.path, file.name);});const menuBtn = card.querySelector('.card-menu-btn');9 unmodified lines};menu.onclick = (e) => e.stopPropagation();}this.containers.files.appendChild(card);170 unmodified lines1711721731741751761775 unmodified lines1831841851861871881896 unmodified lines1961971981992002012022032042052062072082092102112122132142152169 unmodified lines226227228229230231232233234235236237238239170 unmodified lines<div class="quick-actions"><button class="quick-btn" data-action="preview" title="Preview"><i class="ph-fill ph-eye"></i></button><button class="quick-btn" data-action="download" title="Download"><i class="ph-fill ph-download-simple"></i></button><button class="quick-btn" data-action="star" title="${starred ? 'Unstar' : 'Star'}"><i class="ph-bold ph-star"></i></button><button class="quick-btn" data-action="rename" title="Rename"><i class="ph-fill ph-pencil-simple"></i></button><button class="quick-btn" data-action="history" title="History"><i class="ph-fill ph-clock-counter-clockwise"></i></button></div>`;5 unmodified lines<span class="list-meta">${size} • ${ext}</span></div><div class="list-actions"><button class="icon-btn" data-action="star" title="${starred ? 'Unstar' : 'Star'}"><i class="ph-bold ph-star"></i></button><button class="icon-btn" data-action="rename" title="Rename"><i class="ph-fill ph-pencil-simple"></i></button><button class="icon-btn" data-action="history" title="History"><i class="ph-fill ph-clock-counter-clockwise"></i></button><button class="icon-btn" data-action="download" title="Download"><i class="ph-fill ph-download-simple"></i></button>6 unmodified linesactions.onPreview(file);};const runAction = (action) => {if (action === 'preview') actions.onPreview(file);else if (action === 'download') actions.onDownload(url, file.name);else if (action === 'rename') actions.onRename(file.path, file.name);else if (action === 'star') actions.onStar(file.path);else if (action === 'delete') actions.onDelete(file.path, file.name);else if (action === 'history') actions.onHistory(file.path, file.name);};card.addEventListener('click', (e) => {const btn = e.target.closest('[data-action]');if (!btn) return;e.stopPropagation();card.querySelectorAll('.dropdown-menu.open').forEach(m => m.classList.remove('open'));runAction(btn.dataset.action);});const menuBtn = card.querySelector('.card-menu-btn');9 unmodified lines};menu.onclick = (e) => e.stopPropagation();menu.querySelectorAll('[data-action]').forEach((btn) => {btn.onclick = (e) => {e.preventDefault();e.stopPropagation();menu.classList.remove('open');runAction(btn.dataset.action);};});}this.containers.files.appendChild(card);
js/ui/uiRenderer.js+19-8