Configure CKEditor

How to configure the editor #

This article explains how you can configure the default editor of liferay (fckeditor) to suit your needs regarding:

  • Font
  • Size
  • Format

When an user edits an article, these formats get written directly in the generated HTML code, overwriting any predefined CSS definitions. There are several considerations while this is something you want to control. If you are using a CSS to define the design of your webpage or articles, you want to control the design by the CSS and not by the editor. Here you will learn where to configure the editor and how to change the options a user has to define the design of an article.

Configuration file #

The configuration file for fckeditor can be found at:

 Windows: //{liferay directory}\webapps\ROOT\html\js\editor\fckeditor//
 Unix: //{liferay directory}/webapps/ROOT/html/js/editor/fckeditor//

where {liferay directory} kann be c:\lportal on Windows or /opt/lportal on Unix. The file is named fckconfig.js. The configuration options have the structure FCKConfig.Value, where Value stands for a configurable option.

Changes for font #

Search in the file for the following line: FCKConfig.FontNames = 'Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana' ; To allow only Arial or Tahoma to be selectable by the user, change the option to:

  FCKConfig.FontNames = 'Arial;Tahoma' ;

If you don´t want that the user can select the font size, just leave the option empty:

  FCKConfig.FontNames = ' ' ;

Changes for font size#

Search in the file for the following line: FCKConfig.FontSizes = 'smaller;larger;xx-small;x-small;small;medium;large;x-large;xx-large' ;

smaller;larger;etc define the file sizes a user can choose from. So, to allow only small and medium, you have to change the line to the following:

  FCKConfig.FontSizes = 'small;medium' ;

If you don´t want that the user can select the font size, just leave the option empty:

  FCKConfig.FontSizes = ' ' ;

Changes for format #

Search in the file for the following line: FCKConfig.FontFormats = 'p;h1;h2;h3;h4;h5;h6;pre;address;div' ; To allow only headers h1, h2 and h3 and paragraphs to be selectable by the user, change the option to:

  FCKConfig.FontFormats = 'p;h1;h2;h3' ;

If you don´t want that the user can select the font size, just leave the option empty:

  FCKConfig.FontFormats = ' ' ;

Configure the layout #

Instead of emptying out all the possible options to prohibid the user to make changes, you can also simply deactivate the option. This way, the original configuration will be kept, but the user won´t be able to select the option.

Configuration file #

The configration file can be found at:

 Windows: //{liferay directory}\webapps\ROOT\html\js\editor\fckeditor//
 Unix: //{liferay directory}/webapps/ROOT/html/js/editor/fckeditor//

The name of the file is: fckconfig.jsp This is the file that fckeditor uses to displaying the editor.

Changes to the layout #

Look for a line starting with:

 FCKConfig.ToolbarSets["liferay"] = [

This defines the Liferay customization. Here you have to adjust the editor to meet you needs. In the example below, we will remove the option for the size and the layout, but will add the option for the format.

 **Original:**
 //FCKConfig.ToolbarSets["liferay"] = [
 ['FontName','FontSize','-','TextColor','BGColor'],//
 **Modified:**
 FCKConfig.ToolbarSets["liferay"] = [
 ['FontFormat','-','TextColor','BGColor'],

Save the change and you are done. The user will now be able to change the Format, but not the font type and name.

Related Articles #

How To's

0 Allegati
65654 Visualizzazioni
Media (0 Voti)
La media del punteggio è 0.0 stelle su 5.
Commenti
Commenti Autore Data
can i configure upload limit size for image. delang j 16 luglio 2009 1.15
I need configuration folder's default upload... Sergio Romero 13 agosto 2011 9.49
Is it possible to change the limit of the... Vijay Mudivedu 17 agosto 2011 4.39
As for those who were like me using Liferay CE ... Achmed Tyrannus Albab 15 marzo 2012 4.03
How to add "Table of contents" as creole... Ahamed Sakir 23 agosto 2012 0.02
Can Styles combox change event be hadled using... Deepti Prasad 20 giugno 2013 2.12
I'm not sure if I feel comfortable editing this... John Nguyen 27 settembre 2013 7.40
How To Add Customize Fonts To Default HTML... Mohammad Hejazi 11 novembre 2014 23.03

can i configure upload limit size for image.
Inviato il 16/07/09 1.15.
I need configuration folder's default upload image.
Inviato il 13/08/11 9.49.
Is it possible to change the limit of the attachments. Right Now I see the filesize limit as 3MB. Can this be increased to 20MB?
Inviato il 17/08/11 4.39.
As for those who were like me using Liferay CE 6.0.6 (and below i guess..which ever that uses CKEditors) you need to go to http://www.liferay.com/community/forums/-/message_boards/view_message/10991139#_­19_message_10997220 and fix the problem.

IF NOT YOU WOULDN'T BE ABLE TO MODIFY THE EDITOR.
Some of us already suffered ... and i am justt trying to help.
Inviato il 15/03/12 4.03.
How to add "Table of contents" as creole feature in wiki
Inviato il 23/08/12 0.02 in risposta a Achmed Tyrannus Albab.
Can Styles combox change event be hadled using ckconfig.jsp?
Inviato il 20/06/13 2.12.
I'm not sure if I feel comfortable editing this like so in the instructions. Would this be more ideal if its possible to create a hook portlet?
Inviato il 27/09/13 7.40.
How To Add Customize Fonts To Default HTML Editor Of Liferay?
Inviato il 11/11/14 23.03.