IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
430 | 430 | |
431 | 431 | // Handle drag directions. |
432 | 432 | textRng.setEndPoint( |
433 | | textRng.compareEndPoints( 'StartToStart', rngEnd ) < 0 ? |
| 433 | startRng.compareEndPoints( 'StartToStart', rngEnd ) < 0 ? |
434 | 434 | 'EndToEnd' : |
435 | 435 | 'StartToStart', |
436 | 436 | rngEnd ); |
… |
… |
|
440 | 440 | } |
441 | 441 | } |
442 | 442 | |
| 443 | function removeListeners() |
| 444 | { |
| 445 | html.removeListener( 'mouseleave', onSelectEnd ); |
| 446 | html.removeListener( 'mouseup', onSelectEnd ); |
| 447 | } |
| 448 | |
| 449 | function onSelectEnd() |
| 450 | { |
| 451 | |
| 452 | html.removeListener( 'mousemove', onHover ); |
| 453 | removeListeners(); |
| 454 | |
| 455 | // Make it in effect on mouse up. (#9022) |
| 456 | textRng.select(); |
| 457 | } |
| 458 | |
443 | 459 | evt = evt.data; |
444 | 460 | |
445 | 461 | // We're sure that the click happens at the region |
… |
… |
|
449 | 465 | // Start to build the text range. |
450 | 466 | var textRng = body.$.createTextRange(); |
451 | 467 | moveRangeToPoint( textRng, evt.$.x, evt.$.y ); |
| 468 | // Records the dragging start of the above text range. |
| 469 | var startRng = textRng.duplicate(); |
452 | 470 | |
453 | 471 | html.on( 'mousemove', onHover ); |
454 | | |
455 | | html.on( 'mouseup', function( evt ) |
456 | | { |
457 | | html.removeListener( 'mousemove', onHover ); |
458 | | evt.removeListener(); |
459 | | |
460 | | // Make it in effect on mouse up. (#9022) |
461 | | textRng.select(); |
462 | | } ); |
| 472 | html.on( 'mouseleave', onSelectEnd ); |
| 473 | html.on( 'mouseup', onSelectEnd ); |
463 | 474 | } |
464 | 475 | }); |
465 | 476 | } |
… |
… |
|
467 | 478 | // It's much simpler for IE > 8, we just need to reselect the reported range. |
468 | 479 | if ( CKEDITOR.env.ie8 ) |
469 | 480 | { |
470 | | html.on( 'mousedown', function( evt ) { |
471 | | |
| 481 | html.on( 'mousedown', function( evt ) |
| 482 | { |
472 | 483 | if ( evt.data.getTarget().is( 'html' ) ) |
473 | 484 | { |
474 | | html.on( 'mouseup', function( evt ) |
475 | | { |
476 | | evt.removeListener(); |
| 485 | // Limit the text selection mouse move inside of editable. (#9715) |
| 486 | html.on( 'mouseleave', onSelectEnd ); |
| 487 | html.on( 'mouseup', onSelectEnd ) |
| 488 | } |
| 489 | |
| 490 | }); |
| 491 | |
| 492 | function removeListeners() |
| 493 | { |
| 494 | html.removeListener( 'mouseleave', onSelectEnd ); |
| 495 | html.removeListener( 'mouseup', onSelectEnd ); |
| 496 | } |
477 | 497 | |
478 | | // The event is not fired when clicking on the scrollbars, |
479 | | // so we can safely check the following to understand |
480 | | // whether the empty space following <body> has been clicked. |
481 | | var sel = CKEDITOR.document.$.selection, |
482 | | range = sel.createRange(); |
483 | | // The selection range is reported on host, but actually it should applies to the content doc. |
484 | | if ( sel.type != 'None' && range.parentElement().ownerDocument == doc.$ ) |
485 | | range.select(); |
486 | | } ); |
487 | | } |
488 | | |
489 | | }); |
| 498 | function onSelectEnd() |
| 499 | { |
| 500 | removeListeners(); |
| 501 | |
| 502 | // The event is not fired when clicking on the scrollbars, |
| 503 | // so we can safely check the following to understand |
| 504 | // whether the empty space following <body> has been clicked. |
| 505 | var sel = CKEDITOR.document.$.selection, |
| 506 | range = sel.createRange(); |
| 507 | // The selection range is reported on host, but actually it should applies to the content doc. |
| 508 | if ( sel.type != 'None' && range.parentElement().ownerDocument == doc.$ ) |
| 509 | range.select(); |
| 510 | } |
490 | 511 | } |
491 | 512 | |
492 | 513 | } |