Pocisti html vsebine pojma, js pkg apdejti

pull/26/head
Jurij Podgoršek 2023-12-08 15:00:40 +01:00
parent 33da93a1dd
commit cc4c427b89
3 changed files with 6334 additions and 3032 deletions

View File

@ -1,5 +1,7 @@
<script setup="setup"> <script setup="setup">
import { stripHtml } from 'string-strip-html'
const { etherpadApiUrl, etherpadPrefix } = useRuntimeConfig().public const { etherpadApiUrl, etherpadPrefix } = useRuntimeConfig().public
const store = usePojmiStore() const store = usePojmiStore()
@ -17,10 +19,21 @@ const urejanje = ref(false)
const urediPojem = async () => { const urediPojem = async () => {
// Ustvari pad s tekstom pojma, ce se ne obstaja // Ustvari pad s tekstom pojma, ce se ne obstaja
const resp = await $fetch(`${etherpadApiUrl}/createPad?padID=${etherpadPrefix + revisionId.value}&text=` + pojem.value.tekst) const tekstPojma = stripHtml(pojem.value.tekst).result
const resp = await $fetch(`${etherpadApiUrl}/createPad?padID=${etherpadPrefix + revisionId.value}`, {
method: 'post',
body: {
text: tekstPojma
}
})
urejanje.value = true urejanje.value = true
} }
const brisiPojem = async () => {
const resp = await $fetch(`${etherpadApiUrl}/deletePad?padID=${etherpadPrefix + revisionId.value}`)
alert('pad izbrisan')
}
</script> </script>
<template> <template>
@ -28,8 +41,15 @@ const urediPojem = async () => {
<h2>{{ pojem.naslov }}</h2> <h2>{{ pojem.naslov }}</h2>
<div class="tekst" v-html="pojem.tekst" /> <div class="tekst" v-html="pojem.tekst" />
<div class="gumb" @click="urediPojem">Uredi</div> <div class="gumb" @click="urediPojem">Uredi</div>
<div class="gumb" @click="brisiPojem">Briši (pad)</div>
<div v-if="urejanje" class="pojem"> <div v-if="urejanje" class="pojem">
<PojemForm :revisionId="revisionId" /> <PojemForm :revisionId="revisionId" />
</div> </div>
</section> </section>
</template> </template>
<style scoped>
.gumb {
margin-right: 1rem;
}
</style>

9333
nuxt/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,13 +11,14 @@
"devDependencies": { "devDependencies": {
"@nuxtjs/eslint-config": "^6.0.1", "@nuxtjs/eslint-config": "^6.0.1",
"@nuxtjs/eslint-module": "^3.0.2", "@nuxtjs/eslint-module": "^3.0.2",
"@pinia/nuxt": "^0.4.7", "@pinia/nuxt": "^0.5.1",
"nuxt": "^3.2.2" "nuxt": "^3.8.2"
}, },
"dependencies": { "dependencies": {
"druxt": "^0.21.0", "druxt": "^0.24.0",
"jsonapi-serializer": "^3.6.7", "jsonapi-serializer": "^3.6.9",
"nuxt-proxy": "^0.4.1", "nuxt-proxy": "^0.4.1",
"pinia": "^2.0.32" "pinia": "^2.1.7",
"string-strip-html": "^13.4.3"
} }
} }