Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 't/10644'
  • Loading branch information
Reinmar committed Jul 18, 2013
2 parents e16981c + ba1f401 commit 1baa4c5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -4,6 +4,7 @@ CKEditor 4 Changelog
## CKEditor 4.1.3

* Added new translation: Indonesian.
* [#10644](http://dev.ckeditor.com/ticket/10644): Fixed critical bug when pasting plain text in Blink based browsers.
* [#5189](http://dev.ckeditor.com/ticket/5189): Find/Replace dialog window: rename "Cancel" button to "Close".
* [#10562](http://dev.ckeditor.com/ticket/10562): [Housekeeping] Unified CSS gradient filter formats in the Moono skin.
* [#10537](http://dev.ckeditor.com/ticket/10537): ACF should register a default rule for [config.shiftEnterMode](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-shiftEnterMode).
Expand Down
27 changes: 23 additions & 4 deletions plugins/clipboard/plugin.js
Expand Up @@ -660,7 +660,8 @@
cancel = function( evt ) {
evt.cancel();
},
ff3x = CKEDITOR.env.gecko && CKEDITOR.env.version <= 10902;
ff3x = CKEDITOR.env.gecko && CKEDITOR.env.version <= 10902,
blurListener;

// Avoid recursions on 'paste' event or consequent paste too fast. (#5730)
if ( doc.getById( 'cke_pastebin' ) )
Expand All @@ -679,7 +680,7 @@
// what is indistinguishable from pasted <br> (copying <br> in Opera isn't possible,
// but it can be copied from other browser).
var pastebin = new CKEDITOR.dom.element(
editable.is( 'body' ) && !( CKEDITOR.env.ie || CKEDITOR.env.opera ) ? 'body' : 'div', doc );
( CKEDITOR.env.webkit || editable.is( 'body' ) ) && !( CKEDITOR.env.ie || CKEDITOR.env.opera ) ? 'body' : 'div', doc );

pastebin.setAttribute( 'id', 'cke_pastebin' );

Expand All @@ -688,6 +689,7 @@
pastebin.appendBogus();

var containerOffset = 0,
offsetParent,
win = doc.getWindow();

// Seems to be the only way to avoid page scroll in Fx 3.x.
Expand All @@ -701,8 +703,19 @@
editable.append( pastebin );
// Style pastebin like .cke_editable, to minimize differences between origin and destination. (#9754)
pastebin.addClass( 'cke_editable' );

// Compensate position of offsetParent.
containerOffset = ( editable.is( 'body' ) ? editable : CKEDITOR.dom.element.get( pastebin.$.offsetParent ) ).getDocumentPosition().y;
if ( !editable.is( 'body' ) ) {
// We're not able to get offsetParent from pastebin (body element), so check whether
// its parent (editable) is positioned.
if ( editable.getComputedStyle( 'position' ) != 'static' )
offsetParent = editable;
// And if not - safely get offsetParent from editable.
else
offsetParent = CKEDITOR.dom.element.get( editable.$.offsetParent );

containerOffset = offsetParent.getDocumentPosition().y;
}
} else {
// Opera and IE doesn't allow to append to html element.
editable.getAscendant( CKEDITOR.env.ie || CKEDITOR.env.opera ? 'body' : 'html', 1 ).append( pastebin );
Expand Down Expand Up @@ -739,6 +752,12 @@

editor.on( 'selectionChange', cancel, null, null, 0 );

// Webkit fill fire blur on editable when moving selection to
// pastebin (if body is used). Cancel it because it causes incorrect
// selection lock in case of inline editor.
if ( CKEDITOR.env.webkit )
blurListener = editable.once( 'blur', cancel, null, null, -100 );

// Temporarily move selection to the pastebin.
isEditingHost && pastebin.focus();
var range = new CKEDITOR.dom.range( pastebin );
Expand All @@ -750,7 +769,7 @@
// this selection will be restored. We overwrite stored selection, so it's restored
// in pastebin. (#9552)
if ( CKEDITOR.env.ie ) {
var blurListener = editable.once( 'blur', function( evt ) {
blurListener = editable.once( 'blur', function( evt ) {
editor.lockSelection( selPastebin );
} );
}
Expand Down

0 comments on commit 1baa4c5

Please sign in to comment.