Skip to content

Commit

Permalink
Allow usage of hydrated HTML in client segments
Browse files Browse the repository at this point in the history
  • Loading branch information
bkis committed Jan 16, 2025
1 parent 5a889ef commit 4581e40
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Tekst-Web/src/components/SegmentRenderer.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
import HydratedHtml from '@/components/generic/HydratedHtml.vue';
import { usePlatformData } from '@/composables/platformData';
import { useStateStore } from '@/stores';
import { ref, watchEffect } from 'vue';
Expand All @@ -18,7 +19,7 @@ watchEffect(async () => {
</script>

<template>
<div v-if="html" class="segment-container" v-html="html"></div>
<hydrated-html v-if="html" class="segment-container" :html="html" />
</template>

<style>
Expand Down
2 changes: 1 addition & 1 deletion Tekst-Web/src/components/generic/HydratedHtml.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ onMounted(hydrate);
</script>

<template>
<div ref="contentRef" v-html="html" :style="style"></div>
<div ref="contentRef" v-bind="$attrs" v-html="html" :style="style"></div>
<generic-modal
v-if="Object.keys(modalHtml).length"
v-model:show="showModal"
Expand Down
3 changes: 2 additions & 1 deletion Tekst-Web/src/views/InfoPageView.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import type { ClientSegmentRead } from '@/api';
import HydratedHtml from '@/components/generic/HydratedHtml.vue';
import IconHeading from '@/components/generic/IconHeading.vue';
import { usePlatformData } from '@/composables/platformData';
import { useStateStore } from '@/stores';
Expand Down Expand Up @@ -35,6 +36,6 @@ watchEffect(async () => {
<icon-heading v-if="page.title" level="1" :icon="icon">
{{ page.title }}
</icon-heading>
<div class="content-block" style="padding: 1.2rem" v-html="page.html"></div>
<hydrated-html class="content-block" :html="page.html" style="padding: 1.2rem" />
</template>
</template>

0 comments on commit 4581e40

Please sign in to comment.