我的xhtml视图中有一个rich:editor字段,它的默认字体大小为11.就像这样:
<rich:editor id="editor_value"
configuration="#{editorBean.currentSimpleConfiguration}"
width="560" height="130" viewMode="#{editorBean.viewMode}"
value="#{bean.value}">
我想更改默认字体大小并将其缩小。
我知道我可以使用“f:param”这样做:
<rich:editor id="editor_value"
configuration="#{editorBean.currentSimpleConfiguration}"
width="560" height="130" viewMode="#{editorBean.viewMode}"
value="#{bean.value}"/>
<f:param name="font_size" value="13px"/>
</rich:editor>
或将分配“font_size = 13px”放入我的“simple.properties”文件中(在“configuration =”#{editorBean.currentSimpleConfiguration}“”中引用)
但这些解决方案无效,字体大小继续为11px ......
任何人都知道我错在哪里?
很多
答案 0 :(得分:1)
您需要使用config facet并遵循CKEditor说明:http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html
示例:
<rich:editor value="Test de contenu">
<f:facet name="config">
contentsCss: '#{facesContext.externalContext.requestContextPath}/resources/rich.css',
toolbar: 'custom',
language: 'fr',
startupFocus: true,
toolbar_custom:
[
{ name: 'document', items : [ 'NewPage','Preview' ] },
{ name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
{ name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','Scayt' ] },
{ name: 'insert', items : [ 'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'
,'Iframe' ] },
'/',
{ name: 'styles', items : [ 'Styles','Format' ] },
{ name: 'basicstyles', items : [ 'Bold','Italic','Strike','-','RemoveFormat' ] },
{ name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote' ] },
{ name: 'links', items : [ 'Link','Unlink','Anchor' ] },
{ name: 'tools', items : [ 'Maximize' ] }
]
</f:facet>
</rich:editor>
并创建自定义内容css:
body,
p
{
font-family: Arial;
font-size: 16px;
font-weight: bold;
}
希望这有帮助!
答案 1 :(得分:0)
只需将content_css
参数添加到<rich:editor>
并将其指向您的样式表,然后在其中定义样式。
<rich:editor>
<f:param name="content_css" value="resources/myStyles.css"/>
</rich:editor>
现在在 myStyles.css 中定义您的样式,如下所示。
body {
color:red;
font-size:20px;
}