Fix accidental close when dragging out of connection form inputs
This commit is contained in:
@@ -50,8 +50,24 @@ watch(
|
|||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
)
|
)
|
||||||
|
|
||||||
const error = ref('')
|
const error = ref('')
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
const backdropPressed = ref(false)
|
||||||
|
|
||||||
|
function handleBackdropMouseDown() {
|
||||||
|
backdropPressed.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleBackdropMouseUp() {
|
||||||
|
if (backdropPressed.value) {
|
||||||
|
emit('close')
|
||||||
|
}
|
||||||
|
backdropPressed.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDialogMouseDown() {
|
||||||
|
backdropPressed.value = false
|
||||||
|
}
|
||||||
|
|
||||||
async function handleSubmit() {
|
async function handleSubmit() {
|
||||||
error.value = ''
|
error.value = ''
|
||||||
@@ -108,13 +124,18 @@ async function handleSubmit() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4" @click.self="emit('close')">
|
<div
|
||||||
<div
|
class="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4"
|
||||||
class="w-full max-w-lg bg-slate-800 rounded-xl border border-slate-700 shadow-xl"
|
@mousedown.self="handleBackdropMouseDown"
|
||||||
role="dialog"
|
@mouseup.self="handleBackdropMouseUp"
|
||||||
aria-modal="true"
|
>
|
||||||
aria-labelledby="form-title"
|
<div
|
||||||
>
|
class="w-full max-w-lg bg-slate-800 rounded-xl border border-slate-700 shadow-xl"
|
||||||
|
role="dialog"
|
||||||
|
aria-modal="true"
|
||||||
|
aria-labelledby="form-title"
|
||||||
|
@mousedown="handleDialogMouseDown"
|
||||||
|
>
|
||||||
<div class="flex items-center justify-between p-4 border-b border-slate-700">
|
<div class="flex items-center justify-between p-4 border-b border-slate-700">
|
||||||
<h2 id="form-title" class="text-lg font-semibold text-slate-100">
|
<h2 id="form-title" class="text-lg font-semibold text-slate-100">
|
||||||
{{ isEdit ? '编辑连接' : '新建连接' }}
|
{{ isEdit ? '编辑连接' : '新建连接' }}
|
||||||
|
|||||||
Reference in New Issue
Block a user