Follow these 4 simple steps.
Step 1.Add below line on your page
.
Step 2.Create hidden variable to set the value of CK editor like below
Step 3.Add javascript init method like this
function initEditor() {
return “”;
}
Step 4:On submiting form we can assign CK editor value like this
function saveEntry() {
var message = window.editor.getHTML();
document.fm.content.value = message;
submitForm(document.fm);
}
Currently we are having problem in liferay 6.0 is that when we refresh CK editor page , it gives JS error.
For that fix is like this get html/js/editor/ckeditor.jsp in function initCkArea() comment line 52 and 53 which starts with CKEDITOR.config.toolbar and CKEDITOR.config.customConfig respectively and add below line
ckEditor.setData(parent.());
In the same file comment line number 131 i.e
initCkArea(); and add
if (parent.AUI) {
parent.AUI().on(‘domready’, initCkArea);
}
In side CKEDITOR.replace method at line number 123 in same file comment line starts with filebrowserBrowseUrl , filebrowserUploadUrl and
add below code
customConfig: ‘/html/js/editor/ckeditor/ckconfig.jsp?p_l_id=&p_p_id=&p_main_path=&doAsUserId=&cssPath=&cssClasses=’,
filebrowserBrowseUrl: ‘/html/js/editor/ckeditor/editor/filemanager/browser/liferay/browser.html?Connector=’,
filebrowserUploadUrl: null,
toolbar: ”
Finally add required import i.e
and one extra variable
String portletId = ParamUtil.getString(request, “p_p_id”);