Skip to content

Commit

Permalink
[BUS-837] add html cms block and element (#52)
Browse files Browse the repository at this point in the history
* [BUS-837] add html cms block and element

* [BUS-837] code review changes
  • Loading branch information
MorennMcFly authored Sep 25, 2024
1 parent e8a73f1 commit 872ff8b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
14 changes: 14 additions & 0 deletions components/Cms/Block/CmsBlockHtml.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script setup lang="ts">
import type { Schemas } from '@shopware/api-client/api-types';
const props = defineProps<{
block: Schemas['CmsBlock'];
}>();
const { getSlotContent } = useCmsBlock(props.block);
const content: Schemas['CmsSlot'] = getSlotContent('content');
</script>

<template>
<CmsLoader :content="content" />
</template>
16 changes: 16 additions & 0 deletions components/Cms/Element/CmsElementHtml.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<script setup lang="ts">
import type { CmsElementText } from '@shopware-pwa/composables-next';
const props = defineProps<{
element: CmsElementText;
}>();
const config = useCmsElementConfig(props.element);
const content = config.getConfigValue('content');
</script>

<template>
<!-- v-html is necessary because we need to render html -->
<!-- eslint-disable vue/no-v-html -->
<div v-html="content" />
</template>

0 comments on commit 872ff8b

Please sign in to comment.