From b5e0912034a222cb47890fb802c96b08d1f5d673 Mon Sep 17 00:00:00 2001 From: Remi Koenig Date: Fri, 27 Jun 2014 18:23:16 +0200 Subject: [PATCH 1/5] Fix more selection trouble in iOS6 and 7 #10714 --- plugins/button/plugin.js | 3 ++- plugins/dialog/plugin.js | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/button/plugin.js b/plugins/button/plugin.js index 324ebbd5fc6..1f07c1e7c78 100644 --- a/plugins/button/plugin.js +++ b/plugins/button/plugin.js @@ -165,8 +165,9 @@ editor.unlockSelection( 1 ); selLocked = 0; } - instance.execute(); + if (env.iOS) + editor.window.focus(); } ); diff --git a/plugins/dialog/plugin.js b/plugins/dialog/plugin.js index 93a1c5aff5f..30c324feea0 100644 --- a/plugins/dialog/plugin.js +++ b/plugins/dialog/plugin.js @@ -1027,7 +1027,11 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; editor.focus(); // Give a while before unlock, waiting for focus to return to the editable. (#172) - setTimeout( function() { editor.focusManager.unlock(); }, 0 ); + setTimeout( function() { + editor.focusManager.unlock(); + if (CKEDITOR.env.iOS) + editor.window.focus(); + }, 0 ); } else CKEDITOR.dialog._.currentZIndex -= 10; From 313ae0e494b2416fd7ddb8ebf7f6be9d3f16b31e Mon Sep 17 00:00:00 2001 From: Piotr Jasiun Date: Mon, 1 Sep 2014 16:50:04 +0200 Subject: [PATCH 2/5] Code style. --- plugins/button/plugin.js | 3 ++- plugins/dialog/plugin.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/button/plugin.js b/plugins/button/plugin.js index 1f07c1e7c78..ccf57973aef 100644 --- a/plugins/button/plugin.js +++ b/plugins/button/plugin.js @@ -166,8 +166,9 @@ selLocked = 0; } instance.execute(); - if (env.iOS) + if ( env.iOS ) { editor.window.focus(); + } } ); diff --git a/plugins/dialog/plugin.js b/plugins/dialog/plugin.js index 30c324feea0..d4eedf5149b 100644 --- a/plugins/dialog/plugin.js +++ b/plugins/dialog/plugin.js @@ -1029,8 +1029,9 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; // Give a while before unlock, waiting for focus to return to the editable. (#172) setTimeout( function() { editor.focusManager.unlock(); - if (CKEDITOR.env.iOS) + if ( CKEDITOR.env.iOS ) { editor.window.focus(); + } }, 0 ); } else From c7cefbc718f0aea3742db8dc9fcb4f3f39775b2b Mon Sep 17 00:00:00 2001 From: Piotr Jasiun Date: Mon, 1 Sep 2014 16:51:13 +0200 Subject: [PATCH 3/5] Changed editor.window.focus() to editor.focus(). --- plugins/button/plugin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/button/plugin.js b/plugins/button/plugin.js index ccf57973aef..4e86bcc6964 100644 --- a/plugins/button/plugin.js +++ b/plugins/button/plugin.js @@ -167,7 +167,7 @@ } instance.execute(); if ( env.iOS ) { - editor.window.focus(); + editor.focus(); } } ); From 9e7e4eadfc476e67413cd0dd40627f58cd06e7e1 Mon Sep 17 00:00:00 2001 From: Piotr Jasiun Date: Mon, 1 Sep 2014 16:53:10 +0200 Subject: [PATCH 4/5] Code comment. --- plugins/button/plugin.js | 2 ++ plugins/dialog/plugin.js | 3 +++ 2 files changed, 5 insertions(+) diff --git a/plugins/button/plugin.js b/plugins/button/plugin.js index 4e86bcc6964..8dc96029a1f 100644 --- a/plugins/button/plugin.js +++ b/plugins/button/plugin.js @@ -166,6 +166,8 @@ selLocked = 0; } instance.execute(); + + // Fixed iOS focus issue when your press disabled button (#12381). if ( env.iOS ) { editor.focus(); } diff --git a/plugins/dialog/plugin.js b/plugins/dialog/plugin.js index d4eedf5149b..ab2d515aa7c 100644 --- a/plugins/dialog/plugin.js +++ b/plugins/dialog/plugin.js @@ -1029,6 +1029,9 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; // Give a while before unlock, waiting for focus to return to the editable. (#172) setTimeout( function() { editor.focusManager.unlock(); + + // Fixed iOS focus issue (#12381). + // Keep in mind that editor.focus() does not work in this case. if ( CKEDITOR.env.iOS ) { editor.window.focus(); } From 898559dae6c88073074200ad36ecc54c11b8e5e1 Mon Sep 17 00:00:00 2001 From: Piotr Jasiun Date: Wed, 3 Sep 2014 10:01:19 +0200 Subject: [PATCH 5/5] Changelog entry. --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 2aae942bc79..4e70705923a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,7 @@ CKEditor 4 Changelog Fixed Issues: +* [#12381](http://dev.ckeditor.com/ticket/12381): Fixed: Selection trouble in iOS. Thanks to [Remiremi](https://github.com/Remiremi)! * [#10804](http://dev.ckeditor.com/ticket/10804): Fixed: `CKEDITOR_GETURL` isn't used with some plugins it should be used. Thanks to [Thomas Andraschko](https://github.com/tandraschko)! * [#9137](http://dev.ckeditor.com/ticket/9137): Fixed: `base` tag is not created when `head` has an attribute. Thanks to [naoki.fujikawa](https://github.com/naoki-fujikawa)! * [#12377](http://dev.ckeditor.com/ticket/12377): Fixed: Errors thrown in the image plugin when removing preview from dialog definition. Thanks to [Axinet](https://github.com/Axinet)!