1

Topic: Table cells don't have   and causing huge problems!

I am having troubles with newly created cells not having   put into them. So what happens is if you put in text into 1 cell, save the entry to the DB, then open it again... only the cell that had text put into it is accessible. The others don't have the little dotted borders around the cells or anything. Going into the HTML and putting in   for all the blank cells does fix the problem. and then the cells become editable again. In the older versions of tinymce, I thought I remember it putting in   for new table cells. Is there a setting I am missing?

2

Re: Table cells don't have   and causing huge problems!

I noticed that the demo on the tinymce when I insert a new table and give it a width of 100%, it generates this code:

<table border="0" width="100%">
<tbody>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>

Where as my install generates this code:

<table border="0" width="100%">
<tbody>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</tbody>
</table>

So is there some setting that is stripping out the   from the tables?

These are my settings:

button_tile_map : true,
editor_selector : 'lg_mceEditor',
mode:'textareas',
theme : 'advanced',

apply_source_formatting : true,
convert_fonts_to_spans : true,
convert_newlines_to_brs : false,
fix_list_elements : true,
fix_table_elements : true,
fix_nesting : true,
forced_root_block : false,
cleanup_on_startup : true,
heading_clear_tag : 'p',
verify_html : true,
remove_trailing_nbsp : false,

relative_urls : false,
remove_script_host : true,

content_css : "/style.css",

theme_advanced_blockformats : 'p,h2,h3,h4',
theme_advanced_toolbar_location : 'top',
theme_advanced_toolbar_align : 'left',
theme_advanced_statusbar_location : 'bottom',
theme_advanced_resize_horizontal : false,
theme_advanced_resizing : true,

plugins : 'safari,pagebreak,spellchecker,style,table,inlinepopups,media,imagemanager,contextmenu,paste,'
+ 'fullscreen,nonbreaking,xhtmlxtras,advhr,advimage,advlink,paste,visualchars,nonbreaking,xhtmlxtras',
advimage_styles:'Align Left=left;Alight Right=right',
advlink_styles : 'Code=code;Excel=excel;Flash=flash;Sound=sound;Office=office;PDF=pdf;Image=image;PowerPoint=powerpoint;Word=word;Video=video',
theme_advanced_buttons1 : 'cut,copy,pastetext,pasteword,undo,redo,|,formatselect,fontsizeselect,forecolor,|,bold,italic,'
+ '|,link,unlink,|,image,cleanup,removeformat,spellchecker',
theme_advanced_buttons2 : 'bullist,numlist,outdent,indent,hr,justifyleft,justifycenter,justifyright,justifyfull,code,visualaid,fullscreen',
theme_advanced_buttons3 : 'tablecontrols',

I also have a bunch of valid_elements and entities (which I left out because there are a ton!).

3

Re: Table cells don't have   and causing huge problems!

also, I am using the newest version of tinyMCE, 3.2.0.2.

Can anyone help me out? It's driving me nuts!

4

Re: Table cells don't have   and causing huge problems!

Same problem with my tinymce 3.2.0.2 installation.

I'm waiting for a solution...

5

Re: Table cells don't have   and causing huge problems!

I'm happy to hear (in a way) that I'm not the only one!!!

I don't understand how it can be happening on all of my installations, on several different servers, and not in the example on the tinymce website.

I did however figure out a lame temporary hack to get it to insert   into table cells. I went into the plugin code here: plugins > table > js > table.js

Around line 190-195, where it creates the td's, I manually added   so that it looks like this:

for (var x=0; x<cols; x++) {
            if (!tinymce.isIE)
                html += '<td> <br mce_bogus="1"/></td>';
            else
                html += '<td> </td>';
        }

It seems to make it work, although in Firefox I can't get it to clear the cache, so it is still showing the old one. But I tested it on a different Firefox browser and it seemed to be working correctly.

6

Re: Table cells don't have   and causing huge problems!

There's still a problem: If you open the source editor, all  's in the empty table cells are stripped away.

I tried to solve the problem with tinymce's invalid code  </table></p> and changed line 200 to

    html += "</table><p> ";

Now I get something like </p></p> :-(

7

Re: Table cells don't have   and causing huge problems!

did you try modifying the code like i suggested? i am not getting any extra paragraph tags anywhere when i add a table. of course I have some settings that may take these out automatically:

fix_table_elements : true,
forced_root_block : false,

8

Re: Table cells don't have   and causing huge problems!

uclajames wrote:

did you try modifying the code like i suggested? i am not getting any extra paragraph tags anywhere when i add a table. of course I have some settings that may take these out automatically:

fix_table_elements : true,
forced_root_block : false,

Yes, I modified the code. That's ok, but the source editor (if started) still deletes the &nbsp's...

The option 'forced_root_block : false,' solves my problem with invalid HTML. Thank you!

9

Re: Table cells don't have   and causing huge problems!

you might want to try it in another browser (one that hasn't been to the site with tinymce). i was not seeing any change either until i tried it in a different browser/computer and it was working. for some reason the old code was being cached and no amount of refreshing was working.

10

Re: Table cells don't have   and causing huge problems!

It seems to be a Firefox problem. I started a 'fresh' Firefox in a virtual machine, inserted a table, opened the source code editor, and all empty cells had   inside.
Now I saved the code,
closed tinymce,
reloaded the saved code from database (with  's) into tinymce : no spaces in table cells(!),
opened source editor,
no  's in empty table cells!!!

In IE everything's okay!

Last edited by arnold (2008-11-02 17:06:52)

11

Re: Table cells don't have   and causing huge problems!

Loading content with  's from database, tinymce (in Firefox) changes

<p> </p>     to     <p><br></p>       and
<td> </td>   to     <td></td> .

How can I stop tinymce in deleting  's ?

12

Re: Table cells don't have   and causing huge problems!

Please try this out:

Add this line in your tinymce settings code:

entity_encoding: 'named',

13

Re: Table cells don't have   and causing huge problems!

Doesn't help, 'named' is the default value.

My solution:
I'm changing <td></td> to <td> </td>
and <p><br></p> to <p> </p> in my own PHP-Script before putting the code into the database.

14

Re: Table cells don't have   and causing huge problems!

You can pad empty elements using valid_elements or extended_valid_elements. Read the documentation.

Best regards,
Spocke - Main developer of TinyMCE

15

Re: Table cells don't have   and causing huge problems!

Works with <td></td>. Thank you.

But '<p> </p> is still converted to '<p><br></p>'.

16

Re: Table cells don't have   and causing huge problems!

I have the following valid_elements definition and the tds are not padded with an   though td is prefixed with "#":

    valid_elements : "@[id|class|title|dir<ltr?rtl|lang|xml::lang],"
    + "a[rel|rev|charset|hreflang|tabindex|accesskey|type|"
    + "name|href|target|title|class],strong/b,em/i,strike,u,"
    + "#p,-ol[type|compact],-ul[type|compact],-li,br,img[style|longdesc|usemap|"
    + "src|alt=|title|hspace|vspace|width|height|align],-sub,-sup,"
    + "-blockquote,-table[border=0|cellspacing|cellpadding|width|frame|rules|"
    + "height|align|summary],-tr[rowspan|width|"
    + "height|align|valign],tbody,thead,tfoot,"
    + "#td[colspan|rowspan|width|height|align|valign"
    + "|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,"
    + "-span[class],-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],"
    + "dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],"
    + "object[classid|width|height|codebase|*],param[name|value|_value],embed[type|width"
    + "|height|src|*],map[name],area[shape|coords|href|alt|target],bdo,"
    + "button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|"
    + "valign|width],dfn,fieldset,"
    + "kbd,label[for],legend,optgroup[label|disabled],option[disabled|label|selected|value],"
    + "q[cite],samp,select[disabled|multiple|name|size],small,tt,var,big"

17

Re: Table cells don't have   and causing huge problems!

I found out, it's only working when setting "cleanup_on_startup : true". But it's working now!