3

I'm using Drupal 7 with CKEditor module and I would like to delete some formats in the dropdown box that is currently labeled "Format". So I modified the config file which is site/all/modules/ckeditor/ckeditor.config.js. I modified the code like this :

CKEDITOR.editorConfig = function(config) {
   // some code here 
   config.format_tags = 'p;h1;h2;h3'; // I added this line
}

Then I flush all caches of drupal and the cache of browser, but it doesn't work. When I create a new content, I always have all the formats. How to make it work? (Note : I don't want to customize it from admin/config/content/ckeditor/edit page)

1 Answer 1

0

To remove entries from "Format" selection list of ckeditor just follow in the drupal admin menu :

Configuration >> Content authoring >> Ckeditor

Edit the concerned profile(s) and within the Cleanup and Output section change the "Font formats" list, removing the tags you don't want.

Save and clear your caches.

4
  • As I mentioned in my question, I don't want to customize it from the admin page. Do you know why the code I've added doesn't work? Or I used the wrong file? @rtome
    – stevey
    Dec 11, 2014 at 14:37
  • Ok, if you want to hard code it, I think that you must either change the default value of the font_format field in the module settings
    – rtome
    Dec 11, 2014 at 15:02
  • This font_format default value is in the file ckeditor/includes/ckeditor.admin.inc within the ckeditor module (see $form['output']['font_format'] settings) and passed to the RTE via the ckeditor_profile_settings_compile function within the ckeditor/includes/ckeditor.lib.inc (look for $settings['format_tags'])
    – rtome
    Dec 11, 2014 at 15:25
  • Your config.format_tags = 'p;h1;h2;h3'; setting is either not being taken into account or it's being overriden by the settings that take place within ckeditor.lib.inc. I'm not sure of which way it goes but the result is the same.
    – rtome
    Dec 11, 2014 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.