55 lines
1.1 KiB
Vue
55 lines
1.1 KiB
Vue
<script setup="setup">
|
|
|
|
import { stripHtml } from 'string-strip-html'
|
|
|
|
const { etherFetch } = useEtherpadApi()
|
|
|
|
const store = usePojmiStore()
|
|
|
|
const props = defineProps({
|
|
naslov: String
|
|
})
|
|
|
|
const pojem = computed(() => store.pojmi[props.naslov])
|
|
const revisionId = computed(() => pojem.value.id)
|
|
|
|
await store.naloziPojme()
|
|
|
|
const urejanje = ref(false)
|
|
|
|
const urediPojem = async () => {
|
|
// Ustvari pad s tekstom pojma, ce se ne obstaja
|
|
const tekstPojma = stripHtml(pojem.value.tekst).result
|
|
const resp = await etherFetch('/createPad', {
|
|
padID: revisionId.value,
|
|
text: tekstPojma
|
|
})
|
|
urejanje.value = true
|
|
}
|
|
|
|
</script>
|
|
|
|
<template>
|
|
<section class="pojem">
|
|
<PojemForm v-if="urejanje" :revisionId="revisionId" :pojem="pojem" :urejanje="urejanje" />
|
|
<div v-else>
|
|
<div class="gumb" @click="urediPojem">Uredi</div>
|
|
<h2>{{ pojem.naslov }}</h2>
|
|
<div class="tekst" v-html="pojem.tekst" />
|
|
</div>
|
|
</section>
|
|
</template>
|
|
|
|
<style scoped>
|
|
@media screen and (min-width: 768px) {
|
|
PojemForm {
|
|
width: 50%;
|
|
float: left;
|
|
}
|
|
}
|
|
.gumb {
|
|
float: right;
|
|
margin-right: 1rem;
|
|
}
|
|
</style>
|