Render base grid editor partial async
This commit is contained in:
@@ -1,23 +1,27 @@
|
||||
@model dynamic
|
||||
@model dynamic
|
||||
|
||||
@try
|
||||
{
|
||||
string editor = EditorView(Model);
|
||||
<text>@await Html.PartialAsync(editor, (object)Model)</text>
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
<pre>@ex.ToString()</pre>
|
||||
}
|
||||
|
||||
@functions{
|
||||
|
||||
@functions {
|
||||
public static string EditorView(dynamic contentItem)
|
||||
{
|
||||
string view = contentItem.editor.render != null ? contentItem.editor.render.ToString() : contentItem.editor.view.ToString();
|
||||
view = view.ToLower().Replace(".html", ".cshtml");
|
||||
|
||||
if (!view.Contains("/")) {
|
||||
if (!view.Contains("/"))
|
||||
{
|
||||
view = "grid/editors/" + view;
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
||||
@try
|
||||
{
|
||||
string editor = EditorView(Model);
|
||||
<text>@Html.Partial(editor, (object)Model)</text>
|
||||
}
|
||||
catch (Exception ex) {
|
||||
<pre>@ex.ToString()</pre>
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
@model dynamic
|
||||
@model dynamic
|
||||
@using Umbraco.Cms.Core.Media
|
||||
@using Umbraco.Cms.Core.PropertyEditors.ValueConverters
|
||||
@inject IImageUrlGenerator ImageUrlGenerator
|
||||
@if (Model.value != null)
|
||||
{
|
||||
var url = Model.value.image;
|
||||
if(Model.editor.config != null && Model.editor.config.size != null){
|
||||
|
||||
if (Model.editor.config != null && Model.editor.config.size != null)
|
||||
{
|
||||
if (Model.value.coordinates != null)
|
||||
{
|
||||
url = ImageCropperTemplateCoreExtensions.GetCropUrl(
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
@using Umbraco.Cms.Core.Templates
|
||||
@using Umbraco.Cms.Core.Templates
|
||||
@model dynamic
|
||||
@inject HtmlLocalLinkParser HtmlLocalLinkParser;
|
||||
@inject HtmlUrlParser HtmlUrlParser;
|
||||
@inject HtmlImageSourceParser HtmlImageSourceParser;
|
||||
|
||||
@{
|
||||
|
||||
var value = HtmlLocalLinkParser.EnsureInternalLinks(Model.value.ToString());
|
||||
value = HtmlUrlParser.EnsureUrls(value);
|
||||
value = HtmlImageSourceParser.EnsureImageSources(value);
|
||||
}
|
||||
|
||||
@Html.Raw(value)
|
||||
|
||||
Reference in New Issue
Block a user