X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/4713a14935b83517997f3c88f808eb41da55033d..d3947bc013df7edd54b46deed8230d2eeafc5ecb:/wp-includes/js/tinymce/plugins/tabfocus/plugin.js diff --git a/wp-includes/js/tinymce/plugins/tabfocus/plugin.js b/wp-includes/js/tinymce/plugins/tabfocus/plugin.js index 0d81497f..35bc9f58 100644 --- a/wp-includes/js/tinymce/plugins/tabfocus/plugin.js +++ b/wp-includes/js/tinymce/plugins/tabfocus/plugin.js @@ -1,8 +1,8 @@ /** * plugin.js * - * Copyright, Moxiecode Systems AB * Released under LGPL License. + * Copyright (c) 1999-2015 Ephox Corp. All rights reserved * * License: http://www.tinymce.com/license * Contributing: http://www.tinymce.com/contributing @@ -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) { @@ -94,7 +90,7 @@ tinymce.PluginManager.add('tabfocus', function(editor) { if (el.id && focusEditor) { focusEditor.focus(); } else { - window.setTimeout(function() { + tinymce.util.Delay.setTimeout(function() { if (!tinymce.Env.webkit) { window.focus(); } @@ -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); + } + }); });