Skip to content

Commit f8d91c2

Browse files
farosFreedJess Divers
andauthored
feat: APPS-3671 add dompurify for safe v-html usage (#883)
* feat: add dom purify * fix: test --------- Co-authored-by: Jess Divers <jessica.divers@library.ucla.edu>
1 parent 184d054 commit f8d91c2

File tree

5 files changed

+423
-152
lines changed

5 files changed

+423
-152
lines changed

packages/component-library-nuxt-module/playground/nuxt.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
export default defineNuxtConfig({
2-
modules: ['../src/module'],
2+
modules: [
3+
'@radya/nuxt-dompurify',
4+
'../src/module',
5+
],
36
devtools: { enabled: true },
47
compatibilityDate: '2025-02-07',
58
uclaLibraryWebsiteComponents: {},

packages/vue-component-library/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"@antfu/eslint-config": "^0.43.1",
5454
"@percy/cli": "^1.31.1",
5555
"@percy/cypress": "^3.1.2",
56+
"@radya/nuxt-dompurify": "^1.0.5",
5657
"@semantic-release/changelog": "^6.0.3",
5758
"@semantic-release/git": "^10.0.1",
5859
"@storybook/addon-essentials": "^7.1.1",

packages/vue-component-library/src/lib-components/RichText.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const parsedContent = computed(() => {
3333
<div :class="classes">
3434
<div
3535
class="parsed-content"
36-
v-html="parsedContent"
36+
v-sanitize-html="parsedContent"
3737
/>
3838
<slot />
3939
</div>

packages/vue-component-library/src/stories/BentoBoxBlock.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ describe('BentoBoxBlock Storybook', () => {
22
it('Default', () => {
33
cy.visit('/iframe.html?id=funkhaus-bento-box-block--default&viewMode=story')
44
cy.get('.bento-box-block').should('exist')
5-
cy.contains('Default Bento Block')
5+
6+
cy.percySnapshot('FUNKHAUS / Bento Box Block: Default')
67
})
78
})

0 commit comments

Comments
 (0)