Add hotkeys

This commit is contained in:
Kwaroran
2024-11-27 08:29:59 +09:00
parent e0de68cf9e
commit 096d2fe62c
5 changed files with 89 additions and 14 deletions

View File

@@ -304,7 +304,7 @@
<div class="flex-grow flex items-center justify-end" class:text-textcolor2={options?.applyTextColors !== false}>
<span class="text-xs">{statusMessage}</span>
{#if DBState.db.useChatCopy && !blankMessage}
<button class="ml-2 hover:text-blue-500 transition-colors" onclick={async ()=>{
<button class="ml-2 hover:text-blue-500 transition-colors button-icon-copy" onclick={async ()=>{
if(window.navigator.clipboard.write){
alertWait(language.loading)
const root = document.querySelector(':root') as HTMLElement;
@@ -408,7 +408,7 @@
{/if}
{#if idx > -1}
{#if DBState.db.characters[selIdState.selId].type !== 'group' && DBState.db.characters[selIdState.selId].ttsMode !== 'none' && (DBState.db.characters[selIdState.selId].ttsMode)}
<button class="ml-2 hover:text-blue-500 transition-colors" onclick={()=>{
<button class="ml-2 hover:text-blue-500 transition-colors button-icon-tts" onclick={()=>{
return sayTTS(null, message)
}}>
<Volume2Icon size={20}/>
@@ -416,7 +416,7 @@
{/if}
{#if !$ConnectionOpenStore}
<button class={"ml-2 hover:text-blue-500 transition-colors "+(editMode?'text-blue-400':'')} onclick={() => {
<button class={"ml-2 hover:text-blue-500 transition-colors button-icon-edit "+(editMode?'text-blue-400':'')} onclick={() => {
if(!editMode){
editMode = true
}
@@ -427,13 +427,13 @@
}}>
<PencilIcon size={20}/>
</button>
<button class="ml-2 hover:text-blue-500 transition-colors" onclick={(e) => rm(e, false)} use:longpress={(e) => rm(e, true)}>
<button class="ml-2 hover:text-blue-500 transition-colors button-icon-remove" onclick={(e) => rm(e, false)} use:longpress={(e) => rm(e, true)}>
<TrashIcon size={20}/>
</button>
{/if}
{/if}
{#if DBState.db.translator !== '' && !blankMessage}
<button class={"ml-2 cursor-pointer hover:text-blue-500 transition-colors " + (translated ? 'text-blue-400':'')} class:translating={translating} onclick={async () => {
<button class={"ml-2 cursor-pointer hover:text-blue-500 transition-colors button-icon-translate " + (translated ? 'text-blue-400':'')} class:translating={translating} onclick={async () => {
translated = !translated
}}>
<LanguagesIcon />
@@ -441,14 +441,14 @@
{/if}
{#if rerollIcon || altGreeting}
{#if DBState.db.swipe || altGreeting}
<button class="ml-2 hover:text-blue-500 transition-colors" onclick={unReroll}>
<button class="ml-2 hover:text-blue-500 transition-colors button-icon-unreroll" onclick={unReroll}>
<ArrowLeft size={22}/>
</button>
<button class="ml-2 hover:text-blue-500 transition-colors" onclick={onReroll}>
<button class="ml-2 hover:text-blue-500 transition-colors button-icon-reroll" onclick={onReroll}>
<ArrowRight size={22}/>
</button>
{:else}
<button class="ml-2 hover:text-blue-500 transition-colors" onclick={onReroll}>
<button class="ml-2 hover:text-blue-500 transition-colors button-icon-reroll" onclick={onReroll}>
<RefreshCcwIcon size={20}/>
</button>
{/if}
@@ -672,7 +672,7 @@
</div>
{#if editMode}
<textarea class="flex-grow h-138 sm:h-96 overflow-y-auto bg-transparent text-black p-2 mb-2 resize-none" bind:value={message}></textarea>
<textarea class="flex-grow h-138 sm:h-96 overflow-y-auto bg-transparent text-black p-2 mb-2 resize-none message-edit-area" bind:value={message}></textarea>
{:else}
<div class="flex-grow h-138 sm:h-96 overflow-y-auto p-2 mb-2 sm:mb-0">
{@render textBox()}

View File

@@ -447,7 +447,7 @@
{/if}
{#if !DBState.db.useAdvancedEditor}
<textarea class="peer focus:border-textcolor transition-colors outline-none text-textcolor p-2 min-w-0 border border-r-0 bg-transparent rounded-md rounded-r-none input-text text-xl flex-grow ml-4 border-darkborderc resize-none overflow-y-hidden overflow-x-hidden max-w-full"
<textarea class="peer text-input-area focus:border-textcolor transition-colors outline-none text-textcolor p-2 min-w-0 border border-r-0 bg-transparent rounded-md rounded-r-none input-text text-xl flex-grow ml-4 border-darkborderc resize-none overflow-y-hidden overflow-x-hidden max-w-full"
bind:value={messageInput}
bind:this={inputEle}
onkeydown={(e) => {
@@ -483,7 +483,7 @@
{:else}
<button
onclick={send}
class="flex justify-center border-y border-darkborderc items-center text-gray-100 p-3 peer-focus:border-textcolor hover:bg-blue-500 transition-colors"
class="flex justify-center border-y border-darkborderc items-center text-gray-100 p-3 peer-focus:border-textcolor hover:bg-blue-500 transition-colors button-icon-send"
style:height={inputHeight}
>
<Send />

View File

@@ -35,7 +35,7 @@
oninput={handleInput}
use:longpress={handleLongPress}
bind:value={value}
class="rounded-md p-2 text-textcolor bg-transparent resize-none overflow-y-hidden border border-darkborderc w-full"
class="rounded-md p-2 text-textcolor bg-transparent resize-none overflow-y-hidden border border-darkborderc w-full message-edit-area"
style:font-size="{0.875 * (DBState.db.zoomsize / 100)}rem"
style:line-height="{(DBState.db.lineHeight ?? 1.25) * (DBState.db.zoomsize / 100)}rem"
></textarea>