paramander / contentful-rich-text-vue-renderer

Render Contentful Rich Text field using Vue
https://www.npmjs.com/package/contentful-rich-text-vue-renderer
MIT License
38 stars 12 forks source link

Render Marks showing ,[object Object], #21

Closed benpaullamb closed 3 years ago

benpaullamb commented 3 years ago

Hi,

When I make something bold or italic in a Contentful rich text block, and pass the data through the contentful-rich-text-vue-renderer, it's rendered as ,[object Object], as shown in the image below.

image

Using a render mark object with a property like this: [MARKS.BOLD]: (text, key, h) => h('strong', { key }, text), and passing that to the renderer through the mark-renderers prop still results in the same output of ,[object Object],. Logging inside of that render mark property shows that it is getting called with the correct text.

tolgap commented 3 years ago

Hi @benpaullamb which version are you using?

benpaullamb commented 3 years ago

Hi @tolgap, I'm using 2.0.0

benpaullamb commented 3 years ago

I get the same thing on version 1.1.5

tolgap commented 3 years ago

@benpaullamb Could you paste the document object that you are providing to the contentful-rich-text-vue-renderer? I might've missed a use-case for rendering marks that I am unaware of.

benpaullamb commented 3 years ago

Apologies, I've found the solution. It isn't related to your contentful-rich-text-vue-renderer. Some pre-existing code was converting the object that contained the bold text to a string and passing it as the 4th argument to the render function (h). Removing that and first passing the object through the next function solves the issue.