From 86098b348582e1544cc208db25954d31755e6d13 Mon Sep 17 00:00:00 2001 From: Spocke Date: Mon, 1 Sep 2014 11:34:20 +0200 Subject: [PATCH] Fixed bug where tabfocus wouldn't tab properly to other adjacent editor instances. --- changelog.txt | 2 ++ js/tinymce/plugins/tabfocus/plugin.js | 22 +++++++++------------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/changelog.txt b/changelog.txt index f068d5a85ee..0d902460039 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,6 +4,8 @@ Version 4.1.5 (2014-08-xx) Fixed bug where empty list elements would result in empty LI elements without it's parent container. Fixed bug where backspace in empty caret formated element could produce an type error exception of Gecko. Fixed bug where lists pasted from word with a custom start index above 9 wouldn't be properly handled. + Fixed bug where tabfocus plugin would tab out of the editor instance even if the default action was prevented. + Fixed bug where tabfocus wouldn't tab properly to other adjacent editor instances. Fixed so custom images for menubutton/splitbutton can be provided. Patch contributed by Naim Hammadi. Version 4.1.4 (2014-08-21) Added new media_filter_html option to media plugin that blocks any conditional comments, scripts etc within a video element. diff --git a/js/tinymce/plugins/tabfocus/plugin.js b/js/tinymce/plugins/tabfocus/plugin.js index 0d81497f5f8..9fb89bcf1c8 100644 --- a/js/tinymce/plugins/tabfocus/plugin.js +++ b/js/tinymce/plugins/tabfocus/plugin.js @@ -22,7 +22,7 @@ tinymce.PluginManager.add('tabfocus', function(editor) { function tabHandler(e) { var x, el, v, i; - if (e.keyCode !== 9 || e.ctrlKey || e.altKey || e.metaKey) { + if (e.keyCode !== 9 || e.ctrlKey || e.altKey || e.metaKey || e.isDefaultPrevented()) { return; } @@ -35,12 +35,8 @@ tinymce.PluginManager.add('tabfocus', function(editor) { e.style.visibility != "hidden" && canSelectRecursive(e.parentNode)); } - function canSelectInOldIe(el) { - return el.tabIndex || el.nodeName == "INPUT" || el.nodeName == "TEXTAREA"; - } - function canSelect(el) { - return ((!canSelectInOldIe(el))) && el.getAttribute("tabindex") != '-1' && canSelectRecursive(el); + return /INPUT|TEXTAREA|BUTTON/.test(el.tagName) && tinymce.get(e.id) && el.tabIndex != -1 && canSelectRecursive(el); } each(el, function(e, i) { @@ -112,13 +108,13 @@ tinymce.PluginManager.add('tabfocus', function(editor) { // Remove default tabIndex in inline mode tinymce.DOM.setAttrib(editor.getBody(), 'tabIndex', null); } - }); - editor.on('keyup', tabCancel); + editor.on('keyup', tabCancel); - if (tinymce.Env.gecko) { - editor.on('keypress keydown', tabHandler); - } else { - editor.on('keydown', tabHandler); - } + if (tinymce.Env.gecko) { + editor.on('keypress keydown', tabHandler); + } else { + editor.on('keydown', tabHandler); + } + }); });