1

I have found the answer which could help to add table cell as a valid html element of a body, but it doesn't help for some reason. The reason I need this is that I would like to use this particular content as a repeated data for another content, which contains table element.

Example of the initial content:

<td>{{IMAGE}}</td>
<td><span style="font-weight: bold;">{{SHORT_DESCRIPTION}}</span></td>

And the stripped content:

{{IMAGE}}<span style="font-weight: bold;">{{SHORT_DESCRIPTION}}</span>

What I have already tried:

valid_children: "+body[style], +body[td]",
valid_elements : '+*[*]'

Any help appreciated.

Community
  • 1
  • 1
Morpheus
  • 8,829
  • 13
  • 51
  • 77
  • looks like someone on the tinymce forum was trying to do this very thing. http://www.tinymce.com/forum/viewtopic.php?id=25443. it may require you to manipulate some of the code to actually do this because tinymce is trying to maintain the HTML spec. One thing I tried playing around with was the "protect" option and setting it equal to protect: "/\<\/?(td)\>/g", but this give a really weird value when you save the source. – Da Rod Mar 03 '15 at 18:58
  • 1
    one more thing. you could could always convert it to a comment and then back to a regular TD in javascript. /**/ – Da Rod Mar 03 '15 at 19:18
  • The last comment on that post is interesting, also your second comment looks like something worth trying. Thanks, I will get back once I have tried those :) – Morpheus Mar 03 '15 at 19:50
  • hey, yet another possible solution, you could create a custom tag instead of using the td tag temporarily and then prior to adding it to the table change it back to td. – Da Rod Mar 04 '15 at 22:07
  • Would it not be okay to let each `td` have `table` around it, then remove them from the markup that TinyMCE returns? – Lucas Ross Mar 06 '15 at 07:02
  • Thanks all for comments and suggestions. I have resolved my problem - see the answer. – Morpheus Mar 08 '15 at 12:13

1 Answers1

0

After spending couple hours and digging into core of TinyMce realized that the problem is not TinyMce. The table cell element cannot be direct child of a body as of html specs.

So because TinyMce wraps content into iframe, which is another HTML page on the current page, the <td>'s are stripped out.

Instead of doing suggested steps in comments I have added another textarea which is loaded without wrapping it with TinyMce. I think doing this way is better in my case as I have multiple textareas on a page and don't want to affect them all by manipulating with javascript.

Morpheus
  • 8,829
  • 13
  • 51
  • 77