AddThis标记未显示在TinyMCE html编辑器中

时间:2011-06-20 04:27:32

标签: asp.net html tinymce addthis

我有一个我设计的内容管理系统,它使用XML文件作为基础。除了AddThis的标记没有出现在tinymce编辑器中之外,所有内容都已完成且运行良好。它甚至不会出现在HTML视图中。这不是什么大不了的事,除非用户编辑页面的那一部分,它会删除addthis控件。

有什么想法吗?

以下是标记在页面和xml文件中的用法:

<div style="float: left; margin-top: 1px; font-family: arial; color: #005396; margin-left: 3px; font-size: medium; margin-right: 200px;">Join Our Mailing List</div>
      <div style="clear: right; float: right;">
        <div style="text-align: center; margin-top: 8px; font-family: arial; clear: left; float: left; color: #333333; font-size: large; vertical-align: middle;">Check Out _ Weekly <br /><span style="font-family: arial; color: #005396; font-size: large;">National Polling Summary </span></div>
        <div class="addthis_toolbox addthis_default_style addthis_32x32_style" style="float: right; padding-top: 15px;">
          <a class="addthis_button_facebook"></a>
          <a class="addthis_button_twitter"></a>
          <a class="addthis_button_email"></a>
          <a class="addthis_button_compact"></a>
        </div>
      </div>

这是在tinymce的HTML部分

<div style="float: left; margin-top: 1px; font-family: arial; color: #005396; margin-    left: 3px; font-size: medium; margin-right: 200px;">Join Our Mailing List</div>
<div style="clear: right; float: right;">
<div style="text-align: center; margin-top: 8px; font-family: arial; clear: left;     float: left; color: #333333; font-size: large; vertical-align: middle;">Check Out _    Weekly <br /><span style="font-family: arial; color: #005396; font-size: large;">National   Polling Summary </span></div>
</div>

这是我的tinymce init:

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

    // 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,restoredraft",
    theme_advanced_toolbar_location: "top",
    theme_advanced_toolbar_align: "left",
    theme_advanced_statusbar_location: "bottom",
    theme_advanced_resizing: true,
    relative_urls: false,
    editor_deselector : "mceNoEditor",


    // Example content CSS (should be your site CSS)
    // using false to ensure that the default browser settings are used for best Accessibility
    // ACCESSIBILITY SETTINGS
    content_css: "Symba/Styles/CSS/Site.css",        
    // Use browser preferred colors for dialogs.
    browser_preferred_colors: true,
    detect_highcontrast: true,

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

    // Style formats
    style_formats: [
        { title: 'Bold text', inline: 'b' },
        { title: 'Red text', inline: 'span', styles: { color: '#ff0000'} },
        { title: 'Red header', block: 'h1', styles: { color: '#ff0000'} },
        { title: 'Example 1', inline: 'span', classes: 'example1' },
        { title: 'Example 2', inline: 'span', classes: 'example2' },
        { title: 'Table styles' },
        { title: 'Table row 1', selector: 'tr', classes: 'tablerow1' }
    ],

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

更新

好的我尝试将其添加到init函数

 valid_elements: "*[*]",
 extended_valid_elements: "*[*]"

然后把div带回来了,但我仍然没有得到锚标签。

1 个答案:

答案 0 :(得分:3)

FCKEditor和Tinyeditor默认删除空元素。尝试向你的锚点添加空格,如下所示:

<a class="addthis_button_facebook">&nbsp;</a>           
<a class="addthis_button_twitter">&nbsp;</a>           
<a class="addthis_button_email">&nbsp;</a>           
<a class="addthis_button_compact">&nbsp;</a>


<div style="float: left; margin-top: 1px; font-family: arial; color: #005396; margin-left: 3px; font-size: medium; margin-right: 200px;">Join Our Mailing List</div>
<div style="clear: right; float: right;">
<div style="text-align: center; margin-top: 8px; font-family: arial; clear: left; float: left; color: #333333; font-size: large; vertical-align: middle;">Check Out _ Weekly <br />
<span style="font-family: arial; color: #005396; font-size: large;">National Polling Summary </span></div>
<div style="float: right; padding-top: 15px;" class="addthis_toolbox addthis_default_style addthis_32x32_style">
<a class="addthis_button_facebook">&nbsp;</a>           
<a class="addthis_button_twitter">&nbsp;</a>           
<a class="addthis_button_email">&nbsp;</a>           
<a class="addthis_button_compact">&nbsp;</a>
</div>
</div>