如何在JSF上使用markdown编辑器 - Primefaces。

问题描述 投票:2回答:2

有谁知道如何在JSF上使用markdown编辑器?我知道那是可能的。

我试过那些东西,但我无法让它们工作。

http:/markitup.jaysalvat.comhome

http:/toopay.github.iobootstrap-markdown。

http:/epiceditor.com#step-4-init-epiceditor

如果你能创造一个小例子,我会非常感激。

谢谢你!

javascript jsf jsf-2 primefaces markdown
2个回答
3
投票

基于ButterFaces库中提到的Bootstrap Markdown语法的JSF实现已经完成。只需将下一个依赖项添加到Maven项目中即可。

<dependency>
  <groupId>org.butterfaces</groupId>
  <artifactId>components</artifactId>
  <version>3.4.0</version>
</dependency>

然后你就可以在JSF页面中使用它,就像这样。

<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:h="http://xmlns.jcp.org/jsf/html" 
      xmlns:f="http://xmlns.jcp.org/jsf/core" 
      xmlns:b="http://butterfaces.org/components"> 
<h:head /> 
<body>
    <h:form id="formId">
        <b:markdown id="input"
                    label="label"
                    hideLabel="false"
                    value="Hallo & < > "
                    tooltip="tooltip"
                    readonly="false"
                    required="false"
                    disabled="false"
                    placeholder="Enter text..."
                    language="en"
                    autoFocus="false"
                    rendered="true">
        </b:markdown>
    </h:form> 
</body> 
</html>

该组件的源代码可以在 GitHub.

文件资料 ..............................................................................................................................................................................................................................................


1
投票

使用 http:/markitup.jaysalvat.comhome :

下载并添加css和js文件到你的JSF Header!

现在假设你有一个像这样的表格中的textarea。

<h:form id="formID">
    <h:inputTextarea id="textAreaID" cols="10" rows="10" value="#{yourbean.textareaValue}"  >
    </h:inputTextarea>

然后通过JQuery指向它,这样:

$('#formID\\:textAreaID').markItUp(yourSettings);
© www.soinside.com 2019 - 2024. All rights reserved.