Primefaces-扩展名ckeditor-缺少工具栏 [英] Primefaces-extensions ckeditor - missing toolbar

查看:101
本文介绍了Primefaces-扩展名ckeditor-缺少工具栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的JSF应用程序中使用primefaces-扩展名ckEditor,如此处.我将依赖项添加到了pom.xml:

I am trying to use the primefaces-extensions ckEditor in my JSF application, as described here. I added the dependency to my pom.xml:

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

这是我的看法:

<p:growl id="editorgrowl" showDetail="true" />
<pe:ckEditor id="editor" value="#{mbEditorController.content}"
    toolbar="[['Cut','Copy','Paste','PasteText','PasteFromWord','-', 'SpellChecker', 'Scayt']]">
    <p:ajax event="save"
        listener="#{mbEditorController.saveListener}"
        update="editorgrowl" />
</pe:ckEditor>

这是控制器(托管bean):

This is the controller (managed bean):

@ManagedBean(name = "mbEditorController")
@ViewScoped
public class EditorView implements Serializable {

    private static final long serialVersionUID = 6822767317343704211L;

    private String content;

    private String secondContent;

    public EditorView() {
        content = "Type in your text here...";
        secondContent = "This is a second editor";
    }

    public void saveListener() {
        content = content.replaceAll("\\r|\\n", "");
        final FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Content",
                content.length() > 150 ? content.substring(0, 100) : content);
        FacesContext.getCurrentInstance().addMessage(null, msg);
    }

    public void secondSaveListener() {
        secondContent = secondContent.replaceAll("\\r|\\n", "");
        final FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Second Content",
                secondContent.length() > 150 ? secondContent.substring(0, 100) : secondContent);
        FacesContext.getCurrentInstance().addMessage(null, msg);
    }

    // getters, setters
}

不幸的是,我看不到工具栏,只能看到一个文本输入区域,如下面的屏幕截图所示:

Unfortunately I can't see a toolbar, but just a text input area, as you can see in the following screenshot:

更新

我的控制台中有一个JavaScript错误:

There is a javascript error in my console:

http://localhost:8080/MyApp/javax.faces.resource/ckeditor/ckeditor.js.xhtml?ln=primefaces-extensions&v=4.0.0 Failed to load resource: the server responded with a status of 404 (Not Found)

是什么原因引起的?我想念什么吗?

What could cause the problem? Am I missing something?

推荐答案

添加以下依赖项:

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

这篇关于Primefaces-扩展名ckeditor-缺少工具栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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