Ticket #5563: 5563.patch

File 5563.patch, 2.5 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/wysiwygarea/plugin.js

     
    405405                                                        }, 0 );
    406406                                                }
    407407
    408                                                 // IE, Opera and Safari may not support it and throw
    409                                                 // errors.
    410                                                 try { domDocument.execCommand( 'enableObjectResizing', false, !editor.config.disableObjectResizing ) ; } catch(e) {}
    411                                                 try { domDocument.execCommand( 'enableInlineTableEditing', false, !editor.config.disableNativeTableHandles ) ; } catch(e) {}
     408                                                if ( editor.config.disableObjectResizing
     409                                                        || editor.config.disableNativeTableHandles )
     410                                                {
     411                                                        // Disable all elements resizing within document
     412                                                        if( CKEDITOR.env.ie )
     413                                                                body.onresizestart = function () { return false; };
     414                                                        else if ( CKEDITOR.env.gecko )
     415                                                        {
     416                                                                body.addEventListener( 'mousedown', function( evt )
     417                                                                {
     418                                                                        // Checking whether we're clicking on a firefox resizer,
     419                                                                        // on which script access is disabled and will throw an exception.
     420                                                                        try { evt.originalTarget.nodeType; }
     421                                                                        catch( er )
     422                                                                        {
     423                                                                                var bookmark = editor.getSelection().createBookmarks( true ),
     424                                                                                                snapshot = editor.getSnapshot(),
     425                                                                                                restore = function()
     426                                                                                                {
     427                                                                                                        editor.loadSnapshot( snapshot );
     428                                                                                                        editor.getSelection().selectBookmarks( bookmark );
     429                                                                                                },
     430                                                                                                cancelEvent = function( evt )
     431                                                                                                {
     432                                                                                                        body.removeEventListener( 'DOMAttrModified', cancelEvent, false );
     433                                                                                                        body.removeEventListener( 'DOMNodeInserted', cancelEvent, false );
     434                                                                                                        body.removeEventListener( 'DOMNodeRemoved', cancelEvent, false );
    412435
     436                                                                                                        if ( evt.type == 'DOMAttrModified' )
     437                                                                                                                restore();
     438                                                                                                        else
     439                                                                                                                setTimeout( restore, 0 );
     440                                                                                                };
     441
     442                                                                                // Watch the next DOM changes, where browser has just
     443                                                                                // filled in the new size or add/remove nodes.
     444                                                                                body.addEventListener( 'DOMAttrModified', cancelEvent, false );
     445                                                                                body.addEventListener( 'DOMNodeInserted', cancelEvent, false );
     446                                                                                body.addEventListener( 'DOMNodeRemoved', cancelEvent, false );
     447                                                                        }
     448                                                                }, false );
     449                                                        }
     450                                                }
     451
    413452                                                domWindow       = editor.window         = new CKEDITOR.dom.window( domWindow );
    414453                                                domDocument     = editor.document       = new CKEDITOR.dom.document( domDocument );
    415454
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy