找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1997|回复: 0

[分享] 织梦后台编辑器添加中文字体的方法

[复制链接]
发表于 2018-8-3 09:26:18 | 显示全部楼层 |阅读模式 来自 中国–河南–新乡
打开dedecms的后台添加文档的时候,发现竟然中国字体没有?那么遇到这种情况我们应该怎么办呢? 其实办法很简单 DedeCMS 5.7集成了ckeditor网页编辑器,它的原名是FCKeditor,是一个非常优秀的开源网页编辑器,但二者的配置却不完全相同。 下面为ckeditor网页编辑器添加中文字体的方法:
1-1FP1160339341.webp

打开include/ckeditor/ckeditor.js,搜索i.font_names,找到字体列表。添加所需的中文字体,添加后为:
  1. i.font_names='Arial/Arial, Helvetica, sans-serif;Comic Sans MS/Comic Sans MS,  cursive;Courier New/Courier New, Courier, monospace;Georgia/Georgia,  serif;Lucida Sans Unicode/Lucida Sans Unicode, Lucida Grande, sans-serif;Tahoma/Tahoma,  Geneva, sans-serif;Times New Roman/Times New Roman, Times, serif;Trebuchet MS/Trebuchet MS,  Helvetica, sans-serif;Verdana/Verdana, Geneva, sans-serif; 宋体/宋体;黑体/黑体;仿宋/仿宋_GB2312;楷体/楷体_GB2312;隶书/隶书;幼圆/幼圆;微软雅黑/微软雅黑';
复制代码


需要特别注意的是:添加的字体,要写成诸如“宋体/宋体”的形式,而不是“宋体”。即“显示的字体名称/实际字体名称”的格式。 有的同学在添加完后发现后台还是原来的样子,没有增加字体啊?奇怪怎么回事呢? 这里要注意了,你更新了js后后台调用的js他还有缓冲没有更新,这时候你要把
  1. <!-- 添加下面的代码 -->
  2. &#160;&#160;<textarea name="body"&#160;rows="8"&#160;cols="60"></textarea>
  3. <script&#160;type="text/javascript">//<![CDATA[
  4. window.CKEDITOR_BASEPATH='/include/ckeditor/';
  5. //]]></script>

  6. <script&#160;type="text/javascript"&#160;src="/include/ckeditor/ckeditor.js?t=B8DJ5M3"></script>
  7. <script&#160;type="text/javascript">//<![CDATA[
  8. CKEDITOR.replace('body', {"extraPlugins":"dedepage,multipic,addon","toolbar":[["Source","-","Templates"],["Cut","Copy","Paste","PasteText","PasteFromWord","-","Print"],["Undo","Redo","-","Find","Replace","-","SelectAll","RemoveFormat"],["ShowBlocks"],["Image","Flash","Addon"],["Maximize"],"/",["Bold","Italic","Underline","Strike","-"],["NumberedList","BulletedList","-","Outdent","Indent","Blockquote"],["JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock"],["Table","HorizontalRule","Smiley","SpecialChar"],["Link","Unlink","Anchor"],"/",["Styles","Format","Font","FontSize"],["TextColor","BGColor","MyPage","MultiPic"]],"height":450,"skin":"kama"});
  9. //]]></script>
复制代码



  这段代码放到首页更新下首页,然后再把这段代码去掉,这时候你到后台就可以看到你添加的字体了。

发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;

如何回报帮助你解决问题的坛友,好办法就是点击帖子下方的评分按钮给对方加【金币】不会扣除自己的积分,做一个热心并受欢迎的人!

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则 需要先绑定手机号

关闭

站长推荐上一条 /1 下一条

QQ|侵权投诉|广告报价|手机版|小黑屋|西部数码代理|飘仙建站论坛 ( 豫ICP备2022021143号-1 )

GMT+8, 2024-11-23 03:31 , Processed in 0.042163 second(s), 7 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表