fix: on mobile, added a delay before showing the keyboard #345

This commit is contained in:
Simon Cambier
2024-08-13 18:55:08 +02:00
parent 1ccfe23d7a
commit 34e7f378da

View File

@@ -1,8 +1,9 @@
<script lang="ts"> <script lang="ts">
import { debounce } from 'obsidian' import { debounce, Platform } from 'obsidian'
import { toggleInputComposition } from 'src/globals' import { toggleInputComposition } from 'src/globals'
import { createEventDispatcher, tick } from 'svelte' import { createEventDispatcher, tick } from 'svelte'
import type OmnisearchPlugin from '../main' import type OmnisearchPlugin from '../main'
import { wait } from "../tools/utils";
export let initialValue = '' export let initialValue = ''
export let placeholder = '' export let placeholder = ''
@@ -28,11 +29,13 @@
function selectInput(_?: HTMLElement): void { function selectInput(_?: HTMLElement): void {
tick() tick()
.then(() => { .then(async () => {
if (Platform.isMobileApp) await wait(200)
elInput.focus() elInput.focus()
return tick() return tick()
}) })
.then(() => { .then(async () => {
if (Platform.isMobileApp) await wait(200)
elInput.select() elInput.select()
}) })
} }
@@ -57,7 +60,7 @@
placeholder="{placeholder}" placeholder="{placeholder}"
spellcheck="false" spellcheck="false"
type="text" type="text"
use:selectInput /> use:selectInput/>
</div> </div>
<slot /> <slot/>
</div> </div>