While I setup everything to get the tpl button in tiny, and being happy it works puddy well displaying the html templates I made...
Once chosen, the tpl code is here in the template plugin pop up windows (I can inspect its html markup)
But:
as soon as it is validated and inserted in the editing area of tiny, I can see this code as been "cleaned" and the only thing actually inserted in the doc is a new
(whatever the tpl html was).
Really need a solution.
Thank you
Activity
kudykam commentedon Aug 16, 2012
Same problem here... :-(
case303 commentedon Aug 28, 2012
Same problem also..
Tracing through template/editor_plugin.js thinking this is where the problem might lay. I stumbled upon this.. http://forums.modx.com/index.php?topic=61467.msg%msg_id%
However, it did not solve my issue..
Tracing through tiny_mce_src.js I discovered around line 11743:
t.getContent({format : 'raw'}) is only returning my templates root element..
Any ideas why this is happening?
case303 commentedon Aug 28, 2012
I am using Joomla! with tinymce version: 3.5.2. However, found some success editing tiny_mce.js
Specific edits:
approx. line #11251
and
approx. line #2831
setContent() was never called within mceInsertContent, only setHTML().
It appears to me that tinymce's parse function is not comparing inserted elements with acceptable elements correctly.. thinking standard tags were invalid.. Also, stripping templates tags when serializing..
Hopefully this leads to a proper solution..
wuuti commentedon Nov 21, 2012
Hey, is it html5 code you have in your template? It seems to be cleaned up by tiny (the version used by the modx package). See: http://forums.modx.com/thread/?thread=78709&page=1
LucyI commentedon Sep 12, 2013
I have the same issue using TinyMCE 4.3.3, Revo 2.2.7-pl. If I have HTML5 tags in the template they are stripped out completely, which I expected because I don't think TinyMCE supports HTML5 yet. But when I use lowly old paragraph tags in the template, with content in between the tags such as images or text, the content is stripped out and the paragraph tags are inserted empty. Before inserting the template it displays in the preview window perfectly.
keidzi commentedon Jan 23, 2014
Had the same issue using TinyMCE 4.3.3, Revo 2.2.10-pl. Found that template content is stripped when it contains HTML attribute class.
For example, my template contained:
As usual - it showed up in preview, but after clicking Insert button everything was gone. Nothing really was inserted.
After removing class atribute, my template looked like this:
This was working fine. But didn't satisfied my needs. I desperately needed a template with class attribute.
Found a solution. You need to provide some class name for this setting: tiny.template_selected_content_classes
It's empty by default and that's why template content is stripped. When you enter some CSS class name (I used fake one), everything works great again. So my setting looked like this:
Important! Dot (.) before class name is the key. When using class name like this: fakeCssClass (without dot in front), nothing worked.
Hope this helps!