1 | fckconfig.js |
---|
2 | |
---|
3 | // ORIGINAL |
---|
4 | // FCKConfig.FontSizes = '1/xx-small;2/x-small;3/small;4/medium;5/large;6/x-large;7/xx-large' ; |
---|
5 | 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' ; |
---|
6 | |
---|
7 | |
---|
8 | |
---|
9 | |
---|
10 | fck_othercommands.js |
---|
11 | |
---|
12 | |
---|
13 | |
---|
14 | |
---|
15 | |
---|
16 | |
---|
17 | FCKFontSizeCommand.prototype.Execute = function( fontSize ) |
---|
18 | { |
---|
19 | //ORIGINAL |
---|
20 | // if ( typeof( fontSize ) == 'string' ) fontSize = parseInt(fontSize, 10) ; |
---|
21 | // |
---|
22 | // if ( fontSize == null || fontSize == '' ) |
---|
23 | // { |
---|
24 | // // TODO: Remove font size attribute (Now it works with size 3. Will it work forever?) |
---|
25 | // FCK.ExecuteNamedCommand( 'FontSize', 3 ) ; |
---|
26 | // } |
---|
27 | // else { |
---|
28 | // FCK.ExecuteNamedCommand( 'FontSize', fontSize ) ; |
---|
29 | // } |
---|
30 | |
---|
31 | |
---|
32 | // CHANGED CODE |
---|
33 | var oSel = null; |
---|
34 | var bHasSelection = false; |
---|
35 | |
---|
36 | if ( typeof( fontSize ) == 'string' ) fontSize = parseInt(fontSize, 10) ; |
---|
37 | |
---|
38 | var e = FCK.EditorDocument.createElement( 'SPAN' ) ; |
---|
39 | |
---|
40 | if ( fontSize == null || fontSize == '' ) { |
---|
41 | e.style.fontSize = '3px'; |
---|
42 | } else { |
---|
43 | e.style.fontSize = fontSize + 'px'; |
---|
44 | } |
---|
45 | try{ |
---|
46 | if(document.all) { |
---|
47 | oSel = FCK.EditorDocument.selection ; // ie |
---|
48 | bHasSelection = !(oSel.type == "None"); |
---|
49 | } else { |
---|
50 | oSel = FCK.EditorWindow.getSelection() ; // gecko |
---|
51 | bHasSelection = (oSel && oSel.rangeCount == 1 && oSel.getRangeAt(0).cloneContents().childNodes.length > 0); |
---|
52 | } |
---|
53 | } catch (e) {} |
---|
54 | if( bHasSelection ) { |
---|
55 | //if (FCK.EditorDocument.setSelectionRange) |
---|
56 | if (document.selection && document.selection.createRange) { // IE code goes here |
---|
57 | var range = FCK.EditorDocument.selection.createRange(); |
---|
58 | e.innerHTML = FCK.EditorDocument.selection.createRange().text; |
---|
59 | } else { |
---|
60 | FCK.EditorWindow.getSelection() ; |
---|
61 | e.innerHTML = FCK.EditorWindow.getSelection(); |
---|
62 | } |
---|
63 | FCK.InsertElement( e ); |
---|
64 | } |
---|
65 | |
---|
66 | |
---|
67 | } |
---|