From 6a9d685d480e7438942af966977a27001ee387aa Mon Sep 17 00:00:00 2001 From: mirivlad Date: Wed, 1 Jul 2026 19:07:00 +0800 Subject: [PATCH] Add Files no-match clear action --- plugins/files/frontend/src/index.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/plugins/files/frontend/src/index.js b/plugins/files/frontend/src/index.js index 9787dab..fb0a185 100644 --- a/plugins/files/frontend/src/index.js +++ b/plugins/files/frontend/src/index.js @@ -593,6 +593,29 @@ ]); } + function renderNoMatchesState() { + return el('div', { className: 'files-empty' }, [ + el('div', { className: 'files-empty-title' }, ['No matches']), + el('div', { className: 'files-empty-actions' }, [ + el('button', { + className: 'files-empty-btn', + 'data-files-empty-action': 'clear-filter', + 'data-files-icon': 'refresh', + type: 'button', + title: 'Clear filter', + 'aria-label': 'Clear filter', + innerHTML: svgIcon(ACTION_ICONS.refresh) + 'Clear filter', + onClick: function () { + filterText = ''; + filterInput.value = ''; + renderList(); + listContainer.focus(); + } + }) + ]) + ]); + } + function renderList() { showingTrash = false; listContainer.innerHTML = ''; @@ -607,7 +630,7 @@ var shown = visibleEntries(); if (shown.length === 0) { - listContainer.appendChild(filterText ? el('div', { className: 'files-empty' }, ['No matches']) : renderEmptyFolderState()); + listContainer.appendChild(filterText ? renderNoMatchesState() : renderEmptyFolderState()); updateButtons(); return; }