tinymce不服从extend_valid_elements

时间:2011-02-07 10:33:36

标签: configuration iframe tinymce

我正在尝试设置tinyMCE,以便它可以与谷歌地图iframe一起使用。 TinyMCE清理程序剥离了iframe。

所以我找到了一个解决方案herethere,它说我需要在tinyMCE.init中插入一个extend_valid_elements : "iframe",

但无论如何,它会剥离我的iframe。我尝试添加iframeiframe[*]iframe[src|width|height|name|align],但无效。但是,如果我更改cleanup = false,则不会删除iframe。但我宁愿以正确的方式去做。

我的

tinyMCE.init({
        theme : "advanced",
        mode : "textareas",
        editor_selector : "rte",
        convert_urls : false,
        content_css : "<?php echo $html->url("/css/rte.css") ?>",
        plugins : "table, paste, xhtmlxtras, safari",
        file_browser_callback : "tinyBrowser",
        theme_advanced_buttons1 : "bold,italic,underline,separator,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,sub,sup,link,unlink,image,pastetext, pasteword, selectall, forecolor, backcolor,acronym,del,formatselect,fontsizeselect",
        theme_advanced_buttons2 : "tablecontrols,cleanup,removeformat,code",
        theme_advanced_buttons3 : "",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_path_location : "bottom",
        paste_auto_cleanup_on_paste : true,
        theme_advanced_resizing : false,
        handle_event_callback: function CleanupHTML_callback(e)
        {
                if (e.ctrlKey && e.keyCode == 86 && e.type != "keyup")
                {
                        setTimeout('tinyMCE.execInstanceCommand("'+e.target.editorId+'", "mceCleanup", true)',1);
                        //return false;
                }
                return true;
        },
        force_p_newlines : false,
        force_br_newlines : true,
        convert_newlines_to_brs : false,
        remove_linebreaks : false,
        cleanup_on_startup : false,
        extend_valid_elements : "iframe[src|width|height|name|align]",
        //invalid_elements : "script,onclick,ondblclick,onkeydown,onkeypress,onkeyup,onmousedown,onmousemove,onmouseout,onmouseover,onmouseup,font",
        height: "500"
});

1 个答案:

答案 0 :(得分:1)

您需要使用正确的名称extended_valid_elements正确设置配置参数,而不是extend_valid_elements。