Funded by the European Union. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or European Education and Culture Executive Agency (EACEA). Neither the European Union nor the granting authority can be held responsible for them.
+
+
+
+
+
diff --git a/nuxt/components/Pojem.vue b/nuxt/components/Pojem.vue
index 718fab7..84ed8d9 100644
--- a/nuxt/components/Pojem.vue
+++ b/nuxt/components/Pojem.vue
@@ -10,13 +10,16 @@ const props = defineProps({
naslov: String
})
-const pojem = computed(() => store.pojmi[props.naslov])
-const revisionId = computed(() => pojem.value.id)
+if (props.naslov && !(props.naslov in store.pojmi)) {
+ await store.naloziPojme()
+}
-await store.naloziPojme()
+const pojem = computed(() => store.pojmi[props.naslov])
+const revisionId = computed(() => pojem.value ? pojem.value.id : null)
const urejanje = ref(false)
const container = ref(null)
+const obrazec = ref(null)
const urediPojem = async () => {
// Ustvari pad s tekstom pojma, ce se ne obstaja
@@ -29,86 +32,85 @@ const urediPojem = async () => {
}
onMounted(() => {
- // Link na pojem direktno? Poskrolaj nanj + odpri editiranje
+ // Prazen pojem? Nazaj na manifest
+ if (!pojem.value.id) {
+ navigateTo('/manifest#skrol')
+ }
+
+ // Link na editiranje pojma? Poskrolaj nanj + odpri editiranje
if (route.params.guid === revisionId.value) {
urejanje.value = true
- window.container = container
- setTimeout(() => container.value.scrollIntoView(), 50)
+ setTimeout(() => obrazec.value.scrollIntoView({ behavior: 'smooth' }), 50)
+ } else {
+ // Sicer samo poskrolaj na pojem
+ setTimeout(() => {
+ const sekcija = container.value.parentNode
+ console.log('skrolam?', sekcija)
+ if (sekcija) {
+ sekcija.scrollIntoView({ behavior: 'smooth' })
+ }
+ }, 50)
}
})
-
-