Ticket #2248: 2248.patch

File 2248.patch, 2.3 KB (added by Frederico Caldeira Knabben, 17 years ago)
  • _whatsnew.html

     
    106106                        are applied in the image preview dialog.</li>
    107107                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2056">#2056</a>] Fixed several validation
    108108                        errors in the dialogs.</li>
     109                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2248">#2248</a>] Calling FCK.InsertHtml( 'nbsp;') was inserting a plain space instead of a non breaking space
     110                        character.</li>
    109111        </ul>
    110112        <h3>
    111113                Version 2.6</h3>
  • editor/_source/internals/fck_gecko.js

     
    349349// selected content if any.
    350350FCK.InsertHtml = function( html )
    351351{
     352        var doc = FCK.EditorDocument ;
     353
    352354        html = FCKConfig.ProtectedSource.Protect( html ) ;
    353355        html = FCK.ProtectEvents( html ) ;
    354356        html = FCK.ProtectUrls( html ) ;
     
    357359        // Save an undo snapshot first.
    358360        FCKUndo.SaveUndoStep() ;
    359361
     362        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        }
     368
    360369        // Insert the HTML code.
    361         this.EditorDocument.execCommand( 'inserthtml', false, html ) ;
     370        doc.execCommand( 'inserthtml', false, html ) ;
     371
     372        if ( FCKBrowserInfo.IsGecko )
     373        {
     374                // Remove the fake nodes.
     375                FCKDomTools.RemoveNode( doc.getElementById('__fakeFCKRemove1__') ) ;
     376                FCKDomTools.RemoveNode( doc.getElementById('__fakeFCKRemove2__') ) ;
     377        }
     378
    362379        this.Focus() ;
    363380
    364381        // Save the caret position before calling document processor.
     
    366383        range.MoveToSelection() ;
    367384        var bookmark = range.CreateBookmark() ;
    368385
    369         FCKDocumentProcessor.Process( FCK.EditorDocument ) ;
     386        FCKDocumentProcessor.Process( doc ) ;
    370387
    371388        // Restore caret position, ignore any errors in case the document
    372389        // processor removed the bookmark <span>s for some reason.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy