日期:2014-05-17  浏览次数:20590 次

OpenCms8.5.1 扩展OpenCmsHtml类型的编辑器并添加中文字体


?OpenCms8.5.1提供了两个Html编辑器,Fckeditor和Tinymce,默认为Tinymce编辑器,该编辑器功能依然很薄弱,

?

?

?

没有选择字体,字体大小,字体颜色,表格,图片等功能。可以通过如下方法对其进行扩展:

步骤1:在xsd文件的<xsd:annotation> <xsd:appinfo>节点中增加如下设置

<layouts>
  <layout element="Content" widget="HtmlWidget" configuration="bold, italic, underline, strikethrough, justifyleft, justifycenter,
 justifyright, justifyfull, styleselect, bullist, numlist, outdent, indent, undo,redo, link, unlink, image, cleanup, help, code, table,
 row_before, row_after, delete_row, separator, rowseparator, col_before, col_after, delete_col, hr, removeformat, sub, sup, formatselect,
 fontselect, fontsizeselect, forecolor,charmap,visualaid,spacer,cut,copy,paste,height:400px" />
</layouts>

??

?

?

?

此时的编辑器已经有选择字体,字体颜色,表格,插入图片等功能。

?

?

?

?

?但没有中文字体,还需如下操作。

?步骤2:

找到/system/workplace/resources/editors/tinymce/jscripts/tiny_mce/themes/advanced/editor_template.js文件中如下片段,并在红框处加入中文字体。

?

?

?发布项目,打开编辑器就会看到久违的中文字体了。



?