如何在tinymce编辑器中添加一个新的字体? [英] How to add a new font in tinymce editor?

查看:1720
本文介绍了如何在tinymce编辑器中添加一个新的字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

tinymce编辑器中添加新字体,这些显示在字体下拉列表中



我尝试在高级主题皮肤文件夹的字体文件夹中添加ttf字体,并添加 editor_template.js ,并在@ font-face的 contect.css 中添加css。

我在字体下拉列表中获得了字体名称。但是,当我适用于任何文本没有任何字体的文字效果。

什么是实际的问题,我找不到。希望这是路径问题或其他...

解决方案

我解决了这个问题,

检查下面所有可能的问题,并修复它们以在TinyMCE编辑器中添加字体。
$ b


  • 创建字体文件夹: tinymce / themes / advanced / - if不存在。


    1. 将字体放在字体tinymce / themes / advanced / fonts / aphrodite_pro.ttf。在 editor_template.js& editor_template_src.js中添加字体
    2. >theme_advanced_fonts



      例如:theme_advanced_fonts:Aphrodite Pro = aphrodite pro 在上面的两个js文件中的序列。




最重要的部分:Aphrodite Pro code> name是由我们定义的,其中aphrodite pro是字体的名称



注意这可能在TinyMCE版本4或更高版本中不起作用检查新文档: https://www.tinymce.com/docs/configure/content-fo rmatting /#font_formats


I want to add new font in tinymce editor which are display in font dropdown and apply to editor text.

I try to add ttf font in fonts folder of advance themes skin folder and also add in editor_template.js and add css in contect.css for @font-face.

I got font name in fonts dropdown. But when i apply to any text no any font effect on that text.

What is actual problem i can't found. Hope this is path issue or other...

解决方案

I solved the issue,

Check all the possible issues below and fix them to add a font in TinyMCE editor.

  • Create fonts folder : tinymce/themes/advanced/ - if not exists.

    1. Put font in fonts "tinymce/themes/advanced/fonts/aphrodite_pro.ttf.
    2. Add font in editor_template.js & editor_template_src.js include in "theme_advanced_fonts"

      Ex: theme_advanced_fonts: "Aphrodite Pro=aphrodite pro",

  • Maintain "theme_advanced_fonts" font name sequence in above both js files.

Most important part: "Aphrodite Pro" name is defined by us where "aphrodite pro" is the name of the font.

Note this might not work in TinyMCE version 4 or higher. Check new documentation: https://www.tinymce.com/docs/configure/content-formatting/#font_formats

这篇关于如何在tinymce编辑器中添加一个新的字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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