更改TinyMCE中的默认字体系列 [英] Changing the default font family in TinyMCE

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

问题描述

我已使用文档这里成功更改了编辑器中的默认字体,但这会让我失望有问题。

I've successfully changed the default font inside the editor using the documentation here but that leaves me with a problem. The original default font no longer works in the font drop down list.

原始默认值:Verdana

新默认值:MyCustomFont

Original default: Verdana
New default: MyCustomFont

当我在编辑器中输入时,我默认看到我的MyCustomFont字体。如果我尝试改变到Verdana(原默认)没有任何反应。我可以改变它到任何字体系列,除了Verdana。我注意到,当我在下拉列表中选择MyCustomFont时,内容被包围着一个带有内联样式的范围。这不会发生与原来的默认字体(因此为什么没有发生任何事情)。

When I type into the editor I see my MyCustomFont font by default. If I try to change that to Verdana (original default) nothing happens. I can change it to any font family except Verdana. I noticed also that when I select MyCustomFont in the drop down list the content gets surrounded with a span with inline styles. This does not happen with the original default font (hence why nothing happens).

在我看来,有一个关键的文档缺少 - 如何告诉编辑器特别是字体特性)我在css中默认定义的字体是默认字体。

It seems to me like there's a key piece of documentation missing - how to tell the editor (the font feature in particular) that the font I've defined by default in the css is the default font.

我Googled有点,但没有结果。其他人似乎都在解决上面提到的文件。我是唯一有这个问题的人吗?如果没有,请帮助! :)

I've Googled quite a bit but had no results. Everybody else seems to be settling for the documentation mentioned above. Am I the only one having this problem? If not, please help! :)

请注意,这个问题不回答我的问题。

Please note, the answers to this question do not answer my question.

推荐答案

可能太晚了,但...

maybe too late but...

$('.tinymce').tinymce({
    setup : function(ed) {
        ed.onInit.add(function(ed) {
            ed.execCommand("fontName", false, "Arial");
            ed.execCommand("fontSize", false, "2");
        });
    }
});

EDIT

对于TinyMCE 4,作为@ jason-tolliver和@georg状态,语法是:

For TinyMCE 4, as @jason-tolliver and @georg states, the syntax is:

ed.target.editorCommands.execCommand("fontName", false, "Arial");

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

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