I would love to provide my users with toolbar buttons that go directly to the Image and Link dialogs' Upload tabs. I currently have all of my changes on the calling page and a custom config js, and my /js/ckeditor directory is pure and not modified. I'd like to stay that way, so I'm looking for a way to accomplish this with function calls. Any ideas?
My current code follows; it allows me to assign specific labels and icons for these on my toolbar, but it just opens the link and image dialogs... if I can force it to the Upload tab, it'll be perfect.
My current code follows; it allows me to assign specific labels and icons for these on my toolbar, but it just opens the link and image dialogs... if I can force it to the Upload tab, it'll be perfect.
editor.on( 'pluginsLoaded', function( ev )
{
editor.addCommand( 'AttachFile', new CKEDITOR.dialogCommand( 'link' ) );
editor.addCommand( 'AttachImage', new CKEDITOR.dialogCommand( 'image' ) );
editor.ui.addButton( 'AttachFile',
{
label : 'Attach File',
command : 'AttachFile',
icon : '/icons/vwicn005.gif'
} );
editor.ui.addButton( 'AttachImage',
{
label : 'Attach Image',
command : 'AttachImage',
icon: '/icons/vwicn017.gif'
} );
Re: Call a specific tab of existing dialog?
Instead of finding a way to "call" a specific tab of a dialog, I simply juggled the tab definitions within the dialog itself. I also removed Advanced and Target in the Link dialog, and Advanced and Link in the Image dialog per my users' needs.
CKEDITOR.on( 'dialogDefinition', function( ev ) { var dialogName = ev.data.name; var dialogDefinition = ev.data.definition; if ( dialogName == 'image' ) { dialogDefinition.removeContents( 'Link' ); dialogDefinition.removeContents( 'advanced' ); var uploadTab = dialogDefinition.getContents('Upload'); dialogDefinition.removeContents( 'Upload' ); dialogDefinition.addContents( uploadTab, 'info' ); } if ( dialogName == 'link' ) { dialogDefinition.removeContents( 'advanced' ); dialogDefinition.removeContents( 'target' ); var infoTab = dialogDefinition.getContents('info'); dialogDefinition.removeContents( 'info' ); dialogDefinition.addContents( infoTab ); uploadTab = dialogDefinition.getContents('upload'); uploadTab.hidden = false; } });