Opened 7 years ago

Closed 7 years ago

#14822 closed Bug (invalid)

Default font family and size not set for body tag in ckeditor .

Reported by: Prasant Kumar Sahoo Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc: CGS-Turbo@…


I set my default font family and size in ckeditor using this two below line

font_defaultLabel ='Times New Roman' fontSize_defaultLabel='10pt'

When selecting the font and size the paragraph creating in body tag like this. <p>

<span style="font-family:arial,helvetica,sans-serif;">

<span style="font-size:8.0pt;"> </span>



When initialize ckeditor with default family ,Font family and size not selected in dropdown but label Shows like "TimesNewRoman" and "10pt".Then body content show like this


I want to set default font family and font size as dynamically from settings.If i set font family and size in body tag in content css file that content not showing properly on pdf ,because that paragraph not having default font family and size .So I Want the real html content in ckeditor then only it shows correct font in pdf .I want the same functionality that is working when we select from drop down list needs to work when I set the default font family.

Change History (1)

comment:1 Changed 7 years ago by Jakub Ś

Resolution: invalid
Status: newclosed
Version: 4.5.10 (GitHub - master)

Font Labels won't do what you want. You can get that result with ACF e.g.

var editor = CKEDITOR.replace( 'editor1', {				
	extraAllowedContent : 'p{font-family,font-size}'
editor.on('pluginsLoaded', function(evt){
	evt.editor.filter.addTransformations( [					 
			 left: function( el ) {				
				return == 'p';
			 right: function( el, tools ) {						  
				if( el.styles && !el.styles['font-size'] )
					el.styles['font-size'] = '10pt'
				if( el.styles && !el.styles['font-family'] )
					el.styles['font-family'] = 'Times New Roman, Times, serif'

If i set font family and size in body tag in content css file that content not showing properly on pdf

This is not a bug but your specific requirement to style every element with default font-size and font-family. I have shown you how it can be done but if you have further questions, please either ask them on Stack Overflow or read about ACF:!/guide/dev_acf!/guide/dev_advanced_content_filter!/guide/dev_disallowed_content!/api/CKEDITOR.filter-method-addTransformations!/api/CKEDITOR.config-cfg-allowedContent!/api/CKEDITOR.config-cfg-extraAllowedContent

NOTE: Please don't report new tickets about same issue.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy