views:

37

answers:

2

I just upgraded my ckEditor, and it's added a few options I don't want right now.

Of them are to browse images from files rather than just include them as urls. How do I remove those options?

+1  A: 

In your source HTML/JS file you'll have some code that replaces a textarea with the CKEditor. It reads something like:

CKEDITOR.replace( 'editor1',
{
    … /* parameters */
    filebrowserUploadUrl : '/uploader/upload.php',
    … /* other parameters */
});

If you delete the filebrowserUploadUrl parameter (or empty the string assigned to it), the image upload tab will be gone.

Note that, apart from or instead of filebrowserUploadUrl, you can also have a parameter called filebrowserImageUploadUrl. In that case, you have to delete or empty this parameter as well.

See File Browser (Uploader) for more details.

Other solution

You can also customize every dialog:

By listening to the dialogDefinition event of CKEditor it's possible to customize the dialogs removing tabs or changing the default values.

So, if you want to remove the upload tab this way, just add the following code:

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 ( dialogName == 'image' ) {
        // Remove upload tab
        dialogDefinition.removeContents('Upload');
    }
});
Marcel Korpel
I got that..ckeditor is a mess of a machine to figure out though. Have no idea where to put that info :D, let alone pinpoint it to remove what I need
Trip
I appreciate it, but I figured it all out already posted it above. Thanks so much Marcel
Trip
Also I want to know for that first part of your answer, that was located in a yaml file created by rails-ckeditor in my config/ . Just delete it, problem solved. Also if you ever run into this problem, make sure your `git rm` all your files from your remote. Anything hangers will ruin the project.
Trip
A: 

Just add this to your config.js . Good riddance.

CKEDITOR.on( 'dialogDefinition', function( ev ) {
   var dialogName = ev.data.name;
   var dialogDefinition = ev.data.definition;
   if ( dialogName == 'image' ) {
         dialogDefinition.removeContents( 'Link' );
         dialogDefinition.removeContents( 'advanced' );
         dialogDefinition.removeContents( 'Upload' );
   }
});
Trip