platform/packages/ui/src/components/SearchEdit.svelte
Alexander Platov e848480ef3
Update mention popup. Add svelte-check. Fix warnings. (#854)
Signed-off-by: Alexander Platov <sas_lord@mail.ru>
2022-01-24 12:25:10 +01:00

36 lines
737 B
Svelte

<script lang="ts">
import { createEventDispatcher } from 'svelte'
import EditWithIcon from './EditWithIcon.svelte'
import IconSearch from './icons/Search.svelte'
import plugin from '../plugin'
export let value: string = ''
$: _search = value
const dispatch = createEventDispatcher()
</script>
<EditWithIcon
icon={IconSearch}
placeholder={plugin.string.Search}
bind:value={_search}
on:change={() => {
if (_search === '') {
value = ''
dispatch('change', '')
}
}}
on:input={() => {
if (_search === '') {
value = ''
dispatch('change', '')
}
}}
on:keydown={(evt) => {
if (evt.key === 'Enter') {
value = _search
dispatch('change', _search)
}
}}
/>