From be94c6d88d7262e2d80e63c252382eb533c3835a Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Mon, 19 Aug 2013 19:12:39 +0100 Subject: [PATCH] MDL-36803 TinyMCE: Fix TinyMCE following touch events on iOS browsers --- lib/editor/tinymce/module.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/editor/tinymce/module.js b/lib/editor/tinymce/module.js index 8871c4feace..7ee56f4776f 100644 --- a/lib/editor/tinymce/module.js +++ b/lib/editor/tinymce/module.js @@ -56,6 +56,21 @@ M.editor_tinymce.init_editor = function(Y, editorid, options) { M.cfg.wwwroot + '/lib/editor/tinymce/plugins/' + filedetails[1]); } } + + // We have to override the editor setup to work around a bug in iOS browsers - MDL-36803. + if (Y.UA.ios) { + // Retain any setup which is already defined. + options.originalSetupFunction = options.setup || function(){}; + options.setup = function(editor) { + options.originalSetupFunction(); + editor.onPostRender.add(function(ed) { + // Whenever there is a keydown event, ensure that the contentWindow still have focus. + ed.contentDocument.addEventListener('keydown', function() { + ed.contentWindow.focus(); + }); + }); + }; + } tinyMCE.init(options); var item = document.getElementById(editorid+'_filemanager'); -- 2.43.0