]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/tinymce/plugins/tabfocus/plugin.js
WordPress 4.0
[autoinstalls/wordpress.git] / wp-includes / js / tinymce / plugins / tabfocus / plugin.js
index 0d81497f5f83e4d5201ef232d89326ef064aca10..47ddfdee17b1a4f1018bbc0f5408fb0619720e97 100644 (file)
@@ -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;
                }
 
@@ -112,13 +112,14 @@ 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);
-       }
+               // Add later so other plugins can preventDefault()
+               if (tinymce.Env.gecko) {
+                       editor.on('keypress keydown', tabHandler);
+               } else {
+                       editor.on('keydown', tabHandler);
+               }
+       });
 });