简体   繁体   English

CKEditor不显示任何工具栏

[英]CKEditor not showing any toolbar

I declare my CKEditor with this code : 我用以下代码声明CKEditor:

<ckeditor width="600px" id="ckeditorMessage" visible="true" customConfigurationsPath="/styles/js/config.js">                                    
    <attribute name="value">
    </attribute>
</ckeditor>

According to all tutorials I found, it is enough to show the CKEditor. 根据我发现的所有教程,足以显示CKEditor。 But, my CKEditor just showed like this: 但是,我的CKEditor只是这样显示:

I build it inside ZK Framework 7 and the CKEditor version is 4. 我在ZK Framework 7中构建它,而CKEditor版本是4。

This error appear in my console. 此错误出现在我的控制台中。 Hope this help 希望这个帮助

错误

maven dependecies in build path. 专家在构建路径中的依赖。 There is ckez in there: 那里有ckez: 依赖

try this instead, in your .java file insert this code: 尝试这样,在您的.java文件中插入以下代码:

public static CKEditorConfig createConfig() 
{
    CKEditorConfig config = new CKEditorConfig();       
    List<List<String>> list = new ArrayList<List<String>>();
    List<String> subList = new ArrayList<String>();
    subList.add("Source");
    subList.add("-");
    subList.add("Bold");
    subList.add("Italic");
    subList.add("BulletedList");
    list.add(subList);
    config.addConfigValue("toolbar", list);     

    return config;
} 

} }

and put this to your jsp file 并把它放到你的jsp文件中

<% CKEditorConfig textArea = new CKEditorConfig();
    textArea = CKEditor.createConfig();
    textArea.addConfigValue("width", "700");
    textArea.addConfigValue("height", "350");       %>
        <textarea id="txtDescription" name="txtDescription"></textarea>
    <ckeditor:replace replace="txtDescription" basePath="CKEditor/" config="<%=textArea%>"></ckeditor:replace><br><br>

Could you try this version : 你可以试试这个版本:

<dependency>
    <groupId>org.zkoss.zkforge</groupId>
    <artifactId>ckez</artifactId>
    <version>4.4.6.1</version>
</dependency> 

Oke, I checked your project, removing all the redundant dependencies and it came to this POM : 好的,我检查了您的项目,删除了所有多余的依赖项,它涉及到这个POM:

<dependencies>
    <!-- Zkoss dependencies -->
    <dependency>
        <groupId>org.zkoss.zk</groupId>
        <artifactId>zk</artifactId>
                     <version>7.0.4</version>
    </dependency>
    <dependency>
        <groupId>org.zkoss.zk</groupId>
        <artifactId>zul</artifactId>
                    <version>7.0.4</version>
    </dependency>
    <dependency>
        <groupId>org.zkoss.zk</groupId>
        <artifactId>zkplus</artifactId>
                    <version>7.0.4</version>
    </dependency>
    <dependency>
        <groupId>org.zkoss.zk</groupId>
        <artifactId>zkbind</artifactId>
                    <version>7.0.4</version>
    </dependency>
    <dependency>
        <groupId>org.zkoss.zk</groupId>
        <artifactId>zhtml</artifactId>
                    <version>7.0.4</version>
    </dependency>
    <dependency>
        <groupId>org.zkoss.zk</groupId>
        <artifactId>zkmax</artifactId>
                    <version>7.0.4</version>
    </dependency>
    <dependency>
        <groupId>org.zkoss.zk</groupId>
        <artifactId>zkex</artifactId>
                    <version>7.0.4</version>
    </dependency>
    <dependency>
        <groupId>org.zkoss.common</groupId>
        <artifactId>zweb</artifactId>
                    <version>7.0.4</version>
    </dependency>
    <!-- ckeditor -->
    <dependency>
        <groupId>org.zkoss.zkforge</groupId>
        <artifactId>ckez</artifactId>
                    <version>4.4.6.1</version>
    </dependency>
</dependencies>

Zul page : Zul页面:

<window title="new page title" border="normal" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('be.chillworld.TestVM')">
    <ckeditor customConfigurationsPath="/js/ckeditor-config.js" value="@bind(vm.text)"></ckeditor>
</window>

With the folder js is under Web Pages . js文件夹位于Web Pages

Content of javascript file : javascript文件的内容:

CKEDITOR.editorConfig = function(config) {
    config.resize_enabled = false;
    config.toolbar = 'Complex';
    config.toolbar_Simple = [[ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', '-', 'About' ] ];
    config.toolbar_Complex = [[ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript','Superscript', 'TextColor', 'BGColor', '-', 'Cut', 'Copy', 'Paste', 'Link', 'Unlink'],
                              [ 'Undo', 'Redo', '-', 'JustifyLeft', 'JustifyCenter','JustifyRight', 'JustifyBlock' ], 
                              [ 'Table', 'SpecialChar','Styles', 'Format', 'Font', 'FontSize', 'Maximize'] ];
   //config.fontSize_defaultLabel = '12'; // set font size label to 12.
   //config.font_defaultLabel = 'Arial'; // set font family label to arial.
   config.removePlugins = 'elementspath'; // remove bottom bar

};

And I get for both ckez versions the complete ckeditor in the screen. 对于这两种ckez版本,我都会在屏幕上获得完整的ckeditor。
Now, there is a javaScript error when using the 3.6.0.1, what we don't have in the 4.4.6.1 version. 现在,使用3.6.0.1时出现javaScript错误,这是4.4.6.1版本中没有的错误。

Now, I tested a little more and added a fault in the ckeditor-config.js what resulted in the same issue as you have => no more toolbar, but other js fault. 现在,我进行了更多测试,并在ckeditor-config.js添加了一个错误,导致与您有相同的问题=>没有更多的工具栏,但是其他js错误。

So try the posted ckeditor-config.js file, and put it in the correct place. 因此,请尝试发布的ckeditor-config.js文件,并将其放在正确的位置。
See in tab network of developertools that the ckeditor-config.js has status 200, so we know it's loaded. 在developertools的标签网络中,ckeditor-config.js的状态为200,因此我们知道它已加载。
If that doesn't work, try it without the js file, this should be resulting in a full toolbar. 如果这不起作用,请在没有js文件的情况下进行尝试,这将导致工具栏完整。

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

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