mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-03 10:17:43 -05:00
fix: selected skill files cannot be cleared with Escape or a click on empty space (#34691)
In the skill editor, files selected with a Shift or Ctrl/Cmd click stayed selected until each one was unchecked by hand, and while any file was selected a click on a file only added it to the selection. Escape and a click on the empty part of the file list now clear the selection, like the file browser in a chat's Files panel. An Escape that closes one of the editor's dialogs or menus, or cancels a rename, keeps the selection. Fixes #34690
This commit is contained in:
1 parent
f4a12bbc7f
commit
d07679e60c
1 file changed
+21
-1
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { getPageContext } from '$lib/utils/page';
|
||||
const { active } = getPageContext();
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { onDestroy, getContext, tick, type Snippet } from 'svelte';
|
||||
import { toast } from 'svelte-sonner';
|
||||
@@ -546,6 +548,18 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:window
|
||||
on:keydown={(event) => {
|
||||
if (
|
||||
$active &&
|
||||
event.key === 'Escape' &&
|
||||
!event.defaultPrevented &&
|
||||
!document.querySelector('.modal, [role="menu"]')
|
||||
)
|
||||
selectedPaths = new Set();
|
||||
}}
|
||||
/>
|
||||
|
||||
<DiffEditorModal
|
||||
bind:show={showComparison}
|
||||
initialContent={comparison?.content ?? ''}
|
||||
@@ -752,7 +766,13 @@
|
||||
{/snippet}
|
||||
|
||||
{#snippet fileList()}
|
||||
<div class="h-full min-h-0 w-full overflow-auto p-1.5">
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events a11y-no-static-element-interactions -->
|
||||
<div
|
||||
class="h-full min-h-0 w-full overflow-auto p-1.5"
|
||||
on:click={(event) => {
|
||||
if (event.target === event.currentTarget) selectedPaths = new Set();
|
||||
}}
|
||||
>
|
||||
<div class="mb-1 flex w-full items-center">
|
||||
<div class="min-w-0 flex-1">{@render version()}</div>
|
||||
{#if readOnly}
|
||||
|
||||
Reference in new issue
Block a user