定义全局变量
var webEditorHtml;
var webEditor;
//添加文本编辑器
webEditor = new FCKeditor('fckEditor');
var path = basePath+'/webEditor/';
webEditor.BasePath=path;
webEditor.Config["BaseHref"]=path;
webEditor.Config["LinkBrowserURL"] =path+'editor/filemanager/browser/default/browser.html?Connector=fckeditConnector';
webEditor.Config["ImageBrowserURL"] =path+'editor/filemanager/browser/default/browser.html?Type=Image&Connector=fckeditConnector';
webEditor.Config["FlashBrowserURL"] =path+'editor/filemanager/browser/default/browser.html?Type=Flash&Connector=fckeditConnector';
webEditor.Config["LinkUploadURL"] =path+'editor/filemanager/upload/fckeditUploader?Type=File' ;
webEditor.Config["ImageUploadURL"] =path+'editor/filemanager/upload/fckeditUploader?Type=Image';
webEditor.Config["FlashUploadURL"] =path+'editor/filemanager/upload/fckeditUploader?Type=Flash';
webEditor.Config['CustomConfigurationsPath']=basePath+'/scripts/myfckconfig.js?'+ (new Date()*1);//订制FCK 使用Date时防止无法刷新
webEditor.Height = '100%';
webEditor.Width = '100%';
webEditor.ToolbarSet="cms";
webEditorHtml=webEditor.CreateHtml();
load需要获取的时候使用
var value = form.findField('repairRequestForm.requestContent').getValue();将至从form中取出
FCKeditorAPI.GetInstance('fckEditor').SetData(value);//讲取出的值放置到fck中
当提交带有fck的form时使用
var contentValue =FCKeditorAPI.GetInstance('fckEditor').GetData();//获取FCK中的值
然后将值保存到form中
form.findField('repairRequestForm.requestContent').setValue(contentValue);
如果需要更改fck页面中图标顺序可通过修改自己的myFck.js改更改
myFck.js中的内容为:
FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/office2003/' ;
FCKConfig.ToolbarSets["cms"] = [
['-','Save','NewPage','Preview','-','Templates'],
['Cut','Copy','Paste','PasteText','PasteWord','-','Print','SpellCheck'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'],
'/',
['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'],
'/',
['Style','FontFormat','FontName','FontSize'],
['TextColor','BGColor'],
['FitWindow','ShowBlocks','-','About'] // No comma for the last row.
] ;
FCKConfig.Keystrokes = [
[ CTRL + 65 /*A*/, true ],
[ CTRL + 67 /*C*/, true ],
[ CTRL + 70 /*F*/, true ],
[ CTRL + 83 /*S*/, true ],
[ CTRL + 84 /*T*/, true ],
[ CTRL + 88 /*X*/, true ],
[ CTRL + 86 /*V*/, 'Paste' ],
[ CTRL + 45 /*INS*/, true ],
[ SHIFT + 45 /*INS*/, 'Paste' ],
[ CTRL + 88 /*X*/, 'Cut' ],
[ SHIFT + 46 /*DEL*/, 'Cut' ],
[ CTRL + 90 /*Z*/, 'Undo' ],
[ CTRL + 89 /*Y*/, 'Redo' ],
[ CTRL + SHIFT + 90 /*Z*/, 'Redo' ],
[ CTRL + 76 /*L*/, 'Link' ],
[ CTRL + 66 /*B*/, 'Bold' ],
[ CTRL + 73 /*I*/, 'Italic' ],
[ CTRL + 85 /*U*/, 'Underline' ],
[ CTRL + SHIFT + 83 /*S*/, 'Save' ],
[ CTRL + ALT + 13 /*ENTER*/, 'FitWindow' ],
[ SHIFT + 32 /*SPACE*/, 'Nbsp' ]
] ;
注意要将插件导入
如果需要插件可以留下邮箱。