Reputation: 79
I am trying to set the defaultview to list when some one clicks link on CKEditor. I have already configured CKFinder with CKEditor. So now when i click links in CKEditor, I see a browse button and onclick
of browse button it takes me to file list. But there it shows images as thumbnails. I want to display it as "list". I should do this only when I click links in CKEditor. If I click images it should show me the thumbnails.
The following is the way I created my CKEditor and associated it with my CKFinder.
function createCkEditor(textAreaId, width, height) {
var editor = CKEDITOR.replace( textAreaId,
{
customConfig : 'suConfig.js',
width : width,
height : height
});
CKFinder.setupCKEditor( editor, { basePath : '/CKFinderJava/ckfinder/', id:'123', startupPath : varStartupDir, startupFolderExpanded : true, rememberLastFolder : false} ) ;
}
CKEDITOR.on( 'dialogDefinition', function( ev ) {
// Take the dialog name and its definition from the event data.
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
// If "Link" dialog
if ( dialogName == 'link' ) {
alert('link dialog clicked');
// Remove extraneous tabs
dialogDefinition.removeContents( 'target' );
dialogDefinition.removeContents( 'advanced' );
// Set default URL
var infoTab = dialogDefinition.getContents( 'info' );
var urlField = infoTab.get( 'url' );
urlField['default'] = contentUrl;
}
// If "Image" dialog
if ( dialogName == 'image' ) {
// Remove extraneous tabs
dialogDefinition.removeContents( 'Link' );
dialogDefinition.removeContents( 'advanced' );
// Set default URL
var infoTab = dialogDefinition.getContents( 'info' );
var urlField = infoTab.get( 'txtUrl' );
urlField['default'] = contentUrl;
}
});
CKEditor.on
will be called if you click an option in CKEditor. I am not sure how to get the CKFinder instance associated with the current editor and set default view to list. I am using JavaScript and JSP.
Upvotes: 1
Views: 1834
Reputation: 79
i did find the solution for this.
In config.js which is in CKFinderJava.war/ckfinder directory make the necessary configurations. config.defaultViewType_Images = 'thumbnails'; config.defaultViewType_Files = 'list'; this is settings for Images and Links from ckeditor. If you want all the displays to be as list then config.defaultViewType = 'list';
Upvotes: 0