Opened 18 years ago
Closed 18 years ago
#716 closed New Feature (fixed)
Extend Number of Font Sizes
Reported by: | Nicholas Couri | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | FCKeditor 2.5 Beta |
Component: | Core : Styles | Version: | |
Keywords: | Cc: |
Description
The editor comes with only 7 different font sizes:
xx-small;x-small;small;medium;large;x-large;xx-large
when trying to change the number of fonts, I found out that IE has only 7 different font sizes in its native font size command.
In order to bypass this limitation, I changed the fckconfig.js and fck_othercommands.js and it has worked fine on both IE and firefox.
I don't know if it is the correct solution but it worked fine so far.
FILE: fckconfig.js
// ORIGINAL // FCKConfig.FontSizes = '1/xx-small;2/x-small;3/small;4/medium;5/large;6/x-large;7/xx-large' ; FCKConfig.FontSizes = '1/5;2/6;3/7;4/8;5/9;6/10;7/11;8/12;9/14;10/16;11/18;12/20;13/24;14/28;15/30;16/60;17/90' ;
FILE: fck_othercommands.js
FCKFontSizeCommand.prototype.Execute = function( fontSize ) { //ORIGINAL // if ( typeof( fontSize ) == 'string' ) fontSize = parseInt(fontSize, 10) ; // // if ( fontSize == null || fontSize == '' ) // { // // TODO: Remove font size attribute (Now it works with size 3. Will it work forever?) // FCK.ExecuteNamedCommand( 'FontSize', 3 ) ; // } // else { // FCK.ExecuteNamedCommand( 'FontSize', fontSize ) ; // } // CHANGED CODE var oSel = null; var bHasSelection = false; if ( typeof( fontSize ) == 'string' ) fontSize = parseInt(fontSize, 10) ; var e = FCK.EditorDocument.createElement( 'SPAN' ) ; if ( fontSize == null || fontSize == '' ) { e.style.fontSize = '3px'; } else { e.style.fontSize = fontSize + 'px'; } try{ if(document.all) { oSel = FCK.EditorDocument.selection ; // ie bHasSelection = !(oSel.type == "None"); } else { oSel = FCK.EditorWindow.getSelection() ; // gecko bHasSelection = (oSel && oSel.rangeCount == 1 && oSel.getRangeAt(0).cloneContents().childNodes.length > 0); } } catch (e) {} if( bHasSelection ) { if (document.selection && document.selection.createRange) { // IE code goes here var range = FCK.EditorDocument.selection.createRange(); e.innerHTML = FCK.EditorDocument.selection.createRange().text; } else { FCK.EditorWindow.getSelection() ; e.innerHTML = FCK.EditorWindow.getSelection(); } FCK.InsertElement( e ); } }
Attachments (1)
Change History (3)
Changed 18 years ago by
Attachment: | proposal.txt added |
---|
comment:1 Changed 18 years ago by
Component: | General → Core : Styles |
---|---|
Summary: | Extend Number of Font Sizes ( IE ) → Extend Number of Font Sizes |
comment:2 Changed 18 years ago by
Milestone: | → FCKeditor 2.5 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Fixed with [774].
The new Style System introduced a very flexible and customizable way to define the font sizes. Now, any kind of font size can be uses, and any king of output tag be be done with it. Check out the fckconfig.js file.
Click here for more info about our SVN system.
I see several problems with that patch:
This same behaviour should be possible right now using the styles combo (so no need to change any js file), but a proper implementation will be much easier with the new style system for 2.5