Index: _whatsnew.html =================================================================== --- _whatsnew.html (revision 2276) +++ _whatsnew.html (working copy) @@ -48,6 +48,8 @@ browsers default menu using the configuration file (FCKConfig.BrowserContextMenu option).
Fixed Bugs:
Index: editor/_source/classes/fckdocumentfragment_gecko.js =================================================================== --- editor/_source/classes/fckdocumentfragment_gecko.js (revision 2276) +++ editor/_source/classes/fckdocumentfragment_gecko.js (working copy) @@ -40,6 +40,13 @@ targetNode.appendChild( this.RootNode ) ; }, + AppendHtml : function( html ) + { + var eTmpDiv = this.RootNode.ownerDocument.createElement( 'div' ) ; + eTmpDiv.innerHTML = html ; + FCKDomTools.MoveChildren( eTmpDiv, this.RootNode ) ; + }, + InsertAfterNode : function( existingNode ) { FCKDomTools.InsertAfterNode( existingNode, this.RootNode ) ; Index: editor/_source/commandclasses/fck_othercommands.js =================================================================== --- editor/_source/commandclasses/fck_othercommands.js (revision 2276) +++ editor/_source/commandclasses/fck_othercommands.js (working copy) @@ -613,3 +613,22 @@ range.Select() ; } } ; + +// FCKRuleCommand +var FCKNbsp = function() +{ + this.Name = 'Non Breaking Space' ; +} + +FCKNbsp.prototype = +{ + Execute : function() + { + FCK.InsertHtml( ' ' ) ; + }, + + GetState : function() + { + return ( FCK.EditMode != FCK_EDITMODE_WYSIWYG ? FCK_TRISTATE_DISABLED : FCK_TRISTATE_OFF ) ; + } +} ; Index: editor/_source/internals/fck_gecko.js =================================================================== --- editor/_source/internals/fck_gecko.js (revision 2276) +++ editor/_source/internals/fck_gecko.js (working copy) @@ -349,7 +349,8 @@ // selected content if any. FCK.InsertHtml = function( html ) { - var doc = FCK.EditorDocument ; + var doc = FCK.EditorDocument, + range; html = FCKConfig.ProtectedSource.Protect( html ) ; html = FCK.ProtectEvents( html ) ; @@ -361,26 +362,30 @@ if ( FCKBrowserInfo.IsGecko ) { - // Using the following trick, present at the beginning and at - // the end of the HTML are preserved (#2248). - html = ' ' + html + ' ' ; - } + html = html.replace( / $/, '$&' ) ; - // Insert the HTML code. - doc.execCommand( 'inserthtml', false, html ) ; + var docFrag = new FCKDocumentFragment( this.EditorDocument ) ; + docFrag.AppendHtml( html ) ; - if ( FCKBrowserInfo.IsGecko ) - { - // Remove the fake nodes. - FCKDomTools.RemoveNode( doc.getElementById('__fakeFCKRemove1__') ) ; - FCKDomTools.RemoveNode( doc.getElementById('__fakeFCKRemove2__') ) ; + var lastNode = docFrag.RootNode.lastChild ; + + range = new FCKDomRange( this.EditorWindow ) ; + range.MoveToSelection() ; + range.InsertNode( docFrag.RootNode ) ; + + range.MoveToPosition( lastNode, 4 ) ; } + else + doc.execCommand( 'inserthtml', false, html ) ; this.Focus() ; // Save the caret position before calling document processor. - var range = new FCKDomRange( this.EditorWindow ) ; - range.MoveToSelection() ; + if ( !range ) + { + range = new FCKDomRange( this.EditorWindow ) ; + range.MoveToSelection() ; + } var bookmark = range.CreateBookmark() ; FCKDocumentProcessor.Process( doc ) ; Index: editor/_source/internals/fckcommands.js =================================================================== --- editor/_source/internals/fckcommands.js (revision 2276) +++ editor/_source/internals/fckcommands.js (working copy) @@ -80,6 +80,7 @@ case 'NewPage' : oCommand = new FCKNewPageCommand() ; break ; case 'PageBreak' : oCommand = new FCKPageBreakCommand() ; break ; case 'Rule' : oCommand = new FCKRuleCommand() ; break ; + case 'Nbsp' : oCommand = new FCKNbsp() ; break ; case 'TextColor' : oCommand = new FCKTextColorCommand('ForeColor') ; break ; case 'BGColor' : oCommand = new FCKTextColorCommand('BackColor') ; break ; Index: fckconfig.js =================================================================== --- fckconfig.js (revision 2276) +++ fckconfig.js (working copy) @@ -142,7 +142,8 @@ [ CTRL + 73 /*I*/, 'Italic' ], [ CTRL + 85 /*U*/, 'Underline' ], [ CTRL + SHIFT + 83 /*S*/, 'Save' ], - [ CTRL + ALT + 13 /*ENTER*/, 'FitWindow' ] + [ CTRL + ALT + 13 /*ENTER*/, 'FitWindow' ], + [ SHIFT + 32 /*SPACE*/, 'Nbsp' ] ] ; FCKConfig.ContextMenu = ['Generic','Link','Anchor','Image','Flash','Select','Textarea','Checkbox','Radio','TextField','HiddenField','ImageButton','Button','BulletedList','NumberedList','Table','Form','DivContainer'] ;