Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I modify the 'Format' dropdown in CKEditor?

Tags:

php

ckeditor

I'm trying to modify the 'Format' drop down in CKEditor, and I think I've followed all the instructions properly, but it's not working.

I went to _source/plugins/format/plugin.js and changed

CKEDITOR.config.format_tags = 'p;h1;h2;h3;h4;h5;h6;pre;address;div';

to

CKEDITOR.config.format_tags = 'h1;h2;div;p';

When I add a 'Format' drop down though, I still get all the original options in there (p;h1;h2;h3;h4;h5;h6;pre;address;div) instead of just the ones I listed.

Am I editing the wrong file or something? Or do I need to do something else to make it realise that the option has changed?

like image 619
Sharon Avatar asked May 09 '12 15:05

Sharon


People also ask

Where is CKEditor config file?

The main configuration file is named config. js . This file can be found in the root of the CKEditor 4 installation folder.

How do I use CSS in CKEditor?

var editor = CKEDITOR. replace( 'editor' ); // Add dynamic css text to be used by the editing area. editor. addCss( 'body { background-color: grey; }' );

Is CKEditor a plugin?

CKEditor 4 has plugin-based architecture. In fact, initially the editor core is an empty box, which is then filled with features provided by plugins. Even the editor interface, like toolbars, buttons, and the editing area, are plugins, too!


2 Answers

You should edit your config file, not the plugin file.

Should be in the root of the ckeditor folder, config.js

Should start with:

CKEDITOR.editorConfig = function( config )
{

So you would want to add this to it (after the above, but before the closing }):

config.format_tags = 'h1;h2;div;p';
like image 77
Nick Avatar answered Oct 04 '22 04:10

Nick


Nick is right. You shouldn't touch the source folder. Just use the config.js file located in ckeditor root. Also refer to the CKEditor API page for further customization options and the developer guides here.

like image 41
Seb_CKSource Avatar answered Oct 04 '22 03:10

Seb_CKSource