javascript-TinyMCE变成

Tinymce正在删除我的img关闭标签并产生无效的xhtml.

变成这个

<img src="image.jpg" />

入这个

<img src="image.jpg" data-mce-src="/../Index/image.jpg">

我也在使用codemagic,但是在查看html时仍显示.我也尝试过包含< img>< / img&gt ;,但是输出是相同的. 有什么想法吗? 这是我的选择

var tinyMceOptions = {
    mode: 'textareas',
    theme: 'advanced',
    element_format : "xhtml",
    plugins: 'codemagic,wordcount,inlinepopups,sparkimage, sparklink',
    theme_advanced_buttons1: 'formatselect,fontsizeselect,|, bold,italic,underline,|,bullist,numlist,|,outdent,indent,blockquote,|,forecolor,backcolor,|,justifyleft,justifycenter,justifyright,|,sub,sup,|,sparklink,sparkimage,codemagic',
    theme_advanced_buttons2: '',
    theme_advanced_buttons3: '',
    theme_advanced_toolbar_location: 'top',
    theme_advanced_toolbar_align: 'left',
    theme_advanced_resizing: true,
    theme_advanced_statusbar_location: "bottom",
    valid_elements: "*[*]",
    //extended_valid_elements :"script[language<javascript|type|src]",
    skin: 'o2k7',
    width: '575px',
    height: '350px',
    forced_root_block : false,
    theme_advanced_blockformats: 'h1,h2,h3,h4,h5,h6,p',
    relative_urls : false,
    setup : function (ed) {
        ed.onChange.add(function (ed, evt) {
            var val = $('iframe#_contentAreaID_ifr').contents().find('body').html();
                $('._hiddenContentContainer[data-contentid=' + currentTab + '] ._hiddenContentArea').val(val);
            }
        );
    }
};

解决方法:

这是TinyMCE代码本身的问题.

它从未打算与XHTML一起使用-如果您确实想将其与XHTML一起使用,则必须编辑核心.

Here is an article that might highlight how to use strict XHTML with TinyMCE

上一篇:好用的富文本编辑器TinyMCE介绍及使用


下一篇:php-使用tinymce编辑器的问题