PerplexDigital / Perplex.ContentBlocks

Block based content editor for Umbraco
MIT License
31 stars 15 forks source link

Issue on 8.7 #40

Closed seanrockster closed 4 years ago

seanrockster commented 4 years ago

Hi

Just trying out umbraco 8.7 and also trying out Perplex.ContentBlocks. From the QuickStart code..

@using Perplex.ContentBlocks.Rendering; @Html.RenderContentBlocks(Model.Blocks)

My alias is Blocks rather than ContentBlocks but I'm not sure that matters.

With the code to render the example block, I get this error

Compiler Error Message: CS1503: Argument 2: cannot convert from 'Umbraco.Core.Models.Blocks.BlockListModel' to 'Perplex.ContentBlocks.Rendering.IContentBlocks'

PerplexDaniel commented 4 years ago

The alias does not matter. However, judging from the error message your "blocks" property is not using a Perplex.ContentBlocks datatype but the new Umbraco Block List editor.

Can you verify at your document type settings the "blocks" property is actually using the datatype Perplex.ContentBlocks?

seanrockster commented 4 years ago

Yes, its using Perplex.ContentBlocks and the property editor works ok.

image

image

PerplexDaniel commented 4 years ago

Interesting. Did you run ModelsBuilder again? Or are you using PureLive mode? Because clearly Umbraco thinks the "blocks" property is an Umbraco.Core.Models.Blocks.BlockListModel. I have already tested ContentBlocks on 8.7 and that worked fine so I think there is some small mistake in your configuration somewhere.

You can also try to retrieve the value as Model.Value<Perplex.ContentBlocks.Rendering.IContentBlocks>("blocks") and use that instead of Model.Blocks in the RenderContentBlocks method.

seanrockster commented 4 years ago

Yeah, looks like something was clogged up. I deleted all the models, removed all the properties i created, republished everything and the error went away. I must have created a similar property with the built-in block editor as i'm trying them both for an upcoming project. Problem solved.