打開dedecms的後台添加文檔的時候,發現竟然中國字體沒有?那麼遇到這種情況我們應該怎麼辦呢?
其實辦法很簡單
DedeCMS 5.7集成了ckeditor網頁編輯器,它的原名是FCKeditor,是一個非常優秀的開源網頁編輯器,但二者的配置卻不完全相同。
下面為ckeditor網頁編輯器添加中文字體的方法:
打開include/ckeditor/ckeditor.js,搜索i.font_names,找到字體列表。添加所需的中文字體,添加後為:
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他還有緩沖沒有更新,這時候你要把
<!-- 添加下面的代碼 -->
<textarea name="body" rows="8" cols="60"></textarea>
<script type="text/javascript">//<![CDATA[
window.CKEDITOR_BASEPATH='/include/ckeditor/';
//]]></script>
<script type="text/javascript" src="/include/ckeditor/ckeditor.js?t=B8DJ5M3"></script>
<script type="text/javascript">//<![CDATA[
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"});
//]]></script>
這段代碼放到首頁更新下首頁,然後再把這段代碼去掉,這時候你到後台就可以看到你添加的字體了。
*