[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', charLoreBook: 'Character Lorebook',
globalLoreBook: 'Global Lorebook', globalLoreBook: 'Global Lorebook',
globalRegexScript: "Global Regex", globalRegexScript: "Global Regex",
accessibility: "Accessibility" accessibility: "Accessibility",
sendWithEnter: "Send with Enter Key"
} }

View File

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

View File

@@ -20,3 +20,8 @@
<Check bind:check={$DataBase.instantRemove}/> <Check bind:check={$DataBase.instantRemove}/>
<span>{language.instantRemove}</span> <span>{language.instantRemove}</span>
</div> </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)){ if(checkNullish(data.globalscript)){
data.globalscript = [] data.globalscript = []
} }
if(checkNullish(data.sendWithEnter)){
data.sendWithEnter = true
}
changeLanguage(data.language) changeLanguage(data.language)
@@ -481,6 +484,7 @@ export interface Database{
model:string model:string
} }
globalscript: customscript[] globalscript: customscript[]
sendWithEnter:boolean
} }