6
votes

I have been struggling for about 3 hours, both testing solutions and googled as a maniac. I haven't found any solution to this specific problem.

Problem: TinyMCE wont allow me to insert text as a direct "child" in:

<table>
<tr>
<tbody>

Example: I use TinyMCE Option > Source Code.
Input:

<table>
<tr></tr>
 *[generated]*
</table>

When I then press "OK" on the Source Code window the output is the following:

*[generated]*
<table>
<tbody>
<tr></tr>
</tbody>
</table>

What happens is that TinyMCE validates the markup as invalid and adds my "text" ([generated]) outside the table.

WHY: I want this solution because a cms engine takes the static HTML and find special elements to insert data dynamic data. The data will contain valid HTML and my [generated] tag will not exist in the generated page afterwards.

What I have done? I have been trying:

extend_valid_elements: "table[#text], table[text], tr[#text],tr[text]",
valid_elements:        "table[theader|tbody|#text|]",
valid_children:        "table[theader|tbody|#text]"

I cant possibly paste all different elements I have been trying to allow with. But now I am out of ideas. And I dont want to cook a dirty hack for this.

Is there anyone out there who can help me? My settings is all standard, I have just added som plugins.

verify_html: false, cleanup: false,

But whatever plugin/setting that makes this, I will remove.

English is not my mother tounge, but I'll hope I made myself clear.

1
i have no solution for this, but it might help to writa into the official tinymce forum. Maybe an admin or developer will repond directly to you.Thariama
Did you ever find a solution to this? I'm dealing with the same problem, and can't find anything on the tinyMCE forum.mrSpear
Try extending tbody with valid_elements: "table[theader|tbody|#text|],tbody[tr|#text]", valid_children: "table[theader|tbody|#text],tbody[tr|#text]"elixenide

1 Answers

0
votes

I have a small amount of good news for you. TinyMCE docs suggest that valid_elements and valid_children allow some special control characters. One of those characters is an allow all option.

However, it still needs to be an element which begins and ends with < > rather than #. Even better might be a comment, so

That is to say you could set valid_children to '' or '##'. Not sure how it will cope with the replacement.

I would also take a look at your cms docs. If it's clever enough to deal with html attributes you could go that route, or us html comments as mentioned above.

Finally you could use a beforeload and beforesave style function as part of MCE or in your own code to convert any #something# to and then back from.

http://www.tinymce.com/wiki.php/Configuration:valid_elements http://www.tinymce.com/wiki.php/Configuration:valid_children