Try our conversational search powered by Generative AI!

Can drag blocks in xhtml property but not image media (renders as image)

Vote:
 

I have set upp a rule in my template-selector class, like this.

            viewTemplateModelRegistrator.Add(typeof(VimeoBlock), new TemplateModel
            {
                Name = "MyTemplate",
                Default = true,
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialController,
                TemplateType = typeof(MyTemplatePartialController),
                AvailableWithoutTag = true,
                Tags = null,
                Path = "~/Views/Shared/Partials/_MyView.cshtml"
            });

The view exits and to make it simple my controller looks like this ->

    public class MyTemplatePartialController : ActionControllerBase
    {
        // GET: MyTemplatePartial
        public ActionResult Index(VimeoBlock currentContent)
        {
            return Content("My content");
        }
    }

Now when I drag a "VimeoBlock" into a xhtml property it renders with the content "my content" as expected. (in html )

BUT if I swap all references from VimeoBlock to ImageMedia (inheritd ImageDate) like this.

            viewTemplateModelRegistrator.Add(typeof(ImageMedia), new TemplateModel
            {
                Name = "MyTemplate",
                Default = true,
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialController,
                TemplateType = typeof(MyTemplatePartialController),
                AvailableWithoutTag = true,
                Tags = null,
                Path = "~/Views/Shared/Partials/_MyView.cshtml"
            });
    public class MyTemplatePartialController : ActionControllerBase
    {
        // GET: MyTemplatePartial
        public ActionResult Index(ImageMedia currentContent)
        {
            return Content("My content");
        }
    }

The result in html is this -> 

which is what I would expect if i cklick the TinyMCE image icon and choose an image. Not when dragging a content into the xhtml string. 

Thanks for the help.

PS. I have version 10.4.1 and when comparing to an older project with version 8.x.x I can't see what I do differently and it works in the older project.

#175153
Feb 14, 2017 9:14
Vote:
 

Does VimeoBlock inherit from BlockData?

You can tell Episerver what should happen if you drag n' drop content in TinyMCE:

[UIDescriptorRegistration]
public class VimeoUIDescriptor : UIDescriptor<VimeoBlock>, IEditorDropBehavior
{
    public VimeoUIDescriptor()
    {
        this.EditorDropBehaviour = EditorDropBehavior.CreateContentBlock;
    }

    public EditorDropBehavior EditorDropBehaviour { get; set; }
}
#175170
Feb 14, 2017 12:53
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.