MyFaces 2.0.2 + TinyMCE

时间:2011-09-30 10:43:39

标签: jsf tinymce wysiwyg myfaces

我最近试图在我的Myfaces应用程序中集成TinyMCE。我已经在我的webapp文件夹中下载并提取了TynyMCE。我写了以下代码:

<h:outputScript library="tiny_mce" name="tiny_mce.js" target="head" />
<h:outputScript target="head">
                tinyMCE.init({
                mode : "textareas",
                theme : "advanced",
                theme_advanced_buttons1 : "fullscreen,undo,redo,cleanup,|,formatselect,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,outdent,indent,|,link,unlink,|,forecolor",
                theme_advanced_buttons2 : "",
                theme_advanced_buttons3 : "",
                theme_advanced_toolbar_location : "top",
                theme_advanced_toolbar_align : "left",
                theme_advanced_statusbar_location : "none",
                extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
                width : "100%",
                height : "260"
                 });
</h:outputScript>
<h:inputTextarea id="myTextArea" value="#{aboutBean.aboutInfo}"
                        rows="10" cols="50" style="width: 95%" />

因此,我看到带有乐器的面板,但没有图标。The result

任何想法如何解决?

我只想补充一点,这段代码是ui:composition的一部分。

2 个答案:

答案 0 :(得分:1)

您需要将plugin parameter添加到配置中。

这可能看起来像(确保你在这里包含你需要的所有插件名):

plugins: "preview,save,searchreplace,inlinepopups,paste,wordcount,contextmenu",

答案 1 :(得分:1)

使用常规html标记加载tiny_mce.js文件时会发生什么:

<script type="text/javascript" src="#{request.contextPath}/resources/tiny_mce/tiny_mce.js"></script>

我通过替换新的 jsf2 标签解决了 jsf2 和tinymce的问题