File tree 5 files changed +675
-786
lines changed
5 files changed +675
-786
lines changed Original file line number Diff line number Diff line change 1
1
<script setup lang="ts">
2
- import type { VNode } from " vue" ;
3
- import type { StoryblokRichTextNode } from " @storyblok/js" ;
2
+ import { ref , watch , type VNode } from " vue" ;
3
+ import type {
4
+ StoryblokRichTextNode ,
5
+ StoryblokRichTextResolvers ,
6
+ } from " @storyblok/js" ;
4
7
import { useStoryblokRichText } from " ../composables/useStoryblokRichText" ;
5
8
import type { StoryblokRichTextProps } from " ../types" ;
6
9
7
10
const props = defineProps <StoryblokRichTextProps >();
8
11
9
- const { render } = useStoryblokRichText ({
10
- resolvers: props .resolvers ?? {},
11
- });
12
+ const renderedDoc = ref ();
13
+ const root = () => renderedDoc .value ;
12
14
13
- const root = () => render (props .doc as StoryblokRichTextNode <VNode >);
15
+ watch (
16
+ [props .doc , props .resolvers ],
17
+ ([doc , resolvers ]) => {
18
+ const { render } = useStoryblokRichText ({
19
+ resolvers: (resolvers as StoryblokRichTextResolvers <VNode >) ?? {},
20
+ });
21
+ renderedDoc .value = render (doc as StoryblokRichTextNode <VNode >);
22
+ },
23
+ {
24
+ immediate: true ,
25
+ }
26
+ );
14
27
</script >
15
28
16
29
<template >
17
30
<root />
18
31
</template >
32
+ ß
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ export function useStoryblokRichText(options: StoryblokRichTextOptions<VNode>) {
25
25
const mergedOptions : StoryblokRichTextOptions < VNode > = {
26
26
renderFn : h ,
27
27
textFn : createTextVNode ,
28
+ keyedResolvers : true ,
28
29
resolvers : {
29
30
[ BlockTypes . COMPONENT ] : componentResolver ,
30
31
...options . resolvers ,
Original file line number Diff line number Diff line change 25
25
"prepublishOnly" : " npm run build && cp ../README.md ./"
26
26
},
27
27
"dependencies" : {
28
- "@storyblok/js" : " ^3.1.6 "
28
+ "@storyblok/js" : " ^3.1.7 "
29
29
},
30
30
"devDependencies" : {
31
- "@babel/core" : " ^7.25.7 " ,
31
+ "@babel/core" : " ^7.26.0 " ,
32
32
"@cypress/vite-dev-server" : " ^5.2.0" ,
33
33
"@cypress/vue" : " ^6.0.1" ,
34
- "@vitejs/plugin-vue" : " ^5.0.5 " ,
34
+ "@vitejs/plugin-vue" : " ^5.1.4 " ,
35
35
"@vue/babel-preset-app" : " ^5.0.8" ,
36
36
"@vue/test-utils" : " 2.4.6" ,
37
37
"@vue/tsconfig" : " ^0.1.3" ,
38
38
"@vue/vue3-jest" : " ^29.2.6" ,
39
- "babel-jest" : " ^29.4.3 " ,
40
- "cypress" : " ^13.15.0 " ,
41
- "eslint-plugin-cypress" : " ^2.15.1 " ,
39
+ "babel-jest" : " ^29.7.0 " ,
40
+ "cypress" : " ^13.15.1 " ,
41
+ "eslint-plugin-cypress" : " ^2.15.2 " ,
42
42
"eslint-plugin-jest" : " ^28.8.3" ,
43
- "jest" : " ^29.6.4 " ,
43
+ "jest" : " ^29.7.0 " ,
44
44
"typescript" : " ^4.9.5" ,
45
- "vite" : " ^5.4.8 " ,
46
- "vue" : " ^3.5.10 " ,
47
- "vue-tsc" : " ^1.8.0 "
45
+ "vite" : " ^5.4.10 " ,
46
+ "vue" : " ^3.5.12 " ,
47
+ "vue-tsc" : " ^1.8.27 "
48
48
},
49
49
"babel" : {
50
50
"presets" : [
You can’t perform that action at this time.
0 commit comments