1
1
# rich-text-vue-renderer
2
2
3
- Vue renderer for the Contentful rich text field type.
3
+ Vue 3 renderer for the Contentful rich text field type.
4
4
5
- ## Version 2.x dropped support for Node 8. If you need Node 8 support, remain on 1.x!
5
+ ## Version 2.x is for Vue 2 support.
6
+
7
+ ## Changelog
8
+
9
+ See releases page for changelog of versions.
6
10
7
11
## Installation
8
12
@@ -98,6 +102,7 @@ You can also pass custom renderers for both marks and nodes as an optional param
98
102
99
103
``` html
100
104
<script >
105
+ import { h } from " vue" ;
101
106
import { BLOCKS , MARKS } from ' @contentful/rich-text-types' ;
102
107
import RichTextRenderer from ' contentful-rich-text-vue-renderer' ;
103
108
@@ -132,12 +137,12 @@ export default {
132
137
methods: {
133
138
renderMarks () {
134
139
return {
135
- [MARKS .BOLD ]: (text , key , h ) => h (' custom-bold' , { key : key }, text)
140
+ [MARKS .BOLD ]: (text , key ) => h (' custom-bold' , { key }, text)
136
141
};
137
142
},
138
143
renderNodes () {
139
144
return {
140
- [BLOCKS .PARAGRAPH ]: (node , key , h , next ) => h (' custom-paragraph' , { key: key }, next (node .content , key, h , next))
145
+ [BLOCKS .PARAGRAPH ]: (node , key , next ) => h (' custom-paragraph' , { key }, next (node .content , key, next))
141
146
}
142
147
};
143
148
}
@@ -154,6 +159,7 @@ Last, but not least, you can pass a custom rendering component for an embedded e
154
159
155
160
``` html
156
161
<script >
162
+ import { h } from " vue" ;
157
163
import { BLOCKS } from ' @contentful/rich-text-types' ;
158
164
import RichTextRenderer from ' contentful-rich-text-vue-renderer' ;
159
165
@@ -171,8 +177,8 @@ const document = {
171
177
172
178
// Example function to render an embedded entry in a RichText editor.
173
179
// For instance, a react-router link to an entry.
174
- const customEmbeddedEntry = (node , key , h ) => {
175
- return h (' Link' , { key: key , to: ' link to embedded entry' }, ' content for the <Link> component' );
180
+ const customEmbeddedEntry = (node , key ) => {
181
+ return h (' Link' , { key, to: ' link to embedded entry' }, ' content for the <Link> component' );
176
182
};
177
183
178
184
export default {
0 commit comments