tinymce 编辑器内容样式不正确
我正在为我的网站构建一个小型网络应用程序,并包含tinyMCE作为可视化编辑器。 我的网站使用免费模板,内容区域的 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",
....
I am building a small webapp for my website and have included tinyMCE as visual editor.
My site uses a free template and the contentarea has the id #left_side, which almost all styles refer to, that are relevant in articles.
So the editor is kind of wysiwyg, but the styles are wrong, because my styles, that I provided as content_css, won't fit.
I assume that is, because the #left_side id is not anywhere in the iframe.
I have googled for quite some time now and found no way to get tinyMCE to add for example a div with this ID around the editor content, so the css will work.
I don't think that it's hard to accomplish, I currently have just no idea how... :-/
Any ideas?
EDIT:
The content CSS is added like this:
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",
....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定,但也许以下配置选项之一可以做到这一点。
另请参阅我在 Skype 中的其他评论。
Not sure about it, but maybe one of the following configuration options could do it.
Please see also my other comments in Skype.