Use Froala Editor with JSF

2019-09-10 04:18发布

问题:

I would like to use the Froala Editor (https://www.froala.com/wysiwyg-editor) with JSF. However, having the following code, newArticleController.body gets the value null instead of the html generated by Froala:

$(function() {
  $('.articleTextarea').froalaEditor({
    toolbarButtons: ["bold", "italic", "underline", "|", "subscript", "superscript", "|", "paragraphFormat", "fontFamily", "fontSize", "|", "align", "formatOL", "formatUL", "outdent", "indent", "-", "undo", "redo", "|", "color", "emoticons", "|", "quote", "insertHR", "insertTable", "|", "createLink", "insertImage", "insertVideo", "insertFile", "|", "fullscreen", "html", "save"],
    height: 250,
    heightMax: 250
  })
});

...

<h:form>
  <h:inputTextarea value="#{newArticleController.body}" styleClass="articleTextarea"/>
  <h:commandButton value="Save" action="#{newArticleController.newArticle}"/>
</h:form>

Any idea of how to solve this?

回答1:

Finally I solved it. I was putting pt:name="content" in the inputTextarea. When I removed it, it worked.