TinyMCE 4 默认字体大小 [英] TinyMCE 4 default font-size

查看:79
本文介绍了TinyMCE 4 默认字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 TinyMCE 3 中,您可以通过在设置中使用以下代码来更改编辑器的默认字体大小:

In TinyMCE 3 you can change the editor's default font-size by using this code in the settings:

setup : function(ed)
{
    ed.onInit.add(function(ed)
        {
            ed.getDoc().body.style.fontSize = '14px';
        });
}

在第 4 版中,我尝试使用相同的方法但出现此错误:

In version 4, I tried using the same method but get this error:

类型错误:ed.onInit 未定义

TypeError: ed.onInit is undefined

我还尝试使用content_css"选项并将正文设置为 14px 字体大小,但这仅在预览时有效.http://www.tinymce.com/wiki.php/Configuration:content_css

I also tried using the "content_css" option and set the body to 14px font size, but that works only when on preview. http://www.tinymce.com/wiki.php/Configuration:content_css

有没有人找到另一种设置编辑器默认字体大小的方法?我找不到任何文档,即使在他们的论坛中也是如此.

Has anyone found another way to set the editor's default font size? I couldn't find any documents, even in their forum.

推荐答案

setup : function(ed)
{
    ed.on('init', function() 
    {
        this.getDoc().body.style.fontSize = '14px';
    });
}

这篇关于TinyMCE 4 默认字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆