2

我正在尝试在 TinyMCE 包装的文本字段中插入一个简单的图像链接,但它剥离了我所有的标记。我的标记看起来像:

<a class="video-launcher lightbox-video-launcher" href="http://www.youtube.com/watch?v=blah" ><span class="video-launcher-bg"></span><span class="video-launcher-button"></span></a>

我的 tinymce_config_url_init.html 看起来像:

{
  "theme_advanced_toolbar_align":"left",
  "content_css":"/media/css/cms_tinymce.css,/media/css/cms_tinymce_admin.css",
  "theme_advanced_blockformats":"p,h2,h3,div,customformat",
  "theme_advanced_statusbar_location":"bottom",
  "theme_advanced_path":false,
  "plugins":"fullscreen,paste",
  "valid_elements":"*[*]",
  "media_strict":false,
  "paste_auto_cleanup_on_paste":true,
  "theme_advanced_styles":"Header 1=header1;Header 2=header2;Header 3=header3;Table Row=tableRow1",
  "width":"680",
  "theme":"advanced",
  "theme_advanced_font_sizes":"8px,10px,12px,14px,16px,18px,20px,24px,36px",
  "theme_advanced_resizing":true,
  "height":"300",
  "relative_urls":false,
  "theme_advanced_toolbar_location":"top",
  "inline_styles":true,
  "language":"en",
  "theme_advanced_buttons1":"fullscreen,|,undo,redo,|,bullist,numlist,|,anchor,link,unlink,charmap,|,code,|,justifyleft,justifycenter,justifyright,|,image,",
  "theme_advanced_buttons3":"",
  "theme_advanced_buttons2":"removeformat,styleselect,formatselect,fontselect,fontsizeselect,|,bold,italic,underline,|,forecolor,backcolor",
  "removeformat_selector":"span,div,p,h1,h2,h3"
}

我知道问题出在 TinyMCE 上,因为如果不提交表单,只需再次单击“html”按钮,TinyMCE 的弹出窗口就不会显示任何内容。

我假设 TinyMCE 正在删除它认为看起来不安全或无效的任何内容。对于我的应用程序,它正在管理部分中使用,因此可以信任内容。如何禁用导致此标记被剥离的 TinyMCE 配置?

4

2 回答 2

0

您应该仔细查看 tinymce 配置参数valid_elements。您需要根据需要设置它们并定义有效的元素和属性。

于 2012-07-06T09:31:19.570 回答
0

也许将您网站的 css 样式表添加到"content_css"变量中?

并且还设置"paste_auto_cleanup_on_paste"为假,不是真的。

于 2012-07-05T15:58:17.647 回答