Skip to content

Commit

Permalink
feat: replace he with entities to decode html
Browse files Browse the repository at this point in the history
  • Loading branch information
mkucmus authored and patzick committed Nov 21, 2022
1 parent cae882b commit d7da2c1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/tidy-games-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@shopware-pwa/cms-base": minor
---

change of html entites parser library
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<script setup lang="ts">
import type { CmsElementText } from "@shopware-pwa/composables-next";
import { useCmsElementConfig } from "@shopware-pwa/composables-next";
import { h } from "vue";
import { CSSProperties } from "vue";
import { decodeHTML } from "entities";
// @ts-ignore
import htmlToVue from "html-to-vue";
// @ts-ignore
import he from "he";
const { decode } = he;
// @ts-ignore
const { renderHtml, getOptionsFromNode } = htmlToVue;
const props = defineProps<{
content: CmsElementText;
Expand All @@ -27,7 +26,7 @@ const hasVerticalAlignment = computed(() => !!style.value.alignItems);
const CmsTextRender = () => {
const config = {
textTransformer: (text: string) => decode(text),
textTransformer: (text: string) => decodeHTML(text),
extraComponentsMap: {
link: {
conditions(node: any) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cms-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@shopware-pwa/api-client": "workspace:*",
"@shopware-pwa/composables-next": "workspace:*",
"@shopware-pwa/helpers-next": "workspace:*",
"he": "^1.2.0",
"entities": "^4.4.0",
"html-to-vue": "^1.4.0"
},
"devDependencies": {
Expand Down
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions templates/vue-demo-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"build": "NITRO_PRESET=vercel nuxi build",
"lint": "eslint ./**/*.vue* app.vue --fix --max-warnings=0",
"generate": "nuxt generate",
"preview": "nuxt preview"
"preview": "nuxt preview",
"analyze": "nuxi analyze"
},
"dependencies": {
"@shopware-pwa/cms-base": "0.1.22",
Expand All @@ -27,8 +28,8 @@
"eslint-plugin-vue": "^9.6.0",
"nuxt": "3.0.0-rc.11",
"typescript": "^4.8.4",
"vue-tsc": "^0.40.13",
"vue-eslint-parser": "^9.1.0"
"vue-eslint-parser": "^9.1.0",
"vue-tsc": "^0.40.13"
},
"engines": {
"node": "^16.x || ^18.x"
Expand Down

0 comments on commit d7da2c1

Please sign in to comment.