var tabfocus = (function (domGlobals) {
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
var global$2 = tinymce.util.Tools.resolve('tinymce.EditorManager');
var global$3 = tinymce.util.Tools.resolve('tinymce.Env');
var global$4 = tinymce.util.Tools.resolve('tinymce.util.Delay');
var global$5 = tinymce.util.Tools.resolve('tinymce.util.Tools');
var global$6 = tinymce.util.Tools.resolve('tinymce.util.VK');
var getTabFocusElements = function (editor) {
return editor.getParam('tabfocus_elements', ':prev,:next');
var getTabFocus = function (editor) {
return editor.getParam('tab_focus', getTabFocusElements(editor));
var Settings = { getTabFocus: getTabFocus };
var tabCancel = function (e) {
if (e.keyCode === global$6.TAB && !e.ctrlKey && !e.altKey && !e.metaKey) {
var setup = function (editor) {
if (e.keyCode !== global$6.TAB || e.ctrlKey || e.altKey || e.metaKey || e.isDefaultPrevented()) {
function find(direction) {
el = DOM.select(':input:enabled,*[tabindex]:not(iframe)');
function canSelectRecursive(e) {
return e.nodeName === 'BODY' || e.type !== 'hidden' && e.style.display !== 'none' && e.style.visibility !== 'hidden' && canSelectRecursive(e.parentNode);
return /INPUT|TEXTAREA|BUTTON/.test(el.tagName) && global$2.get(e.id) && el.tabIndex !== -1 && canSelectRecursive(el);
global$5.each(el, function (e, i) {
if (e.id === editor.id) {
for (i = x + 1; i < el.length; i++) {
for (i = x - 1; i >= 0; i--) {
v = global$5.explode(Settings.getTabFocus(editor));
var focusEditor = global$2.get(el.id || el.name);
if (el.id && focusEditor) {
global$4.setTimeout(function () {
domGlobals.window.focus();
editor.on('init', function () {
DOM.setAttrib(editor.getBody(), 'tabIndex', null);
editor.on('keyup', tabCancel);
editor.on('keypress keydown', tabHandler);
editor.on('keydown', tabHandler);
var Keyboard = { setup: setup };
global.add('tabfocus', function (editor) {