]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/tinymce/plugins/tabfocus/plugin.js
WordPress 4.3-scripts
[autoinstalls/wordpress.git] / wp-includes / js / tinymce / plugins / tabfocus / plugin.js
index 0d81497f5f83e4d5201ef232d89326ef064aca10..7a9b5c8ad4ddf2394da83ec7e82e14897279ad50 100644 (file)
@@ -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) {
@@ -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);
+               }
+       });
 });