Soma Posted April 5, 2012 Share Posted April 5, 2012 Since I don't know when, I got problem with the TinyMCE setting table attribute to 100%. The attribute get's stripped off when saved. All other attributes work. Anyone have same issue or know how to fix it?I'm sure it worked before. So maybe this has to do with the new TinyMCE version 3.4.7?This is the valid_elements:@[id|class],a[href|target|name|title],strong/b,em/i,br,img[src|id|class|width|height|alt],ul,ol,li,p[class],h2,h3,h4,blockquote,-p,-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],code,pre,supDoing this it works setting it always to 100%:...-table[border=0|cellspacing|cellpadding|width=100%|frame|rules|height|align|summary|bgcolor|background|bordercolor]... Solution: add the "style" attribute to the valid elements, as TinyMCE converts the width="100%" to style="width:100%". To allow it for all add it to @[id,class|style] or just the table elements. Link to comment Share on other sites More sharing options...
apeisa Posted April 5, 2012 Share Posted April 5, 2012 I tried to allow iframes. Worked fine but tinymce stripped width and height. Other attributes were fine. Link to comment Share on other sites More sharing options...
Soma Posted November 12, 2012 Author Share Posted November 12, 2012 This bug is annoying, I got now a page where someone tried to insert a table with attr 100%. After saving the table in TinyMCE is gone, but it throws an error and fails to load completely and editor stays in a state where when saving it won't really save new content. DANG! Link to comment Share on other sites More sharing options...
Soma Posted November 12, 2012 Author Share Posted November 12, 2012 Ok it wasn't the table, it is a image inserted in TinyMCE which looks like this in html: <p><img mce_advimageresize_id="Inputfield_body_mce_1" height="343" width="643" mce_src="/site/assets/files/3349/egg.jpg" src="/site/assets/files/3349/egg.jpg" /></p> I think this was because the table failed it failed to strip of the TinyMCE temporary attributes. omg. No not really, all image get inserted like this, nothing with table todo. Strange thing. Link to comment Share on other sites More sharing options...
doolak Posted January 24, 2013 Share Posted January 24, 2013 I have the same problem with some attributes, e.g. setting table width or align and text align. I tried to modify the valid_elements, i even tried to use the full set which is provided on the TinyMCE website, but it's always stripped. Any news about this problem? Link to comment Share on other sites More sharing options...
ryan Posted January 25, 2013 Share Posted January 25, 2013 I have the same problem with some attributes, e.g. setting table width or align and text align. How are you doing this? With a style attribute or actual "width" and "align" attributes? If you are using non-style attributes, it could simply be a matter of them being deprecated in HTML5/XHTML? Double check that you are using a style attribute. I honestly don't know off-hand which ones are deprecated or if TinyMCE even cares, but using the style attribute, or better yet, a dedicated class name is probably the proper way to do this stuff. See if you can find a consistently repeatable condition that we can test. Link to comment Share on other sites More sharing options...
doolak Posted January 26, 2013 Share Posted January 26, 2013 I was trying it with "width" and "align" attributes - and of course you're right: it does make sense to use just style-attributes... and they will work fine. Link to comment Share on other sites More sharing options...
doolak Posted February 7, 2013 Share Posted February 7, 2013 Again im am stuck somehow with this table width problem... How should one use TinyMCE if it is not more supported to set the width of a table or table cell? The different cells have no different CSS classes and even if they had, the person who edits the website cannot set the width in the CSS style sheet. It would be easy possible to use CSS classes e.g. for text align - but e.g. for font size or table width it is not possible. Of course i prefer to give the client just a very few options, no font size etc. - but there are some costumers who already worked with WYSIWYG and they want to have the same possibilities... I still cannot imagine that the newest TinyMCE versions do not support this anymore - in the editor it shows the preview for setting tect left, right, center and it sets the width of the table and table cells. So it has to be stripped somehow through the InputField, or not? Even if i use all the valid elements which are provided in TinyMCE it will not work. Any idea how this could be solved? Link to comment Share on other sites More sharing options...
Soma Posted February 7, 2013 Author Share Posted February 7, 2013 Add the "style" attribute to the valid_elements table. Now you can set the width and it stays. TinyMCE converts the width="100%" to a style="width:100%", and since PW default config has "style" not in valid elements it gets stripped. Ryan, can could you add that "style" to the table elements or default @[id|class]? -- BTW you can also define classes to use with the table and I also always use the excellent html templates feature of TinyMCE to create various prepared tables that has the right settings to just fill in. 1 Link to comment Share on other sites More sharing options...
doolak Posted February 7, 2013 Share Posted February 7, 2013 Thanks Soma, works perfect now for setting the table or table cell width and works for "justify left, right, center", too. Do you have any idea for the fontsize? Link to comment Share on other sites More sharing options...
Soma Posted February 7, 2013 Author Share Posted February 7, 2013 There's font size capability in TinyMCE. I'm not sure I understand. Link to comment Share on other sites More sharing options...
doolak Posted February 7, 2013 Share Posted February 7, 2013 Yes, but it is stripped out, too... Link to comment Share on other sites More sharing options...
Soma Posted February 7, 2013 Author Share Posted February 7, 2013 Maybe because you don't have "span" inside valid_elements? 1 Link to comment Share on other sites More sharing options...
doolak Posted February 7, 2013 Share Posted February 7, 2013 Perfect - thanks a lot, Soma! Link to comment Share on other sites More sharing options...
doolak Posted February 7, 2013 Share Posted February 7, 2013 As i said, i really don't like to give the costumers too much possibilities and try to avoid the WYSIWYG as much as possible - guess you all know why: ( Source: http://kopozky.net ) 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now