【问题标题】:TinyMCE strips out all html when saving using IE9使用 IE9 保存时 TinyMCE 会删除所有 html
【发布时间】:2014-06-10 08:17:58
【问题描述】:

我在 IE9 中使用 TinyMCE 文本编辑器时遇到问题。

由于某种原因,当我提交更改 (php) 时,当我使用 IE9 时,html 标签都被删除了。

据我所知,所有其他浏览器都很好,但我需要让它与 IE9 一起使用(不担心早期版本)

这是我的代码。格式可以保存到保存点 - 它会更新按键上的 textarea 内容。

<div class="myDiv">
    <input type="hidden" name="textblock_id" value="123">
    <textarea id="textblock_data" name="textblock_data" ></textarea>
</div>

<script>

var myFont = "Ubuntu=Ubuntu;Comic Sans MS=Comic Sans MS,Architects Daughter,sans-serif;Arial=arial,helvetica,sans-serif;Book Antiqua=book antiqua,palatino;Courier New=courier new,courier,monospace;Georgia=georgia,palatino;Helvetica=helvetica;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva";
if($('#navigation.website_cms').length) {
    //var myCss = "/assets/css/cms/tinymce.css";
    var myCss = '/cms_manage/get_default_font';
} else {
    if($("#wrapper.primary").length) {
        var myCss = '/assets/css/tinymce.css';
    } else {
        var myCss = '/assets/css/tinymce_secondary.css';
    }
}

$(function(){
    tinymce.init({
        selector: "#textblock_data",
        plugins: "link textcolor paste", // add " table" if needed
        paste_auto_cleanup_on_paste : true,
        paste_retain_style_properties: "*",
        menubar : false,
        statusbar: false,
        toolbar1: "bold italic underline",
        setup: function(editor) {
            editor.on('change', function(e) {
                    $("#textblock_data").html(editor.getContent());
            });
        },
        forced_root_block : false
    });

    $('#textblock_data').closest(".modal").on('hidden', function () {
      tinymce.remove('#textblock_data');
    });

});
</script>

【问题讨论】:

    标签: jquery internet-explorer tinymce internet-explorer-9 tinymce-4


    【解决方案1】:

    使用

    tinyMCE.init({
            ...
            cleanup : false
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-24
      相关资源
      最近更新 更多