Ticket #1511: 1511.patch

File 1511.patch, 1.9 KB (added by David Chandler, 10 years ago)

Patch to allow undo of resize in Internet Explorer

  • plugins/wysiwygarea/plugin.js

     plugins/wysiwygarea/plugin.js | 48 ++++++++++++++++++++++++++++++++++++++++++-
     1 file changed, 47 insertions(+), 1 deletion(-)
    
    diff --git a/plugins/wysiwygarea/plugin.js b/plugins/wysiwygarea/plugin.js
    index f180125..3166b6c 100644
    a b  
    179179                                                }
    180180                                        }, 0 );
    181181                                }
    182                         } );
     182                        });
    183183                }
    184184
    185185                // Fix problem with cursor not appearing in Webkit and IE11+ when clicking below the body (#10945, #10906).
     
    217217                                } );
    218218                        }
    219219                }
     220                else if ( CKEDITOR.env.ie )
     221                {
     222                        // Hook the onresizestart and onresizeend events so that we can track resizing via the native browser size grips (#1511).
     223                        function resizeStart( evt ) {
     224                                oldSelectedElement.$.detachEvent( 'onresizestart', resizeStart );
     225                                // Save an initial snapshot so that we can detect the first resize.
     226                                editor.fire( 'saveSnapshot' );
     227                        };
     228
     229                        function resizeEnd( evt ) {
     230                                editor.fire( 'saveSnapshot' );
     231                        };
     232
     233                        var oldSelectedElement = null;
     234
     235                        function monitorResizeForCurrentSelection()
     236                        {
     237                                var selection = doc.getSelection();
     238                                if ( !selection )
     239                                {
     240                                        return;
     241                                }
     242
     243                                var selectedElement = selection.getSelectedElement();
     244                                if ( !selectedElement )
     245                                {
     246                                        return;
     247                                }
     248
     249                                selectedElement.$.attachEvent( 'onresizestart', resizeStart );
     250                                selectedElement.$.attachEvent( 'onresizeend', resizeEnd );
     251                                oldSelectedElement = selectedElement;
     252                        }
     253
     254                        this.attachListener( doc, 'selectionchange', function ( evt ) {
     255                                if (oldSelectedElement)
     256                                {
     257                                        oldSelectedElement.$.detachEvent('onresizeend', resizeEnd);
     258                                        oldSelectedElement = null;
     259                                }
     260
     261                                monitorResizeForCurrentSelection();
     262                        });
     263
     264                        monitorResizeForCurrentSelection();
     265                }
    220266
    221267                if ( CKEDITOR.env.gecko || CKEDITOR.env.ie && editor.document.$.compatMode == 'CSS1Compat' ) {
    222268                        this.attachListener( this, 'keydown', function( evt ) {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy