Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MkInputをpreventに対応させ、enterの意図せぬ伝搬を防ぐ #1

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/frontend/src/components/MkInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const props = defineProps<{
const emit = defineEmits<{
(ev: 'change', _ev: KeyboardEvent): void;
(ev: 'keydown', _ev: KeyboardEvent): void;
(ev: 'enter'): void;
(ev: 'enter', _ev: KeyboardEvent): void;
(ev: 'update:modelValue', value: string | number): void;
}>();

Expand Down Expand Up @@ -111,7 +111,7 @@ const onKeydown = (ev: KeyboardEvent) => {
emit('keydown', ev);

if (ev.code === 'Enter') {
emit('enter');
emit('enter', ev);
}
};

Expand Down
11 changes: 1 addition & 10 deletions packages/frontend/src/pages/search.note.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<div class="_gaps">
<div class="_gaps">
<MkInput v-model="searchQuery" :large="true" :autofocus="true" type="search" @enter="search">
<MkInput v-model="searchQuery" :large="true" :autofocus="true" type="search" @enter.prevent="search">
<template #prefix><i class="ti ti-search"></i></template>
</MkInput>
<MkFolder>
Expand Down Expand Up @@ -75,9 +75,6 @@ async function search() {
if (query == null || query === '') return;

if (query.startsWith('https://') && !query.includes(' ')) {
//Enterの入力によって検索が開始された場合、Confirmの方にもEnterが入力されてしまうため、遅延させる
await new Promise(x => setTimeout(x, 2));

const confirm = await os.confirm({
type: 'info',
text: i18n.ts.lookupConfirm,
Expand All @@ -103,9 +100,6 @@ async function search() {

if (query.length > 1 && !query.includes(' ')) {
if (query.startsWith('@')) {
//Enterの入力によって検索が開始された場合、Confirmの方にもEnterが入力されてしまうため、遅延させる
await new Promise(x => setTimeout(x, 2));

const confirm = await os.confirm({
type: 'info',
text: i18n.ts.lookupConfirm,
Expand All @@ -117,9 +111,6 @@ async function search() {
}

if (query.startsWith('#')) {
//Enterの入力によって検索が開始された場合、Confirmの方にもEnterが入力されてしまうため、遅延させる
await new Promise(x => setTimeout(x, 2));

const confirm = await os.confirm({
type: 'info',
text: i18n.ts.openTagPageConfirm,
Expand Down
11 changes: 1 addition & 10 deletions packages/frontend/src/pages/search.user.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<div class="_gaps">
<div class="_gaps">
<MkInput v-model="searchQuery" :large="true" :autofocus="true" type="search" @enter="search">
<MkInput v-model="searchQuery" :large="true" :autofocus="true" type="search" @enter.prevent="search">
<template #prefix><i class="ti ti-search"></i></template>
</MkInput>
<MkRadios v-model="searchOrigin" @update:modelValue="search()">
Expand Down Expand Up @@ -49,9 +49,6 @@ async function search() {
if (query == null || query === '') return;

if (query.startsWith('https://') && !query.includes(' ')) {
//Enterの入力によって検索が開始された場合、Confirmの方にもEnterが入力されてしまうため、遅延させる
await new Promise(x => setTimeout(x, 2));

const confirm = await os.confirm({
type: 'info',
text: i18n.ts.lookupConfirm,
Expand All @@ -77,9 +74,6 @@ async function search() {

if (query.length > 1 && !query.includes(' ')) {
if (query.startsWith('@')) {
//Enterの入力によって検索が開始された場合、Confirmの方にもEnterが入力されてしまうため、遅延させる
await new Promise(x => setTimeout(x, 2));

const confirm = await os.confirm({
type: 'info',
text: i18n.ts.lookupConfirm,
Expand All @@ -91,9 +85,6 @@ async function search() {
}

if (query.startsWith('#')) {
//Enterの入力によって検索が開始された場合、Confirmの方にもEnterが入力されてしまうため、遅延させる
await new Promise(x => setTimeout(x, 2));

const confirm = await os.confirm({
type: 'info',
text: i18n.ts.openTagPageConfirm,
Expand Down
Loading