开发者

Tinymce strips attributes on submit

Tinymce loses my inline styles from all elements. I've tried pretty much everything.

    language : "fi",
    theme : "advanced",
    plugins : "style,paste,table,media,layer,fullscreen,autoresize",
    theme_advanced_disable : "help,sub,sup,anchor",
    theme_advanced_buttons1_add : "styleprops,fontselect,fontsizeselect,forecolor",
    theme_advanced_buttons2_add : "pastetext,pasteword",
    theme_advanced_buttons3 : "tablecontrols,hr,removeformat,media,fullscreen",
    remove_linebreaks : true,
    remove_trailing_nbsp : true,
    relative_urls : false,
    remove_script_host : false,
    entity_encoding : "raw",
    fix_n开发者_如何转开发esting: true,
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_resize_horizontal : true,
    theme_advanced_resizing : true,
    theme_advanced_path_location : "bottom",
    file_browser_callback : 'myFileBrowser',
    valid_elements : '*[*]',
    inline_styles : true

I can't think there's much more things to allow user to do. But still. When i click my table, open properties, change width to 600 and look at HTML, it says style="width: 600px".

BUT, when i submit it, next page will not get that style attribute. This is making me mad and i don't know where to look, because pretty much anything i've done, has changed nothing. Is there a problem with my syntax that i can't see, because i'm too pissed or something? Any other ideas?

Thanks


On special events the editors content gets written back to the former html element. Tinymce has a built-in cleanup functionality which will cleanup your content depending on your tinymce settings (this usually happens onSave and onSubmit). You will have to check the following tinymce settings:

  • valid_elements
  • valid_children

Make sure tables can have the width attribute.


I use the following config and have nosuch kind of problems:

tinyMCE.init({
        // General options
        mode : "textareas",
        theme : "advanced",
        plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

        // Theme options
        theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
        theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
        theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
        theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true,

        // Example content CSS (should be your site CSS)
        content_css : "css/example.css",

        // Drop lists for link/image/media/template dialogs
        template_external_list_url : "js/template_list.js",
        external_link_list_url : "js/link_list.js",
        external_image_list_url : "js/image_list.js",
        media_external_list_url : "js/media_list.js",

        // Replace values for the template plugin
        template_replace_values : {
                username : "Some User",
                staffid : "991234"
        }
});

Do you think that you have to set valid_elements? I haven't it set and works fine fore me. May be the default settings works better. tinyMCE minorVersion:"3.9.3",releaseDate:"2010-12-20"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜