MDL-41328 Editor: Work around another iOS issue with TinyMCE
authorAndrew Nicols <andrew@nicols.co.uk>
Fri, 30 Aug 2013 10:10:27 +0000 (11:10 +0100)
committerDamyon Wiese <damyon@moodle.com>
Mon, 2 Sep 2013 01:41:27 +0000 (09:41 +0800)
We apply this only on touchend and not touchstart or touchmove. The
location is not guaranteed until the end of the gesture, and there's no
need to keep applying focus on every move.

lib/editor/tinymce/module.js

index 7ee56f4..b86da9d 100644 (file)
@@ -68,6 +68,13 @@ M.editor_tinymce.init_editor = function(Y, editorid, options) {
                 ed.contentDocument.addEventListener('keydown', function() {
                     ed.contentWindow.focus();
                 });
                 ed.contentDocument.addEventListener('keydown', function() {
                     ed.contentWindow.focus();
                 });
+
+                // Whenever a touch event is registered against the content document,
+                // reapply focus. This works around an issue with the location caret not
+                // being focusable without use of the Loupe.
+                ed.contentDocument.addEventListener('touchend', function() {
+                    ed.contentWindow.focus();
+                });
             });
         };
     }
             });
         };
     }