--- a/wp/wp-includes/js/tinymce/plugins/tabfocus/plugin.js Tue Jun 09 11:14:17 2015 +0000
+++ b/wp/wp-includes/js/tinymce/plugins/tabfocus/plugin.js Mon Oct 14 17:39:30 2019 +0200
@@ -1,120 +1,124 @@
-/**
- * plugin.js
- *
- * Copyright, Moxiecode Systems AB
- * Released under LGPL License.
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
+(function () {
+var tabfocus = (function () {
+ 'use strict';
+
+ var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
-/*global tinymce:true */
+ var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
-tinymce.PluginManager.add('tabfocus', function(editor) {
- var DOM = tinymce.DOM, each = tinymce.each, explode = tinymce.explode;
+ var global$2 = tinymce.util.Tools.resolve('tinymce.EditorManager');
+
+ var global$3 = tinymce.util.Tools.resolve('tinymce.Env');
- function tabCancel(e) {
- if (e.keyCode === 9 && !e.ctrlKey && !e.altKey && !e.metaKey) {
- e.preventDefault();
- }
- }
+ var global$4 = tinymce.util.Tools.resolve('tinymce.util.Delay');
- function tabHandler(e) {
- var x, el, v, i;
+ var global$5 = tinymce.util.Tools.resolve('tinymce.util.Tools');
- if (e.keyCode !== 9 || e.ctrlKey || e.altKey || e.metaKey || e.isDefaultPrevented()) {
- return;
- }
+ var global$6 = tinymce.util.Tools.resolve('tinymce.util.VK');
- 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));
- }
-
- function canSelect(el) {
- return /INPUT|TEXTAREA|BUTTON/.test(el.tagName) && tinymce.get(e.id) && el.tabIndex != -1 && canSelectRecursive(el);
- }
+ var getTabFocusElements = function (editor) {
+ return editor.getParam('tabfocus_elements', ':prev,:next');
+ };
+ var getTabFocus = function (editor) {
+ return editor.getParam('tab_focus', getTabFocusElements(editor));
+ };
+ var $_8rita4kwjjgwed4m = { getTabFocus: getTabFocus };
- each(el, function(e, i) {
- if (e.id == editor.id) {
- x = i;
- return false;
- }
- });
- if (direction > 0) {
- for (i = x + 1; i < el.length; i++) {
- if (canSelect(el[i])) {
- return el[i];
- }
- }
- } else {
- for (i = x - 1; i >= 0; i--) {
- if (canSelect(el[i])) {
- return el[i];
- }
- }
- }
-
- return null;
- }
-
- v = explode(editor.getParam('tab_focus', editor.getParam('tabfocus_elements', ':prev,:next')));
-
- if (v.length == 1) {
- v[1] = v[0];
- v[0] = ':prev';
- }
+ var DOM = global$1.DOM;
+ var tabCancel = function (e) {
+ if (e.keyCode === global$6.TAB && !e.ctrlKey && !e.altKey && !e.metaKey) {
+ e.preventDefault();
+ }
+ };
+ var setup = function (editor) {
+ function tabHandler(e) {
+ var x, el, v, i;
+ if (e.keyCode !== global$6.TAB || e.ctrlKey || e.altKey || e.metaKey || e.isDefaultPrevented()) {
+ return;
+ }
+ 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);
+ }
+ function canSelect(el) {
+ 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) {
+ x = i;
+ return false;
+ }
+ });
+ if (direction > 0) {
+ for (i = x + 1; i < el.length; i++) {
+ if (canSelect(el[i])) {
+ return el[i];
+ }
+ }
+ } else {
+ for (i = x - 1; i >= 0; i--) {
+ if (canSelect(el[i])) {
+ return el[i];
+ }
+ }
+ }
+ return null;
+ }
+ v = global$5.explode($_8rita4kwjjgwed4m.getTabFocus(editor));
+ if (v.length === 1) {
+ v[1] = v[0];
+ v[0] = ':prev';
+ }
+ if (e.shiftKey) {
+ if (v[0] === ':prev') {
+ el = find(-1);
+ } else {
+ el = DOM.get(v[0]);
+ }
+ } else {
+ if (v[1] === ':next') {
+ el = find(1);
+ } else {
+ el = DOM.get(v[1]);
+ }
+ }
+ if (el) {
+ var focusEditor = global$2.get(el.id || el.name);
+ if (el.id && focusEditor) {
+ focusEditor.focus();
+ } else {
+ global$4.setTimeout(function () {
+ if (!global$3.webkit) {
+ window.focus();
+ }
+ el.focus();
+ }, 10);
+ }
+ e.preventDefault();
+ }
+ }
+ editor.on('init', function () {
+ if (editor.inline) {
+ DOM.setAttrib(editor.getBody(), 'tabIndex', null);
+ }
+ editor.on('keyup', tabCancel);
+ if (global$3.gecko) {
+ editor.on('keypress keydown', tabHandler);
+ } else {
+ editor.on('keydown', tabHandler);
+ }
+ });
+ };
+ var $_6zogdykpjjgwed4h = { setup: setup };
- // Find element to focus
- if (e.shiftKey) {
- if (v[0] == ':prev') {
- el = find(-1);
- } else {
- el = DOM.get(v[0]);
- }
- } else {
- if (v[1] == ':next') {
- el = find(1);
- } else {
- el = DOM.get(v[1]);
- }
- }
-
- if (el) {
- var focusEditor = tinymce.get(el.id || el.name);
+ global.add('tabfocus', function (editor) {
+ $_6zogdykpjjgwed4h.setup(editor);
+ });
+ function Plugin () {
+ }
- if (el.id && focusEditor) {
- focusEditor.focus();
- } else {
- window.setTimeout(function() {
- if (!tinymce.Env.webkit) {
- window.focus();
- }
-
- el.focus();
- }, 10);
- }
-
- e.preventDefault();
- }
- }
+ return Plugin;
- editor.on('init', function() {
- if (editor.inline) {
- // Remove default tabIndex in inline mode
- tinymce.DOM.setAttrib(editor.getBody(), 'tabIndex', null);
- }
-
- editor.on('keyup', tabCancel);
-
- if (tinymce.Env.gecko) {
- editor.on('keypress keydown', tabHandler);
- } else {
- editor.on('keydown', tabHandler);
- }
- });
-});
+}());
+})();