Skip to content

Commit

Permalink
chore(ltLocationInput): save button stays disabled when pasting
Browse files Browse the repository at this point in the history
See #70.
  • Loading branch information
simon04 committed Feb 11, 2024
1 parent 6d951bb commit aeccc33
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/components/ltLocationInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
:value="modelValue.csv"
class="form-control"
type="text"
@blur="event => updateLatLng((event.target as HTMLInputElement).value)"
@blur="updateLatLng(($event.target as HTMLInputElement).value)"
@paste="updateLatLng($event.clipboardData?.getData('text'))"
/>
<button
class="btn btn-secondary"
Expand Down Expand Up @@ -45,7 +46,8 @@ const props = defineProps<{modelValue: LatLng}>();
const type = ref(props.modelValue?.type);
const $valid = ref(true);
function updateLatLng(viewValue: string) {
function updateLatLng(viewValue: string | undefined) {
if (viewValue === undefined) return;
if (!type.value) {
// keep track of coordinate type since it is lost
// when returning undefined on invalid input
Expand Down

0 comments on commit aeccc33

Please sign in to comment.