feat: Add longpress functionality to Chat message removal button
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
import { sayTTS } from "src/ts/process/tts";
|
import { sayTTS } from "src/ts/process/tts";
|
||||||
import { getModelShortName } from "src/ts/model/names";
|
import { getModelShortName } from "src/ts/model/names";
|
||||||
import { capitalize } from "src/ts/util";
|
import { capitalize } from "src/ts/util";
|
||||||
|
import { longpress } from "src/ts/gui/longtouch";
|
||||||
export let message = ''
|
export let message = ''
|
||||||
export let name = ''
|
export let name = ''
|
||||||
export let largePortrait = false
|
export let largePortrait = false
|
||||||
@@ -34,7 +35,7 @@
|
|||||||
|
|
||||||
let msgDisplay = ''
|
let msgDisplay = ''
|
||||||
let translated = get(DataBase).autoTranslate
|
let translated = get(DataBase).autoTranslate
|
||||||
async function rm(e:MouseEvent){
|
async function rm(e:MouseEvent, rec?:boolean){
|
||||||
if(e.shiftKey){
|
if(e.shiftKey){
|
||||||
let msg = $CurrentChat.message
|
let msg = $CurrentChat.message
|
||||||
msg = msg.slice(0, idx)
|
msg = msg.slice(0, idx)
|
||||||
@@ -44,7 +45,7 @@
|
|||||||
|
|
||||||
const rm = $DataBase.askRemoval ? await alertConfirm(language.removeChat) : true
|
const rm = $DataBase.askRemoval ? await alertConfirm(language.removeChat) : true
|
||||||
if(rm){
|
if(rm){
|
||||||
if($DataBase.instantRemove){
|
if($DataBase.instantRemove || rec){
|
||||||
const r = await alertConfirm(language.instantRemoveConfirm)
|
const r = await alertConfirm(language.instantRemoveConfirm)
|
||||||
let msg = $CurrentChat.message
|
let msg = $CurrentChat.message
|
||||||
if(!r){
|
if(!r){
|
||||||
@@ -199,7 +200,7 @@
|
|||||||
}}>
|
}}>
|
||||||
<PencilIcon size={20}/>
|
<PencilIcon size={20}/>
|
||||||
</button>
|
</button>
|
||||||
<button class="ml-2 hover:text-green-500 transition-colors" on:click={rm}>
|
<button class="ml-2 hover:text-green-500 transition-colors" on:click={(e) => rm(e, false)} use:longpress={(e) => rm(e, true)}>
|
||||||
<TrashIcon size={20}/>
|
<TrashIcon size={20}/>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in New Issue
Block a user