Skip to content

Commit

Permalink
iframe: Reset URL input field on config window close if it's not valid
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl committed Jul 11, 2024
1 parent 4b10636 commit c5556c4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/components/widgets/IFrame.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

<script setup lang="ts">
import { useWindowSize } from '@vueuse/core'
import { computed, defineProps, onBeforeMount, ref, toRefs } from 'vue'
import { computed, defineProps, onBeforeMount, ref, toRefs, watch } from 'vue'
import Snackbar from '@/components/Snackbar.vue'
import { isValidURL } from '@/libs/utils'
Expand Down Expand Up @@ -127,6 +127,18 @@ function loadFinished(): void {
console.log('Finished loading')
iframe_loaded.value = true
}
watch(
widget,
() => {
if (widget.value.managerVars.configMenuOpen === false) {
if (validateURL(inputURL.value) !== true) {
inputURL.value = widget.value.options.source
}
}
},
{ deep: true }
)
</script>

<style scoped>
Expand Down

0 comments on commit c5556c4

Please sign in to comment.