mirror of
https://github.com/open-webui/open-webui
synced 2025-02-21 12:29:29 +00:00
enh: ctrl+shift+delete chat delete support
This commit is contained in:
parent
99f70cac8b
commit
0556479cbe
@ -1,12 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount, getContext, createEventDispatcher } from 'svelte';
|
import { onMount, getContext, createEventDispatcher } from 'svelte';
|
||||||
import { fade } from 'svelte/transition';
|
|
||||||
const i18n = getContext('i18n');
|
const i18n = getContext('i18n');
|
||||||
|
|
||||||
import { flyAndScale } from '$lib/utils/transitions';
|
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
|
import { fade } from 'svelte/transition';
|
||||||
|
import { flyAndScale } from '$lib/utils/transitions';
|
||||||
|
|
||||||
export let title = '';
|
export let title = '';
|
||||||
export let message = '';
|
export let message = '';
|
||||||
|
|
||||||
@ -27,6 +26,12 @@
|
|||||||
console.log('Escape');
|
console.log('Escape');
|
||||||
show = false;
|
show = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.key === 'Enter') {
|
||||||
|
console.log('Enter');
|
||||||
|
show = false;
|
||||||
|
dispatch('confirm', inputValue);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
@ -56,7 +61,7 @@
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class=" m-auto rounded-2xl max-w-full w-[32rem] mx-2 bg-gray-50 dark:bg-gray-950 max-h-[100dvh] shadow-3xl border border-gray-850"
|
class=" m-auto rounded-2xl max-w-full w-[32rem] mx-2 bg-gray-50 dark:bg-gray-950 max-h-[100dvh] shadow-3xl"
|
||||||
in:flyAndScale
|
in:flyAndScale
|
||||||
on:mousedown={(e) => {
|
on:mousedown={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
@ -58,13 +58,7 @@
|
|||||||
let shiftKey = false;
|
let shiftKey = false;
|
||||||
|
|
||||||
let selectedChatId = null;
|
let selectedChatId = null;
|
||||||
let deleteChat = null;
|
|
||||||
|
|
||||||
let showDeleteConfirm = false;
|
|
||||||
let showDropdown = false;
|
let showDropdown = false;
|
||||||
|
|
||||||
let selectedTagName = null;
|
|
||||||
|
|
||||||
let showPinnedChat = true;
|
let showPinnedChat = true;
|
||||||
|
|
||||||
// Pagination variables
|
// Pagination variables
|
||||||
|
@ -389,7 +389,7 @@
|
|||||||
id="delete-chat-button"
|
id="delete-chat-button"
|
||||||
class="hidden"
|
class="hidden"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
dispatch('delete');
|
showDeleteConfirm = true;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
|
@ -165,7 +165,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if Ctrl + Shift + Backspace is pressed
|
// Check if Ctrl + Shift + Backspace is pressed
|
||||||
if (isCtrlPressed && isShiftPressed && event.key === 'Backspace') {
|
if (
|
||||||
|
isCtrlPressed &&
|
||||||
|
isShiftPressed &&
|
||||||
|
(event.key === 'Backspace' || event.key === 'Delete')
|
||||||
|
) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
console.log('deleteChat');
|
console.log('deleteChat');
|
||||||
document.getElementById('delete-chat-button')?.click();
|
document.getElementById('delete-chat-button')?.click();
|
||||||
|
Loading…
Reference in New Issue
Block a user