@sbc-connect/nuxt-base 0.1.25 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @sbc-connect/nuxt-base
2
2
 
3
+ ## 0.1.26
4
+
5
+ ### Patch Changes
6
+
7
+ - [#86](https://github.com/bcgov/connect-nuxt/pull/86) [`c1fb4f2`](https://github.com/bcgov/connect-nuxt/commit/c1fb4f2a217b3d57e7ea7aed8b9773e215a21978) Thanks [@deetz99](https://github.com/deetz99)! - feat: v-sanitize directive.
8
+
3
9
  ## 0.1.25
4
10
 
5
11
  ### Patch Changes
@@ -1,7 +1,4 @@
1
1
  <script setup lang="ts">
2
- /* eslint-disable vue/no-v-html */
3
- /* eslint-disable vue/no-v-text-v-html-on-component */
4
-
5
2
  const {
6
3
  translationPath,
7
4
  as = 'span'
@@ -39,5 +36,5 @@ const textToDisplay = computed(() => {
39
36
  </script>
40
37
 
41
38
  <template>
42
- <component :is="as" v-html="$sanitize(textToDisplay)" />
39
+ <component :is="as" v-sanitize="textToDisplay" />
43
40
  </template>
@@ -3,7 +3,16 @@ import DOMPurify from 'dompurify'
3
3
  export default defineNuxtPlugin({
4
4
  name: 'connect-sanitize-plugin',
5
5
  parallel: true,
6
- setup() {
6
+ setup(nuxtApp) {
7
+ nuxtApp.vueApp.directive('sanitize', {
8
+ beforeMount(el, binding) {
9
+ el.innerHTML = DOMPurify.sanitize(binding.value)
10
+ },
11
+ updated(el, binding) {
12
+ el.innerHTML = DOMPurify.sanitize(binding.value)
13
+ }
14
+ })
15
+
7
16
  return {
8
17
  provide: {
9
18
  sanitize: DOMPurify.sanitize
@@ -0,0 +1,7 @@
1
+ declare module 'vue' {
2
+ interface GlobalDirectives {
3
+ vSanitize: Directive<HTMLElement, string>
4
+ }
5
+ }
6
+
7
+ export {}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sbc-connect/nuxt-base",
3
3
  "type": "module",
4
- "version": "0.1.25",
4
+ "version": "0.1.26",
5
5
  "repository": "github:bcgov/connect-nuxt",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "./nuxt.config.ts",
@@ -25,8 +25,8 @@
25
25
  "typescript": "5.9.3",
26
26
  "vue-tsc": "3.1.2",
27
27
  "@sbc-connect/eslint-config": "0.0.8",
28
- "@sbc-connect/vitest-config": "0.0.6",
29
- "@sbc-connect/playwright-config": "0.0.8"
28
+ "@sbc-connect/playwright-config": "0.0.8",
29
+ "@sbc-connect/vitest-config": "0.0.6"
30
30
  },
31
31
  "scripts": {
32
32
  "preinstall": "npx only-allow pnpm",