Opened 11 years ago

Closed 11 years ago

#10611 closed Bug (invalid)

no property of "style=font-size" for default font size

Reported by: Chenyue Gao Owned by:
Priority: Normal Milestone:
Component: General Version: 3.6.4
Keywords: IBM Cc: gaoc@…

Description

There is no property of style=font-size when the user first enter text with default font size. This problem can be reproduced with your demo.

first time enter text with default font size

<com.ibm.rqm.planning.editor.section.planBusinessObjectives extensionDisplayName="RQM-KEY-TP-BUSS-OBJ-TITLE"> <div>this is a text with font size set to default 10</div> </com.ibm.rqm.planning.editor.section.planBusinessObjectives>

Select the entire text and change the font size to 16 and save

<com.ibm.rqm.planning.editor.section.planBusinessObjectives extensionDisplayName="RQM-KEY-TP-BUSS-OBJ-TITLE"> <div> <span style="font-size:16px;">; this is a text with font size set to default 10 and later changed to 16 </span> </div> </com.ibm.rqm.planning.editor.section.planBusinessObjectives>

  1. Now change the font back to 10:

<com.ibm.rqm.planning.editor.section.planBusinessObjectives extensionDisplayName="RQM-KEY-TP-BUSS-OBJ-TITLE"> <div> <span style="font-size:10px;">; this is a text with font size set to default 10 and later changed to 16 </span> </div> </com.ibm.rqm.planning.editor.section.planBusinessObjectives>

Change History (2)

comment:1 Changed 11 years ago by Chenyue Gao

Cc: gaoc@… added

comment:2 Changed 11 years ago by Jakub Ś

Resolution: invalid
Status: newclosed

When you insert code like <p>test</p> it has no styles defined and if there are no styles defined then the only thing that can and IMHO should style content is either contents.css or main css file in case of inline editor.

Plugins inserts font-size inline style when you use it. Editor should not make this by default. If you want to get such result either insert styled content or use below code

editor.on( 'instanceReady', function( evt )
			{				
				editor.setData('<p>test</p><p>test</p><p>test</p>');
				
				window.setTimeout(function(){
						evt.editor.focus(); 
						var d = evt.editor.document; 
						var r = new CKEDITOR.dom.range(d); 													
						r.selectNodeContents(d.getBody()); 						
						r.select(); 
						
						var style = new CKEDITOR.style( { element : 'span',  styles: { 'font-size': '10px' } } );
						style.type = CKEDITOR.STYLE_INLINE;
						style.applyToRange( r );
						
						r.collapse(true);
						r.select(); 						
				},0);
			});	
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