AI OnAI Off
You should be able to use rendering tags for this by passing in a tag to the Html.DisplayFor() call, just as you can for a ContentArea. So, when rendering your XhtmlString property you can do something like this:
@Html.PropertyFor(x => x.CurrentPage.MainBody, new { Tag = "MyXhtmlStringRenderingTag" })
Then you can register the correct rendering method in your IViewTemplateModelRegistrator like this:
viewTemplateModelRegistrator.Add(typeof(MyBlockType), new TemplateModel
{
Name = "MyBlockInAnXhtmlString",
Inherit = true,
AvailableWithoutTag = false,
Tags = new[] { "MyXhtmlStringRenderingTag" },
Path = "/path/to/my/block/partial.cshtml"
});
I am using a block within TinyMCE and in the block controller, I need to know if the current block is getting rendered in the TinyMCE property or content area of IContent. As there will be different views for both the scenarios. What should I do here?