Skip to content

Commit 2f764bc

Browse files
authored
Merge pull request #20 from paramander/vue3
Upgrade to vue 3 component
2 parents 8963a2d + 01823cc commit 2f764bc

File tree

6 files changed

+7924
-10602
lines changed

6 files changed

+7924
-10602
lines changed

.github/workflows/nodejs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99

1010
strategy:
1111
matrix:
12-
node-version: [10.x, 12.x, 14.x]
12+
node-version: [12.x, 14.x, 16.x, 18.x]
1313

1414
steps:
1515
- uses: actions/checkout@v1

README.md

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# rich-text-vue-renderer
22

3-
Vue renderer for the Contentful rich text field type.
3+
Vue 3 renderer for the Contentful rich text field type.
44

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.
610

711
## Installation
812

@@ -98,6 +102,7 @@ You can also pass custom renderers for both marks and nodes as an optional param
98102

99103
```html
100104
<script>
105+
import { h } from "vue";
101106
import { BLOCKS, MARKS } from '@contentful/rich-text-types';
102107
import RichTextRenderer from 'contentful-rich-text-vue-renderer';
103108
@@ -132,12 +137,12 @@ export default {
132137
methods: {
133138
renderMarks() {
134139
return {
135-
[MARKS.BOLD]: (text, key, h) => h('custom-bold', { key: key }, text)
140+
[MARKS.BOLD]: (text, key) => h('custom-bold', { key }, text)
136141
};
137142
},
138143
renderNodes() {
139144
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))
141146
}
142147
};
143148
}
@@ -154,6 +159,7 @@ Last, but not least, you can pass a custom rendering component for an embedded e
154159

155160
```html
156161
<script>
162+
import { h } from "vue";
157163
import { BLOCKS } from '@contentful/rich-text-types';
158164
import RichTextRenderer from 'contentful-rich-text-vue-renderer';
159165
@@ -171,8 +177,8 @@ const document = {
171177
172178
// Example function to render an embedded entry in a RichText editor.
173179
// 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');
176182
};
177183
178184
export default {

0 commit comments

Comments
 (0)