Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Umbraco 8.2 Grid Embed fixed #33

Merged
merged 5 commits into from
Dec 9, 2019
Merged

Umbraco 8.2 Grid Embed fixed #33

merged 5 commits into from
Dec 9, 2019

Conversation

ArnoldV
Copy link

@ArnoldV ArnoldV commented Dec 6, 2019

This commit fixed the Grid Embed editor that has changed in Umbraco 8.2 (umbraco/Umbraco-CMS#4178)

You can now use the following in your razor to get the iframe rendered:

These where available already:

@Html.Raw(Model.Value) 
@Model.Value.HtmlValue

New: same as in the json of Umbraco for the Embed
@Model.Value.Preview

also since thes following values are now available from Umbraco you can also use:

@Model.Value.Width
@Model.Value.Height
@Model.Value.Info
@Model.Value.Url

value = GridControlEmbedValue.Parse(control, token);
value = GridControlEmbedValue.Parse(control, token as JObject);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ArnoldV,

Thanks again for this PR 👍

From our chat the other day, I understood it as this PR would maintain backwards compatible with 8.1. Should that still be the case?

Casting the token and passing it to the constructor as a JObject breaks in 8.1, since the value property is a string, and not an object as in 8.2+. So if we should continue to support 8.1, the token should still be passed on to the constructor as JToken, and then we can do some type checks inside the constructor.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm make sense I'll add a different kind of check

@ArnoldV
Copy link
Author

ArnoldV commented Dec 9, 2019

Updated this PR with Umbraco 8.1 compatibility.

in Umbraco pre 8.1 the Jtoken is a JValue
In Umbraco 8.2 the Jtoken is a JObject.

I now included a check to see if the type of token is JValue or JObject and gets handled accordingly.

@abjerner abjerner merged commit 3f90607 into skybrud:master Dec 9, 2019
@abjerner
Copy link
Member

abjerner commented Dec 9, 2019

Hi @ArnoldV,

I've now merged your changes, but to minimize the breaking changes, I've made som additional changes:

  • Via GridControlHtmlValue, the old implementation of GridControlEmbedValue had both the Value and HtmlString properties. I've re-added the Value property for backwards compatibility.

  • The GridControlHtmlValue class also implements the IHtmlString interface. As GridControlEmbedValue no longer inherits from GridControlHtmlValue, I've updated the class definition to implement the IHtmlString interface.

Thanks for your help on this 😉

@ArnoldV
Copy link
Author

ArnoldV commented Dec 10, 2019

@abjerner great updates, makes a lot of sense! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants