[feat] change with enter

This commit is contained in:
kwaroran
2023-05-26 05:30:13 +09:00
parent c7125a19ec
commit 549cdf3487
4 changed files with 15 additions and 3 deletions

View File

@@ -278,5 +278,6 @@ export const languageEnglish = {
charLoreBook: 'Character Lorebook',
globalLoreBook: 'Global Lorebook',
globalRegexScript: "Global Regex",
accessibility: "Accessibility"
accessibility: "Accessibility",
sendWithEnter: "Send with Enter Key"
}

View File

@@ -205,8 +205,10 @@
bind:this={inputEle}
on:keydown={(e) => {
if(e.key.toLocaleLowerCase() === "enter" && (!e.shiftKey)){
send()
e.preventDefault()
if($DataBase.sendWithEnter){
send()
e.preventDefault()
}
}
if(e.key.toLocaleLowerCase() === "m" && (e.ctrlKey)){
reroll()

View File

@@ -20,3 +20,8 @@
<Check bind:check={$DataBase.instantRemove}/>
<span>{language.instantRemove}</span>
</div>
<div class="flex items-center mt-2">
<Check bind:check={$DataBase.sendWithEnter}/>
<span>{language.sendWithEnter}</span>
</div>

View File

@@ -251,6 +251,9 @@ export function setDatabase(data:Database){
if(checkNullish(data.globalscript)){
data.globalscript = []
}
if(checkNullish(data.sendWithEnter)){
data.sendWithEnter = true
}
changeLanguage(data.language)
@@ -481,6 +484,7 @@ export interface Database{
model:string
}
globalscript: customscript[]
sendWithEnter:boolean
}