【问题标题】:tinymce editor content not styled correctlytinymce 编辑器内容样式不正确
【发布时间】:2012-02-17 20:07:31
【问题描述】:

我正在为我的网站构建一个小型 web 应用程序,并包含 tinyMCE 作为可视化编辑器。 我的网站使用免费模板,并且 contentarea 的 id 为 #left_side,几乎所有样式都引用它,这在文章中是相关的。

所以编辑器有点所见即所得,但样式是错误的,因为我作为 content_css 提供的样式不适合。

我假设是,因为 #left_side id 不在 iframe 中的任何位置。

我已经用谷歌搜索了很长一段时间,发现无法让 tinyMCE 在编辑器内容周围添加一个具有此 ID 的 div,因此 css 可以工作。

我不认为这很难完成,我目前只是不知道如何...... :-/

有什么想法吗?

编辑: 内容 CSS 是这样添加的:

tinyMCE.init({
    // General options
    mode : "textareas",
    theme : "advanced",
    plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,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,

    // Example content CSS (should be your site CSS)
    content_css : "/cms/static/style/site.css",
    ....

【问题讨论】:

  • 你是如何设置 content_css 的?请提供您的 tinymce 初始化

标签: tinymce


【解决方案1】:

不确定,但也许以下配置选项之一可以做到。

请在 Skype 中查看我的其他 cmets。

【讨论】:

  • 太棒了!谢谢! “body_class”解决了这个问题,但是我不得不在我的模板和css中从ID切换到class,但这没问题。
  • TinyMCE 还有一个 body_id 选项。
  • 很好,帮了大忙
猜你喜欢
  • 2012-04-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多