Ticket #2247: 2247_2.patch

File 2247_2.patch, 3.7 KB (added by martinkou, 20 months ago)
  • _whatsnew.html

     
    4444                        (Kudos to asuter for proposing the patch) </li> 
    4545                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2234">#2234</a>] Added the 
    4646                        ability to create, modify and remove Div containers.</li> 
     47                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2247">#2247</a>] The SHIFT+SPACE 
     48                        keystroke will now produce a &amp;nbsp; character.</li> 
    4749        </ul> 
    4850        <p> 
    4951                Fixed Bugs:</p> 
  • editor/_source/commandclasses/fck_othercommands.js

     
    613613                range.Select() ; 
    614614        } 
    615615} ; 
     616 
     617// FCKRuleCommand 
     618var FCKNbsp = function() 
     619{ 
     620        this.Name = 'Non Breaking Space' ; 
     621} 
     622 
     623FCKNbsp.prototype = 
     624{ 
     625        Execute : function() 
     626        { 
     627                FCK.InsertHtml( '&nbsp;' ) ; 
     628        }, 
     629 
     630        GetState : function() 
     631        { 
     632                return ( FCK.EditMode != FCK_EDITMODE_WYSIWYG ? FCK_TRISTATE_DISABLED : FCK_TRISTATE_OFF ) ; 
     633        } 
     634} ; 
  • editor/_source/internals/fck_gecko.js

     
    359359        // Save an undo snapshot first. 
    360360        FCKUndo.SaveUndoStep() ; 
    361361 
     362        // Firefox cannot handle HTML code with &nbsp; or &#160;. (See #2248) 
     363        // Convert them all to \xa0 first. 
    362364        if ( FCKBrowserInfo.IsGecko ) 
    363         { 
    364                 // Using the following trick, &nbsp; present at the beginning and at 
    365                 // the end of the HTML are preserved (#2248). 
    366                 html = '<span id="__fakeFCKRemove1__" style="display:none;">fakeFCKRemove</span>' + html + '<span id="__fakeFCKRemove2__" style="display:none;">fakeFCKRemove</span>' ; 
    367         } 
     365                html = html.replace( /(&nbsp;|&#160;)/g, '\xa0' ) ; 
    368366 
    369367        // Insert the HTML code. 
    370368        doc.execCommand( 'inserthtml', false, html ) ; 
    371369 
    372         if ( FCKBrowserInfo.IsGecko ) 
    373         { 
    374                 // Remove the fake nodes. 
    375                 FCKDomTools.RemoveNode( doc.getElementById('__fakeFCKRemove1__') ) ; 
    376                 FCKDomTools.RemoveNode( doc.getElementById('__fakeFCKRemove2__') ) ; 
    377         } 
    378  
    379370        this.Focus() ; 
    380371 
    381372        // Save the caret position before calling document processor. 
  • editor/_source/internals/fckcommands.js

     
    8080                case 'NewPage'          : oCommand = new FCKNewPageCommand() ; break ; 
    8181                case 'PageBreak'        : oCommand = new FCKPageBreakCommand() ; break ; 
    8282                case 'Rule'                     : oCommand = new FCKRuleCommand() ; break ; 
     83                case 'Nbsp'                     : oCommand = new FCKNbsp() ; break ; 
    8384 
    8485                case 'TextColor'        : oCommand = new FCKTextColorCommand('ForeColor') ; break ; 
    8586                case 'BGColor'          : oCommand = new FCKTextColorCommand('BackColor') ; break ; 
  • fckconfig.js

     
    142142        [ CTRL + 73 /*I*/, 'Italic' ], 
    143143        [ CTRL + 85 /*U*/, 'Underline' ], 
    144144        [ CTRL + SHIFT + 83 /*S*/, 'Save' ], 
    145         [ CTRL + ALT + 13 /*ENTER*/, 'FitWindow' ] 
     145        [ CTRL + ALT + 13 /*ENTER*/, 'FitWindow' ], 
     146        [ SHIFT + 32 /*SPACE*/, 'Nbsp' ] 
    146147] ; 
    147148 
    148149FCKConfig.ContextMenu = ['Generic','Link','Anchor','Image','Flash','Select','Textarea','Checkbox','Radio','TextField','HiddenField','ImageButton','Button','BulletedList','NumberedList','Table','Form','DivContainer'] ;