简体   繁体   English

如何在JSP页面中实现ckeditor 3 JavaScript API?

[英]how to implement ckeditor 3 javascript api in jsp page?

I have config.js file in ckeditor dir but for some reason my project's JSP page is not implementing the code form this js file. 我在ckeditor目录中有config.js文件,但是由于某些原因,我项目的JSP页面未实现此js文件的代码。 Config.js file is laoding on the page. Config.js文件正在页面上显示。

WebContent/ckeditor/config.js WebContent / ckeditor / config.js

CKEDITOR.editorConfig = function( config )
{
    config.autoGrow_minHeight = 300;
    config.autoGrow_maxHeight = 400;
    config.baseFloatZIndex = 2000;
    config.blockedKeystrokes =
        [
            CKEDITOR.CTRL + 66 /*B*/,
            CKEDITOR.CTRL + 73 /*I*/,
            CKEDITOR.CTRL + 85 /*U*/
        ];
    config.bodyId = 'Anshul_contents_id';
    config.filebrowserWindowFeatures = 'resizable=yes,scrollbars=no';

};

WebContent/index.jsp WebContent / index.jsp

<lable>Description</lable>
<div>
     <textarea cols="50" id="editor1" name="editor1" rows="7" />
</div>
<ckeditor:replace replace="editor1" basePath="ckeditor/" />

The reason it was tricky is because the Class ConfigurationHelper have static methods. 之所以棘手,是因为Class ConfigurationHelper具有静态方法。 We can call them in a specific way. 我们可以用特定的方式称呼他们。

Like calling static CKEditorConfig basic() function in ConfigurationHelper 就像在ConfigurationHelper中调用静态CKEditorConfig basic()函数一样

<%@ taglib uri="http://ckeditor.com" prefix="ckeditor" %>

CKEditorConfig ckConfig = new CKEditorConfig();
ckConfig = ConfigurationHelper.basic();

<td>Description</td>
<td>
<textarea cols="50" id="description" name="description" rows="7"></textarea>
</td>

<ckeditor:replace replace="description" basePath="ckeditor/" config="<%=ckConfig %>"/>

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

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