简体   繁体   English

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

[英]How to use a markdown editor on JSF - Primefaces

Does someone knows how to use a markdown editor on JSF?有人知道如何在 JSF 上使用 Markdown 编辑器吗? I know that's possible.我知道这是可能的。

I tried those stuff, but I couldn't make them to work.我尝试了这些东西,但我无法让它们工作。

http://markitup.jaysalvat.com/home/ http://markitup.jaysalvat.com/home/

http://toopay.github.io/bootstrap-markdown/ http://toopay.github.io/bootstrap-markdown/

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

I'll really appreciate if you can create a little example.如果您能创建一个小示例,我将不胜感激。

Thank you!!谢谢!!

Exists already finished JSF implementation of markdown syntax based on mentioned Bootstrap Markdown in library ButterFaces.存在已经基于库 ButterFaces 中提到的 Bootstrap Markdown 完成 Markdown 语法的 JSF 实现。 Just add next dependency to Maven project:只需将下一个依赖项添加到 Maven 项目:

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

And than you can use it in JSF page like this:然后你可以像这样在 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>

Sources of this component can be found on GitHub .该组件的来源可以在GitHub找到

Documentation文档

Using http://markitup.jaysalvat.com/home/ :使用http://markitup.jaysalvat.com/home/

download it and add css and js Files to your JSF Header!下载它并将 css 和 js 文件添加到您的 JSF Header 中!

now assume you have a textarea in a form like this:现在假设你有一个像这样形式的 textarea:

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

then point to it via JQuery this way:然后通过 JQuery 以这种方式指向它:

$('#formID\\:textAreaID').markItUp(yourSettings);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM