From ba4ec35410bd7dc1a64234c606845f99f42106a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurij=20Podgor=C5=A1ek?= Date: Tue, 5 Mar 2024 22:48:42 +0100 Subject: [PATCH] Popravljeno skrolanje sekcij (urejanje, dodajanje pojma) --- nuxt/app.vue | 1 + nuxt/components/Pojem.vue | 40 ++++++++++++++++++++++------------- nuxt/components/PojemForm.vue | 4 ++++ nuxt/composables/ui.js | 12 +++++++++++ nuxt/pages/manifest/dodaj.vue | 9 +++----- nuxt/pages/manifest/index.vue | 7 +++--- 6 files changed, 49 insertions(+), 24 deletions(-) create mode 100644 nuxt/composables/ui.js diff --git a/nuxt/app.vue b/nuxt/app.vue index 503788a..cfff88b 100644 --- a/nuxt/app.vue +++ b/nuxt/app.vue @@ -83,6 +83,7 @@ background: none; text-decoration: underline; width: fit-content; + z-index: 100; } footer { diff --git a/nuxt/components/Pojem.vue b/nuxt/components/Pojem.vue index 84ed8d9..a6068f6 100644 --- a/nuxt/components/Pojem.vue +++ b/nuxt/components/Pojem.vue @@ -3,6 +3,8 @@ import { stripHtml } from 'string-strip-html' const { etherFetch } = useEtherpadApi() +const { poskrolaj } = useUi() + const store = usePojmiStore() const route = useRoute() @@ -40,16 +42,15 @@ onMounted(() => { // Link na editiranje pojma? Poskrolaj nanj + odpri editiranje if (route.params.guid === revisionId.value) { urejanje.value = true - 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) + poskrolaj(container.value.parentNode) + } +}) + +onUpdated(() => { + if (route.params.guid === revisionId.value) { + poskrolaj(obrazec.value) } }) @@ -62,11 +63,13 @@ onMounted(() => {

{{ naslov }}

- +
+ +
@@ -87,9 +90,12 @@ onMounted(() => { } form.pojem { + width: 100%; + } + + .obrazec { width: calc(50% - 32px); margin-left: 32px; - gap: 1rem; float: right; } @@ -106,8 +112,12 @@ onMounted(() => { width: 100%; } - form.pojem { + .obrazec { + width: 100%; margin-left: 0; + } + + form.pojem { min-height: 70vh; width: 100%; margin-left: 0; diff --git a/nuxt/components/PojemForm.vue b/nuxt/components/PojemForm.vue index 831e3ce..e99f015 100644 --- a/nuxt/components/PojemForm.vue +++ b/nuxt/components/PojemForm.vue @@ -78,6 +78,10 @@ const etherNalozen = ev => {