我使用的是jquery tinymce编辑器。默认字体大小为10。我喜欢更改默认字体大小。我该怎么做呢,
发布于 2010-12-13 17:36:01
您需要使用tinymce的content_css设置来设置您自己的自定义css文件(确保此设置指向css文件的有效位置)。这个文件将在初始化tinymce时插入所有其他css设置(来自内核的文件)后插入编辑器iframes头中-因此,您在文件中放置的所有设置都将覆盖之前(通过tinymce)所做的设置。
示例:将默认字体大小设置为11px。自定义css文件的内容(我在安装中将其命名为content.css ):
body {
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: 11px;
}
如何使用此设置:
tinyMCE.init({
...
// you do not need to include it yourself, tinymce will do this for you,
// but you will need to give tinymce the location of your css file
content_css : "http://www.myserver.com/css/content.css",
...
});
发布于 2015-04-13 14:17:03
我在我的项目中就是这样使用的
tinymce.init({
selector:"#txt1",
setup : function(ed)
{
ed.on('init', function()
{
this.execCommand("fontName", false, "tahoma");
this.execCommand("fontSize", false, "12px");
});
}
});
这比仅在“content.css”中更改属性值更好
发布于 2016-10-21 21:26:49
只需将此行添加到选项中
content_style: ".mce-content-body {font-size:15px;font-family:Arial,sans-serif;}",
所以它看起来是这样的
tinymce.init({
selector: "textarea",theme: "modern",width: '100%',min_height:350 ,menubar:false,
content_style: ".mce-content-body {font-size:15px;font-family:Arial,sans-serif;}",
browser_spellcheck : true,
plugins:
[
"advlist autolink link image lists charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars insertdatetime media nonbreaking",
"table contextmenu directionality emoticons paste textcolor responsivefilemanager code"
],
toolbar1: " undo redo preview code | \n\
link bold italic underline | hr | image responsivefilemanager media |unlink anchor | ",
image_advtab: true ,
external_filemanager_path:"/tinymce/filemanager/",
filemanager_title:"Responsive Filemanager" ,
relative_urls: false,
remove_script_host : false,
external_plugins: { "filemanager" : "/tinymce/filemanager/plugin.min.js"}
});
https://stackoverflow.com/questions/4427407
复制相似问题