请问使用CKEditor+CKFinder时怎么取得CKFinder回传的图片路径 这个问题你是怎么解决的啊?谢谢
发布网友
发布时间:2022-04-12 09:02
我来回答
共2个回答
热心网友
时间:2022-04-12 10:31
我写的博客文章,正好和你不谋而合,我是直接将路径提交到一个指定的input,并触发该input的chang事件,希望对你有所帮助:
(function(){
var oCKeditor = CKEDITOR.replace( 'Content', {
customConfig : "/editor/ckeditor/myconfig.js",
toolbar : 'Default'
});
oCKeditor.config.Savepathfilename = "upFiles" ;
oCKeditor.on( 'instanceReady', function( event )
{
var editor = event.editor;
setTimeout( function()
{
// Delay bit more if editor is still not ready.
if ( !editor.element )
{
setTimeout( arguments.callee, 100 );
return;
}
event.removeListener( 'instanceReady', this.callee );
if ( editor.name == 'Content' )
{
var bFilebrowserFn = editor._.filebrowserFn;
var setUploadFileck=function(a,b){
var b=parent.document.getElementById(editor.config.Savepathfilename);
if(b && !!a)
if(b.value.indexOf(a)==-1){
if(b.value!=='')b.value=b.value+'|'+a;
else b.value=a;
if(b.onchange)b.onchange();
}
CKEDITOR.tools.callFunction(bFilebrowserFn, a, b);
};
editor._.filebrowserFn = CKEDITOR.tools.addFunction( setUploadFileck, editor );
}
}, 0 );
}, null, null, 9999);
CKFinder.setupCKEditor( oCKeditor, '../editor/ckfinder/' ) ;
})();
http://lurocky.javaeye.com/admin/blogs/868738