һ
CKEditor + CKFinder ˮˣ
CKEditor
1.ѹCKEditorwebRootĿ¼Ӧҳckeditor.js ;
2.ҳtextarea
[html];[/html]
CKFinder
3.ѹCKFinderwebRootĿ¼CKEditorͬӦҳckfinder.js ;
4.ҳscripttextarea֮
[javascript]
if (typeof CKEDITOR == undefined) {
document.write(CKEditorʧܡ);
}
else {
var editor = CKEDITOR.replace(editor1);
CKFinder.SetupCKEditor(editor, ../ckeditor/ckfinder/); //ckfinderĿ¼·.
}
[/javascript]
ϣ
jsصͬһļʵѾϺˣҪĵ£
5.\ckfinder\config.php$baseUrl = ϴĴ·; //webRootΪʼľ·Ŀ¼»ԶimagesflashĿ¼ĬwebRootĸĿ¼£עġ
ϣҪԶ棬ɽµĸģ
6.ckeditor\config.jsеCKEDITOR.editorConfigҪԶô룺
[css]
//.
config.font_names = ;_GB2312;;;;Բ;ź;Arial;
Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana; ;
//߰ť.
config.toolbar=
[
['Source','-','Save','NewPage','Preview','-','Templates'],
['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print','SpellChecker','Scayt'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
['Form','Checkbox','Radio','TextField','Textarea','Select','Button',
'ImageButton','HiddenField'],
/,
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar',
'PageBreak'],
/,
['Styles','Format','Font','FontSize'],
['TextColor','BGColor'],
['Maximize','ShowBlocks','-','About']
];
//
config.width = 500;
//߶
config.height = 400;
//Ƥ
config.skin=v2;
//ȵȡ
[/css]
װCKFinderϴ:
ڶCKFinderϴ
ڱCKEditorȫ¸İ棬ûṩļϴܣѡCKFinderǸѡ
ҪһCKEditorļµJSԴ룬imageΪFlashFilesͬ
Code
//±ߵĴһЩ
//{type:'button',id:'browse',align:'center',label:m.lang.common.browseServer,hidden:false,filebrowser:'info:txtUrl'}]}]},
//2009-07-13 ťΪʾ״̬ hidden: false,onClickڴckfinderҳ,Ĵ
{ type: 'button', id: 'browse', align: 'center', label: m.lang.common.browseServer, hidden: false, filebrowser: 'info:txtUrl', onClick: function() { var finder = new CKFinder(); finder.BasePath = '../ckfinder20090716/'; finder.SelectFunction = SetFileField; finder.Popup(); } }]}]},
ڷ±ߵĺ
//ȡ ckfinder صͼƬַ·ıԤͼƬиֵ
function SetFileField(fileUrl)
{
//ȡDivµıؼ
var inputStr = document.getElementById("cke_txtContent_dialog").getElementsByTagName("Input");
for(var i=0; i
if(inputStr[i].type=="text")
{
//һؼͼ·õIDµͼƬ·
CKEDITOR.document.getById(inputStr[i].id).setValue(fileUrl);
break ;
}
}
CKEDITOR.document.getById('previewImage').setAttribute('src', decodeURI(fileUrl));
}
CKFINDERϴ⣺֡Ϊȫԭļ. ϵϵͳԱCKFinderļ
Ϻ֡Ϊȫԭļ. ϵϵͳԱCKFinderļ
The Solution:
1. There is no write access for the default upload folder $baseUrl = '/userfiles/'; in ckfinder/config.php.
Ŀļ$baseUrl = '/userfiles/';ûдȨ
2. This is maybe because the Return value of Funcation CheckAuthentication() is always FALSE by default in ckfinder/config.php. Change the Validation Condition according to your condition, not recommend to set the return value to true directly.
Ϊڰȫckfinder/config.phpļеCheckAuthentication()ĬϷֵfalse, Ҫֶ֤, ֱӷtrue
ckeditorĬpǩܷˡ
£
ckeditorļconfig.jsм
config.shiftEnterMode = CKEDITOR.ENTER_P;
config.enterMode = CKEDITOR.ENTER_BR;
brǩġسbrǩ
config.startupMode = 'source';
ĬϽԴģʽhtmlļԼĬԴģʽһĿȻ