在jsf页面中使用ckeditor [英] Using ckeditor in jsf page

查看:205
本文介绍了在jsf页面中使用ckeditor的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在jsf页面中使用自定义CKEditor?我有很多麻烦,试图实现它。我做了什么:

How do I use a custom CKEditor in a jsf page ? I'm having lots of trouble trying to implement it. What I did:

test.xhtml网页:

test.xhtml page:

<script src="/ckeditor/ckeditor.js"></script>
     <form>
        <textarea name="editor1" id="editor1" rows="10" cols="80"/>

        <script>

        CKEDITOR.replace( 'editor1');
        </script>
    </form>

不工作,只是有一个标准的textarea。所以我将src更改为:

Not working, just had a standard textarea. So I changed the src to:

<script src="ckeditor/ckeditor.js"></script>

这是工作,但它不是我的自定义CKEditor构建它是香草一个。

It's was working but it wasn't my custom CKEditor build it was the vanilla one.

所以我使用了h:OutputScript标签。 (我在同一个项目中有2个ckEditor文件夹,以便于在测试时访问):

So I used the h:OutputScript tag. (I had 2 ckEditor folders in the same project to facilitate access while testing):

<h:outputScript library="script/ckeditor" name="ckeditor.js"></h:outputScript>

textarea刚刚消失。我的textarea只是消失。它找到脚本,因为如果我把一个错误的脚本名称我的textarea是备份。

The textarea just disappears. My textarea just disappears. It finds the script because if I put a wrong script name my textarea is back up.

所以我删除了CKeditor文件夹...有魔术发生:仍然工作时使用此:

So I deleted the CKeditor folders... And there the magic happenned: It was still working when using this :

<script src="ckeditor/ckeditor.js"></script>

我的项目中没有ckeditor.js文件,但脚本正在工作。

I had zero ckeditor.js file in my project and yet the script was working.

然后我在pom.xml中尝试了这个扩展:

Then I tried the primefaces extension with this in pom.xml:

    <dependency>
        <groupId>org.primefaces.extensions</groupId>
        <artifactId>primefaces-extensions</artifactId>
        <version>3.1.0</version>
    </dependency>

这在xhtml:

<pe:ckEditor id="editor" value="" checkDirtyInterval="0">  
</pe:ckEditor>  

但结果是标准的html textarea框。如何使用它?

But the result was the standard html textarea box again. How can I use it ?

推荐答案

我切换到前缀扩展

这些是所需的依赖项(我忘记了第二个,这就是为什么它不工作):

Those are the dependencies needed (I forgot the second one that's why it wasn't working):

<dependency>
    <groupId>org.primefaces.extensions</groupId>
    <artifactId>primefaces-extensions</artifactId>
    <version>3.1.0</version>
</dependency>
<dependency>
    <groupId>org.primefaces.extensions</groupId>
    <artifactId>resources-ckeditor</artifactId>
    <version>3.1.0</version>
</dependency>

然后xhtml文件中的命名空间:

then the namespace in the xhtml file:

xmlns:pe="http://primefaces.org/ui/extensions"

这里是一个链接

如果您不使用primefaces,您可以按照w vd L的注释使其工作

If you are not using primefaces you can make it work by following the comment of w vd L

这篇关于在jsf页面中使用ckeditor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆