Changeset 587

Show
Ignore:
Timestamp:
2007-07-28 12:48:15 (16 months ago)
Author:
fredck
Message:

Fixed #996 : Changed the paste system to better support the OnPaste event.

Location:
FCKeditor/trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/trunk/editor/fckeditor.html

    r498 r587  
    204204// Set the editor interface direction. 
    205205window.document.dir = FCKLang.Dir ; 
    206  
    207 // Activate pasting operations. 
    208 if ( FCKConfig.ForcePasteAsPlainText || FCKConfig.AutoDetectPasteFromWord ) 
    209         FCK.Events.AttachEvent( 'OnPaste', FCK.Paste ) ; 
    210206 
    211207        </script> 
  • FCKeditor/trunk/editor/_source/internals/fck_gecko.js

    r502 r587  
    150150} 
    151151 
    152 FCK.Paste = function() 
     152FCK._ExecPaste = function() 
    153153{ 
    154154        // Save a snapshot for undo before actually paste the text 
  • FCKeditor/trunk/editor/_source/internals/fck_ie.js

    r502 r587  
    8585function Doc_OnPaste() 
    8686{ 
    87         return ( FCK.Status == FCK_STATUS_COMPLETE && FCK.Events.FireEvent( "OnPaste" ) ) ; 
     87        var body = FCK.EditorDocument.body ; 
     88         
     89        body.detachEvent( 'onpaste', Doc_OnPaste ) ; 
     90 
     91        var ret = FCK.Paste( !FCKConfig.ForcePasteAsPlainText && !FCKConfig.AutoDetectPasteFromWord ) ; 
     92 
     93        body.attachEvent( 'onpaste', Doc_OnPaste ) ; 
     94         
     95        return ret ; 
    8896} 
    8997 
     
    194202} 
    195203 
    196 FCK.Paste = function() 
     204FCK._ExecPaste = function() 
    197205{ 
    198206        // As we call ExecuteNamedCommand('Paste'), it would enter in a loop. So, let's use a semaphore. 
  • FCKeditor/trunk/editor/_source/internals/fck.js

    r563 r587  
    491491                return sValue ? sValue : '' ; 
    492492        }, 
     493         
     494        Paste : function( _callListenersOnly ) 
     495        { 
     496                // First call 'OnPaste' listeners. 
     497                if ( FCK.Status != FCK_STATUS_COMPLETE || !FCK.Events.FireEvent( 'OnPaste' ) ) 
     498                        return false ; 
     499                 
     500                // Then call the default implementation. 
     501                return _callListenersOnly || FCK._ExecPaste() ; 
     502        }, 
    493503 
    494504        PasteFromWord : function() 
     
    814824                { 
    815825                        case 'Paste' : 
    816                                 return !FCK.Events.FireEvent( 'OnPaste' ) ; 
     826                                return !FCK.Paste() ; 
    817827 
    818828                        case 'Cut' : 
  • FCKeditor/trunk/_whatsnew.html

    r530 r587  
    138138                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/977">#977</a>] The "shape" attribute of &lt;area&gt; had its 
    139139                        value changed to uppercase in IE.</li> 
     140                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/996">#996</a>] "OnPaste" 
     141                        event listeners will now get executed only once.</li> 
    140142        </ul> 
    141143        <h3>