When I drag an image into a content area it gets rendered using a template located at /Shared/DisplayTemplates/. When I drag a block into the TinyMCE editor it gets rendered using its template. When I drag an image into the TinyMCE editor it doesn't get rendered with the template located at /Shared/DisplayTemplates.
Is there a way to achieve this? Or another way to alter the way an image is rendered when added with the TinyMCE editor?
What model do you have in your displaytemplate? Can you write the code here?
Nothing more magical than
@if (Model != null)
<img src="@Url.ContentUrl(Model)" />
The problem isn't the template, but the fact that images are handled different than blocks by the TinyMCE editor.
When you drag a block into TinyMCE it gets handled like this:
But images are handled like, well, images. I want them to be handled like blocks.
I think you might have to specify two displaytemplate, one for mediafile like this (http://tedgustaf.com/blog/2014/4/render-image-properties-in-episerver-75/) and one for the old way since it seems like it is handle the old way in TinyMCE.I have not been able to try it myself, but will do soon.
Check of this thread http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=81790
Seems to be exactly what I'm looking for, Per Magne. Thanks!
Thanks Per Magne, now I know what to do.