Skip to content

Commit

Permalink
Merge branch 't/10714'
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed May 12, 2014
2 parents 5b1b8ed + 99d89bd commit 823d821
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -4,6 +4,7 @@ CKEditor 4 Changelog
## CKEditor 4.4.1

Fixed Issues:
* [#10714](http://dev.ckeditor.com/ticket/10714): Fixed: [iOS] Selection and drop-downs are broken if touch listener is used due to [Webkit bug](https://bugs.webkit.org/show_bug.cgi?id=128924). Thanks to [Arty Gus](https://github.com/artygus)!
* [#11911](http://dev.ckeditor.com/ticket/11911): Fixed setting the `dir` attribute for preloaded language in [CKEDITOR.lang](http://docs.ckeditor.com/#!/api/CKEDITOR.lang).
* [#9661](http://dev.ckeditor.com/ticket/9661): Added optional, [configurable](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-linkJavaScriptLinksAllowed) possibility to set JavaScript code in `href` attribute in anchor tags.
* [#11809](http://dev.ckeditor.com/ticket/11809): Set indentation to four spaces in [Code Snippet](http://ckeditor.com/addon/codesnippet) sample.
Expand Down
35 changes: 33 additions & 2 deletions plugins/floatpanel/plugin.js
Expand Up @@ -80,8 +80,12 @@ CKEDITOR.plugins.add( 'floatpanel', {

editor.on( 'mode', hide );
editor.on( 'resize', hide );

// Window resize doesn't cause hide on blur. (#9800)
doc.getWindow().on( 'resize', hide );
// [iOS] Poping up keyboard triggers window resize
// which leads to undesired panel hides.
if ( !CKEDITOR.env.iOS )
doc.getWindow().on( 'resize', hide );

// We need a wrapper because events implementation doesn't allow to attach
// one listener more than once for the same event on the same object.
Expand Down Expand Up @@ -145,6 +149,7 @@ CKEDITOR.plugins.add( 'floatpanel', {
// Record from where the focus is when open panel.
var editable = this._.editor.editable();
this._.returnFocus = editable.hasFocus ? editable : new CKEDITOR.dom.element( CKEDITOR.document.$.activeElement );
this._.hideTimeout = 0;

var element = this.element,
iframe = this._.iframe,
Expand Down Expand Up @@ -195,7 +200,6 @@ CKEDITOR.plugins.add( 'floatpanel', {
CKEDITOR.event.useCapture = true;

focused.on( 'blur', function( ev ) {

// As we are using capture to register the listener,
// the blur event may get fired even when focusing
// inside the window itself, so we must ensure the
Expand All @@ -204,6 +208,16 @@ CKEDITOR.plugins.add( 'floatpanel', {
return;

if ( this.visible && !this._.activeChild ) {
// [iOS] Allow hide to be prevented if touch is bound
// to any parent of the iframe blur happens before touch (#10714).
if ( CKEDITOR.env.iOS ) {
if ( !this._.hideTimeout )
this._.hideTimeout = CKEDITOR.tools.setTimeout( doHide, 0, this );
} else
doHide.call( this );
}

function doHide() {
// Panel close is caused by user's navigating away the focus, e.g. click outside the panel.
// DO NOT restore focus in this case.
delete this._.returnFocus;
Expand All @@ -217,6 +231,23 @@ CKEDITOR.plugins.add( 'floatpanel', {
this.allowBlur( true );
}, this );

// [iOS] if touch is bound to any parent of the iframe blur
// happens twice before touchstart and before touchend (#10714).
if ( CKEDITOR.env.iOS ) {
// Prevent false hiding on blur.
// We don't need to return focus here because touchend will fire anyway.
// If user scrolls and pointer gets out of the panel area touchend will also fire.
focused.on( 'touchstart', function() {
clearInterval( this._.hideTimeout );
}, this );

// Set focus back to handle blur and hide panel when needed.
focused.on( 'touchend', function() {
this._.hideTimeout = 0;
this.focus();
}, this );
}

CKEDITOR.event.useCapture = false;

this._.blurSet = 1;
Expand Down
8 changes: 8 additions & 0 deletions plugins/wysiwygarea/plugin.js
Expand Up @@ -287,6 +287,14 @@
} );
}

if ( CKEDITOR.env.iOS ) {
// [iOS] If touch is bound to any parent of the iframe blur happens on any touch
// event and body becomes the focused element (#10714).
this.attachListener( doc, 'touchend', function() {
win.focus();
} );
}

// ## END


Expand Down

0 comments on commit 823d821

Please sign in to comment.