Ticket #9097: 9097_2.patch

File 9097_2.patch, 6.8 KB (added by Garry Yao, 12 years ago)
  • _source/plugins/selection/plugin.js

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    408408                                                                saveSelection();
    409409                                                        });
    410410
    411                                                 // When content doc is in standards mode, IE doesn't focus the editor when
    412                                                 // clicking at the region below body (on html element) content, we emulate
    413                                                 // the normal behavior on old IEs. (#1659, #7932)
    414                                                 if ( ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat )
    415                                                          && doc.$.compatMode != 'BackCompat' )
     411                                                // When content doc is in standards mode, IE doesn't produce text selection
     412                                                // when click on the region outside of body, we emulate
     413                                                // the correct behavior here. (#1659, #7932, # 9097)
     414                                                if ( doc.$.compatMode != 'BackCompat' )
    416415                                                {
    417                                                         function moveRangeToPoint( range, x, y )
    418                                                         {
    419                                                                 // Error prune in IE7. (#9034, #9110)
    420                                                                 try { range.moveToPoint( x, y ); } catch ( e ) {}
    421                                                         }
     416                                                        if ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat )
     417                                                        {
     418                                                                function moveRangeToPoint( range, x, y )
     419                                                                {
     420                                                                        // Error prune in IE7. (#9034, #9110)
     421                                                                        try { range.moveToPoint( x, y ); } catch ( e ) {}
     422                                                                }
    422423
    423                                                         html.on( 'mousedown', function( evt )
    424                                                         {
    425                                                                 // Expand the text range along with mouse move.
    426                                                                 function onHover( evt )
    427                                                                 {
    428                                                                         evt = evt.data.$;
    429                                                                         if ( textRng )
    430                                                                         {
    431                                                                                 // Read the current cursor.
    432                                                                                 var rngEnd = body.$.createTextRange();
     424                                                                html.on( 'mousedown', function( evt )
     425                                                                {
     426                                                                        // Expand the text range along with mouse move.
     427                                                                        function onHover( evt )
     428                                                                        {
     429                                                                                evt = evt.data.$;
     430                                                                                if ( textRng )
     431                                                                                {
     432                                                                                        // Read the current cursor.
     433                                                                                        var rngEnd = body.$.createTextRange();
    433434
    434                                                                                 moveRangeToPoint( rngEnd, evt.x, evt.y );
     435                                                                                        moveRangeToPoint( rngEnd, evt.x, evt.y );
    435436
    436                                                                                 // Handle drag directions.
    437                                                                                 textRng.setEndPoint(
    438                                                                                         textRng.compareEndPoints( 'StartToStart', rngEnd ) < 0 ?
    439                                                                                         'EndToEnd' :
    440                                                                                         'StartToStart',
    441                                                                                         rngEnd );
     437                                                                                        // Handle drag directions.
     438                                                                                        textRng.setEndPoint(
     439                                                                                                textRng.compareEndPoints( 'StartToStart', rngEnd ) < 0 ?
     440                                                                                                'EndToEnd' :
     441                                                                                                'StartToStart',
     442                                                                                                rngEnd );
    442443
    443                                                                                 // Update selection with new range.
    444                                                                                 textRng.select();
    445                                                                         }
    446                                                                 }
     444                                                                                        // Update selection with new range.
     445                                                                                        textRng.select();
     446                                                                                }
     447                                                                        }
    447448
    448                                                                 evt = evt.data.$;
     449                                                                        evt = evt.data;
    449450
    450                                                                 // We're sure that the click happens at the region
    451                                                                 // below body, but not on scrollbar.
    452                                                                 if ( evt.y < html.$.clientHeight
    453                                                                          && evt.y > body.$.offsetTop + body.$.clientHeight
    454                                                                          && evt.x < html.$.clientWidth )
    455                                                                 {
    456                                                                         // Start to build the text range.
    457                                                                         var textRng = body.$.createTextRange();
    458                                                                         moveRangeToPoint( textRng, evt.x, evt.y );
     451                                                                        // We're sure that the click happens at the region
     452                                                                        // below body, but not on scrollbar.
     453                                                                        if ( evt.getTarget().is( 'html' )  )
     454                                                                        {
     455                                                                                // Start to build the text range.
     456                                                                                var textRng = body.$.createTextRange();
     457                                                                                moveRangeToPoint( textRng, evt.$.x, evt.$.y );
    459458
    460                                                                         html.on( 'mousemove', onHover );
     459                                                                                html.on( 'mousemove', onHover );
    461460
    462                                                                         html.on( 'mouseup', function( evt )
    463                                                                         {
    464                                                                                 html.removeListener( 'mousemove', onHover );
    465                                                                                 evt.removeListener();
     461                                                                                html.on( 'mouseup', function( evt )
     462                                                                                {
     463                                                                                        html.removeListener( 'mousemove', onHover );
     464                                                                                        evt.removeListener();
    466465
    467                                                                                 // Make it in effect on mouse up. (#9022)
    468                                                                                 textRng.select();
    469                                                                         } );
    470                                                                 }
    471                                                         });
    472                                                 }
     466                                                                                        // Make it in effect on mouse up. (#9022)
     467                                                                                        textRng.select();
     468                                                                                } );
     469                                                                        }
     470                                                                });
     471                                                        }
    473472
    474                                                 // It's much simpler for IE8, we just need to reselect the reported range.
    475                                                 if ( CKEDITOR.env.ie8 )
    476                                                 {
    477                                                         html.on( 'mouseup', function( evt )
    478                                                         {
    479                                                                 // The event is not fired when clicking on the scrollbars,
    480                                                                 // so we can safely check the following to understand
    481                                                                 // whether the empty space following <body> has been clicked.
    482                                                                 if ( evt.data.getTarget().getName() == 'html' )
    483                                                                 {
    484                                                                         var sel = CKEDITOR.document.$.selection,
    485                                                                                 range = sel.createRange();
    486                                                                         // The selection range is reported on host, but actually it should applies to the content doc.
    487                                                                         if ( sel.type != 'None' && range.parentElement().ownerDocument == doc.$ )
    488                                                                                 range.select();
    489                                                                 }
    490                                                         } );
    491                                                 }
     473                                                        // It's much simpler for IE > 8, we just need to reselect the reported range.
     474                                                        if ( CKEDITOR.env.ie8 )
     475                                                        {
     476                                                                html.on( 'mousedown', function( evt ) {
     477
     478                                                                        if ( evt.data.getTarget().is( 'html' ) )
     479                                                                        {
     480                                                                                html.on( 'mouseup', function( evt )
     481                                                                                {
     482                                                                                        evt.removeListener();
     483
     484                                                                                        // The event is not fired when clicking on the scrollbars,
     485                                                                                        // so we can safely check the following to understand
     486                                                                                        // whether the empty space following <body> has been clicked.
     487                                                                                                var sel = CKEDITOR.document.$.selection,
     488                                                                                                        range = sel.createRange();
     489                                                                                                // The selection range is reported on host, but actually it should applies to the content doc.
     490                                                                                                if ( sel.type != 'None' && range.parentElement().ownerDocument == doc.$ )
     491                                                                                                        range.select();
     492                                                                                } );
     493                                                                        }
     494
     495                                                                });
     496                                                        }
    492497
     498                                                }
    493499                                                // IE is the only to provide the "selectionchange"
    494500                                                // event.
    495501                                                doc.on( 'selectionchange', saveSelection );
  • _source/plugins/wysiwygarea/plugin.js

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    12671267                                editor.addCss( 'html { height: 100% !important; }' );
    12681268                                editor.addCss( 'img:-moz-broken { -moz-force-broken-image-icon : 1;     min-width : 24px; min-height : 24px; }' );
    12691269                        }
    1270                         // Remove the margin to avoid mouse confusion. (#8835)
    1271                         else if ( CKEDITOR.env.ie && CKEDITOR.env.version < 8 && editor.config.contentsLangDirection == 'ltr' )
    1272                                 editor.addCss( 'body{margin-right:0;}' );
    12731270
    12741271                        /* #3658: [IE6] Editor document has horizontal scrollbar on long lines
    12751272                        To prevent this misbehavior, we show the scrollbar always */
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy